-
Notifications
You must be signed in to change notification settings - Fork 5
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
Implement the driver #1
Conversation
Welcome to Codecov 🎉Once merged to your default branch, Codecov will compare your coverage reports and display the results in this comment. Thanks for integrating Codecov - We've got you covered ☂️ |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as outdated.
This comment was marked as outdated.
<var name="driver_config_factory" value="Mink\WebdriverClassDriver\Tests\WebdriverClassicConfig::getInstance"/> | ||
<!--server name="WEB_FIXTURES_HOST" value="http://test.mink.dev" /--> | ||
|
||
<server name="WEB_FIXTURES_HOST" value="http://host.docker.internal:8002"/> | ||
<!-- MacOS --> | ||
<!--<server name="WEB_FIXTURES_HOST" value="http://docker.for.mac.localhost:8002"/>--> | ||
<!--<server name="WEB_FIXTURES_BROWSER" value="firefox"/>--> | ||
|
||
<!-- where driver will connect to --> | ||
<server name="DRIVER_URL" value="http://localhost:4444/wd/hub"/> | ||
|
||
<!-- where DocumentRoot of 'Test Machine' is mounted to on 'Driver Machine' (only if these are 2 different machines) --> | ||
<!--server name="DRIVER_MACHINE_BASE_PATH" value="" /--> | ||
<!--server name="TEST_MACHINE_BASE_PATH" value="" /--> | ||
<server name="DRIVER_MACHINE_BASE_PATH" value="/fixtures/"/> | ||
|
||
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak"/> |
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.
Changing the defaults of this section would result in the developer's inability to run the test suite with a locally started Selenium server.
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.
I replied to this point already, but I guess it got somehow lost: #1 (comment)
That still stands, the recommended test setup is with docker, therefore the defaults are tailored for docker. In case developers want to customize this, they can easily create their own phpunit.xml
(that won't be committed with the project).
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
protected function supportsCss(): bool | ||
{ | ||
return true; | ||
} | ||
|
||
private function isXvfb(): bool |
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.
misleading method name. why you need it?
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.
misleading method name
It's not exactly misleading - it's what we are actually intending there by checking the github action env var.
That check was originally implemented in MinkSelenium2Driver:
https://github.com/minkphp/MinkSelenium2Driver/blob/master/tests/Selenium2Config.php#L38
After trial and error, I found what it was trying to do, hence the name I gave it. Maybe we can find a better name though.
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.
'chrome' => [ | ||
'goog:chromeOptions' => [ | ||
// disable "Chrome is being controlled.." notification bar | ||
'excludeSwitches' => ['enable-automation'], |
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.
does it affect something?
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.
Not sure what you mean...the comment describes exactly what it does...removing the notification bar means there's more rendering space and less unexpected UI potentially interfering with tests.
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 situation for Edge is similar, except that for some weird reason, it refuses to even start when with any settings (but that seems to be something else).
$name | ||
): ?string { | ||
$escapedName = $this->jsonEncode($name, 'get attribute', 'attribute name'); | ||
$script = "return arguments[0].getAttribute($escapedName)"; |
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.
* @param string $browserName One of 'edge', 'firefox', 'chrome' or any one of {@see WebDriverBrowserType} constants. | ||
*/ | ||
public function __construct( | ||
string $browserName = self::DEFAULT_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.
@stof recently I found that the proper browser name for MSEdge is "MicrosoftEdge".
For some reason, "edge" used to work before, but not anymore.
At the moment, we use the browser name from the docker image suffix, which eventually triggered the problem I just mentioned.
However, this got me thinking, at the moment there aren't any restrictions or suggestions for the browser name from the mink side, which is far from ideal especially since we have extra (default) initialization logic based on the browser name.
On the other hand, I'm not sure it's a good idea to tell the dev to use constants from a 3rd party library (what I sort of the in the phpdoc). I took the liberty to say exactly which browsers are definitely supported in the PHPDoc, which is effectively the keys from BROWSER_NAME_ALIAS_MAP
. Another approach could be to define our own constants, or provide them in a new class that extends WebDriverBrowserType
.
What do you think?
|
||
case WebDriverBrowserType::MICROSOFT_EDGE: | ||
return DesiredCapabilities::microsoftEdge() | ||
->setCapability(WebDriverCapabilityType::PLATFORM, WebDriverPlatform::ANY); |
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.
Regarding the usage of syn.js, I'd rather keep the initial implementation free of it, marking methods as unsupported and skipping tests if needed.
syn.js is quite a bad fit as it does not actually simulate the actual browser events. See minkphp/driver-testsuite#36 (comment)
Note that we might have to deprecate the existing keypress, keyup and keydown methods as they don't reflect reality: an actual browser has no way to interact in a way that triggers only one of those events.
src/WebdriverClassicDriver.php
Outdated
use Facebook\WebDriver\WebDriverDimension; | ||
use JetBrains\PhpStorm\Language; | ||
use JsonException; | ||
use Throwable; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
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.
Let's finally merge this and keep follow-up works in other PRs
Remaining Tasks
Update readmeUpdate readme #4seems they're always about seleium4+chrome?
Couldn't reproduce them, and last two runs were failure-free - maybe problem got solved somehow?