Skip to content

test(site): move users page test to storybook #14579

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

Merged
merged 13 commits into from
Sep 6, 2024

Conversation

BrunoQuaresma
Copy link
Collaborator

By using Storybook interaction tests, we improve the developer experience, as we can see what is happening in the browser, use browser tools to debug, and snapshot the component after interactions, making our tests more reliable and easier to maintain.

Fixes #14535

@BrunoQuaresma BrunoQuaresma requested a review from a team September 5, 2024 17:55
@BrunoQuaresma BrunoQuaresma self-assigned this Sep 5, 2024
@BrunoQuaresma BrunoQuaresma requested review from code-asher and removed request for a team September 5, 2024 17:55
Copy link
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

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

Love to see tests replaced with Storybook!

@@ -0,0 +1,577 @@
import type { LoginType, User, UserStatus } from "api/typesGenerated";
Copy link
Member

Choose a reason for hiding this comment

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

Should we replace all the emails with fake ones? Some of these are probably real (the Coder ones at least, maybe the ones from ChatGPT too).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah, sorry, I thought I had removed all of them. 🤦

// These values were retrieved from the Coder API. Sensitive information such as
// usernames, names, and emails has been replaced with fake user data to protect
// privacy. This user data comes from the MockUsers to keep consistency.
export const MockGroups: Group[] = [
Copy link
Member

Choose a reason for hiding this comment

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

Should we replace/remove the ones with external avatar URLs? Could be weird if our tests are making requests for these external jpgs and such

await user.click(
within(userRow).getByLabelText("Auditor", { exact: false }),
);
await within(document.body).findByText("Error updating the user roles.");
Copy link
Member

Choose a reason for hiding this comment

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

Looks like the error text is Error on updating the user roles.

@BrunoQuaresma BrunoQuaresma merged commit 0f342ed into main Sep 6, 2024
27 checks passed
@BrunoQuaresma BrunoQuaresma deleted the bq/fix-users-page-test branch September 6, 2024 12:56
@github-actions github-actions bot locked and limited conversation to collaborators Sep 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

flake: UsersPage.test.tsx
2 participants