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
Switch to fb webdriver #263
Conversation
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.
In general I like the change, but too many unneeded formatting changes to clearly see it.
@@ -6,7 +6,7 @@ cache: | |||
directories: | |||
- $HOME/.composer/cache/files | |||
|
|||
php: [5.3, 5.4, 5.5, 5.6, 7.0, 7.1, hhvm] |
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.
Revert. See #262 (comment).
@@ -35,7 +35,7 @@ before_script: | |||
# Start a webserver for web fixtures. Force using PHP 5.6 to be able to run it on PHP 5.3 and HHVM jobs too | |||
- MINK_PHP_BIN=~/.phpenv/versions/5.6/bin/php vendor/bin/mink-test-server > /dev/null 2>&1 & | |||
|
|||
script: phpunit -v --coverage-clover=coverage.clover |
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.
Revert. See #262 (comment).
@@ -20,13 +20,14 @@ | |||
], | |||
|
|||
"require": { | |||
"php": ">=5.3.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.
Revert. See #262 (comment).
composer.json
Outdated
}, | ||
|
||
"require-dev": { | ||
"mink/driver-testsuite": "dev-master" |
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.
Revert. See #262 (comment).
phpunit.xml.dist
Outdated
@@ -1,6 +1,6 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
|
|||
<phpunit colors="true" bootstrap="vendor/autoload.php"> |
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.
Revert. You can specify it for now in .travis.yml
and command line option to PHPUnit. No need to alter default phpunit config file.
src/Selenium2Driver.php
Outdated
@@ -186,17 +151,17 @@ public function getWebDriverSession() | |||
*/ | |||
public static function getDefaultCapabilities() | |||
{ | |||
return array( | |||
'browserName' => 'firefox', |
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.
No need to remove formatting of multi-line array calls.
} | ||
|
||
return json_encode($options); | ||
} | ||
|
||
/** | ||
* Executes JS on a given element - pass in a js script string and {{ELEMENT}} will |
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.
Why the {{ELEMENT}}
was replaced with __ELEMENT__
? If I recall correctly it's driver itself who parses {{ELEMENT}}
and not WebDriver/Facebook.
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.
- It shows up as JS errors in my IDE
- It seems to be replaced by webdriver: https://github.com/uuf6429/MinkSelenium2Driver/blob/05872053bd733959b25fa4df3f3aa41bef845d64/src/Selenium2Driver.php#L251-L251
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.
Of course it will show as JavaScript error in IDE because {{ELEMENT}}
is invalid syntax. Since it works please replace __ELEMENT__
back into {{ELEMENT}}
.
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.
Why do you want to show errors when they're in fact just replaced tokens? O.o
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.
Because changes in PR should be on topic. Making unrelated change doesn't help anybody.
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.
You can send another PR with just that change and we can merge/not merge it separately regardless of faith of this PR.
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.
Plus, it is a BC break as it is a change affecting a protected method
$this->applyTimeouts(); | ||
} catch (\Exception $e) { | ||
throw new DriverException('Could not open connection: '.$e->getMessage(), 0, $e); |
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.
Revert. No need to change formatting.
src/Selenium2Driver.php
Outdated
private function clickOnElement(Element $element) | ||
{ | ||
$this->wdSession->moveto(array('element' => $element->getID())); | ||
//$element->click(); // TODO why was this 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.
What this comment is for? The click
is called because method is called clickOnElement
😄
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.
Ah, never mind... seems to be an artefact from my changes (I thought old code called $element->click();
twice).
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.
Then you can safely remove it.
} | ||
|
||
$element->postValue(array('value' => array($remotePath))); | ||
$element->sendKeys($path); |
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.
Are you sure, that sendKeys
is clever enough to handle file upload code on local/remote servers?
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.
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.
Good. In any case we have functional tests to prove that it really works as expected.
phpunit.xml.dist
Outdated
@@ -1,6 +1,6 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
|
|||
<phpunit colors="true" bootstrap="vendor/autoload.php"> | |||
<phpunit colors="true" bootstrap="vendor/autoload.php" stopOnFailure="true"> |
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 is temporary until we get all tests working.
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.
Still please move it to .travis.yml
. This would allow people checking out PR branch (for reviewing purposes) like me and using alternative PHPUnit runner not have this stopOnFailure behavior.
Why closing the PR ? |
Because nobody noticed upfront that Facebook's version of WebDriver requires PHP 5.5+ to run. Since Mink/Mink Drivers require PHP 5.3+ to run we have no way to use it. |
Well, as PHP 5.3 and 5.4 are EOLed, dropping support for them could be acceptable if we have some benefit when doing it (switching to a maintained library). Some drivers may drop support for older PHP versions (the third-party phantomJS driver does not support PHP 5.3 btw) |
use Facebook\WebDriver\WebDriverBy; | ||
use Facebook\WebDriver\WebDriverElement; | ||
|
||
class Selenium2DriverSession |
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.
Why creating this class ?
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.
It's a proxy class to avoid changing the original driver too much. In the end, I could merge all changes into one class.
Switching one dependency for another, while both work at the end is no benefit to me. Fact that one dependency is better maintained than another one doesn't really change the fact that both work. |
@aik099 actually there are many limitations on the instaclick version that are not present on the facebook one. Off the top of my head I can remember the iframe manipulation bit, for instance. On instaclick/php-webdriver you can only change iframes based on it's id, whereas in facebook/php-webdriver you can use the id, name or an WebDriverElement |
This particular change isn't a problem, because public API of Mink supporting locating frames by name only anyway. Since Instaclick version covers 100% of functionality needed to implement the driver it doesn't really matter at this point if we switch to FB at all. |
Some other reasons:
That said, I gave up arguing here. It's a huge shame this project will die like this "because it works". |
@uuf6429 no reason for it to die at all, just put your fork up on Packagist and I'll help you maintain it. No trouble at all if the main one is stagnant and becomes obsolete, we'll just move forward using yours. |
I see you're eager to change stuff even though it works as expected for years now. I'm not here to judge how you should spend your time, but in your place I won't be spending time on doing anything that won't result in any kind of gain. In this case I don't see any actual gains except |
Seems instaclick does not officially support Selenium 3.x, am I right? Moreover, if it's a question of BC and minimum PHP version, it's also our duty to make all this community evolve. Even 5.6 is not actively supported anymore. People with previous PHP versions will still have older versions of MinkSelenium2Driver. |
No description provided.