-
-
Notifications
You must be signed in to change notification settings - Fork 194
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
Port robot framework tests to Playwright #3813
Comments
These flags are defined in https://github.com/plone/plone.app.robotframework/blob/e5d98a98483729231a23cb5007e56b386e7001a6/src/plone/app/robotframework/browser.robot#L43 and are just the first way to integrate these Playwright and robotframework-browser features that came to mind. (robotsuite does the magic for passing any ROBOT_-prefixed environment variable into robot run as a robot variable) |
@thet @petschki I see that on plone.app.event there is a disabled robot test. On my way from Bilbao to Barcelona with train I was looking at it, and it's a bit tricky to get it to work again, given that the date widget is browser dependent... should we try it anyway, or should it be removed entirely? 🤔 |
For those following this issue, I created another issue in |
@datakurre @gforcada what are the next steps if the tests are ported?
|
|
Please remind me: is './bin/rfbrowser init' only needed for playwright? Or can it also be useful for the old selenium based tests? |
I think it's only needed for playwright based tests. |
Yes, it is only needed for playwright tests. Playwright is distributed through NPM and that command should imperatively install the required packages. Probably it also fetches the playwright compatible browser binaries. |
I am testing plone/plone.schemaeditor#118. I have a problem on my Mac: On I tried each test scenario individually with for example But running two together leads to a hang:
There it does nothing anymore. I see a playwright log generated for the first test:
That sounds like teardown does not work correctly, and the second test cannot start. For the second test I only see an empty I have Any idea? |
@mauritsvanrees I got this working on my Mac with the following version set:
those versions are pinned here https://github.com/plone/buildout.coredev/blob/6.1/versions.cfg#L236-L239 NOTE: don't forget to UPDATE:
|
Tangent: to make test runs platform independent (same locally as in pipeline), it could be prudent to provide devcontainers. |
Thanks @petschki, with those pins it works for me. I have merged your coredev PR. Could you check if those versions work on 6.0 as well? |
@gforcada The Jenkins nodes may need some upgrade. "Host system is missing dependencies to run browsers." See plone/buildout.coredev#948 (comment) |
Sorry for the delay on replies, I'm rather busy as of late, hopefully in 2 weeks the big project I work on will be deployed (and the more bugs and features will be asked 😆 ) and I will have some time 🤞🏾 Ok, I found some time, I bumped nodejs to |
Turns out that 20.5.1 is not enough 🙃 |
Log says
|
And |
So, finally, in a sleepless night I found the time to look at the problem 🎉 I installed The long list of dependencies can be installed (if anyone hits the same problem) with Oh, and indeed @petschki chromedriver was again outdated, fortunately that's easier to fix (and it is 😄 ) /cc @mauritsvanrees @1letter (I'm not sure in which other PR/issue we were also discussing CI problems of robot tests 😓 ) Seems that robot tests run again: https://jenkins.plone.org/job/plone-6.1-python-3.12-robot-chrome/561/console |
Thanks a lot! And I hope you sleep better next night. 😴💫 |
@gforcada Sorry, but an error happen on install rfbrowser https://jenkins.plone.org/job/pull-request-6.1-3.10/360/console
|
Sorry again, my life is (a bit) in shambles, but I think, at least on https://jenkins.plone.org/job/plone-6.0-python-3.11-robot-chrome/1457/console 🤞🏾 |
STATUS
Report from Midsummer sprint 2023: playwright integration to
plone.app.robotframework
(via robotframework-browser) works! 🎉All credits to @datakurre ✨
And even better, it not only works, but we don't have to have a sync day where all tests need to be converted at the same time, but rather we can move them incrementally!
TASKS
There are a plenty of things to do still, all arms and fingers are welcome! there are work items for everyone:
plone.app.robotframework
to use playwright, see Support playwright based robot tests via robotframework-browser extension plone.app.robotframework#149robotsuite
images reports Fix to support screenshots / images below sub directories collective/robotsuite#28plone.restapiCleanup robot tests plone.restapi#1720plone.app.widgets(deprecated)plone.app.widgets
and update to Playwright integration plone.app.z3cform#174)robotsuitesee comment by @datakurreplone.themepreview(should be archived)Please write your name next to a package if you want to work on porting them! 🙇🏾
PORTING TESTS
IMPORTANT NOTE: when porting tests from selenium to playwright, they have to be ported all tests from the same distribution in a single go, otherwise either the ported or the old ones will fail on CI.
Probably this is due to them sharing the same layer, if we keep the old test layer and create a new one for the playwright ones, all tests might pass.
RUN TESTS
To run tests locally:
buildout.coredev
up and runningcheckouts.cfg
buildout
again to get your package in development mode./bin/rfbrowser init
ROBOT_BROWSER=chrome ./bin/test --all -s MY.PACKAGE -t .robot
DEBUGGING TESTS
By default
playwright
does not show the browser, asselenium
used to do.If you want to follow along though, add another environment variable
ROBOT_DEBUG=true
✨It will automatically stop (when using
ROBOT_DEBUG
) if a keyword fails 🤩 note though that if the keyword itself is wrong (an old selenium keyword) then it does not stop, it breaks the test and stops 😅And as usual with @datakurre there is even more: VSCode integration right at your fingertips, run robot tests from within VSCode and run tests step by step 🤯
KEYWORDS STATUS
Notice that plenty of keywords that we were using for robot tests are no longer needed (the whole collection of
Wait until...
💥 ) asplaywright
does implicit waits already 🚀As soon as we have them running in CI we can see if we need to add them back, hopefully not 🍀 🤞🏾
robotframework-browser
being much more younger thanselenium
has a smaller set of keywords available, see the p.a.discussion PR to get an idea on which replacements one can use.On
plone.app.robotframework
we created quite a few custom ones. We either need to re-implement them withplaywright
based keywords, or drop them altogether, we need to see.Exciting times! 🎉
The text was updated successfully, but these errors were encountered: