intern icon indicating copy to clipboard operation
intern copied to clipboard

pressKeys emulation is broken

Open jason0x43 opened this issue 4 years ago • 1 comments

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

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.

jason0x43 avatar Jan 15 '20 19:01 jason0x43

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.

kgibb avatar Feb 09 '21 11:02 kgibb