-
Notifications
You must be signed in to change notification settings - Fork 20
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
Allow to specify mink driver in browser configuration #30
Conversation
Is the failing build is not related to the PR?
At least that is the only test that fails (so far). Locally all tests are green. If you are interested in merging the PR, please let me know if there is anything I can do to have travis pass. |
@@ -14,7 +14,6 @@ | |||
use aik099\PHPUnit\BrowserTestCase; | |||
use aik099\PHPUnit\Event\TestEndedEvent; | |||
use aik099\PHPUnit\Event\TestEvent; | |||
use aik099\PHPUnit\IEventDispatcherAware; |
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 import was unused I presume.
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.
Indeed, it must have been a leftover.
Thank you very much for reviewing, I'll wait another hour or so if you comment more before updating the PR. |
@@ -42,6 +41,7 @@ class BrowserConfiguration implements EventSubscriberInterface | |||
'browserName' => 'firefox', | |||
'desiredCapabilities' => array(), | |||
'baseUrl' => '', | |||
'minkDriverClass' => 'Behat\\Mink\\Driver\\Selenium2Driver', |
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 think you can remove mink
word from key name and all associated methods because library itself is Mink-only compatible so the driver
could only mean Mink's driver. I guess same approach is taken in Behat's .behat.yml
with not writing mink
word everywhere, but I'm not 100% sure.
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.
Will do.
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.
Here is code link: https://github.com/Behat/MinkExtension/tree/master/src/Behat/MinkExtension/ServiceContainer/Driver
You can reuse aliases and way how driver parameters end up in actual driver class constructor arguments. This is how it's done for Guzzle: https://github.com/Behat/MinkExtension/blob/master/src/Behat/MinkExtension/ServiceContainer/Driver/GoutteFactory.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.
Ah, I missed this note of yours. Do I understand correctly you would like me to copy the code from the linked class into the phpunit-mink driver factories?
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.
Or write something similar. Always easier to modify existing class, then writing one from scratch.
@Vinai , the PR itself is very in time, because several people already have requested such functionality in one way or another. Today’s review completed. Better to make changes in phrases so nobody gets lost in review process. |
Did all the small changes, now only the big changes to the driver factory and options to the browser config is open. |
Also please comment on PR because GitHub doesn't send e-mail when new commits are pushed for review. But I think you're already aware of that.
No worries. You can make changes when you have time. I'll return back to review them tomorrow then (it's 21:25 already in my country). |
Also when all will be ok with code changes and public api would be stable please update ReadTheDocs documentation in the |
Maybe we also can merge driver registry in session factory because the only think SessionFactory is doing is creating new Session using driver that is created using registry. |
@Vinai please do the following (don't forget to commit your changes first):
|
Quick note: appologies for the delay, life has kept me quite busy today. I have a few spare hours later though, hope to get the changes done then. |
21910b1
to
e0f7acc
Compare
Pushed update with all feedback from the code review implemented.
For example, to configure a test to run with the Goutte driver, use
There also is a new configuration option 'driverOptions' which can be used Also added a convenience feature that setting the browserName to 'goutte' in |
OK, just realized I'm no longer checking which mink drivers are installed. Will fix that. |
Thanks, thats what I meant. |
7de3e8b
to
7137265
Compare
After investigating the possible driver options I decided not to implement that now due to time constraints. |
It's ok. Better to create stub classes for other driver factories so they at least create driver as written in manual (on ReadTheDocs.org) and pass host/user/pass to it and that's it. Then we can finalize them in another PR. |
To prevent |
@@ -356,6 +367,60 @@ public function getBaseUrl() | |||
} | |||
|
|||
/** | |||
* Set the mink driver to use. |
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.
We should use Mink
term instead of mink
across the PR, because it's name of the product here, not an animal 😉
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.
Done
@Vinai , let me know, when you'll complete 100% of comments so that I can review. |
7137265
to
658343d
Compare
All done. |
* @param string $driver The driver to use. | ||
* | ||
* @return self | ||
* @throws \InvalidArgumentException When Mink driver is not a valid driver alias. |
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.
Pay attention to text in DocBlocks. This method no longer validates driver alias. The only thing it does is checks that it's a string. Therefore please update it accordingly.
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.
Fixed.
@Vinai , have you've completed all requested changes? |
* Add option to specify the mink driver as part of the browser configuration. * For backward compatibility defaults to Selenium2Driver. * Add Goutte and SahiDriver support. * Allows to register additional mink drivers. For example, to configure a test to run with the Goutte driver, use public static $browsers = [[ 'browserName' => 'Goutte', 'driver' => 'goutte' ]]; There also is a new configuration option 'driverOptions' which can be used by driver factories when instantiating the mink driver. It defaults to null, places no restriction on the data structure and is currently not used by any of the driver factories. This PR is realated to issue minkphp#12.
658343d
to
0f6721e
Compare
Sorry for the delay, life is has been too busy (moving house etc). Pushed the latest update. |
Closing in favor of #49 |
👍 |
For example, to configure a test to run with the Goutte driver, use
Closes #12