Skip to content

Commit 0250506

Browse files
committed
When no argument is passed to the .click interaction command, the webdriver command should also have no argument
Indeed webdriver.io has a different behavior when the argument is not undefined. Fixes #8931
1 parent ab9a690 commit 0250506

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/browser-webdriverio/src/commands/click.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import type { UserEventCommand } from './utils'
44
export const click: UserEventCommand<UserEvent['click']> = async (
55
context,
66
selector,
7-
options = {},
7+
options,
88
) => {
99
const browser = context.browser
10-
await browser.$(selector).click(options as any)
10+
await browser.$(selector).click(options)
1111
}
1212

1313
export const dblClick: UserEventCommand<UserEvent['dblClick']> = async (

test/browser/test/userEvent.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ describe('userEvent.click', () => {
2929

3030
expect(onClick).toHaveBeenCalled()
3131
expect(dblClick).not.toHaveBeenCalled()
32+
33+
onClick.mockClear()
34+
await userEvent.click(button, { button: 'right' })
35+
expect(onClick).toHaveBeenCalled()
3236
})
3337

3438
test('correctly doesn\'t click on a disabled button', async () => {

0 commit comments

Comments
 (0)