-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
refactor(playwright): use fixtures instead of calling setup in every test file #10511
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
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
| await page | ||
| .locator('textarea') | ||
| .type( | ||
| .pressSequentially( |
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.
type method is deprecated and pressSequentially is the new recommended one by the docs
86d9ded to
edaa327
Compare
|
This will take forever for me to parse. |
no worries, I will adjust to the current setup then |
|
I will close this and we can revisit the whole setup later when we have completely migrated from qunit |
|
ok i can imagine this was accumulating issues of merge conflicts. |
|
I will reopen this with resolved merge conflicts as soon as I am done with all qunit to playwright migration |
I am currently studying current playwright setup in order to understand it fully and to be able to contribute in migration of visual tests to playwright.
Current playwright setup seems overwhelming to me and with too many acrobatics going on in order to write a simple test.
This PR has a goal to reduce the boiler plate needed to write a playwright test by utilizing a pattern called POM (page object model) https://playwright.dev/docs/pom and playwright fixtures https://playwright.dev/docs/test-fixtures.
This makes playwright setup in fabric more playwright idiomatic and in line of how playwright recommends to structure the tests.
As a result there is not need to call setupApp anymore in each test file, it is done automatically in the page fixture now.
You can also see that this PR reduced lines in playwright by almost 100 lines.
Further ideas to simplify playwright setup even more:
remove http-server dependency and startup and leverage playwright routes https://playwright.dev/docs/api/class-
route to intercept the requests to assets and pages directly by playwright.
This makes tests truly isolated and removes latency between real client-server scenario.
It also makes tests depending on one dependency less.
Another issue with http-server approach is that it currently logs deprecation message
It also doesn't seem maintained anymore.
use monocart reporter to simplify coverage collection instead of doing complex acrobatics as it is now
implement fully typed playwright test
currently there are lots of type issues in playwright tests not giving proper intellisense and doesn't give all the type safety typescript offers. It should be easy to create global types so we can have full type safety and intellisense
Figure out if babel is needed to build or is there a more straightforward way to run playwright tests in watch mode
maybe playwright already offers watch mode and we don't need to do all the babel magic at all
Figure out if we can directly run playwright files from ts instead of building the js files first