Thanks to visit codestin.com
Credit goes to github.com

Skip to content

test(site): make loading snapshots more predictable #14564

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 3 commits into from
Sep 4, 2024

Conversation

BrunoQuaresma
Copy link
Collaborator

@BrunoQuaresma BrunoQuaresma commented Sep 4, 2024

Abstracts the Spinner component to control the display of the CircularProgress component. This allows us to make it static during Chromatic tests, making loading tests easier to visualize.

Before:
Screenshot 2024-09-04 at 14 00 44

After:
Screenshot 2024-09-04 at 14 00 49

Abstracts the Spinner component to control the display of the CircularProgress component. This allows us to make it static during Chromatic tests, making loading tests easier to visualize.
@BrunoQuaresma BrunoQuaresma self-assigned this Sep 4, 2024
@BrunoQuaresma BrunoQuaresma requested review from a team and Kira-Pilot and removed request for a team September 4, 2024 17:01
@@ -18,7 +18,7 @@ export const Loader: FC<LoaderProps> = ({
data-testid="loader"
{...attrs}
>
<CircularProgress size={size} />
<Spinner aria-label="Loading..." size={size} />
Copy link
Member

Choose a reason for hiding this comment

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

I might be misunderstanding but it seems we have a Loader component wrapping a Spinner component wrapping a CircularProgress component. Is there a reason to have 3 levels nesting here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point! The purpose of the 'Loader' is to act as a container that centrally positions the loading spinner on the page or within a section, with some padding around it. Meanwhile, the 'Spinner' can be utilized in other components, such as loading buttons. Perhaps 'Loader' is not the most suitable name, but I can't think of anything better at the moment.

Copy link
Member

Choose a reason for hiding this comment

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

Ahh, makes sense! Loader works for me :)

@Kira-Pilot
Copy link
Member

Kira-Pilot commented Sep 4, 2024

One suggestion: we could stick the aria on the actual component so the Spinner is always labeled correctly. Then consumers of the component could pass in a more specific label and override the default, e.g. "Loading the Workspaces Page".

*/
if (isChromatic()) {
props.variant = "determinate";
props.value = 75;
Copy link
Member

Choose a reason for hiding this comment

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

nice

@BrunoQuaresma
Copy link
Collaborator Author

One suggestion: we could stick the aria on the actual component so the Spinner is always labeled correctly. Then consumers of the component could pass in a more specific label and override the default, e.g. "Loading the Workspaces Page".

I like the idea! 👍

@BrunoQuaresma BrunoQuaresma merged commit c3f0db3 into main Sep 4, 2024
27 checks passed
@BrunoQuaresma BrunoQuaresma deleted the bq/determinate-loading-on-storybook branch September 4, 2024 18:20
@github-actions github-actions bot locked and limited conversation to collaborators Sep 4, 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.

2 participants