Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/desktop-gui/cypress/integration/settings_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,7 @@ describe('Settings', () => {
it('loads preferred editor, available editors and shows spinner', () => {
cy.get('.loading-editors').then(function () {
expect(this.ipc.getUserEditor).to.be.called
cy.contains('File Opener Preference').click()
})
})

Expand Down
10 changes: 10 additions & 0 deletions packages/reporter/cypress/integration/shortcuts_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,15 @@ describe('shortcuts', function () {
cy.get('button.stop').trigger('mouseover')
cy.get('.cy-tooltip').should('have.text', 'Stop Running S')
})

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@majidzeno - I went ahead and pushed a test for these changes onto your branch, this is what @jennifer-shehane was asking for.

Looks good to me. 👍

it('does not run shortcut if modifier keys are pressed', () => {
['{ctrl+f}', '{alt+f}', '{shift+f}', '{meta+f}'].forEach((text) => {
cy.get('body').type(text)
})

cy.then(() => {
expect(runner.emit).not.to.have.been.calledWith('focus:tests')
})
})
})
})
7 changes: 5 additions & 2 deletions packages/reporter/src/lib/shortcuts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @ts-ignore
import dom from '@packages/driver/src/dom'
import $dom from '@packages/driver/src/dom'
import events from './events'
import appState from './app-state'
import { action } from 'mobx'
Expand All @@ -16,7 +16,10 @@ class Shortcuts {
_handleKeyDownEvent (event: KeyboardEvent) {
// if typing into an input, textarea, etc, don't trigger any shortcuts
// @ts-ignore
if (dom.isTextLike(event.target)) return
const isTextLike = $dom.isTextLike(event.target)
const isAnyModifierKeyPressed = event.altKey || event.ctrlKey || event.shiftKey || event.metaKey

if (isAnyModifierKeyPressed || isTextLike) return

switch (event.key) {
case 'r': !appState.studioActive && events.emit('restart')
Expand Down