From f6a8e2eeefef4975a715b0c030b66737327c45b8 Mon Sep 17 00:00:00 2001 From: Alan Cruikshanks Date: Mon, 29 Apr 2024 23:26:16 +0100 Subject: [PATCH] WIP --- .../billing/annual/cancel-existing.cy.js | 4 ++-- .../e2e/internal/billing/annual/journey.cy.js | 16 ++++++++-------- .../internal/billing/annual/remove-licence.cy.js | 4 ++-- .../billing/supplementary/cancel-existing.cy.js | 4 ++-- .../change-billing-account-current-year.cy.js | 8 ++++---- .../change-billing-account-previous-year.cy.js | 8 ++++---- .../internal/billing/supplementary/journey.cy.js | 6 +++--- .../no-annual-in-current-year.cy.js | 2 +- .../non-charge-licence-credit.cy.js | 6 +++--- .../replace-cv-2023-fin-year-no-changes.cy.js | 6 +++--- .../replace-cv-current-year-with-changes.cy.js | 6 +++--- .../two-part-tariff/cancel-existing.cy.js | 4 ++-- .../billing/two-part-tariff/journey.cy.js | 6 +++--- 13 files changed, 40 insertions(+), 40 deletions(-) diff --git a/cypress/e2e/internal/billing/annual/cancel-existing.cy.js b/cypress/e2e/internal/billing/annual/cancel-existing.cy.js index d319565f..6bc4eec0 100644 --- a/cypress/e2e/internal/billing/annual/cancel-existing.cy.js +++ b/cypress/e2e/internal/billing/annual/cancel-existing.cy.js @@ -35,7 +35,7 @@ describe('Cancel an existing annual bill run (internal)', () => { // Bill runs // click the Create a bill run button - cy.get('#main-content > a.govuk-button').contains('Create a bill run').click() + cy.get('.govuk-button').contains('Create a bill run').click() // Which kind of bill run do you want to create? // choose Annual and continue @@ -52,7 +52,7 @@ describe('Cancel an existing annual bill run (internal)', () => { // The bill run we created will be the top result. We expect it's status to be BUILDING. Building might take a few // seconds though so to avoid the test failing we use our custom Cypress command to look for the status EMPTY, and // if not found reload the page and try again. We then select it using the link on the date created - cy.reloadUntilTextFound('tr:nth-child(1) > td:nth-child(6) > .govuk-tag', 'Empty') + cy.reloadUntilTextFound('[data-test="bill-run-status-0"] > .govuk-tag', 'Empty') cy.get('@formattedCurrentDate').then((formattedCurrentDate) => { cy.get('tr:nth-child(1)') .should('contain.text', formattedCurrentDate) diff --git a/cypress/e2e/internal/billing/annual/journey.cy.js b/cypress/e2e/internal/billing/annual/journey.cy.js index 96542e58..933e2b6a 100644 --- a/cypress/e2e/internal/billing/annual/journey.cy.js +++ b/cypress/e2e/internal/billing/annual/journey.cy.js @@ -32,7 +32,7 @@ describe('Create and send annual bill run (internal)', () => { // Bill runs // click the Create a bill run button - cy.get('#main-content > a.govuk-button').contains('Create a bill run').click() + cy.get('.govuk-button').contains('Create a bill run').click() // Which kind of bill run do you want to create? // choose Annual and continue @@ -49,7 +49,7 @@ describe('Create and send annual bill run (internal)', () => { // The bill run we created will be the top result. We expect it's status to be BUILDING. Building might take a few // seconds though so to avoid the test failing we use our custom Cypress command to look for the status READY, and // if not found reload the page and try again. We then select it using the link on the date created - cy.reloadUntilTextFound('tr:nth-child(1) > td:nth-child(6) > .govuk-tag', 'Ready') + cy.reloadUntilTextFound('[data-test="bill-run-status-0"] > .govuk-tag', 'ready') cy.get('@formattedCurrentDate').then((formattedCurrentDate) => { cy.get('tr:nth-child(1)') .should('contain.text', formattedCurrentDate) @@ -96,12 +96,12 @@ describe('Create and send annual bill run (internal)', () => { // Bill runs // back on the bill runs page confirm our bill run is present and listed as SENT cy.get('@formattedCurrentDate').then((formattedCurrentDate) => { - cy.get('#main-content > div:nth-child(5) > div > table > tbody > tr:nth-child(1)') - .should('contain.text', formattedCurrentDate) - .and('contain.text', 'Test Region') - .and('contain.text', 'Annual') - .and('contain.text', '2,171.00') - .and('contain.text', 'Sent') + cy.get('[data-test="date-created-0"] > .govuk-link').should('contain.text', formattedCurrentDate) + cy.get('[data-test="region-0"]').should('contain.text', 'Test Region') + cy.get('[data-test="bill-run-type-0"]').should('contain.text', 'Annual') + cy.get('[data-test="number-of-bills-0"]').should('contain.text', '4') + cy.get('[data-test="bill-run-total-0"]').should('contain.text', '2,171.00') + cy.get('[data-test="bill-run-status-0"] > .govuk-tag').should('contain.text', 'sent') }) }) }) diff --git a/cypress/e2e/internal/billing/annual/remove-licence.cy.js b/cypress/e2e/internal/billing/annual/remove-licence.cy.js index a6d138b6..ca1ae9c8 100644 --- a/cypress/e2e/internal/billing/annual/remove-licence.cy.js +++ b/cypress/e2e/internal/billing/annual/remove-licence.cy.js @@ -32,7 +32,7 @@ describe('Remove bill from annual bill run (internal)', () => { // Bill runs // click the Create a bill run button - cy.get('#main-content > a.govuk-button').contains('Create a bill run').click() + cy.get('.govuk-button').contains('Create a bill run').click() // Which kind of bill run do you want to create? // choose Annual and continue @@ -49,7 +49,7 @@ describe('Remove bill from annual bill run (internal)', () => { // The bill run we created will be the top result. We expect it's status to be BUILDING. Building might take a few // seconds though so to avoid the test failing we use our custom Cypress command to look for the status READY, and // if not found reload the page and try again. We then select it using the link on the date created - cy.reloadUntilTextFound('tr:nth-child(1) > td:nth-child(6) > .govuk-tag', 'Ready') + cy.reloadUntilTextFound('[data-test="bill-run-status-0"] > .govuk-tag', 'ready') cy.get('@formattedCurrentDate').then((formattedCurrentDate) => { cy.get('tr:nth-child(1)') .should('contain.text', formattedCurrentDate) diff --git a/cypress/e2e/internal/billing/supplementary/cancel-existing.cy.js b/cypress/e2e/internal/billing/supplementary/cancel-existing.cy.js index 5df38a47..9d227b6b 100644 --- a/cypress/e2e/internal/billing/supplementary/cancel-existing.cy.js +++ b/cypress/e2e/internal/billing/supplementary/cancel-existing.cy.js @@ -35,7 +35,7 @@ describe('Cancel existing supplementary bill runs (internal)', () => { // Bill runs // click the Create a bill run button - cy.get('#main-content > a.govuk-button').contains('Create a bill run').click() + cy.get('.govuk-button').contains('Create a bill run').click() // Which kind of bill run do you want to create? // choose Supplementary and continue @@ -55,7 +55,7 @@ describe('Cancel existing supplementary bill runs (internal)', () => { // The bill run we created will be the top result. We expect it's status to be BUILDING. Building might take a few // seconds though so to avoid the test failing we use our custom Cypress command to look for the status READY, and // if not found reload the page and try again. We then select it using the link on the date created - cy.reloadUntilTextFound('tr:nth-child(1) > td:nth-child(6) > .govuk-tag', 'Ready') + cy.reloadUntilTextFound('[data-test="bill-run-status-0"] > .govuk-tag', 'ready') cy.get('@formattedCurrentDate').then((formattedCurrentDate) => { cy.get('tr:nth-child(1)') .should('contain.text', formattedCurrentDate) diff --git a/cypress/e2e/internal/billing/supplementary/change-billing-account-current-year.cy.js b/cypress/e2e/internal/billing/supplementary/change-billing-account-current-year.cy.js index b9fe8460..8f3797b2 100644 --- a/cypress/e2e/internal/billing/supplementary/change-billing-account-current-year.cy.js +++ b/cypress/e2e/internal/billing/supplementary/change-billing-account-current-year.cy.js @@ -42,7 +42,7 @@ describe('Change billing account in current financial year (internal)', () => { // Bill runs // click the Create a bill run button - cy.get('#main-content > a.govuk-button').contains('Create a bill run').click() + cy.get('.govuk-button').contains('Create a bill run').click() // Which kind of bill run do you want to create? // choose Supplementary and continue @@ -208,7 +208,7 @@ describe('Change billing account in current financial year (internal)', () => { // Bill runs // click the Create a bill run button - cy.get('#main-content > a.govuk-button').contains('Create a bill run').click() + cy.get('.govuk-button').contains('Create a bill run').click() // Which kind of bill run do you want to create? // choose Supplementary and continue @@ -231,7 +231,7 @@ describe('Change billing account in current financial year (internal)', () => { // The bill run we created will be the top result. We expect it's status to be BUILDING. Building might take a few // seconds though so to avoid the test failing we use our custom Cypress command to look for the status READY, and // if not found reload the page and try again. We then select it using the link on the date created - cy.reloadUntilTextFound('tr:nth-child(1) > td:nth-child(6) > .govuk-tag', 'Ready') + cy.reloadUntilTextFound('[data-test="bill-run-status-0"] > .govuk-tag', 'ready') cy.get('@formattedCurrentDate').then((formattedCurrentDate) => { cy.get('tr:nth-child(1)') .should('contain.text', formattedCurrentDate) @@ -293,7 +293,7 @@ describe('Change billing account in current financial year (internal)', () => { // Bill runs // back on the bill runs page confirm our SROC bill run is present and listed as SENT cy.get('@formattedCurrentDate').then((formattedCurrentDate) => { - cy.get('#main-content > div:nth-child(5) > div > table > tbody > tr:nth-child(1)') + cy.get('table > tbody > tr:nth-child(1)') .should('contain.text', formattedCurrentDate) .and('contain.text', 'Test Region') .and('contain.text', 'Supplementary') diff --git a/cypress/e2e/internal/billing/supplementary/change-billing-account-previous-year.cy.js b/cypress/e2e/internal/billing/supplementary/change-billing-account-previous-year.cy.js index e71e2a06..1f3ade0c 100644 --- a/cypress/e2e/internal/billing/supplementary/change-billing-account-previous-year.cy.js +++ b/cypress/e2e/internal/billing/supplementary/change-billing-account-previous-year.cy.js @@ -42,7 +42,7 @@ describe('Change billing account in previous financial year (internal)', () => { // Bill runs // click the Create a bill run button - cy.get('#main-content > a.govuk-button').contains('Create a bill run').click() + cy.get('.govuk-button').contains('Create a bill run').click() // Which kind of bill run do you want to create? // choose Supplementary and continue @@ -208,7 +208,7 @@ describe('Change billing account in previous financial year (internal)', () => { // Bill runs // click the Create a bill run button - cy.get('#main-content > a.govuk-button').contains('Create a bill run').click() + cy.get('.govuk-button').contains('Create a bill run').click() // Which kind of bill run do you want to create? // choose Supplementary and continue @@ -231,7 +231,7 @@ describe('Change billing account in previous financial year (internal)', () => { // The bill run we created will be the top result. We expect it's status to be BUILDING. Building might take a few // seconds though so to avoid the test failing we use our custom Cypress command to look for the status READY, and // if not found reload the page and try again. We then select it using the link on the date created - cy.reloadUntilTextFound('tr:nth-child(1) > td:nth-child(6) > .govuk-tag', 'Ready') + cy.reloadUntilTextFound('[data-test="bill-run-status-0"] > .govuk-tag', 'ready') cy.get('@formattedCurrentDate').then((formattedCurrentDate) => { cy.get('tr:nth-child(1)') .should('contain.text', formattedCurrentDate) @@ -302,7 +302,7 @@ describe('Change billing account in previous financial year (internal)', () => { // Bill runs // back on the bill runs page confirm our SROC bill run is present and listed as SENT cy.get('@formattedCurrentDate').then((formattedCurrentDate) => { - cy.get('#main-content > div:nth-child(5) > div > table > tbody > tr:nth-child(1)') + cy.get('table > tbody > tr:nth-child(1)') .should('contain.text', formattedCurrentDate) .and('contain.text', 'Test Region') .and('contain.text', 'Supplementary') diff --git a/cypress/e2e/internal/billing/supplementary/journey.cy.js b/cypress/e2e/internal/billing/supplementary/journey.cy.js index ab3cd432..bc8e88d3 100644 --- a/cypress/e2e/internal/billing/supplementary/journey.cy.js +++ b/cypress/e2e/internal/billing/supplementary/journey.cy.js @@ -42,7 +42,7 @@ describe('Create and send supplementary bill runs (internal)', () => { // Bill runs // click the Create a bill run button - cy.get('#main-content > a.govuk-button').contains('Create a bill run').click() + cy.get('.govuk-button').contains('Create a bill run').click() // Which kind of bill run do you want to create? // choose Supplementary and continue @@ -59,7 +59,7 @@ describe('Create and send supplementary bill runs (internal)', () => { // The bill run we created will be the top result. We expect it's status to be BUILDING. Building might take a few // seconds though so to avoid the test failing we use our custom Cypress command to look for the status READY, and // if not found reload the page and try again. We then select it using the link on the date created - cy.reloadUntilTextFound('tr:nth-child(1) > td:nth-child(6) > .govuk-tag', 'Ready') + cy.reloadUntilTextFound('[data-test="bill-run-status-0"] > .govuk-tag', 'ready') cy.get('@formattedCurrentDate').then((formattedCurrentDate) => { cy.get('tr:nth-child(1)') .should('contain.text', formattedCurrentDate) @@ -108,7 +108,7 @@ describe('Create and send supplementary bill runs (internal)', () => { // Bill runs // back on the bill runs page confirm our PRESROC bill run is present and listed as SENT cy.get('@formattedCurrentDate').then((formattedCurrentDate) => { - cy.get('#main-content > div:nth-child(5) > div > table > tbody > tr:nth-child(1)') + cy.get('table > tbody > tr:nth-child(1)') .should('contain.text', formattedCurrentDate) .and('contain.text', 'Old charge scheme') .and('contain.text', 'Test Region') diff --git a/cypress/e2e/internal/billing/supplementary/no-annual-in-current-year.cy.js b/cypress/e2e/internal/billing/supplementary/no-annual-in-current-year.cy.js index 31d5b288..6c183c28 100644 --- a/cypress/e2e/internal/billing/supplementary/no-annual-in-current-year.cy.js +++ b/cypress/e2e/internal/billing/supplementary/no-annual-in-current-year.cy.js @@ -45,7 +45,7 @@ describe('Create and send supplementary bill runs (internal)', () => { // Bill runs // click the Create a bill run button - cy.get('#main-content > a.govuk-button').contains('Create a bill run').click() + cy.get('.govuk-button').contains('Create a bill run').click() // Which kind of bill run do you want to create? // choose Supplementary and continue diff --git a/cypress/e2e/internal/billing/supplementary/non-charge-licence-credit.cy.js b/cypress/e2e/internal/billing/supplementary/non-charge-licence-credit.cy.js index a3401939..b65da223 100644 --- a/cypress/e2e/internal/billing/supplementary/non-charge-licence-credit.cy.js +++ b/cypress/e2e/internal/billing/supplementary/non-charge-licence-credit.cy.js @@ -35,7 +35,7 @@ describe('Make licence non-chargeable then see credit in next bill run (internal // Bill runs // click the Create a bill run button - cy.get('#main-content > a.govuk-button').contains('Create a bill run').click() + cy.get('.govuk-button').contains('Create a bill run').click() // Which kind of bill run do you want to create? // choose Supplementary and continue @@ -161,7 +161,7 @@ describe('Make licence non-chargeable then see credit in next bill run (internal // Bill runs // click the Create a bill run button - cy.get('#main-content > a.govuk-button').contains('Create a bill run').click() + cy.get('.govuk-button').contains('Create a bill run').click() // Which kind of bill run do you want to create? // choose Supplementary and continue @@ -178,7 +178,7 @@ describe('Make licence non-chargeable then see credit in next bill run (internal // The bill run we created will be the top result. We expect it's status to be BUILDING. Building might take a few // seconds though so to avoid the test failing we use our custom Cypress command to look for the status READY, and // if not found reload the page and try again. We then select it using the link on the date created - cy.reloadUntilTextFound('tr:nth-child(1) > td:nth-child(6) > .govuk-tag', 'Ready') + cy.reloadUntilTextFound('[data-test="bill-run-status-0"] > .govuk-tag', 'ready') cy.get('@formattedCurrentDate').then((formattedCurrentDate) => { cy.get('tr:nth-child(1)') .should('contain.text', formattedCurrentDate) diff --git a/cypress/e2e/internal/billing/supplementary/replace-cv-2023-fin-year-no-changes.cy.js b/cypress/e2e/internal/billing/supplementary/replace-cv-2023-fin-year-no-changes.cy.js index 655fe3a8..9745204b 100644 --- a/cypress/e2e/internal/billing/supplementary/replace-cv-2023-fin-year-no-changes.cy.js +++ b/cypress/e2e/internal/billing/supplementary/replace-cv-2023-fin-year-no-changes.cy.js @@ -118,7 +118,7 @@ describe('Replace charge version in the 2023 financial year with no changes (int // Bill runs // click the Create a bill run button - cy.get('#main-content > a.govuk-button').contains('Create a bill run').click() + cy.get('.govuk-button').contains('Create a bill run').click() // Which kind of bill run do you want to create? // choose Supplementary and continue @@ -263,7 +263,7 @@ describe('Replace charge version in the 2023 financial year with no changes (int // Bill runs // click the Create a bill run button - cy.get('#main-content > a.govuk-button').contains('Create a bill run').click() + cy.get('.govuk-button').contains('Create a bill run').click() // Which kind of bill run do you want to create? // choose Supplementary and continue @@ -283,7 +283,7 @@ describe('Replace charge version in the 2023 financial year with no changes (int // The bill run we created will be the top result. We expect it's status to be BUILDING. Building might take a few // seconds though so to avoid the test failing we use our custom Cypress command to look for the status READY, and // if not found reload the page and try again. We then select it using the link on the date created - cy.reloadUntilTextFound('tr:nth-child(1) > td:nth-child(6) > .govuk-tag', 'Ready') + cy.reloadUntilTextFound('[data-test="bill-run-status-0"] > .govuk-tag', 'ready') cy.get('@formattedCurrentDate').then((formattedCurrentDate) => { cy.get('tr:nth-child(1)') .should('contain.text', formattedCurrentDate) diff --git a/cypress/e2e/internal/billing/supplementary/replace-cv-current-year-with-changes.cy.js b/cypress/e2e/internal/billing/supplementary/replace-cv-current-year-with-changes.cy.js index af3e313a..a4e94f1d 100644 --- a/cypress/e2e/internal/billing/supplementary/replace-cv-current-year-with-changes.cy.js +++ b/cypress/e2e/internal/billing/supplementary/replace-cv-current-year-with-changes.cy.js @@ -118,7 +118,7 @@ describe('Replace charge version in current financial year change the charge ref // Bill runs // click the Create a bill run button - cy.get('#main-content > a.govuk-button').contains('Create a bill run').click() + cy.get('.govuk-button').contains('Create a bill run').click() // Which kind of bill run do you want to create? // choose Supplementary and continue @@ -312,7 +312,7 @@ describe('Replace charge version in current financial year change the charge ref // Bill runs // click the Create a bill run button - cy.get('#main-content > a.govuk-button').contains('Create a bill run').click() + cy.get('.govuk-button').contains('Create a bill run').click() // Which kind of bill run do you want to create? // choose Supplementary and continue @@ -332,7 +332,7 @@ describe('Replace charge version in current financial year change the charge ref // The bill run we created will be the top result. We expect it's status to be BUILDING. Building might take a few // seconds though so to avoid the test failing we use our custom Cypress command to look for the status READY, and // if not found reload the page and try again. We then select it using the link on the date created - cy.reloadUntilTextFound('tr:nth-child(1) > td:nth-child(6) > .govuk-tag', 'Ready') + cy.reloadUntilTextFound('[data-test="bill-run-status-0"] > .govuk-tag', 'ready') cy.get('@formattedCurrentDate').then((formattedCurrentDate) => { cy.get('tr:nth-child(1)') .should('contain.text', formattedCurrentDate) diff --git a/cypress/e2e/internal/billing/two-part-tariff/cancel-existing.cy.js b/cypress/e2e/internal/billing/two-part-tariff/cancel-existing.cy.js index 32b458e8..7724630f 100644 --- a/cypress/e2e/internal/billing/two-part-tariff/cancel-existing.cy.js +++ b/cypress/e2e/internal/billing/two-part-tariff/cancel-existing.cy.js @@ -32,7 +32,7 @@ describe('Cancel an existing two-part tariff bill run (internal)', () => { // Bill runs // click the Create a bill run button - cy.get('#main-content > a.govuk-button').contains('Create a bill run').click() + cy.get('.govuk-button').contains('Create a bill run').click() // Which kind of bill run do you want to create? // choose Two-part tariff then continue @@ -59,7 +59,7 @@ describe('Cancel an existing two-part tariff bill run (internal)', () => { // The bill run we created will be the top result. We expect it's status to be BUILDING. Building might take a few // seconds though so to avoid the test failing we use our custom Cypress command to look for the status EMPTY, and // if not found reload the page and try again. We then select it using the link on the date created - cy.reloadUntilTextFound('tr:nth-child(1) > td:nth-child(6) > .govuk-tag', 'Empty') + cy.reloadUntilTextFound('[data-test="bill-run-status-0"] > .govuk-tag', 'Empty') cy.get('@formattedCurrentDate').then((formattedCurrentDate) => { cy.get('tr:nth-child(1)') .should('contain.text', formattedCurrentDate) diff --git a/cypress/e2e/internal/billing/two-part-tariff/journey.cy.js b/cypress/e2e/internal/billing/two-part-tariff/journey.cy.js index 3ea7c898..9b318df0 100644 --- a/cypress/e2e/internal/billing/two-part-tariff/journey.cy.js +++ b/cypress/e2e/internal/billing/two-part-tariff/journey.cy.js @@ -32,7 +32,7 @@ describe('Create and send PRESROC two-part tariff bill run (internal)', () => { // Bill runs // click the Create a bill run button - cy.get('#main-content > a.govuk-button').contains('Create a bill run').click() + cy.get('.govuk-button').contains('Create a bill run').click() // Which kind of bill run do you want to create? // choose Two-part tariff then continue @@ -59,7 +59,7 @@ describe('Create and send PRESROC two-part tariff bill run (internal)', () => { // The bill run we created will be the top result. We expect it's status to be BUILDING. Building might take a few // seconds though so to avoid the test failing we use our custom Cypress command to look for the status REVIEW, and // if not found reload the page and try again. We then select it using the link on the date created - cy.reloadUntilTextFound('tr:nth-child(1) > td:nth-child(6) > .govuk-tag', 'Review') + cy.reloadUntilTextFound('[data-test="bill-run-status-0"] > .govuk-tag', 'Review') cy.get('@formattedCurrentDate').then((formattedCurrentDate) => { cy.get('tr:nth-child(1)') .should('contain.text', formattedCurrentDate) @@ -158,7 +158,7 @@ describe('Create and send PRESROC two-part tariff bill run (internal)', () => { // Bill runs // back on the bill runs page confirm our PRESROC bill run is present and listed as SENT cy.get('@formattedCurrentDate').then((formattedCurrentDate) => { - cy.get('#main-content > div:nth-child(5) > div > table > tbody > tr:nth-child(1)') + cy.get('table > tbody > tr:nth-child(1)') .should('contain.text', formattedCurrentDate) .and('contain.text', 'Old charge scheme') .and('contain.text', 'Test Region')