From 258f4a1306aa645cebc4aa497acef18a600f8fc3 Mon Sep 17 00:00:00 2001 From: dzonidoo Date: Thu, 2 Nov 2023 16:57:32 +0100 Subject: [PATCH] changes after reivew --- e2e/cypress/e2e/wire/wire_action.cy.js | 16 ++++++++-------- e2e/cypress/support/pages/wire.js | 4 ++++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/e2e/cypress/e2e/wire/wire_action.cy.js b/e2e/cypress/e2e/wire/wire_action.cy.js index 9ed0210f9..88f6e0bbe 100644 --- a/e2e/cypress/e2e/wire/wire_action.cy.js +++ b/e2e/cypress/e2e/wire/wire_action.cy.js @@ -36,14 +36,14 @@ describe('wire - filters', () => { cy.url().should('include', 'Sydney'); - cy.get(`[data-test-id="wire-item"][data-test-value="${WireItems.item_1._id}"]`).should('exist'); - cy.get(`[data-test-id="wire-item"][data-test-value="${WireItems.item_2._id}"]`).should('not.exist'); + WirePage.item(WireItems.item_1._id).should('exist'); + WirePage.item(WireItems.item_2._id).should('not.exist'); cy.get('[data-test-id="top-search-bar"] form input').clear().type("{enter}"); cy.url().should('not.include', 'Sydney'); - cy.get(`[data-test-id="wire-item"][data-test-value="${WireItems.item_1._id}"]`).should('exist'); - cy.get(`[data-test-id="wire-item"][data-test-value="${WireItems.item_2._id}"]`).should('exist'); + WirePage.item(WireItems.item_1._id).should('exist'); + WirePage.item(WireItems.item_2._id).should('exist'); /** FILTERS @@ -59,8 +59,8 @@ describe('wire - filters', () => { cy.url().should('include', `${WireItems.item_1.service[0].name}`); - cy.get(`[data-test-id="wire-item"][data-test-value="${WireItems.item_1._id}"]`).should('exist'); - cy.get(`[data-test-id="wire-item"][data-test-value="${WireItems.item_2._id}"]`).should('not.exist'); + WirePage.item(WireItems.item_1._id).should('exist'); + WirePage.item(WireItems.item_2._id).should('not.exist'); FilterPanel.button('clear'); @@ -70,7 +70,7 @@ describe('wire - filters', () => { FilterPanel.selectNowDate(); FilterPanel.button('search'); - cy.get(`[data-test-id="wire-item"][data-test-value="${WireItems.item_1._id}"]`).should('exist'); - cy.get(`[data-test-id="wire-item"][data-test-value="${WireItems.item_2._id}"]`).should('not.exist'); + WirePage.item(WireItems.item_1._id).should('exist'); + WirePage.item(WireItems.item_2._id).should('not.exist'); }); }); diff --git a/e2e/cypress/support/pages/wire.js b/e2e/cypress/support/pages/wire.js index e8edbf6bb..8f34e22c0 100644 --- a/e2e/cypress/support/pages/wire.js +++ b/e2e/cypress/support/pages/wire.js @@ -7,6 +7,10 @@ class WirePageWrapper { this.filterPanel = new FilterPanelContainer(); } + item(value) { + return cy.get(`[data-test-id="wire-item"][data-test-value="${value}"]`); + } + showAdvancedSearchModal() { cy.get('[data-test-id="show-advanced-search-panel-btn"]').click(); }