-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Update acceptance tests to Selenium 3 #25991
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
Conversation
872a5b2 to
ecc41bc
Compare
|
@danxuliu promising results! :) |
| $this->actor->find(self::passwordProtectCheckbox($shareLinkMenuTriggerElement), 2)->click(); | ||
|
|
||
| $this->actor->find(self::passwordProtectField($shareLinkMenuTriggerElement), 2)->setValue($password . "\r"); | ||
| $this->actor->find(self::passwordProtectField($shareLinkMenuTriggerElement), 2)->setValue($password . Key::ENTER); |
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.
Love this
tests/acceptance/run.sh
Outdated
|
|
||
| echo "Starting Selenium server" | ||
| docker run --detach --name=$SELENIUM_CONTAINER --publish 4444:4444 --publish 5900:5900 $DOCKER_OPTIONS selenium/standalone-firefox-debug:2.53.1-beryllium | ||
| docker run --detach --name=$SELENIUM_CONTAINER --publish 4444:4444 --publish 5900:5900 --shm-size 256m $DOCKER_OPTIONS selenium/standalone-chrome-debug:3.141.59 |
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 if you tried this before: https://stackoverflow.com/a/41640458
if it didn't work, there's a note that says that the containers need to be marked as trusted in the repo settings
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.
@PVince81 this file is also used to run selenium locally. So adding a drone-only config would not be compatible :)
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, missing context. this was an answer to a chat message of @danxuliu where he said if I had an idea how to add it to Drone config. I just picked this line to answer as it was closest :-D
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 if you tried this before: https://stackoverflow.com/a/41640458
if it didn't work, there's a note that says that the containers need to be marked as trusted in the repo settings
As mentioned in the pull request description I have not tried it yet, but that does not seem to work in latest Drone even if the repository is trusted :-( But I still need to dig into all this ;-)
ecc41bc to
dfb1e04
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Well, it was pending for another pr during your vacations. Which I rebased and merged. So I assumed this one was maybe done 🤷 |
Maybe move the tests to github actions? |
Fair enough ;-)
🤦 I knew I forgot something xD
I have no idea about GitHub actions :-( But I will take a look, thanks for the suggestion ;-) Nevertheless, with the current Drone workers the tests are already quite fast. Those that take longer (the sharing ones) are mostly idling in some overcautious waits. I have took a look already at improving them, but failed miserably :-P They are a bit tricky ;-) But I hope that it will be eventually solved :-) |
|
seems it might be possible to disable shm, see https://developers.google.com/web/tools/puppeteer/troubleshooting#tips that article points at issues with docker |
Sending the "enter" key is not needed in those input fields that auto save while the user is typing or when the focus is lost (which since version 1.4.0 the Selenium driver for Mink is automatically done after setting the value). Signed-off-by: Daniel Calviño Sánchez <[email protected]>
When the value is set in some input fields a carriage return was sent to simulate pressing the enter key and thus confirming the input. However, different browsers use different keys (Firefox uses "\r", but Chrome uses "\n"), so the carriage return was replaced with the WebDriver "ENTER" constant which is common to both browsers. Signed-off-by: Daniel Calviño Sánchez <[email protected]>
The acceptance tests used the last Selenium 2 Docker container
available, which provides a rather old Firefox version (Firefox 47).
Nevertheless, despite some rendering issues, most things still worked as
expected due to the JavaScript files being built with support for older
browsers. However, now that support for Internet Explorer 11 and older
browsers will be dropped things could start to fail, so a newer browser
(and thus a newer Selenium version) should be used in the acceptance
tests.
Selenium has been standardized by the W3C, and the protocol to
communicate between the Selenium server and the browser has changed due
to that. Firefox >= 48 only supports the new W3C protocol, but the
Selenium driver for Mink does not support it yet.
The old protocol can still be used in recent Chromium/Chrome versions by
explicitly forcing it, so for the time being the acceptance tests will
need to be run on Chrome instead (although Firefox provides some
interesting features like the fake streams that would be needed to test
calls in Talk, so they should be moved again to Firefox once possible).
Finally, the default shm size of Docker is 64 MiB. This does not seem
enough to run newer Chrome releases and causes the browser to randomly
crash during the tests ("unknown error: session deleted because of page
crash" is shown in the logs). Due to this "disable-dev-shm-usage" needs
to be used so Chrome writes shared memory files into "/tmp" instead of
"/dev/shm" (the default shm size of Docker could have been increased
instead using "docker run --shm-size...", but that seems to be
problematic when the container is run in current Drone releases).
Signed-off-by: Daniel Calviño Sánchez <[email protected]>
dfb1e04 to
9e1246e
Compare
|
It worked! 🚀 |
Great finding, thanks! :-)
Yay! :-D
No, luckily the failure from master is fixed now :-) The problem is that, even if Chrome uses the old protocol, in some cases it generates However... I have been running tests literally for hours and the error was never thrown to really investigate it 😢 So I just added a tentative fix for it, but... I do not really know if the tests will always work or randomly fail 🤷 |
|
|
|
LGTM |
In the WebDriver protocol, when a command fails because it can not interact with the target element, an "element not interactable" error is generated. It can be a transitive issue (for example, due to an animation), so when the error is received the command should be tried again, just like done, for example, with "ElementNotVisible" exceptions. However, the last version of the "instaclick/php-webdriver" library compatible with the Selenium Driver of Mink did not support yet that WebDriver error. And even if Chrome is run using the old protocol an unknown "element not interactable" error can be received anyway in some cases. When an unknown error is received by the "instaclick/php-webdriver" library it is thrown as a generic Exception so, until the library can be updated, the message of generic exceptions is checked and the command is retried if it matched. For the time being "element not interactable" errors are handled like "ElementNotVisible" exceptions; this may need to change once the error is better understood. Signed-off-by: Daniel Calviño Sánchez <[email protected]>
3cdc654 to
4b376a1
Compare
The logs also showed some retries on |
|
A bit more reviewers @danxuliu ? :) |
PVince81
left a comment
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.
👍
|
Unrelated failure of sqlite |
|
All acceptance tests currently fail in Drone in pull requests that were branched before this pull request was merged. It seems that there is a strange mismatch between the Selenium Docker image used and the expected one. I guess it is just some Drone caching issue. |
As mentioned it was probably some caching issue, as a pull request rebased after the merge got green CI (such a beautiful colour :-P ). |

