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

test[e2e]: Add PlanX input components to create-flow test #3617

Merged
merged 16 commits into from
Sep 5, 2024

Conversation

jamdelion
Copy link
Contributor

@jamdelion jamdelion commented Sep 3, 2024

Trello ticket: https://trello.com/c/dBmTyu9F/3017-test-each-planx-component-via-an-e2e-test

So far I've just focused on adding in the relatively easy 'input' components. The next PR will start to tackle the more complicated ones.

In this PR:

  • Add more guidance to readme
  • Refactor existing test to use helper functions for question/notice components
  • Add test coverage of checklist, text/number/date/address/contact inputs
  • Extract out a 'createBaseInput' helper to reduce code duplication.
  • Minor useToast hook improvement cherry-picked from my closed react-toastify PR 🍒
  • Refactor the helper files - causes a lot of import files changes, sorry! 😩

Copy link

github-actions bot commented Sep 3, 2024

Removed vultr server and associated DNS entries

@jamdelion jamdelion changed the title jh/playwright initial test[e2e]: Add more PlanX components to create-flow test Sep 3, 2024
Copy link
Contributor Author

@jamdelion jamdelion Sep 4, 2024

Choose a reason for hiding this comment

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

Minor toast improvements cherry-picked from the react-toastify PR so it's not forgotten :)

Comment on lines -1 to -5
import { Browser, Page, Request } from "@playwright/test";
import { createAuthenticatedSession } from "../globalHelpers";

export const isGetUserRequest = (req: Request) =>
req.url().includes("/user/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.

Renamed the file to be more specific to 'getPage' helpers, and moved this to another file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just moved this file into a helpers folder and moved a couple of the functions into another file with a better name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry there's a lot of changes like this where it's just the imports that have changed!

@jamdelion jamdelion marked this pull request as ready for review September 4, 2024 17:57
@jamdelion jamdelion requested a review from a team September 4, 2024 17:57
@jamdelion jamdelion changed the title test[e2e]: Add more PlanX components to create-flow test test[e2e]: Add PlanX input components to create-flow test Sep 4, 2024
Copy link
Member

@jessicamcinchak jessicamcinchak left a comment

Choose a reason for hiding this comment

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

Super exciting first additions here and meaningful refactors, thanks !

1. Navigate to `/tests/ui-driven`
2. Run `pnpm install` to install the Playwright package.
3. Run `pnpm exec playwright install` to install the Playwright test browsers.
4. Run the tests with `pnpm test`
Copy link
Member

Choose a reason for hiding this comment

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

🌟

noBranchNoticeText,
);

// TODO: find a nicer way to find the next node
Copy link
Member

Choose a reason for hiding this comment

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

When you're in a real browser, a handy trick for doing this is running window.api.getState().upcomingCardIds() in the console - where the next node ID will be the first item in the returned array. From there, you can do flow[nodeId] for the full node data like its' type etc.

Just flagging in case it jogs any future ideas ! setFeatureFlag & getSessionId helper functions already hook into similar window calls, so might be a pattern we can follow here too!

await page.getByRole("dialog").waitFor();
await page.locator("select").selectOption({ label: type });

switch (type) {
Copy link
Member

Choose a reason for hiding this comment

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

Nice & clear !

@jamdelion jamdelion merged commit 7907d0a into main Sep 5, 2024
12 checks passed
@DafyddLlyr DafyddLlyr deleted the jh/playwright-initial branch September 17, 2024 15:07
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.

2 participants