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

Write tests for modals #53895

Closed
1 of 18 tasks
huyenltnguyen opened this issue Feb 27, 2024 · 3 comments
Closed
1 of 18 tasks

Write tests for modals #53895

huyenltnguyen opened this issue Feb 27, 2024 · 3 comments
Assignees
Labels
platform: learn UI side of the client application that needs familiarity with React, Gatsby etc. scope: tools/scripts Scripts for supporting dev work, generating config and build artifacts, etc.

Comments

@huyenltnguyen
Copy link
Member

huyenltnguyen commented Feb 27, 2024

Description

Before we migrate the Modal component (#52759), we want to ensure the existing modals have sufficient test coverage.

If we already have a corresponding Playwright test file for the modal, check if the test suite covers all expected behaviors (conditional rendering logic, user interaction, keyboard usage, etc.). If we don't have a corresponding Playwright test file for the modal, add the file in.

Note: I think we might want to incorporate modal tests with the relevant user flows rather than having them in separate files, but we can move the tests around later when we have all of them in.

Guides

Task list

Tasks

@gikf gikf added platform: learn UI side of the client application that needs familiarity with React, Gatsby etc. scope: tools/scripts Scripts for supporting dev work, generating config and build artifacts, etc. labels Feb 27, 2024
@a2937
Copy link
Member

a2937 commented Feb 27, 2024

I believe I spotted the existing Playwright test for the donation modal.

There is the modal body itself that appears to need a fair bit of tests like the animation, the bear block completion illustration, the rows, the confirmation, and the header. Is this something I should consider working on in this file?

@huyenltnguyen
Copy link
Member Author

@a2937 That's my least favorite modal (because of its complexity), so feel free to look into it 🙂 I think we can use that donate-page-default.spec.ts file for donation-modal's tests.

Just a note: If you need to add new tests, try to avoid the getByTestId() locator as much as possible. getByRole(), getByLabel(), and getByText() should be sufficient in most cases.

Here is our guide to working with Playwright: https://contribute.freecodecamp.org/#/how-to-add-playwright-tests.

@huyenltnguyen
Copy link
Member Author

Closing this issue as we have decided to incorporate tests in the migration work, rather than making the changes in phases.

The tests will be part of #52759.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: learn UI side of the client application that needs familiarity with React, Gatsby etc. scope: tools/scripts Scripts for supporting dev work, generating config and build artifacts, etc.
Projects
None yet
Development

No branches or pull requests

3 participants