You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Question: use of Syn instead of native selenium calls #78
I'm using this driver to test an large angularJS application. A fair amount of our UI behaviour is delivered using CSS as well as javascript...:hover being an example.
I've been experiencing issues when elements aren't available for clicking because they are not displayed. I presume this is because javascript events are being used (via syn) instead of the native mouse movements available in selenium.
Anyhow I've forked and replaced a few commands with native webdriver calls as I don't want our frontend devs to get too wrapped up in the internals of the webdriver api - they're pretty happy with the mink api.
I'll continue to use my fork but I'm wondering if you've plans to adopt more of the native api calls into the mink API?
can you be more specific about stuff, that doesn't work for you? If we're looking at situation in general, then it's up to individual driver (e.g. Selenium, Sahi, etc.) to to use one or another approach in implementing specific user interaction with a browser.
If there is a proof, that Selenium native implementation of some functionality does call all the JS events properly (in all browsers of course), then we surely can skip using Syn there.
But I recommend to be careful with massive changes. Instead let's just focus on stuff that doesn't work for you and analyze alternative (you have PR ready already?), that would do what you need plus all tests will be still passing.
I wasn't there at decision (whatever to use Syn or not) making time, but looking at Selenium server development it looks like, that it had problems with firing native JavaScript events when being used.
Then things have changed (for Selenium server), but Mink driver wasn't updated to reflect that. The related #51 issue, that you mentioned, proves that. I'll watch closely for Syn to be replaced with native calls for cases, where Syn won't be doing it's job properly in emulating real user action.
Excuse this slightly nooby question..What's the best way for me to get my proposed changes into the codebase.
I added a web-fixture for this issue to the Mink package. Now I realise I'm not going to be able to update Mink through composer as the dependancy is ~1.5.0 :(
It doesn't look like any test cases have been added to Selenium2DriverTest for a while - what's the best approach to get these changes in?
I guess you need to add new test to JavascriptDriverTest.php. This test would cover that :hover effect testing. However you must also test that both Selenium1 and Sahi driver would pass that new test too.
thanks. I've taken a similar approach in my working repo. I was worried about travis really. Composer will install mink 1.5.0 during the build so my tests won't be there...any ideas?
In terms of adding a test to JavascriptDriverTest.php I don't think that's advisable. This issue actually relates to CSS and not javascript - i.e the driver's ability for behaviour implemented in CSS to be accurately tested. If this test was added, the suite would always fail for the zombie driver.
I can add a specific test case for the issue (378) to the selenium 1 and sahi drivers to ensure they work in the same way.
would you mind just explaining that actually. composer require behat/mink=1.5.*@dev will add "behat/mink": "1.5.*dev" to composer.json...isn't that the correct way to specify the deps, as opposed to using the branch alias?
Branch alias is there to match branch, that isn't named as version (e.g. develop in this case) to some version, when comparing versions. I guess I just trust you on this one, since I don't have time to double check that over Composer manual.
@robsquires , I've solved problem, where tests added to Mink weren't immediately available on it's driver's PR's when doing tests by replacing ~1.5 to ~1.5@dev in composer.json of each driver.
For the record, I've just raised these bugs with the Syn library, and have found fixes. We too were finding issues with our tests randomly failing on pages where scrollbars were removed and the Syn library caused the page to jump thus moving the elements which should be visible, out of the window.
I've raised a couple of issues relating to this: bitovi/syn#29 - firefox bug with the href JS detection bitovi/syn#30 - firefox bug whereby including the library causes the browser focus to jump
Applying these fixes gets us back to a passing state on all of our failing tests.
It looks like the Syn library is being actively maintained once more and the maintainers are working to improve code quality (bitovi/syn#32).
I see, that you've created #125 about that topic. Just referencing it here so both issues are linked properly.
This Syn() issue has been around for while, but without a solid research we can't really change anything.
So we have code of 2 types:
pure Syn() call to emulate JS event
native WebDriver call to do something
On some browser/platform/window manager combinations some of JS events, that occur during native WebDriver call doesn't occur at all. Here Syn() comes to play and emulates them.
Problem is that on some other browser/platform/window manager combinations these native events occur and Syn is triggering a duplicate JS event causing bad things to happen.
Ideally at the end we need to have a table if "browser x platform x window_manager x event" where we can see what's been natively triggered by Selenium WebDriver.
Activity
aik099 commentedon Sep 6, 2013
Hi,
can you be more specific about stuff, that doesn't work for you? If we're looking at situation in general, then it's up to individual driver (e.g. Selenium, Sahi, etc.) to to use one or another approach in implementing specific user interaction with a browser.
If there is a proof, that Selenium native implementation of some functionality does call all the JS events properly (in all browsers of course), then we surely can skip using Syn there.
But I recommend to be careful with massive changes. Instead let's just focus on stuff that doesn't work for you and analyze alternative (you have PR ready already?), that would do what you need plus all tests will be still passing.
robsquires commentedon Sep 12, 2013
I've created a project to test this specific case: https://github.com/robsquires/Selenium-Tests
If you run the feature suite you'll see a failing test + the screenshot generated in
/screenshotconfirms the CSS :hover state is not being triggered.I'm using phantomjs in webdriver mode. I've not tested cross browser as I'm not sure what support you are going for - could you confirm?
The quick + dirty change I mentioned above can be seen here
aik099 commentedon Sep 12, 2013
I see, current
mouseOverimplementation does emulate themouseoverevent, but doesn't really move mouse anywhere 😄What if you, in current
mouseOvermethod implementation, change code to do$this->wdSession->moveTo ...? If that would:mouseoverevents along the way:hovercss selector to workthen you can safely send a PR for this case.
robsquires commentedon Sep 12, 2013
Yup thanks, that's all cool. The code I posted uses
moveTo+ I'll happily submit a PR for that change.In relation to this question - what was behind the implementation decision to use
synas opposed to the native selenium calls?aik099 commentedon Sep 12, 2013
I wasn't there at decision (whatever to use Syn or not) making time, but looking at Selenium server development it looks like, that it had problems with firing native JavaScript events when being used.
Then things have changed (for Selenium server), but Mink driver wasn't updated to reflect that. The related #51 issue, that you mentioned, proves that. I'll watch closely for Syn to be replaced with native calls for cases, where Syn won't be doing it's job properly in emulating real user action.
robsquires commentedon Sep 12, 2013
Ok thanks
aik099 commentedon Sep 12, 2013
@robsquires , why you closed this task? Shouldn't you be submitting PR instead and associating it with this task?
robsquires commentedon Sep 12, 2013
yeah you're right...sorry :)
robsquires commentedon Sep 12, 2013
Excuse this slightly nooby question..What's the best way for me to get my proposed changes into the codebase.
I added a web-fixture for this issue to the
Minkpackage. Now I realise I'm not going to be able to updateMinkthrough composer as the dependancy is~1.5.0:(It doesn't look like any test cases have been added to
Selenium2DriverTestfor a while - what's the best approach to get these changes in?thanks
aik099 commentedon Sep 12, 2013
This is because all drivers should identically simulate user actions and all tests are placed in following folder: https://github.com/Behat/Mink/tree/develop/tests/Behat/Mink/Driver
I guess you need to add new test to
JavascriptDriverTest.php. This test would cover that:hovereffect testing. However you must also test that both Selenium1 and Sahi driver would pass that new test too.aik099 commentedon Sep 12, 2013
Here is how I usually do this:
robsquires commentedon Sep 13, 2013
thanks. I've taken a similar approach in my working repo. I was worried about travis really. Composer will install mink 1.5.0 during the build so my tests won't be there...any ideas?
In terms of adding a test to
JavascriptDriverTest.phpI don't think that's advisable. This issue actually relates to CSS and not javascript - i.e the driver's ability for behaviour implemented in CSS to be accurately tested. If this test was added, the suite would always fail for the zombie driver.I can add a specific test case for the issue (378) to the selenium 1 and sahi drivers to ensure they work in the same way.
aik099 commentedon Sep 13, 2013
So you suggest, that current implementation of
mouseOvermethod in a driver isn't covered by tests right now?10 remaining items
robsquires commentedon Sep 13, 2013
would you mind just explaining that actually.
composer require behat/mink=1.5.*@devwill add"behat/mink": "1.5.*dev"tocomposer.json...isn't that the correct way to specify the deps, as opposed to using the branch alias?aik099 commentedon Sep 13, 2013
Branch alias is there to match branch, that isn't named as version (e.g.
developin this case) to some version, when comparing versions. I guess I just trust you on this one, since I don't have time to double check that over Composer manual.robsquires commentedon Sep 13, 2013
ha - ok, well i'll double double check and do the right thing ;-)
aik099 commentedon Dec 2, 2013
@robsquires , I've solved problem, where tests added to Mink weren't immediately available on it's driver's PR's when doing tests by replacing
~1.5to~1.5@devincomposer.jsonof each driver.andrewnicols commentedon Feb 21, 2014
For the record, I've just raised these bugs with the Syn library, and have found fixes. We too were finding issues with our tests randomly failing on pages where scrollbars were removed and the Syn library caused the page to jump thus moving the elements which should be visible, out of the window.
I've raised a couple of issues relating to this:
bitovi/syn#29 - firefox bug with the href JS detection
bitovi/syn#30 - firefox bug whereby including the library causes the browser focus to jump
Applying these fixes gets us back to a passing state on all of our failing tests.
It looks like the Syn library is being actively maintained once more and the maintainers are working to improve code quality (bitovi/syn#32).
aik099 commentedon Feb 21, 2014
Yes, they even start to number versions from zero back again.
J7mbo commentedon Apr 9, 2014
Does this still exist? Can we trigger
:hoverwithmouseOver()yet?aik099 commentedon Apr 9, 2014
@J7mbo have you tried it and it doesn't work for you?
J7mbo commentedon Apr 9, 2014
@aik099 Yes, but I wanted to confirm that I'm not doing something stupid before asking for help :-)
aik099 commentedon Apr 9, 2014
I see, that you've created #125 about that topic. Just referencing it here so both issues are linked properly.
This Syn() issue has been around for while, but without a solid research we can't really change anything.
So we have code of 2 types:
On some browser/platform/window manager combinations some of JS events, that occur during native WebDriver call doesn't occur at all. Here Syn() comes to play and emulates them.
Problem is that on some other browser/platform/window manager combinations these native events occur and Syn is triggering a duplicate JS event causing bad things to happen.
Ideally at the end we need to have a table if "browser x platform x window_manager x event" where we can see what's been natively triggered by Selenium WebDriver.
aik099 commentedon Apr 9, 2014
@ALL, the SauceLabs (https://saucelabs.com/platforms) or BrowserStack (http://www.browserstack.com/list-of-browsers-and-platforms?product=live) are free for OpenSource so we write some tests to verify what JS events are fired by native Selenium calls (VS ones that should be fired) then we can adjust current Syn() calls to make more sense.
aik099 commentedon Apr 9, 2014
Maybe we need to create a separate repo, that will:
aik099 commentedon Apr 14, 2014
I'll close this task since functionality is already merged in the #126. Feel free to reopen if needed.