Skip to content

Commit 398450c

Browse files
committed
fix searchfilters cypress test
1 parent 0501a2b commit 398450c

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

smoke-test/tests/cypress/cypress/e2e/search/searchFilters.js

+16-9
Original file line numberDiff line numberDiff line change
@@ -41,31 +41,38 @@ describe("search", () => {
4141
it("should add and remove multiple filters with no issues", () => {
4242
setSearchFiltersFeatureFlag(true);
4343
cy.login();
44+
cy.hideOnboardingTour();
4445
cy.visit("/");
4546
cy.get("input[data-testid=search-input]").type("*{enter}");
47+
cy.hideOnboardingTour();
4648

47-
// click tag filter dropdown inside of "More Filters"
48-
//cy.get("[data-testid=more-filters-dropdown").click({ force: true });
49-
cy.get("[data-testid=filter-dropdown-Tag").click({ force: true });
49+
// Sometimes the tag filter is in the more section and sometimes it is at the top level - this checks for both
50+
cy.get("body").then(($body) => {
51+
if ($body.find("[data-testid=filter-dropdown-Tag]").length > 0) {
52+
// Tag filter is visible at top level
53+
cy.get("[data-testid=filter-dropdown-Tag]").click({ force: true });
54+
} else {
55+
// Tag filter is inside More Filters
56+
cy.get("[data-testid=more-filters-dropdown]").click({ force: true });
57+
cy.get("[data-testid=more-filter-Tag]").click({ force: true });
58+
}
59+
});
5060

5161
// click and search for tag, save that tag
52-
//
5362
cy.get("[data-testid=search-bar").eq(1).type("cypress");
5463
cy.get("[data-testid=filter-option-Cypress").click({ force: true });
5564
cy.get("[data-testid=update-filters").click({ force: true });
5665
cy.url().should(
5766
"include",
5867
"filter_tags___false___EQUAL___0=urn%3Ali%3Atag%3ACypress",
5968
);
60-
// cy.get("[data-testid=update-filters").should("not.exist");
69+
// Assert that the button is not visible
70+
cy.get("[data-testid=update-filters").should("not.be.visible");
6171

6272
// select datasets filter
6373
cy.get("[data-testid=filter-dropdown-Type").click({ force: true });
6474
cy.get("[data-testid=filter-option-Datasets").click({ force: true });
65-
cy.get(
66-
':nth-child(4) > :nth-child(1) > .ant-dropdown > [data-testid="filter-dropdown"] > [data-testid="update-filters"] > span',
67-
).click({ force: true });
68-
// cy.get("[data-testid=update-filters").click({ force: true });
75+
cy.get("[data-testid=update-filters").eq(1).click({ force: true });
6976
cy.url().should(
7077
"include",
7178
"filter__entityType%E2%90%9EtypeNames___false___EQUAL___1=DATASET",

0 commit comments

Comments
 (0)