Skip to content

Commit 6417290

Browse files
committed
fix(provider-webdriver): report a keyboard dismissal only when the keyboard went down
dismissed read true whenever the keyboard ended down, including when it was never up; it now names the transition, as the Android IME probe defines it. The keyboard capability note says status is Android's.
1 parent 6c71b54 commit 6417290

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

‎packages/provider-webdriver/src/capabilities.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ const BASE_WEBDRIVER_CAPABILITIES: CloudWebDriverCapabilityMap = {
8787
type: supported,
8888
keyboard: {
8989
support: 'partial',
90-
note: 'Enter presses Android keycode 66 through `mobile: pressKey` and types a newline into the focused iOS field; dismiss and status use the Appium keyboard routes.',
90+
note: 'Enter presses Android keycode 66 through `mobile: pressKey` and types a newline into the focused iOS field; dismiss uses the Appium hide-keyboard route, and Android status uses the Appium keyboard probe.',
9191
},
9292
back: supported,
9393
home: {

‎packages/provider-webdriver/src/webdriver-interactor.test.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,21 @@ test('keyboard dismiss names the Appium route as the mechanism on iOS', async ()
616616
});
617617
});
618618

619+
// `dismissed` is the transition, as the Android IME probe defines it: a keyboard that was never
620+
// up was not dismissed by this call.
621+
test('keyboard dismiss does not claim a dismissal when the keyboard was already down', async () => {
622+
const world = createKeyboardWorld([false, false]);
623+
624+
const result = await keyboardInteractor(world, 'android').keyboardDismiss!();
625+
626+
assert.deepEqual(result, {
627+
kind: 'ime-probe',
628+
wasVisible: false,
629+
visible: false,
630+
dismissed: false,
631+
});
632+
});
633+
619634
test('keyboard status reads the Appium probe, and refuses a driver without one', async () => {
620635
const shown = createKeyboardWorld([false]);
621636
assert.deepEqual(await keyboardInteractor(shown, 'android').keyboardStatus!(), {

‎packages/provider-webdriver/src/webdriver-interactor.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ class WebDriverInteractor implements Interactor {
382382
const visible = await this.keyboardVisibility();
383383
const echo = {
384384
...(wasVisible === undefined ? {} : { wasVisible }),
385-
...(visible === undefined ? {} : { visible, dismissed: !visible }),
385+
...(visible === undefined ? {} : { visible, dismissed: wasVisible === true && !visible }),
386386
};
387387
return this.backend === 'android'
388388
? { kind: 'ime-probe', ...echo }

0 commit comments

Comments
 (0)