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 tests #1832

Draft
wants to merge 88 commits into
base: master
Choose a base branch
from
Draft

Playwright tests #1832

wants to merge 88 commits into from

Conversation

@aerinsol
Copy link
Member

@fhenrich33 can you post a link in the description with a fully rendered file, like what @pylipp does with his?

@aerinsol aerinsol self-requested a review December 26, 2024 09:25
@aerinsol
Copy link
Member

aerinsol commented Dec 26, 2024

Good ADR @fhenrich33. There are some missing sentences in the context section that should be cleaned up, and I'd like that section on MSW to clarify that you're referring to the current production or development environment (or a specific part of it) rather than just saying "we".

Similarly, for the Readme, it's good to be precise with your terminology. For example:

  • "real backend" should probably "production backend" and so on. Describing things that way clarifies where they lie in the SDLC and what purpose they serve.
  • While using "you" make sense for the readme as you're speaking to a potential developer, since the code is open source, "our application" makes less sense. I recommend referring to it more as a public good as we are part of the DPGA (e.g. "the codebase, the application").

Otherwise, nice work, please request reviews whenever you're ready.

Copy link
Contributor

Choose a reason for hiding this comment

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

Are we removing the old tests and expecting to rewrite them again using Playwright? @fhenrich33

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, for rewriting tests with Playwright; no, for rewriting tests that already exist. I'm almost finished with that right now!

product: element.product!.name,
productCategory: element.product!.category.name,
gender: element.product!.gender,
product: element.product?.name,
Copy link
Contributor

Choose a reason for hiding this comment

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

quick qn: Why are we removing the non-null assertion operator here? Is it possible that product/location can be optional?

Copy link
Contributor Author

@fhenrich33 fhenrich33 Dec 28, 2024

Choose a reason for hiding this comment

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

Good that you brought that up!

! aka non-null assertion operator is a TypeScript compiler flag of sorts, telling TS to exclude null and undefined from the type of this property, or in a way telling it's okay if they end up being those types. This doesn't help on runtime as this is a type-only thing.

But since this piece of code blew up for me using mock data that had this property nullified in some entries, the right thing to do is to use ? or the optional chaining operator to avoid exceptions on trying to access properties inside an undefined or null object/property.

- No built-in support for cross-browser testing.

2. **Playwright**
- Pros:
Copy link
Member

Choose a reason for hiding this comment

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

I thought the main Pro argument is that you can easily generate mock data @fhenrich33 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This would be the benefit of gql.tada, used with MSW request handlers. Playwright does have a very similar mocking capability as MSW, but we use the latter to allow us to mock yet-to-be-implemented schemas in the future.

@@ -82,35 +84,104 @@ Afterwards:

## Testing

Testing is done with React Testing Library and Jest.
Testing is done with [Playwright](https://playwright.dev/) for application, integration, and component testing.
Copy link
Member

Choose a reason for hiding this comment

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

feels like you have pasted the same section twice here. Also please ensure that the old section on react testing library is still in, but that it is clear that we are slowly deprecating it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did you read from the README in the PR description section? I didn't find any dupes there.

Also, I'm replicating the entire test suite where we used React Testing Library with Playwright, so I don't think it makes sense to keep it in that case.

Copy link
Contributor Author

@fhenrich33 fhenrich33 Jan 23, 2025

Choose a reason for hiding this comment

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

Apologies @HaGuesto, it seems that the description didn't updated properly.

@aerinsol
Copy link
Member

Good clear updates to the comparative evaluation. Nice work.

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.

4 participants