Skip to content
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

setup e2e testing using playwright #1918

Merged
merged 8 commits into from
Mar 13, 2024
Merged

setup e2e testing using playwright #1918

merged 8 commits into from
Mar 13, 2024

Conversation

mayank99
Copy link
Contributor

@mayank99 mayank99 commented Mar 13, 2024

Changes

Adds a new e2e workspace, where Playwright e2e testing has been set up in a Remix app.

It actually turned out to be quite straightforward specifically because of remix's file-based routing. To add a new test, we only need to create a new route and add a spec.ts file to visit that route! Each route/test can be completely independent of one another.

This PR is just opening the path to adding tests in the future. No real tests have been added so far.

Testing

Tested a hello world scenario locally (pnpm run test --filter=e2e) and in CI.

Docs

Added basic instructions in CONTRIBUTING.md.

@mayank99 mayank99 self-assigned this Mar 13, 2024
@mayank99 mayank99 force-pushed the mayank/e2e branch 3 times, most recently from 02ecf84 to b08b5a7 Compare March 13, 2024 16:21
Copy link
Contributor Author

@mayank99 mayank99 Mar 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've deleted this example test that Playwright created upon initialization, but it's worth skimming through, just to understand how to do some pretty advanced things with playwright.

https://github.com/iTwin/iTwinUI/blob/6bd69da76e3f5a1a606b01c499a8d2978e7fa0ab/testing/e2e/tests-examples/demo-todo-app.spec.ts

@mayank99 mayank99 marked this pull request as ready for review March 13, 2024 16:38
@mayank99 mayank99 requested review from a team as code owners March 13, 2024 16:38
@mayank99 mayank99 requested review from r100-stack and Ben-Pusey-Bentley and removed request for a team March 13, 2024 16:38
@@ -4,7 +4,8 @@
"streetsidesoftware.code-spell-checker",
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"astro-build.astro-vscode"
"astro-build.astro-vscode",
"ms-playwright.playwright"
Copy link
Contributor Author

@mayank99 mayank99 Mar 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The vscode extension is pretty neat

Screen.Recording.2024-03-13.at.12.50.27.PM.mov

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, that seems incredibly useful for debugging tests.


The `testing/e2e` workspace facilitates testing of complex scenarios in a real browser. This is achieved by running [Playwright](https://playwright.dev/) tests against a [Remix](https://remix.run/) app.

- **To run tests**, use this command: `pnpm run test --filter=e2e`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we mention running pnpm exec playwright install? Because without running that, I got the below error:

image

Copy link
Contributor Author

@mayank99 mayank99 Mar 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean running pnpm install was not enough?

Edit: To make it work automatically I've added it to the postinstall script: aa6a44d

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, pnpm install was not sufficient for me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should work fine after latest commit.

@Ben-Pusey-Bentley Can you also test?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can confirm that this is working for me now.

Copy link
Contributor

@Ben-Pusey-Bentley Ben-Pusey-Bentley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@mayank99 mayank99 merged commit 14405ea into main Mar 13, 2024
16 checks passed
@mayank99 mayank99 deleted the mayank/e2e branch March 13, 2024 19:15
@mayank99 mayank99 mentioned this pull request Apr 1, 2024
18 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants