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

playwright e2e tests #487

Merged
merged 1 commit into from
Nov 14, 2024
Merged

playwright e2e tests #487

merged 1 commit into from
Nov 14, 2024

Conversation

robin-drexler
Copy link
Member

@robin-drexler robin-drexler commented Nov 12, 2024

This adds a first set of playwright based e2e that leverage the existing kitchen sink example application to prevent further accidental regressions.

In this PR, we're adding tests for all the sandbox/framework constellations that currently work.
Everything using webworker is currently broken as well as react in the iframe. This is a separate issue to address that actually triggered me wanting to add e2e tests.

Once these work again, we can add them to the matix.

The tests are checking that the modal can be opened and that the counter works.

Successful run: https://github.com/Shopify/remote-dom/actions/runs/11808443962/job/32897020650?pr=487

Here's a job run with an error to prove that failing tests actually fail the build: https://github.com/Shopify/remote-dom/actions/runs/11808338067/job/32896744315

@robin-drexler robin-drexler force-pushed the rd/playwright branch 12 times, most recently from 425fbbd to f20c8bf Compare November 13, 2024 00:50
@robin-drexler robin-drexler changed the title wip playwright e2e tests Nov 13, 2024
['iframe', 'svelte'],
['iframe', 'vue'],
['iframe', 'htm'],
].forEach(([sandbox, example]) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

@robin-drexler robin-drexler marked this pull request as ready for review November 13, 2024 00:56
Copy link
Member

@lemonmade lemonmade left a comment

Choose a reason for hiding this comment

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

Thanks so much for doing this, Robin! Left a few small requests and questions, but I am very glad to have this layer of validation.


await expect(page.getByText('Click Count: 2')).toBeVisible();

page.once('dialog', (dialog) => {
Copy link
Member

Choose a reason for hiding this comment

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

Can we store this as a promise and make sure it resolves, to ensure that the contained expect() is actually hit?

Copy link
Member Author

Choose a reason for hiding this comment

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

playwright.config.ts Show resolved Hide resolved
['iframe', 'preact'],
['iframe', 'svelte'],
['iframe', 'vue'],
['iframe', 'htm'],
Copy link
Member

Choose a reason for hiding this comment

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

Can you add the other tuples for the worker, and comment out the ones that are currently broken?

Copy link
Member Author

Choose a reason for hiding this comment

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

done

Copy link
Member Author

Choose a reason for hiding this comment

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

/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
Copy link
Member

Choose a reason for hiding this comment

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

Is there any way to configure playwright to shove all this in a single file, instead of spraying a bunch of directories all over the root of the project?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not that I'm aware of

@@ -0,0 +1,27 @@
import {test, expect} from '@playwright/test';
Copy link
Member

Choose a reason for hiding this comment

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

Is x.spec.ts the required/ conventional name for Playwright tests? I find it hard to know what .spec.ts vs .test.ts means at first glance, in the past I have used .e2e.ts to make these tests more explicit.

Copy link
Member Author

Choose a reason for hiding this comment

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

@lemonmade lemonmade merged commit 5bc58a4 into main Nov 14, 2024
5 checks passed
@lemonmade lemonmade deleted the rd/playwright branch November 14, 2024 20:25
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