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

More tidying prior to Models in Browse Data #38126

Merged
merged 10 commits into from Jan 26, 2024

Conversation

rafpaf
Copy link
Contributor

@rafpaf rafpaf commented Jan 25, 2024

The PR makes some e2e tests and associated components more semantic

@rafpaf rafpaf self-assigned this Jan 25, 2024
@metabase-bot metabase-bot bot added the .Team/AdminWebapp Admin and Webapp team label Jan 25, 2024
@rafpaf rafpaf force-pushed the models-in-browse-data--more-initial-cleanup branch from 323e55d to ec104b1 Compare January 25, 2024 11:47
@rafpaf rafpaf mentioned this pull request Jan 25, 2024
cy.findByText("Our analytics").should("not.exist");
cy.findByRole("heading", { name: /Our data/ }).should("be.visible");
cy.findByRole("treeitem", { name: /Our data/ }).should("not.exist");
cy.findByRole("treeitem", { name: "Our analytics" }).should("not.exist");
appBar().should("not.exist");
Copy link
Contributor Author

@rafpaf rafpaf Jan 25, 2024

Choose a reason for hiding this comment

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

I think this test is actually ensuring that the side nav, not the top nav, is not rendered

Copy link
Member

Choose a reason for hiding this comment

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

IIRC, @WiNloSt originally wrote these tests.
I think the test is doing what it says on the tin - if we hide the side navigation and hide the logo, we want to make sure the top bar is not rendered.

There is a test below that explicitly makes sure nav bar is hidden via param.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for helping me understand. I've reverted that change

Copy link
Member

Choose a reason for hiding this comment

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

@nemanjaglumac got it exactly right. That test was added during the implementation of hiding Metabase logo.

For context if you're interested:

cy.button("Sign in").click();
cy.findByRole("alert")
.filter(':contains("did not match stored password")')
.should("be.visible");
Copy link
Contributor Author

@rafpaf rafpaf Jan 25, 2024

Choose a reason for hiding this comment

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

cy.findByRole("alert", {name: "did not match stored password"}) does not work; this longer formula is needed.

@rafpaf rafpaf added the no-backport Do not backport this PR to any branch label Jan 25, 2024
@rafpaf rafpaf requested a review from iethree January 25, 2024 12:42
@rafpaf rafpaf marked this pull request as ready for review January 25, 2024 12:43
Copy link

github-actions bot commented Jan 25, 2024

Codenotify: Notifying subscribers in CODENOTIFY files for diff 291ecc0...5d75fe7.

Notify File(s)
@ranquild frontend/src/metabase/auth/components/Login/Login.tsx
frontend/src/metabase/home/components/HomeGreeting/HomeGreeting.tsx

Copy link

replay-io bot commented Jan 25, 2024

StatusComplete ↗︎
Commit5d75fe7
Results
⚠️ 3 Flaky
2248 Passed

Copy link
Contributor

@iethree iethree left a comment

Choose a reason for hiding this comment

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

looks great, except we don't want to keep adding more chainers off of cy.

Comment on lines 49 to 65
Cypress.Commands.add(
"heading",
{
prevSubject: "optional",
},
(subject, headingName, timeout) => {
const config = {
name: headingName,
timeout,
};

return subject
? cy.wrap(subject).findByRole("heading", config)
: cy.findByRole("heading", config);
},
);

Copy link
Contributor

Choose a reason for hiding this comment

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

@nemanjaglumac might have better judgment here than I, but we're trying not to make new cy.something() functions in favor of simple helpers like getHeading(name)

Copy link
Member

Choose a reason for hiding this comment

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

Yup, what Ryan said.
If anything, we want to reduce the amount of custom commands.

findByRole is already a custom command - it comes from Cypress Testing Library.

Can we please use it directly as is?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks both. I've removed that extra helper function.

cy.findByText("Our analytics").should("not.exist");
cy.findByRole("heading", { name: /Our data/ }).should("be.visible");
cy.findByRole("treeitem", { name: /Our data/ }).should("not.exist");
cy.findByRole("treeitem", { name: "Our analytics" }).should("not.exist");
appBar().should("not.exist");
Copy link
Member

Choose a reason for hiding this comment

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

IIRC, @WiNloSt originally wrote these tests.
I think the test is doing what it says on the tin - if we hide the side navigation and hide the logo, we want to make sure the top bar is not rendered.

There is a test below that explicitly makes sure nav bar is hidden via param.

@rafpaf rafpaf force-pushed the models-in-browse-data--more-initial-cleanup branch from f1c9289 to d67e988 Compare January 25, 2024 18:27
Copy link
Contributor

@iethree iethree left a comment

Choose a reason for hiding this comment

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

🚀

Copy link
Member

@nemanjaglumac nemanjaglumac left a comment

Choose a reason for hiding this comment

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

Thanks for improving a11y and for addressing the reviews.

@rafpaf rafpaf merged commit 7de3ad2 into master Jan 26, 2024
106 checks passed
@rafpaf rafpaf deleted the models-in-browse-data--more-initial-cleanup branch January 26, 2024 16:25
Copy link

@rafpaf Did you forget to add a milestone to the issue for this PR? When and where should I add a milestone?

@rafpaf rafpaf added this to the 0.49 milestone Jan 26, 2024
npfitz pushed a commit that referenced this pull request Feb 5, 2024
* Make embedding-full-app.cy.spec.js and associated components more semantic

* Make signin.cy.spec.js and associated components more semantic

* Fix comment

* minor tweak

* Remove aria-label=breadcrumbs

* Fix variable name

* Fix e2e tests

* Remove cy.heading

* Restore test name
sloansparger pushed a commit that referenced this pull request Feb 5, 2024
* Make embedding-full-app.cy.spec.js and associated components more semantic

* Make signin.cy.spec.js and associated components more semantic

* Fix comment

* minor tweak

* Remove aria-label=breadcrumbs

* Fix variable name

* Fix e2e tests

* Remove cy.heading

* Restore test name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-backport Do not backport this PR to any branch .Team/AdminWebapp Admin and Webapp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants