From c4a8fce4d41a18d335e8c1fe4e4ae15eea7aedc4 Mon Sep 17 00:00:00 2001 From: Vinai Kopp Date: Sun, 25 Sep 2022 18:32:13 +0200 Subject: [PATCH] Revert "Fix broken tests (#85)" This reverts commit dde4eb0097974e15a82f680260e42a57034701a6. --- cypress/fixtures/globalSelectors.json | 2 +- cypress/fixtures/hyva/selectors/search.json | 2 +- cypress/integration/hyva/catalog/category.spec.js | 3 +++ cypress/integration/hyva/search/product-searches.spec.js | 6 +++--- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/cypress/fixtures/globalSelectors.json b/cypress/fixtures/globalSelectors.json index 6f36bc6..c48b179 100644 --- a/cypress/fixtures/globalSelectors.json +++ b/cypress/fixtures/globalSelectors.json @@ -1,5 +1,5 @@ { - "successMessage": ".message.success", + "successMessage": ".message-success.success", "errorMessage": ".message-error", "pageTitle": "h1.page-title .base" } diff --git a/cypress/fixtures/hyva/selectors/search.json b/cypress/fixtures/hyva/selectors/search.json index b7cf3d7..74a80e4 100644 --- a/cypress/fixtures/hyva/selectors/search.json +++ b/cypress/fixtures/hyva/selectors/search.json @@ -3,5 +3,5 @@ "headerSearchIcon": "#menu-search-icon", "searchResults": ".search.results .products .card.card-interactive", "noResultsMessage": ".message.notice", - "searchSuggestions": "[x-text=\"searchResult.title\"]" + "searchSuggestions": "[x-text=\"suggestion.title\"]" } diff --git a/cypress/integration/hyva/catalog/category.spec.js b/cypress/integration/hyva/catalog/category.spec.js index cc9add4..2567bff 100644 --- a/cypress/integration/hyva/catalog/category.spec.js +++ b/cypress/integration/hyva/catalog/category.spec.js @@ -7,7 +7,10 @@ describe("Category page tests", () => { }); it("Can visit the category page and filters on color red", () => { + cy.get(selectors.shopByColorFilter).contains('Color').click(); cy.get(selectors.selectColorRed).click(); + + cy.get(selectors.shopByColorFilter).contains('Color').should("not.exist") cy.get(selectors.activeFilterLabel).should("contain.text", "Color") cy.get(selectors.activeFilterValue).should("contain.text", "Red") }); diff --git a/cypress/integration/hyva/search/product-searches.spec.js b/cypress/integration/hyva/search/product-searches.spec.js index 6905705..b84b061 100644 --- a/cypress/integration/hyva/search/product-searches.spec.js +++ b/cypress/integration/hyva/search/product-searches.spec.js @@ -1,6 +1,5 @@ import { Search } from '../../../page-objects/hyva/search'; import search from '../../../fixtures/hyva/search.json'; -import globalSelectors from '../../../fixtures/globalSelectors.json' import selectors from '../../../fixtures/hyva/selectors/search.json'; import homepageSelectors from '../../../fixtures/hyva/selectors/homepage.json'; @@ -20,10 +19,11 @@ describe('Perform searches', () => { it('Can find a single product', () => { Search.search(search.singleProduct); - cy.get(globalSelectors.successMessage).should( + cy.get(homepageSelectors.mainHeading).should( 'contain.text', - `is the only product matching your '${search.singleProduct}' search.` + `Search results for: '${search.singleProduct}'` ); + cy.get(selectors.searchResults).should('have.lengthOf', 1) }); it('Can perform search with no search results', () => {