From b67ea906338605fd8f64ec35bb2be4eb5d1e7bf1 Mon Sep 17 00:00:00 2001 From: Rhys Berrow <47635349+berroar@users.noreply.github.com> Date: Tue, 7 Nov 2023 09:45:34 +0000 Subject: [PATCH] Refactor the list collector repeating blocks functional test spec (#1240) --- .../list_collector_repeating_blocks.spec.js | 273 ++++++++---------- 1 file changed, 127 insertions(+), 146 deletions(-) diff --git a/tests/functional/spec/features/repeating_blocks/list_collector_repeating_blocks.spec.js b/tests/functional/spec/features/repeating_blocks/list_collector_repeating_blocks.spec.js index c7c829cedd..2a31cd218a 100644 --- a/tests/functional/spec/features/repeating_blocks/list_collector_repeating_blocks.spec.js +++ b/tests/functional/spec/features/repeating_blocks/list_collector_repeating_blocks.spec.js @@ -13,6 +13,7 @@ import { repeatingAnswerChangeLink, checkItemsInList, checkListItemComplete, che import HubPage from "../../../base_pages/hub.page"; import ResponsiblePartyHubPage from "../../../generated_pages/list_collector_repeating_blocks_with_hub/responsible-party-business.page"; import { expect } from "@wdio/globals"; +import ThankYouPage from "../../../base_pages/thank-you.page"; const summaryValues = 'dd[class="ons-summary__values"]'; async function proceedToListCollector() { @@ -52,13 +53,13 @@ async function addCompany( } describe("List Collector Repeating Blocks", () => { - describe("Given a normal journey through the list collector with repeating blocks, the answers can be submitted.", () => { + describe("Given a normal journey through the list collector with repeating blocks", () => { before("Load the survey", async () => { await browser.openQuestionnaire("test_list_collector_repeating_blocks_section_summary.json"); // These tests sometimes fail when a button is on the screen, but right on the very edge, accept cookies to increase screen space await $(ResponsiblePartyPage.acceptCookies()).click(); }); - it("The user is able to add companies, complete repeating blocks, and submit.", async () => { + it("When the user adds items and completes all of the repeating blocks, Then they are able to successfully submit the questionnaire.", async () => { await proceedToListCollector(); await addCompany("ONS", "123", "1", "1", "2023", true, true); await $(AnyOtherCompaniesOrBranchesPage.yes()).click(); @@ -71,14 +72,15 @@ describe("List Collector Repeating Blocks", () => { await click(AnyOtherTradingDetailsPage.submit()); await click(SectionCompaniesPage.submit()); await click(SubmitPage.submit()); + await expect(browser).toHaveUrlContaining(ThankYouPage.pageName); }); }); - describe("Given a journey through the list collector with repeating blocks, the companies can be added, removed and edited.", () => { + describe("Given a journey through the list collector with repeating blocks where items need to be updated", () => { before("Load the survey", async () => { await browser.openQuestionnaire("test_list_collector_repeating_blocks_section_summary.json"); }); - it("The user is able to add companies and complete repeating blocks.", async () => { + it("When the user adds items to the list and completes the repeating blocks, Then the completed items are displayed on the list collector page.", async () => { await proceedToListCollector(); await addCompany("ONS", "123", "1", "1", "2023", true, true); await $(AnyOtherCompaniesOrBranchesPage.yes()).click(); @@ -87,57 +89,48 @@ describe("List Collector Repeating Blocks", () => { await $(AnyOtherCompaniesOrBranchesPage.yes()).click(); await click(AnyOtherCompaniesOrBranchesPage.submit()); await addCompany("MOD", "789", "3", "3", "2023", true); + checkItemsInList(["ONS", "GOV", "MOD"], AnyOtherCompaniesOrBranchesPage.listLabel); }); - it("The list collector shows all of the companies.", async () => { - const companiesExpected = ["ONS", "GOV", "MOD"]; - checkItemsInList(companiesExpected, AnyOtherCompaniesOrBranchesPage.listLabel); - }); - - it("The list collector allows the name of 'GOV' to be changed", async () => { + it("When the user edits an item, Then the name of the item is able to be changed", async () => { await $(AnyOtherCompaniesOrBranchesPage.listEditLink(2)).click(); await $(EditCompanyPage.companyOrBranchName()).setValue("Government"); await click(EditCompanyPage.submit()); await expect(await $(AnyOtherCompaniesOrBranchesPage.listLabel(2)).getText()).toBe("Government"); }); - it("The list collector allows removal of 'Government'", async () => { + it("When the user clicks the remove link, Then the item selected is removed", async () => { await $(AnyOtherCompaniesOrBranchesPage.listRemoveLink(2)).click(); await $(RemoveCompanyPage.yes()).click(); await click(RemoveCompanyPage.submit()); - }); - - it("The list collector does not show 'GOV' anymore.", async () => { - await expect(await $(AnyOtherCompaniesOrBranchesPage.listLabel(2)).getText()).not.toBe("Government"); + checkItemsInList(["ONS", "MOD"], AnyOtherCompaniesOrBranchesPage.listLabel); + await expect(await $(AnyOtherCompaniesOrBranchesPage.listLabel(2)).getText()).not.toContain("Government"); await expect(await $(AnyOtherCompaniesOrBranchesPage.listLabel(2)).getText()).toBe("MOD"); }); - it("The list collector can add more companies.", async () => { + it("When a user has finished editing or removing from the list, Then they are still able to add additional companies", async () => { await $(AnyOtherCompaniesOrBranchesPage.yes()).click(); await click(AnyOtherCompaniesOrBranchesPage.submit()); await addCompany("Council", "101", "4", "4", "2023", false, true); + checkItemsInList(["ONS", "MOD", "Council"], AnyOtherCompaniesOrBranchesPage.listLabel); }); - it("The list collector shows all of the companies.", async () => { - const companiesExpected = ["ONS", "MOD", "Council", "another one"]; - checkItemsInList(companiesExpected, AnyOtherCompaniesOrBranchesPage.listLabel); - }); - - it("The list collector can then be submitted", async () => { + it("When a user has finished making changes to the list, Then section can be completed and the questionnaire submitted", async () => { await $(AnyOtherCompaniesOrBranchesPage.no()).click(); await click(AnyOtherCompaniesOrBranchesPage.submit()); await click(AnyOtherTradingDetailsPage.submit()); await click(SectionCompaniesPage.submit()); await click(SubmitPage.submit()); + await expect(browser).toHaveUrlContaining(ThankYouPage.pageName); }); }); - describe("Given a journey through the list collector with repeating blocks, any incomplete repeating_block will be revisited before navigating to the next block after the list collector.", () => { + describe("Given a journey that test routes through the list collector with repeating blocks.", () => { before("Load the survey", async () => { await browser.openQuestionnaire("test_list_collector_repeating_blocks_section_summary.json"); }); - it("The user is able to add companies complete some repeating blocks and leave others incomplete.", async () => { + it("When the user only completes some of the repeating blocks and leaves others incomplete, Then on the list collector page only completed items should display the completed checkmark icon.", async () => { await proceedToListCollector(); await addCompany("ONS", "123", "1", "1", "2023", true, true); @@ -164,20 +157,23 @@ describe("List Collector Repeating Blocks", () => { await $(AnyOtherCompaniesOrBranchesPage.yes()).click(); await click(AnyOtherCompaniesOrBranchesPage.submit()); await addCompany("NAV", "101", "4", "4", "2023", true, true); - }); - it("The list collector shows all of the companies as well as checkmarks on the complete items 1 and 4, but not on the incomplete items 3 and 4.", async () => { - const companiesExpected = ["ONS", "GOV", "MOD", "NAV"]; - checkItemsInList(companiesExpected, AnyOtherCompaniesOrBranchesPage.listLabel); + // Only the ONS and NAV items should be complete + checkItemsInList(["ONS", "GOV", "MOD", "NAV"], AnyOtherCompaniesOrBranchesPage.listLabel); checkListItemComplete(`dt[data-qa="list-item-1-label"]`); checkListItemIncomplete(`dt[data-qa="list-item-2-label"]`); checkListItemIncomplete(`dt[data-qa="list-item-3-label"]`); checkListItemComplete(`dt[data-qa="list-item-1-label"]`); }); - it("Attempting to complete the list collector will navigate the user to the first incomplete block of the second list item.", async () => { + it("When an item has incomplete repeating blocks, Then using submit on the list collector page will navigate the user to the first incomplete repeating block.", async () => { await $(AnyOtherCompaniesOrBranchesPage.no()).click(); await click(AnyOtherCompaniesOrBranchesPage.submit()); + await expect(browser).toHaveUrlContaining(CompaniesRepeatingBlock1Page.pageName); + }); + + it("When there are multiple incomplete items and only the first incomplete item is completed, Then attempting using Submit on the list collector page will navigate the user to the next incomplete item.", async () => { + // Complete the first incomplete list item await $(CompaniesRepeatingBlock1Page.registrationNumber()).setValue("456"); await $(CompaniesRepeatingBlock1Page.registrationDateday()).setValue("2"); await $(CompaniesRepeatingBlock1Page.registrationDatemonth()).setValue("2"); @@ -186,23 +182,24 @@ describe("List Collector Repeating Blocks", () => { await $(CompaniesRepeatingBlock2Page.authorisedTraderUkRadioNo()).click(); await $(CompaniesRepeatingBlock2Page.authorisedTraderEuRadioNo()).click(); await click(CompaniesRepeatingBlock2Page.submit()); - }); - it("Attempting to complete the list collector will navigate the user to the first incomplete block of the third list item.", async () => { await $(AnyOtherCompaniesOrBranchesPage.no()).click(); await click(AnyOtherCompaniesOrBranchesPage.submit()); - await $(CompaniesRepeatingBlock2Page.authorisedTraderUkRadioNo()).click(); - await click(CompaniesRepeatingBlock2Page.submit()); + + // The user is taken to the next incomplete repeating block + await expect(browser).toHaveUrlContaining(CompaniesRepeatingBlock2Page.pageName); }); - it("All items are now marked as completed with the checkmark icon.", async () => { + it("When the last remaining incomplete repeating block is completed, Then all items are marked as completed with the checkmark icon.", async () => { + await $(CompaniesRepeatingBlock2Page.authorisedTraderUkRadioNo()).click(); + await click(CompaniesRepeatingBlock2Page.submit()); checkListItemComplete(`dt[data-qa="list-item-1-label"]`); checkListItemComplete(`dt[data-qa="list-item-2-label"]`); checkListItemComplete(`dt[data-qa="list-item-3-label"]`); checkListItemComplete(`dt[data-qa="list-item-4-label"]`); }); - it("Clicking a change link from the section summary and pressing previous or submit without changing an answer returns the user to the section summary anchored to the answer they clicked on", async () => { + it("When the user clicks a change link from the section summary and submits without changing an answer, Then the user is returned to the section summary anchored to the answer they clicked on", async () => { await $(AnyOtherCompaniesOrBranchesPage.no()).click(); await click(AnyOtherCompaniesOrBranchesPage.submit()); await click(AnyOtherTradingDetailsPage.submit()); @@ -216,14 +213,14 @@ describe("List Collector Repeating Blocks", () => { await expect(browser).toHaveUrlContaining("section-companies/#any-other-trading-details-answer"); }); - it("Editing an answer from the section summary which does not affect progress and pressing continue returns the user to the section summary anchored to the answer they edited", async () => { + it("When an answer is edited from the section summary which does not affect progress, Then pressing continue returns the user to the section summary anchored to the answer they edited", async () => { await $(SectionCompaniesPage.anyOtherTradingDetailsAnswerEdit()).click(); await $(AnyOtherTradingDetailsPage.answer()).setValue("No"); await click(AnyOtherTradingDetailsPage.submit()); await expect(browser).toHaveUrlContaining("section-companies/#any-other-trading-details-answer"); }); - it("Clicking a change link from the final summary and pressing previous or submit without changing an answer returns the user to the final summary anchored to the answer they clicked on", async () => { + it("When a user clicks a change link from the final summary and submits without changing an answer, Then the user is returned to the final summary anchored to the answer they clicked on", async () => { await click(SectionCompaniesPage.submit()); await $(SubmitPage.anyOtherTradingDetailsAnswerEdit()).click(); @@ -235,23 +232,24 @@ describe("List Collector Repeating Blocks", () => { await expect(browser).toHaveUrlContaining("submit/#any-other-trading-details-answer"); }); - it("Editing an answer from the final summary which does not affect progress and pressing continue returns the user to the final summary anchored to the answer they edited", async () => { + it("When an an answer is edited from the final summary which does not affect progress, Then pressing continue returns the user to the final summary anchored to the answer they edited", async () => { await $(SectionCompaniesPage.anyOtherTradingDetailsAnswerEdit()).click(); await $(AnyOtherTradingDetailsPage.answer()).setValue("Yes"); await click(AnyOtherTradingDetailsPage.submit()); await expect(browser).toHaveUrlContaining("submit/#any-other-trading-details-answer"); }); - it("The list collector can now be submitted.", async () => { + it("When all items are completed by the user, Then the questionnaire is able to be submitted.", async () => { await click(SubmitPage.submit()); + await expect(browser).toHaveUrlContaining(ThankYouPage.pageName); }); }); - describe("Given a journey through the list collector with repeating blocks, the answers from repeating blocks can be edited.", () => { + describe("Given a journey through the list collector with repeating blocks", () => { before("Load the survey", async () => { await browser.openQuestionnaire("test_list_collector_repeating_blocks_section_summary.json"); }); - it("The user is able to add companies, complete repeating blocks and navigate to the section summary.", async () => { + it("When the user adds and completes items, Then they are able to see the items on the section summary page.", async () => { await proceedToListCollector(); await addCompany("ONS", "123", "1", "1", "2023", true, true); await $(AnyOtherCompaniesOrBranchesPage.yes()).click(); @@ -261,125 +259,108 @@ describe("List Collector Repeating Blocks", () => { await click(AnyOtherCompaniesOrBranchesPage.submit()); await click(AnyOtherTradingDetailsPage.submit()); await click(SectionCompaniesPage.submit()); + await expect(await $$(summaryValues)[2].getText()).toContain("ONS"); + await expect(await $$(summaryValues)[4].getText()).toContain("1 January 2023"); + await expect(await $$(summaryValues)[5].getText()).toContain("Yes"); + await expect(await $$(summaryValues)[7].getText()).toContain("GOV"); + await expect(await $$(summaryValues)[8].getText()).toContain("456"); + await expect(await $$(summaryValues)[11].getText()).toContain("No answer provided"); }); - it("Edit each type of answer on different items from the section summary.", async () => { - await expect(await $$(summaryValues)[8].getText()).toBe("456"); + it("When an item is edited from the section summary page, Then the correct value is displayed when the user returns to the summary.", async () => { + await expect(await $$(summaryValues)[8].getText()).toContain("456"); await repeatingAnswerChangeLink(8).click(); await $(CompaniesRepeatingBlock1Page.registrationNumber()).setValue("789"); await click(CompaniesRepeatingBlock1Page.submit()); - await expect(await $$(summaryValues)[8].getText()).toBe("789"); + await expect(await $$(summaryValues)[8].getText()).toContain("789"); + }); + }); - await expect(await $$(summaryValues)[4].getText()).toBe("1 January 2023"); - await repeatingAnswerChangeLink(4).click(); - await $(CompaniesRepeatingBlock1Page.registrationDateday()).setValue("4"); - await $(CompaniesRepeatingBlock1Page.registrationDatemonth()).setValue("4"); - await click(CompaniesRepeatingBlock1Page.submit()); - await expect(await $$(summaryValues)[4].getText()).toBe("4 April 2023"); + describe("Given the user is completing a list collector with repeating blocks in a mandatory section of a hub based questionnaire.", () => { + before("Load the survey", async () => { + await browser.openQuestionnaire("test_list_collector_repeating_blocks_with_hub.json"); + }); + it("When the user adds complete and incomplete items and returns to the hub, Then the user should be taken to first incomplete repeating block when pressing Continue.", async () => { + await proceedToListCollector(); - await expect(await $$(summaryValues)[5].getText()).toBe("Yes"); - await repeatingAnswerChangeLink(5).click(); - await $(CompaniesRepeatingBlock2Page.authorisedTraderUkRadioNo()).click(); - await click(CompaniesRepeatingBlock2Page.submit()); - await expect(await $$(summaryValues)[5].getText()).toBe("No"); + await addCompany("ONS", "123", "1", "1", "2023", true, true); + await $(AnyOtherCompaniesOrBranchesPage.yes()).click(); + await click(AnyOtherCompaniesOrBranchesPage.submit()); + await $(AddCompanyPage.companyOrBranchName()).setValue("GOV"); + await click(AddCompanyPage.submit()); + await $(CompaniesRepeatingBlock1Page.cancelAndReturn()).click(); + await browser.url("questionnaire/"); + await click(HubPage.submit()); + await $(AnyOtherCompaniesOrBranchesPage.no()).click(); + await click(AnyOtherCompaniesOrBranchesPage.submit()); + await expect(browser).toHaveUrlContaining(CompaniesRepeatingBlock1Page.pageName); + }); - await expect(await $$(summaryValues)[11].getText()).toBe("No answer provided"); - await repeatingAnswerChangeLink(11).click(); - await $(CompaniesRepeatingBlock2Page.authorisedTraderEuRadioYes()).click(); + it("When the user completes the incomplete blocks and returns to the list collector Page, Then the completed items should display the checkmark icon", async () => { + await $(CompaniesRepeatingBlock1Page.registrationNumber()).setValue("456"); + await $(CompaniesRepeatingBlock1Page.registrationDateday()).setValue("2"); + await $(CompaniesRepeatingBlock1Page.registrationDatemonth()).setValue("2"); + await $(CompaniesRepeatingBlock1Page.registrationDateyear()).setValue("2023"); + await click(CompaniesRepeatingBlock1Page.submit()); + await $(CompaniesRepeatingBlock2Page.authorisedTraderUkRadioNo()).click(); await click(CompaniesRepeatingBlock2Page.submit()); - await expect(await $$(summaryValues)[11].getText()).toBe("Yes"); + await expect(browser).toHaveUrlContaining(AnyOtherCompaniesOrBranchesPage.pageName); + checkListItemComplete(`dt[data-qa="list-item-1-label"]`); + checkListItemComplete(`dt[data-qa="list-item-2-label"]`); }); - it("The list collector can then be submitted", async () => { - await click(SubmitPage.submit()); - }); - }); -}); + it("When another incomplete item is added via the section summary, Then navigating to the submit page of the section will redirect to the list collector page.", async () => { + // Add another item and partially complete + await $(AnyOtherCompaniesOrBranchesPage.no()).click(); + await click(AnyOtherCompaniesOrBranchesPage.submit()); + await click(AnyOtherTradingDetailsPage.submit()); + await $(SectionCompaniesPage.companiesListAddLink()).click(); + await $(AddCompanyPage.companyOrBranchName()).setValue("MOD"); + await click(AddCompanyPage.submit()); + await $(CompaniesRepeatingBlock1Page.cancelAndReturn()).click(); -describe("Given a journey through the list collector with repeating blocks, in a mandatory section of hub questionnaire, the incomplete repeating blocks mark the list collector incomplete and thus navigate back there.", () => { - before("Load the survey", async () => { - await browser.openQuestionnaire("test_list_collector_repeating_blocks_with_hub.json"); - }); - it("The user is able to add a compete company and an incomplete company.", async () => { - await proceedToListCollector(); - - await addCompany("ONS", "123", "1", "1", "2023", true, true); - await $(AnyOtherCompaniesOrBranchesPage.yes()).click(); - await click(AnyOtherCompaniesOrBranchesPage.submit()); - await $(AddCompanyPage.companyOrBranchName()).setValue("GOV"); - await click(AddCompanyPage.submit()); - await $(CompaniesRepeatingBlock1Page.cancelAndReturn()).click(); - }); + // Navigating to the section summary will redirect to the list collector page + await browser.url("questionnaire/sections/section-companies/"); + await expect(browser).toHaveUrlContaining(AnyOtherCompaniesOrBranchesPage.pageName); + }); - it("Navigating to the root of the questionnaire will redirect to the incomplete list collector, which we can then complete.", async () => { - await browser.url("questionnaire/"); - await expect(browser).toHaveUrlContaining(AnyOtherCompaniesOrBranchesPage.url()); - - await $(AnyOtherCompaniesOrBranchesPage.no()).click(); - await click(AnyOtherCompaniesOrBranchesPage.submit()); - await $(CompaniesRepeatingBlock1Page.registrationNumber()).setValue("456"); - await $(CompaniesRepeatingBlock1Page.registrationDateday()).setValue("2"); - await $(CompaniesRepeatingBlock1Page.registrationDatemonth()).setValue("2"); - await $(CompaniesRepeatingBlock1Page.registrationDateyear()).setValue("2023"); - await click(CompaniesRepeatingBlock1Page.submit()); - await $(CompaniesRepeatingBlock2Page.authorisedTraderUkRadioNo()).click(); - await click(CompaniesRepeatingBlock2Page.submit()); - }); + it("When the incomplete repeating blocks are completed, Then the user is able to complete the section and is taken to the hub page.", async () => { + await $(AnyOtherCompaniesOrBranchesPage.no()).click(); + await click(AnyOtherCompaniesOrBranchesPage.submit()); + await $(CompaniesRepeatingBlock1Page.registrationNumber()).setValue("789"); + await $(CompaniesRepeatingBlock1Page.registrationDateday()).setValue("3"); + await $(CompaniesRepeatingBlock1Page.registrationDatemonth()).setValue("3"); + await $(CompaniesRepeatingBlock1Page.registrationDateyear()).setValue("2023"); + await click(CompaniesRepeatingBlock1Page.submit()); + await $(CompaniesRepeatingBlock2Page.authorisedTraderUkRadioYes()).click(); + await click(CompaniesRepeatingBlock2Page.submit()); + await $(AnyOtherCompaniesOrBranchesPage.no()).click(); + await click(AnyOtherCompaniesOrBranchesPage.submit()); + await click(SectionCompaniesPage.submit()); + await expect(browser).toHaveUrlContaining(HubPage.pageName); + }); - it("Another incomplete item can be added via the section summary.", async () => { - await $(AnyOtherCompaniesOrBranchesPage.no()).click(); - await click(AnyOtherCompaniesOrBranchesPage.submit()); - await click(AnyOtherTradingDetailsPage.submit()); - await $(SectionCompaniesPage.companiesListAddLink()).click(); - await $(AddCompanyPage.companyOrBranchName()).setValue("MOD"); - await click(AddCompanyPage.submit()); - await $(CompaniesRepeatingBlock1Page.cancelAndReturn()).click(); - }); + it("When the user is on the Hub page and has completed the section, Then they are able to add additional companies using the Add link", async () => { + await $(HubPage.summaryRowLink("section-companies")).click(); + await $(SectionCompaniesPage.companiesListAddLink()).click(); + await $(AddCompanyPage.companyOrBranchName()).setValue("MOJ"); + await click(AddCompanyPage.submit()); + await $(CompaniesRepeatingBlock1Page.registrationNumber()).setValue("789"); + await $(CompaniesRepeatingBlock1Page.registrationDateday()).setValue("3"); + await $(CompaniesRepeatingBlock1Page.registrationDatemonth()).setValue("3"); + await $(CompaniesRepeatingBlock1Page.registrationDateyear()).setValue("2023"); + await click(CompaniesRepeatingBlock1Page.submit()); + await $(CompaniesRepeatingBlock2Page.authorisedTraderUkRadioYes()).click(); + await click(CompaniesRepeatingBlock2Page.submit()); + await $(AnyOtherCompaniesOrBranchesPage.no()).click(); + await click(AnyOtherCompaniesOrBranchesPage.submit()); + await click(SectionCompaniesPage.submit()); + await expect(browser).toHaveUrlContaining(HubPage.pageName); + }); - it("Navigating to the submit page of the section will redirect to the incomplete list collector, which we can then complete.", async () => { - await browser.url("questionnaire/sections/section-companies/"); - await expect(browser).toHaveUrlContaining(AnyOtherCompaniesOrBranchesPage.url()); - - await $(AnyOtherCompaniesOrBranchesPage.no()).click(); - await click(AnyOtherCompaniesOrBranchesPage.submit()); - await $(CompaniesRepeatingBlock1Page.registrationNumber()).setValue("789"); - await $(CompaniesRepeatingBlock1Page.registrationDateday()).setValue("3"); - await $(CompaniesRepeatingBlock1Page.registrationDatemonth()).setValue("3"); - await $(CompaniesRepeatingBlock1Page.registrationDateyear()).setValue("2023"); - await click(CompaniesRepeatingBlock1Page.submit()); - await $(CompaniesRepeatingBlock2Page.authorisedTraderUkRadioYes()).click(); - await click(CompaniesRepeatingBlock2Page.submit()); - }); - it("The user is able to add additional company via a list collector, edit this newly added list item and return to list collector page", async () => { - await $(AnyOtherCompaniesOrBranchesPage.no()).click(); - await click(AnyOtherCompaniesOrBranchesPage.submit()); - await click(SectionCompaniesPage.submit()); - await $(HubPage.summaryRowLink("section-companies")).click(); - await $(SectionCompaniesPage.companiesListAddLink()).click(); - await $(AddCompanyPage.companyOrBranchName()).setValue("MOJ"); - await click(AddCompanyPage.submit()); - await $(CompaniesRepeatingBlock1Page.previous()).click(); - await $(EditCompanyPage.previous()).click(); - await $(AnyOtherCompaniesOrBranchesPage.listEditLink(4)).click(); - await expect(browser).toHaveUrlContaining(EditCompanyPage.pageName); - await click(EditCompanyPage.submit()); - await $(CompaniesRepeatingBlock1Page.previous()).click(); - await $(EditCompanyPage.previous()).click(); - await $(AnyOtherCompaniesOrBranchesPage.no()).click(); - await click(AnyOtherCompaniesOrBranchesPage.submit()); - await $(CompaniesRepeatingBlock1Page.registrationNumber()).setValue("789"); - await $(CompaniesRepeatingBlock1Page.registrationDateday()).setValue("3"); - await $(CompaniesRepeatingBlock1Page.registrationDatemonth()).setValue("3"); - await $(CompaniesRepeatingBlock1Page.registrationDateyear()).setValue("2023"); - await click(CompaniesRepeatingBlock1Page.submit()); - await $(CompaniesRepeatingBlock2Page.authorisedTraderUkRadioYes()).click(); - await click(CompaniesRepeatingBlock2Page.submit()); - await $(AnyOtherCompaniesOrBranchesPage.no()).click(); - await click(AnyOtherCompaniesOrBranchesPage.submit()); - await click(SectionCompaniesPage.submit()); - }); - it("The section can now be submitted and and hub will redirect user to the next section.", async () => { - await click(HubPage.submit()); - await expect(browser).toHaveUrlContaining(ResponsiblePartyHubPage.pageName); + it("When the user has completed the list collector section and uses Submit on the hub page, Then the user will be redirected to the next section.", async () => { + await click(HubPage.submit()); + await expect(browser).toHaveUrlContaining(ResponsiblePartyHubPage.pageName); + }); }); });