Skip to content
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

Closed
wants to merge 11 commits into from
Closed

Switch to fb webdriver #263

wants to merge 11 commits into from

Conversation

uuf6429
Copy link
Member

@uuf6429 uuf6429 commented Feb 5, 2017

No description provided.

@uuf6429 uuf6429 mentioned this pull request Feb 5, 2017
Copy link
Member

@aik099 aik099 left a 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]
Copy link
Member

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
Copy link
Member

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",
Copy link
Member

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"
Copy link
Member

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">
Copy link
Member

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.

@@ -186,17 +151,17 @@ public function getWebDriverSession()
*/
public static function getDefaultCapabilities()
{
return array(
'browserName' => 'firefox',
Copy link
Member

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
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

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}}.

Copy link
Member Author

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

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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);
Copy link
Member

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.

private function clickOnElement(Element $element)
{
$this->wdSession->moveto(array('element' => $element->getID()));
//$element->click(); // TODO why was this needed?
Copy link
Member

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 😄

Copy link
Member Author

@uuf6429 uuf6429 Feb 5, 2017

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).

Copy link
Member

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);
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

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">
Copy link
Member Author

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.

Copy link
Member

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.

@uuf6429 uuf6429 closed this Feb 5, 2017
@stof
Copy link
Member

stof commented Feb 6, 2017

Why closing the PR ?

@aik099
Copy link
Member

aik099 commented Feb 6, 2017

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.

@stof
Copy link
Member

stof commented Feb 6, 2017

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).
The previous PR dropping it for Mink was dropping support with no benefit for us. Here, it could have one.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why creating this class ?

Copy link
Member Author

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.

@aik099
Copy link
Member

aik099 commented Feb 6, 2017

Here, it could have one.

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.

@volkyeth
Copy link

@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

@aik099
Copy link
Member

aik099 commented Feb 15, 2017

Off the top of my head I can remember the iframe manipulation bit, for instance.

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.

@uuf6429
Copy link
Member Author

uuf6429 commented Feb 15, 2017

Some other reasons:

  • maintained library is possibly faster and in case of performance/bug/security issues, there's a higher chance of a patch
  • the FB library takes care of things like handling uploads and other stuff that is unnecessarily replicated in MinkSelenium2Driver.

That said, I gave up arguing here. It's a huge shame this project will die like this "because it works".

@volkyeth
Copy link

@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.

@aik099
Copy link
Member

aik099 commented Feb 16, 2017

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 FB library is more maintained than Instaclick one. There can't be any possible performance gain from upgrade, because both FB and Instaclick are doing remote calls using WebDriver protocol, where speed is result of how fast we get a response and not how fast library can process it.

@Einenlum
Copy link

Einenlum commented Apr 4, 2017

Seems instaclick does not officially support Selenium 3.x, am I right?
Therefore, if a library is still active (facebook) and the other is not, plus does not supports officially Selenium 3.x, why shouldn't we change this dependency?

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.

@aik099 aik099 mentioned this pull request Oct 4, 2017
@aik099 aik099 mentioned this pull request Jan 4, 2019
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.

None yet

5 participants