-
Notifications
You must be signed in to change notification settings - Fork 29
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
Changes from all commits
c8cf063
28280b2
147493b
545be83
38c6b3d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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 commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. |
||
if (getenv('GITHUB_ACTION')) { | ||
$file1 = '/etc/hosts.allow'; | ||
$file2 = '/etc/hosts.deny'; | ||
} else { | ||
$file1 = realpath(__DIR__ . '/../../web-fixtures/file1.txt'); | ||
$file2 = realpath(__DIR__ . '/../../web-fixtures/file2.txt'); | ||
} | ||
|
||
return array( | ||
'input default' => array('the-input-default', 'from empty', 'from existing'), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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 commentThe 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) |
||
|
||
$input2->keyPress('r', $modifier); | ||
$this->assertEquals('key pressed:114 / '.$eventProperties, $event->getText()); | ||
$this->assertEquals('key pressed:114 / ' . $eventProperties, $event->getText()); | ||
|
||
$input3->keyUp(78, $modifier); | ||
$this->assertEquals('key upped:78 / '.$eventProperties, $event->getText()); | ||
$this->assertEquals('key upped:78 / ' . $eventProperties, $event->getText()); | ||
} | ||
|
||
public function provideKeyboardEventsModifiers() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,19 +14,21 @@ public function testWindow() | |
$webAssert = $this->getAssertSession(); | ||
|
||
$page->clickLink('Popup #1'); | ||
$popup1WindowHandle = array_slice($session->getDriver()->getWindowNames(), -1)[0]; | ||
$session->switchToWindow(null); | ||
|
||
$page->clickLink('Popup #2'); | ||
$popup2WindowHandle = array_slice($session->getDriver()->getWindowNames(), -1)[0]; | ||
$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 commentThe reason will be displayed to describe this comment to others. Learn more. since Selenium 3.x and newer Firefox names are handles and only There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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. |
||
$el = $webAssert->elementExists('css', '#text'); | ||
$this->assertSame('Popup#1 div text', $el->getText()); | ||
|
||
$session->switchToWindow('popup_2'); | ||
$session->switchToWindow($popup2WindowHandle); | ||
$el = $webAssert->elementExists('css', '#text'); | ||
$this->assertSame('Popup#2 div text', $el->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.
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.