-
Notifications
You must be signed in to change notification settings - Fork 823
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
API Update behat-extension from selenium > chromedriver #7777
API Update behat-extension from selenium > chromedriver #7777
Conversation
tractorcow, I am hoping to use newer versions of selenium like 3.8.0 with w3c compliant web-driver, how might I use your untagged driver? what changes should I make to my composer.json ? Untagged meaning it's not yet on packagist right? so clone it? should I just clone your project and put it in my vendor folder? what changes to my behat.yml are necessary? here is my current composer.json
here's a profile called seleniumfirefox (I also have one for IE11 and chrome) I'm testing, here is a section of my behat.yml
|
This commit adds the remote protocol end points and handling of commands as required by the W3C WebDriver Specification for the IE driver. It deprecates and mostly removes behavior that is at odds with the specification, but may have been the proper behavior under the open-source dialect of the protocol. Issues arising from this version of the driver that appeared to work in previous versions will only be addressed if a simple test case is provided that demonstrates it working in a prior version of the driver and failing in this one. Reported issues lacking such a test case will be summarily closed.
ah I looked at your commit, looks like you've switched away from selenium completely to the chromium driver. So maybe the solution is being worked on somewhere upstream at the selenium HQ |
@joejoseph00 you can use the new webdriver I wrote with selenium if you like; It does work but you need to handle the selenium and browser configuration yourself. :) facebook/webdriver is simply the abstract layer which works with webdriver compatible services such as chromium / selenium. I've posted a candidate composer.json with the necessary custom repositories listed at silverstripe/silverstripe-behat-extension#137 (comment). behat.yml changes should be as-per https://github.com/open-sausages/silverstripe-framework/blob/bffd12e597ea09af44bd9de8ce4c29620ca63e79/behat.yml except:
Also please note that firefox isn't fully w3c webdriver compliant, so some operations (especially related to mouse movement) won't work properly; Use older selenium + older firefox in this case. Set base url via Regarding selenium 3 support upstream at mink, please see the thread at minkphp/MinkSelenium2Driver#254. Status is that "yes you can use selenium 3 but just not with firefox yet". You can theoretically use selenium2 driver with selenium3. |
@joejoseph00 I'll try to get the driver on packagist soon, just waiting for internal approval. |
bffd12e
to
7f4b537
Compare
Ok, pushing up a temp patch that should pull in the new forked repos for testing on travis. Let's see if it runs. ;) |
It works yes. ;) @dhensby @chillu what do you think about how we should handle semver for this? Does switching behat-extension to a new driver mean we need a new major version? I am hoping we just go with minor version, but on the other hand it cannot swap back. - "behat/mink-selenium2-driver": "^1.3",
+ "silverstripe/mink-facebook-web-driver": "^1", Also we may need to switch this for all 4.x branches at the same time, as the next time travis updates their images (or drops support for deprecated images) we will find behat breaking on 4.0 again. |
Green tick (don't merge, it has temp commits in it though). |
@tractorcow Our dependencies do not form part of our API, IMO - so we can swap them out. Any project that uses our lib but directly depends on |
Yay that's good. The new behat-extension change will have the new dependency, should we be happy to go ahead with this. |
I've chosen to stay a couple steps behind the bleeding edge and it's working out very nicely. We've settled with behat version 3.4.3 using selenium/standalone-chrome-debug:3.5.3-boron , it's working well. I've put my special sauce into features/bootstrap/FeatureContext.php . Maybe later see what the silverstripe is all about. |
Yes chrome works well with the new selenium, actually. That's what I was trying to get working prior to sticking with chromedriver. |
oh really? not sure, I'm afraid to upgrade my chrome after having issues. our stack is based on behat 3.4.3 and the selenium2mink driver , are you also using the instaclick/php-webdriver ? that is what we are using. There's so many drivers and combinations to choose from and I had to make some business decisions quickly, what we have works ok so far. I'm not sure how much refactoring I'd have to do to switch to a different driver to replace selenium2mink , selenium/standalone-chrome-debug:3.5.3-boron is where we're at. this I think is due to our team wanting to also use IE11 . I had to downgrade to selenium 3.4.0 to get IE11 to work, but we've not been using IE11 lately due to our use of docker we're sticking to dockerizable componants for our c.i. Our firefox is even older than 3.5.3 , I think we were using 2.4.3 We're staying a few steps behind bleeding edge due to our need to have something that works today, can't be always fiddling with it. living with it for a while. |
I was actually using facebook/webdriver which has more modern support. I know instaclick driver has a 2.0 version that might be in beta, but the prior 1.x didn't support new selenium well. |
So you're using the facebook/webdriver with behat ? do you have an example of this? like a composer.json file with a list of the dependencies, and a github repo with an example feature and FeatureContext.php and behat.yml? |
I have exactly that actually. :) See my comment on silverstripe/silverstripe-behat-extension#137 (comment) for the composer.json. Warning, I haven't rebased those branches for a while. You may need to do a bit of manual rebasing to get it working with latest framework. |
behat.yml # Note: Currently chrome latest is recommended
# Behat test setup requires an `.env` with `SS_BASE_URL` defined, as well
# as each of the following commands to initiate a test run:
# ========================================================================= #
# composer require silverstripe/recipe-testing ^1
# vendor/bin/behat-ss @<module>
# ========================================================================= #
default:
suites: []
extensions:
SilverStripe\BehatExtension\MinkExtension:
default_session: facebook_web_driver
javascript_session: facebook_web_driver
facebook_web_driver:
browser: chrome
wd_host: "http://127.0.0.1:9515" #chromedriver port
browser_name: chrome
SilverStripe\BehatExtension\Extension:
bootstrap_file: vendor/silverstripe/cms/tests/behat/serve-bootstrap.php
screenshot_path: %paths.base%/artifacts/screenshots
retry_seconds: 4 # default is 2
|
The new behat-ss command will ensure that both serve and chromedriver are running for each test, and safely shuts them down at the end. |
fd93012
to
c54b07a
Compare
Other modules merged, and this PR rebased. Waiting to see if it all passes now. :) |
This change requires a new (yet untagged) version of behat-extension, so be careful of merge order. :)
Parent story: silverstripe/silverstripe-behat-extension#137
Instead of using selenium, switch behat to the custom https://github.com/open-sausages/MinkFacebookWebDriver I wrote which uses github.com/facebook/php-webdriver instead of the instaclick/webdriver.
See discussion on minkphp/MinkSelenium2Driver#254 for why we aren't using latest firefox anymore (it's not quite ready for use with latest selenium).
In order to test see the composer.json with all the necessary repositories in my comment at silverstripe/silverstripe-behat-extension#137 (comment)