Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Initial Cypress e2e wab test migration to Playwright #149

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

Open
przemek-qadna wants to merge 8 commits into plasmicapp:master
base: master
Choose a base branch
Loading
from QA-DNA:playwright-wab-test

Conversation

@przemek-qadna
Copy link
Contributor

@przemek-qadna przemek-qadna commented Jul 15, 2025

This PR begins the migration of E2E tests from Cypress to Playwright. It includes:

  • Initial Playwright test structure and config

  • First migrated wab test as a reference

More tests will be ported in follow-up PRs.

plasmic-first-wab-test.mov

Copy link

vercel bot commented Jul 15, 2025

@AdrianQADNA is attempting to deploy a commit to the Plasmic Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

vercel bot commented Jul 15, 2025
edited
Loading

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-plasmic-cms-i18n ❌ Failed (Inspect) Aug 5, 2025 1:52pm
examples-react-email ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 5, 2025 1:52pm

Copy link

github-actions bot commented Jul 15, 2025
edited
Loading

Thank you for your submission, we really appreciate it! ❤️

Like many open-source projects, we ask that you sign our Individual Contributor License Agreement before we can accept your contribution. If you are contributing on behalf of a company, please contact us at help@plasmic.app to sign a Corporate Contributor License Agreement.

You can sign the individual CLA by posting a comment with the below text.


I have read, agree to, and hereby sign Plasmic's Individual Contributor License Agreement


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

Copy link
Contributor

@sampullman sampullman left a comment
edited
Loading

Choose a reason for hiding this comment

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

Looks good overall, though maybe more abstract than needed in some places. For example, addInteraction -> getInteractionAction -> selectElementWithDataKey.

getInteractionAction is only used in one place. It will probably be reused later, but I'm not sure it's clearer than doing e.g. getElementWithDataKey in addInteraction. It's mostly personal preference, but I'd tend to prefer less indirection up front, adding later when it makes sense.

edit: @jaslong Does it make sense to move this to its own package, like platform/wab-e2e or wab-tests? That's what I usually do to keep heavy dev dependencies out of apps.

}

async switchArena(name: string) {
await this.projectNavButton.click({ force: true });
Copy link
Contributor

@sampullman sampullman Jul 16, 2025

Choose a reason for hiding this comment

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

I think in some cases, these force: true settings copied from Cypress should no longer be necessary.

jaslong reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

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

+1. Please get rid of as many force: true as possible.

}
await this.projectNavSearchInput.fill(name);
await this.frame.locator(`text=${name}`).click({ force: true });
await this.page.waitForTimeout(1000);
Copy link
Contributor

@sampullman sampullman Jul 16, 2025

Choose a reason for hiding this comment

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

I haven't tested it, but instead of waiting 1s I think it's sufficient to wait for #proj-nav-button to change to the new arena name. Then, subsequent Playwright selectors should naturally wait if the new content is still loading.

"@types/node": "^24.0.13"
},
"scripts": {
"e2e": "npx dotenvx run -f .env.test -- npx playwright test"
Copy link
Contributor

@sampullman sampullman Jul 16, 2025

Choose a reason for hiding this comment

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

Any reason to do this here, instead of loading dotenv in playwright config?


test("can create all types of text interactions", async ({ pages, page }) => {
//GIVEN
const TEST_DATA = {
Copy link
Member

Choose a reason for hiding this comment

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

Not a fan of this pattern. It typically just obfuscates the actual values.

As a general rule, only make a variable for a constant if used 3 or more times.

await pages.projectPage.switchArena(TEST_DATA.arenaName);

//WHEN
const contentFrame = await findFrameByText(page, TEST_DATA.setToText);
Copy link
Member

Choose a reason for hiding this comment

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

Why aren't these locators in ProjectPage? And why is findFrameByText necessary here instead of the specific frame locators that are already in ProjectPage?

};
};

// eslint-disable-next-line no-shadow
Copy link
Member

Choose a reason for hiding this comment

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

remove/fix eslint-disable-next-line

}

async switchArena(name: string) {
await this.projectNavButton.click({ force: true });
Copy link
Member

Choose a reason for hiding this comment

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

+1. Please get rid of as many force: true as possible.

@@ -0,0 +1,21 @@
import { getEnvVar } from "../utils/env";
Copy link
Member

Choose a reason for hiding this comment

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

Move getEnvVar into this file, do not export it.

Copy link
Member

Choose a reason for hiding this comment

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

Remove this file and inline types instead.

};

// eslint-disable-next-line no-shadow
enum Operations {
Copy link
Member

Choose a reason for hiding this comment

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

Use string literal unions instead. "new" | "clear"

Copy link
Member

Choose a reason for hiding this comment

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

Since we have a single-page application AND we have the concept of pages in our app, we should get rid of the "page" terminology. Maybe rename "page" to "model (i.e. rename from "pages/project-page.ts" to "models/StudioModel.ts")? Ultimately, in test code, I want to be able to write something like studio.switchArena("some page").

@@ -0,0 +1,9 @@
import { Page } from "playwright/test";

export class BasePage {
Copy link
Member

Choose a reason for hiding this comment

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

Get rid of this, just inline

constructor(private readonly page: Page)

in every model.

}

await this.closeSidebarButton.click();
}
Copy link
Member

Choose a reason for hiding this comment

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

I see this file growing to become as large as the existing cypress/support/utils.ts file. How should we divide it into separate files? Maybe by feature?

Copy link
Member

jaslong commented Jul 17, 2025

platform/wab-e2e would be fine too! As long as it's clear these tests are for wab.

Copy link
Member

jaslong commented Aug 1, 2025

Need decision later

Current

platform/wab
platform/wab-e2e
platform/loader-tests

Root

e2e-tests
e2e-tests/wab
e2e-tests/loader

In Platform

platform/e2e-
platform/e2e-tests/wab
platform/e2e-tests/loader

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@sampullman sampullman sampullman left review comments

@jaslong jaslong jaslong left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /