From bb76fdedd48be1696f4cb662f064b9ab1c27f5bc Mon Sep 17 00:00:00 2001 From: FahadDarw Date: Wed, 10 Jan 2024 16:07:53 +0000 Subject: [PATCH] added-more-cypress-refactors-&-fixed-previous-tests --- .../cypress/pages/projectList.js | 2 +- .../cypress/support/commands.js | 29 ++++++------------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/projectList.js b/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/projectList.js index 668db1aa2..216649502 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/projectList.js +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/projectList.js @@ -16,7 +16,7 @@ export default class projectList extends BasePage { static getNthProjectDeliveryOfficer(n = 0) { this.checkProjectListPage() - return cy.get(`[id="delivery-officer-${n}"]`) + return cy.get(`[id="assigned-to-${n}"]`) } static filterProjectList(titleFilter) { diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/support/commands.js b/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/support/commands.js index 0ccecd765..53e2a1537 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/support/commands.js +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/support/commands.js @@ -78,26 +78,15 @@ Cypress.Commands.add('generateProjectTempBtn', () => { }) Cypress.Commands.add('enterDate', (idSelector, day, month, year) => { - cy.get(`[id*="${idSelector}-day"]`).as('day') - cy.get(`[id*="${idSelector}-month"]`).as('month') - cy.get(`[id*="${idSelector}-year"]`).as('year') - - cy.get(`@day`).then((dayLoc) => { - dayLoc.should('be.visible') - dayLoc.clear() - dayLoc.type(day) - }) - cy.get(`@month`).then((monthLoc) => { - monthLoc.should('be.visible') - monthLoc.clear() - monthLoc.type(month) - }) - cy.get(`@year`).then((yearLoc) => { - yearLoc.should('be.visible') - yearLoc.clear() - yearLoc.type(year) - }) -}) + cy.get(`[id*="${idSelector}-day"]`).as('day'); + cy.get(`[id*="${idSelector}-month"]`).as('month'); + cy.get(`[id*="${idSelector}-year"]`).as('year'); + + cy.get('@day').should('be.visible').invoke('val', '').type(day); + cy.get('@month').should('be.visible').invoke('val', '').type(month); + cy.get('@year').should('be.visible').invoke('val', '').type(year); +}); + // No Radio Btn Cypress.Commands.add('NoRadioBtn', () => {