-
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 4 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 |
---|---|---|
|
@@ -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()); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Please don't add a space after |
||
}); | ||
|
||
$('.elements input.input.second').keypress(function(ev) { | ||
$('.text-event').text('key pressed:' + (ev.keyCode || ev.charCode) + ' / ' + ev.altKey * 1 + ' / ' + ev.ctrlKey * 1 + ' / ' + ev.shiftKey * 1 + ' / ' + ev.metaKey * 1); | ||
$('.text-event').text('key pressed: ' + (ev.keyCode || ev.charCode) + ' / ' + ev.altKey * 1 + ' / ' + ev.ctrlKey * 1 + ' / ' + ev.shiftKey * 1 + ' / ' + ev.metaKey * 1); | ||
mvorisek marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}); | ||
|
||
$('.elements input.input.third').keyup(function(ev) { | ||
$('.text-event').text('key upped:' + (ev.keyCode || ev.charCode) + ' / ' + ev.altKey * 1 + ' / ' + ev.ctrlKey * 1 + ' / ' + ev.shiftKey * 1 + ' / ' + ev.metaKey * 1); | ||
$('.text-event').text('key upped: ' + (ev.keyCode || ev.charCode) + ' / ' + ev.altKey * 1 + ' / ' + ev.ctrlKey * 1 + ' / ' + ev.shiftKey * 1 + ' / ' + ev.metaKey * 1); | ||
mvorisek marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}); | ||
|
||
$( "#draggable" ).draggable(); | ||
|
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.