intern
intern copied to clipboard
pressKeys emulation is broken
In browsers using mostly or all W3C semantics, pressKeys
uses simulated keyboard events. In these browsers, sending some characters such as keys.TAB
doesn't work as expected.
Consider the following test:
import { suite, test } from 'intern/core/lib/interfaces/tdd';
import keys from 'intern/webdriver/keys';
suite('functional', () => {
test('find link', test => {
return test.remote
.setFindTimeout(5000)
.get('/tests/functional/page.html')
.findById('username')
.click()
.pressKeys('testing' + keys.TAB)
.sleep(20000);
});
});
In Firefox 72 with geckodriver 0.26, using a simple test page, it results in the following:
![Screen Shot 2020-01-15 at 2 19 52 PM](https://user-images.githubusercontent.com/1042866/72464299-fc93dd80-37a2-11ea-94a2-86442ff85c7a.png)
Sending keys.TAB
should cause the browser to behave as if a Tab key was pressed, not send a Unicode character.
Similar behavior was observed with Chrome 79 and Safari 13.
See also: theintern/leadfoot#110.
I'd like to see this one implemented. I can workaround the issue in some test cases using Element.type
but not all of them have inputs.