Skip to content

Commit 156ac3a

Browse files
devversionwagnermaciel
authored andcommitted
test: update menu modifier chord tests to workaround chromium bug
It seems that after the recent chromium update, two menu e2e tests started to fail consistently given the use of `Key.chord` with a modifier key. The problem seems to be that chromium has a bug with the revision we are using, where the chord `Key.NULL` reset key is sent as actual character to the active element instead of the key state/modifier state being reset. Related: https://bugs.chromium.org/p/chromedriver/issues/detail?id=3999. It's low-effort to just release the keys manually here. (cherry picked from commit e99d633)
1 parent 4385603 commit 156ac3a

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/material-experimental/mdc-menu/menu.e2e.spec.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {browser, by, element, ExpectedConditions, Key, protractor} from 'protractor';
1+
import {browser, by, element, ExpectedConditions, Key} from 'protractor';
22
import {
33
expectAlignedWith,
44
expectFocusOn,
@@ -135,7 +135,8 @@ describe('MDC-based menu', () => {
135135
await pressKeys(Key.TAB, Key.ENTER);
136136
await expectToExist(menuSelector);
137137

138-
await pressKeys(protractor.Key.chord(Key.SHIFT, Key.TAB));
138+
// Press SHIFT+TAB, but make sure to release SHIFT again.
139+
await pressKeys(Key.SHIFT, Key.TAB, Key.SHIFT);
139140
await expectToExist(menuSelector, false);
140141
});
141142

@@ -149,13 +150,14 @@ describe('MDC-based menu', () => {
149150
});
150151

151152
it('should focus before and after trigger when tabbing past items', async () => {
152-
let shiftTab = protractor.Key.chord(Key.SHIFT, Key.TAB);
153+
// Press SHIFT+TAB, but make sure to release SHIFT again.
154+
let shiftTab = [Key.SHIFT, Key.TAB, Key.SHIFT];
153155

154156
await pressKeys(Key.ENTER, Key.TAB);
155157
await expectFocusOn(page.triggerTwo());
156158

157159
// navigate back to trigger
158-
await pressKeys(shiftTab, Key.ENTER, shiftTab);
160+
await pressKeys(...shiftTab, Key.ENTER, ...shiftTab);
159161
await expectFocusOn(page.start());
160162
});
161163
});

src/material/menu/menu.e2e.spec.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {browser, by, element, ExpectedConditions, Key, protractor} from 'protractor';
1+
import {browser, by, element, ExpectedConditions, Key} from 'protractor';
22
import {
33
expectAlignedWith,
44
expectFocusOn,
@@ -135,7 +135,8 @@ describe('menu', () => {
135135
await pressKeys(Key.TAB, Key.ENTER);
136136
await expectToExist(menuSelector);
137137

138-
await pressKeys(protractor.Key.chord(Key.SHIFT, Key.TAB));
138+
// Press SHIFT+TAB, but make sure to release SHIFT again.
139+
await pressKeys(Key.SHIFT, Key.TAB, Key.SHIFT);
139140
await expectToExist(menuSelector, false);
140141
});
141142

@@ -149,13 +150,14 @@ describe('menu', () => {
149150
});
150151

151152
it('should focus before and after trigger when tabbing past items', async () => {
152-
let shiftTab = protractor.Key.chord(Key.SHIFT, Key.TAB);
153+
// Press SHIFT+TAB, but make sure to release SHIFT again.
154+
let shiftTab = [Key.SHIFT, Key.TAB, Key.SHIFT];
153155

154156
await pressKeys(Key.ENTER, Key.TAB);
155157
await expectFocusOn(page.triggerTwo());
156158

157159
// navigate back to trigger
158-
await pressKeys(shiftTab, Key.ENTER, shiftTab);
160+
await pressKeys(...shiftTab, Key.ENTER, ...shiftTab);
159161
await expectFocusOn(page.start());
160162
});
161163
});

0 commit comments

Comments
 (0)