Skip to content

Commit

Permalink
fix: webdriverio release
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Jul 23, 2024
1 parent 5cf8704 commit 5121921
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/browser/src/node/commands/keyboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,10 @@ export async function keyboardImplementation(
}
}

await keyboard.perform(skipRelease)
// seems like webdriverio doesn't release keys automatically if skipRelease is true and all events are keyUp
const allRelease = keyboard.toJSON().actions.every(action => action.type === 'keyUp')

await keyboard.perform(allRelease ? false : skipRelease)
}

return {
Expand Down
1 change: 1 addition & 0 deletions test/browser/test/userEvent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,7 @@ describe('userEvent.keyboard', async () => {
])
})

// looks like wdio doesn't support releasing Enter on its own
test('should not auto release', async () => {
const spyKeydown = vi.fn()
const spyKeyup = vi.fn()
Expand Down

0 comments on commit 5121921

Please sign in to comment.