This should be rebased on master once #25983 is merged.
The acceptance tests used the last Selenium 2 Docker container available, which provides a rather old Firefox version (Firefox 47). Nevertheless, despite some rendering issues, most things still worked as expected due to the JavaScript files being built with support for older browsers. However, now that support for Internet Explorer 11 and older browsers will be dropped things could start to fail, so a newer browser (and thus a newer Selenium version) should be used in the acceptance tests.
Selenium has been standardized by the W3C, and the protocol to communicate between the Selenium server and the browser has changed due to that. Firefox >= 48 only supports the new W3C protocol, but the Selenium driver for Mink does not support it yet (see issue 293 in https://github.com/minkphp/MinkSelenium2Driver/issues, not linking to prevent polluting the thread with back references).
The old protocol can still be used in recent Chromium/Chrome versions by explicitly forcing it, so for the time being the acceptance tests will need to be run on Chrome instead (although Firefox provides some interesting features like the fake streams that would be needed to test calls in Talk, so they should be moved again to Firefox once possible).
Finally, the default shm size of Docker is 64 MiB. This does not seem enough to run newer Chromium releases and causes the browser to randomly crash during the tests (
unknown error: session deleted because of page crashis shown in the logs). Due to thisdisable-dev-shm-usageneeds to be used so Chrome writes shared memory files into /tmp instead of /dev/shm (the default shm size of Docker could have been increased instead usingdocker run --shm-size..., but that seems to be problematic when the container is run in current Drone releases).Pending: shm size needs to be increased when run in Drone too. In theory it should be enough to useshm_size, but it seems that parameter no longer works (although I have not actually tested it, I just hoped that for some reason our Drone had a high enough default shm size, but based on theunknown error: session deleted because of page crasherrors in the logs it seems it does not :-( )