Skip to content

Commit 427e91f

Browse files
authored
fix(cdk/testing): don't send unnecessary Key.chords to protr… (#18685)
Because of a bug in geckodriver (mozilla/geckodriver#1502), Key.chord does not work as expected when testing under Firefox. While there is no complete solution to that problem, this change at least reduces the frequency with which users will encounter the bug. Before: bug encountered on any invocation of sendKeys. After: bug only encountered when using modifier keys. Plain text can still be entered.
1 parent 9343d08 commit 427e91f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/cdk/testing/protractor/protractor-element.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ export class ProtractorElement implements TestElement {
111111
const modifierKeys = toProtractorModifierKeys(modifiers);
112112
const keys = rest.map(k => typeof k === 'string' ? k.split('') : [keyMap[k]])
113113
.reduce((arr, k) => arr.concat(k), [])
114-
.map(k => Key.chord(...modifierKeys, k));
114+
// Key.chord doesn't work well with geckodriver (mozilla/geckodriver#1502),
115+
// so avoid it if no modifier keys are required.
116+
.map(k => modifierKeys.length > 0 ? Key.chord(...modifierKeys, k) : k);
115117

116118
return this.element.sendKeys(...keys);
117119
}

0 commit comments

Comments
 (0)