-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix tests for Selenium 3.x #60
Conversation
web-fixtures/js_test.html
Outdated
@@ -73,15 +73,15 @@ | |||
}); | |||
|
|||
$('.elements input.input.first').keydown(function(ev) { | |||
$('.text-event').text('key downed:' + ev.altKey * 1 + ' / ' + ev.ctrlKey * 1 + ' / ' + ev.shiftKey * 1 + ' / ' + ev.metaKey * 1); | |||
$('.text-event').text('key downed: ' + (ev.keyCode || ev.charCode) + ' / ' + ev.altKey * 1 + ' / ' + ev.ctrlKey * 1 + ' / ' + ev.shiftKey * 1 + ' / ' + ev.metaKey * 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just unify/improve keyXxx testing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't add a space after :
.
$session->switchToWindow(null); | ||
|
||
$el = $webAssert->elementExists('css', '#text'); | ||
$this->assertSame('Main window div text', $el->getText()); | ||
|
||
$session->switchToWindow('popup_1'); | ||
$session->switchToWindow($popup1WindowHandle); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since Selenium 3.x and newer Firefox names are handles
and only handle
must be sent to webdriver, no name
is supported (/w or /wo handle
) - fixed in instaclick/php-webdriver#119
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we preserve backwards-compatible behavior by using the window name on Selenium2 and handle on Selenium3?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ability to switch a window by name on Selenium 3 was fixed in the minkphp/MinkSelenium2Driver#384.
@@ -60,8 +60,14 @@ public function testSetValueChangeEvent($elementId, $valueForEmpty, $valueForFil | |||
|
|||
public function setValueChangeEventDataProvider() | |||
{ | |||
$file1 = __DIR__ . '/../../web-fixtures/file1.txt'; | |||
$file2 = __DIR__ . '/../../web-fixtures/file2.txt'; | |||
// paths must be canonical and reachable from browser |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newer browsers, for security reasons, validate the paths if they exist and are canonical, of course from browser POV, thus we must use some paths available within the browser container
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't introduce any BC beaks for the Selenium2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#67 should fix this part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -14,7 +14,7 @@ public function testIFrame() | |||
$el = $webAssert->elementExists('css', '#text'); | |||
$this->assertSame('Main window div text', $el->getText()); | |||
|
|||
$this->getSession()->switchToIFrame('subframe'); | |||
$this->getSession()->switchToIFrame(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since Selenium 3.x both Chrome and Firefox accepts only iframe index instead of iframe name
passing webdriver element is not supported https://github.com/instaclick/php-webdriver
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we preserve backwards-compatible behavior by using the iframe name on Selenium2 and index on Selenium3?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The frame switching support by name/id on Selenium 3 was fixed in the minkphp/MinkSelenium2Driver#382.
PR with test fixes is RTM, I will then submit fixes for the driver itself |
web-fixtures/js_test.html
Outdated
@@ -73,15 +73,15 @@ | |||
}); | |||
|
|||
$('.elements input.input.first').keydown(function(ev) { | |||
$('.text-event').text('key downed:' + ev.altKey * 1 + ' / ' + ev.ctrlKey * 1 + ' / ' + ev.shiftKey * 1 + ' / ' + ev.metaKey * 1); | |||
$('.text-event').text('key downed: ' + (ev.keyCode || ev.charCode) + ' / ' + ev.altKey * 1 + ' / ' + ev.ctrlKey * 1 + ' / ' + ev.shiftKey * 1 + ' / ' + ev.metaKey * 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't add a space after :
.
@@ -14,7 +14,7 @@ public function testIFrame() | |||
$el = $webAssert->elementExists('css', '#text'); | |||
$this->assertSame('Main window div text', $el->getText()); | |||
|
|||
$this->getSession()->switchToIFrame('subframe'); | |||
$this->getSession()->switchToIFrame(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we preserve backwards-compatible behavior by using the iframe name on Selenium2 and index on Selenium3?
@@ -60,8 +60,14 @@ public function testSetValueChangeEvent($elementId, $valueForEmpty, $valueForFil | |||
|
|||
public function setValueChangeEventDataProvider() | |||
{ | |||
$file1 = __DIR__ . '/../../web-fixtures/file1.txt'; | |||
$file2 = __DIR__ . '/../../web-fixtures/file2.txt'; | |||
// paths must be canonical and reachable from browser |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't introduce any BC beaks for the Selenium2?
$session->switchToWindow(null); | ||
|
||
$el = $webAssert->elementExists('css', '#text'); | ||
$this->assertSame('Main window div text', $el->getText()); | ||
|
||
$session->switchToWindow('popup_1'); | ||
$session->switchToWindow($popup1WindowHandle); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we preserve backwards-compatible behavior by using the window name on Selenium2 and handle on Selenium3?
@@ -14,7 +14,7 @@ public function testIFrame() | |||
$el = $webAssert->elementExists('css', '#text'); | |||
$this->assertSame('Main window div text', $el->getText()); | |||
|
|||
$this->getSession()->switchToIFrame('subframe'); | |||
$this->getSession()->switchToIFrame(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The frame switching support by name/id on Selenium 3 was fixed in the minkphp/MinkSelenium2Driver#382.
@@ -60,8 +60,14 @@ public function testSetValueChangeEvent($elementId, $valueForEmpty, $valueForFil | |||
|
|||
public function setValueChangeEventDataProvider() | |||
{ | |||
$file1 = __DIR__ . '/../../web-fixtures/file1.txt'; | |||
$file2 = __DIR__ . '/../../web-fixtures/file2.txt'; | |||
// paths must be canonical and reachable from browser |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$session->switchToWindow(null); | ||
|
||
$el = $webAssert->elementExists('css', '#text'); | ||
$this->assertSame('Main window div text', $el->getText()); | ||
|
||
$session->switchToWindow('popup_1'); | ||
$session->switchToWindow($popup1WindowHandle); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ability to switch a window by name on Selenium 3 was fixed in the minkphp/MinkSelenium2Driver#384.
@@ -99,13 +99,13 @@ public function testKeyboardEvents($modifier, $eventProperties) | |||
$event = $webAssert->elementExists('css', '.elements .text-event'); | |||
|
|||
$input1->keyDown('u', $modifier); | |||
$this->assertEquals('key downed:'.$eventProperties, $event->getText()); | |||
$this->assertEquals('key downed:117 / ' . $eventProperties, $event->getText()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mvorisek , why this is needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
key presses asserts the code, but key downed not, the answer is: it is not needed, but wanted to be tested - feel free to cherrypick this from this PR (1st commit)
@aik099 @mvorisek considering we are using the same test-suite for selenium 2, 3 and 4 in webdriver-classic-driver, I don't think this PR is relevant any more (or at least, it won't really fix selenium3-specific test problems). |
@uuf6429 , as for fixing the part I agree (the driver-specific PRs for almost all issues were created and mentioned in the minkphp/MinkSelenium2Driver#383). I'm not closing this PR yet, because I'm curious what was the reasoning behind key code adding in the tests. |
Closing, because selenium 2 driver code was changed instead (PRs not merged yet) to make tests pass. |
needed for minkphp/MinkSelenium2Driver#354