Skip to content

Conversation

@oleg-andreyev
Copy link
Contributor

To make Mink Drivers more compatible W3C driver specifications need to adjust some testcases e.g.: testKeyboardEvents

public function testKeyboardEvents($modifier, $eventProperties)
{
$this->getSession()->visit($this->pathTo('/js_test.html'));
$webAssert = $this->getAssertSession();
$input1 = $webAssert->elementExists('css', '.elements input.input.first');
$input2 = $webAssert->elementExists('css', '.elements input.input.second');
$input3 = $webAssert->elementExists('css', '.elements input.input.third');
$event = $webAssert->elementExists('css', '.elements .text-event');
$input1->keyDown('u', $modifier);
$this->assertEquals('key downed:'.$eventProperties, $event->getText());
$input2->keyPress('r', $modifier);
$this->assertEquals('key pressed:114 / '.$eventProperties, $event->getText());
$input3->keyUp(78, $modifier);
$this->assertEquals('key upped:78 / '.$eventProperties, $event->getText());
}

because W3C does not allow sending separate actions like keyUp, keyDown, keyPress
https://www.w3.org/TR/webdriver/#dfn-element-send-keys

I'm trying to replace instaclick/php-webdriver with facebook/php-webdriver for MinkSelenium2Driver (work in progress)

Changes are tested againts selenium/standalone-chrome:latest and selenium/standalone-firefox:2.53.1

MinkZombieDriver will not pass this tests, because zombie.js does not implement KeyboardEvent as described https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent
assaf/zombie#275 (comment)

@stof
Copy link
Member

stof commented Jan 8, 2019

because W3C does not allow sending separate actions like keyUp, keyDown, keyPress
https://www.w3.org/TR/webdriver/#dfn-element-send-keys

should we deprecate the separate methods then ?

@oleg-andreyev
Copy link
Contributor Author

oleg-andreyev commented Jan 8, 2019

IMO yes, we should deprecate them, but for B/C we could emulate them via KeyboardEvent instead of syn.js

@stof
Copy link
Member

stof commented Jan 8, 2019

See my comment on minkphp/MinkSelenium2Driver#304 (comment)

I think these test changes are invalid. You are changing the test to hide the fact that the new driver you wrote does not support the existing expected behavior of the methods.

@oleg-andreyev
Copy link
Contributor Author

Well actually no, I'm not hiding anything, I've extracted test cases into test provider with comments and change JS part, so that event would append logs to element instead of always replacing it.

@stof
Copy link
Member

stof commented Jan 14, 2019

no, you are hiding the fact that your keyDown implementation triggers all 3 events rather than only the keyDown one (and so that the key is already released at the end).

@oleg-andreyev
Copy link
Contributor Author

You've convinced me

@stof
Copy link
Member

stof commented Jan 14, 2019

what you wrote it could become the basis for a test for the new pressKey though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants