From 420f6a89e93e481d37f09fb1e145f99353a091b5 Mon Sep 17 00:00:00 2001 From: liamtoozer Date: Tue, 9 Jan 2024 10:00:10 +0000 Subject: [PATCH] Remove redundant awaits found in PyCharm and await-thenable linting (#1287) --- tests/functional/spec/custom_page_titles.spec.js | 10 +++++----- .../features/dynamic_answer_options/function_driven.js | 6 +++--- tests/functional/spec/features/routing/date.spec.js | 10 +++++----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/functional/spec/custom_page_titles.spec.js b/tests/functional/spec/custom_page_titles.spec.js index 135e7b1af9..dc04f6fc2c 100644 --- a/tests/functional/spec/custom_page_titles.spec.js +++ b/tests/functional/spec/custom_page_titles.spec.js @@ -53,18 +53,18 @@ describe("Feature: Custom Page Titles", () => { await $(RelationshipsPage.husbandOrWife()).click(); await click(RelationshipsPage.submit()); - expectedPageTitle = browser.getTitle(); - await expect(await expectedPageTitle).toBe("How Person 1 is related to Person 3 - Test Custom Page Titles"); + expectedPageTitle = await browser.getTitle(); + await expect(expectedPageTitle).toBe("How Person 1 is related to Person 3 - Test Custom Page Titles"); await $(RelationshipsPage.sonOrDaughter()).click(); await click(RelationshipsPage.submit()); expectedPageTitle = await browser.getTitle(); - await expect(await expectedPageTitle).toBe("How Person 2 is related to Person 3 - Test Custom Page Titles"); + await expect(expectedPageTitle).toBe("How Person 2 is related to Person 3 - Test Custom Page Titles"); await $(RelationshipsPage.sonOrDaughter()).click(); await click(RelationshipsPage.submit()); expectedPageTitle = await browser.getTitle(); - await expect(await expectedPageTitle).toBe("Custom section summary page title - Test Custom Page Titles"); + await expect(expectedPageTitle).toBe("Custom section summary page title - Test Custom Page Titles"); }); it("When I navigate to list edit and remove pages Then I should see the custom page titles", async () => { @@ -74,7 +74,7 @@ describe("Feature: Custom Page Titles", () => { await $(ListCollectorEditPage.previous()).click(); await $(ListCollectorPage.listRemoveLink(1)).click(); expectedPageTitle = await browser.getTitle(); - await expect(await expectedPageTitle).toBe("Remove person 1 - Test Custom Page Titles"); + await expect(expectedPageTitle).toBe("Remove person 1 - Test Custom Page Titles"); }); it("When I navigate to a repeating section which has custom page title, Then all page titles in the section should have the correct prefix", async () => { diff --git a/tests/functional/spec/features/dynamic_answer_options/function_driven.js b/tests/functional/spec/features/dynamic_answer_options/function_driven.js index 23f5a05498..6c5605edcc 100644 --- a/tests/functional/spec/features/dynamic_answer_options/function_driven.js +++ b/tests/functional/spec/features/dynamic_answer_options/function_driven.js @@ -60,7 +60,7 @@ testCases.forEach((testCase) => { describe("Given a dynamic answer options questionnaire and I am on the radio answer page", () => { it("When I click a radio option, then the radio should be selected", async () => { - for (let i = 0; i < (await testCase.answerOptionCount); i++) { + for (let i = 0; i < testCase.answerOptionCount; i++) { await $(DynamicRadioPage.answerByIndex(i)).click(); await expect(await $(DynamicRadioPage.answerByIndex(i)).isSelected()).toBe(true); } @@ -88,14 +88,14 @@ testCases.forEach((testCase) => { describe("Given a dynamic answer options questionnaire and I am on the mutually exclusive page", () => { it("When I click a dynamic checkbox option, then the checkbox should be selected", async () => { - for (let i = 0; i < (await testCase.answerOptionCount); i++) { + for (let i = 0; i < testCase.answerOptionCount; i++) { await $(DynamicMutuallyExclusivePage.answerByIndex(i)).click(); await expect(await $(DynamicMutuallyExclusivePage.answerByIndex(i)).isSelected()).toBe(true); } }); it("When I click a selected option, then it should be deselected", async () => { - for (let i = 0; i < (await testCase.answerOptionCount); i++) { + for (let i = 0; i < testCase.answerOptionCount; i++) { await $(DynamicMutuallyExclusivePage.answerByIndex(i)).click(); await expect(await $(DynamicMutuallyExclusivePage.answerByIndex(i)).isSelected()).toBe(false); } diff --git a/tests/functional/spec/features/routing/date.spec.js b/tests/functional/spec/features/routing/date.spec.js index db7dca2226..6202b5e91b 100644 --- a/tests/functional/spec/features/routing/date.spec.js +++ b/tests/functional/spec/features/routing/date.spec.js @@ -221,7 +221,7 @@ describe("Feature: Routing on a Date", () => { const browserUrl = await browser.getUrl(); - await expect(await browserUrl).toContain(CorrectAnswerPage.pageName); + await expect(browserUrl).toContain(CorrectAnswerPage.pageName); }); it("When I enter a date equal to today, Then I should be routed to the incorrect page", async () => { @@ -232,7 +232,7 @@ describe("Feature: Routing on a Date", () => { const browserUrl = await browser.getUrl(); - await expect(await browserUrl).toContain(IncorrectAnswerPage.pageName); + await expect(browserUrl).toContain(IncorrectAnswerPage.pageName); }); it("When I enter a date greater than today, Then I should be routed to the incorrect page", async () => { @@ -243,7 +243,7 @@ describe("Feature: Routing on a Date", () => { const browserUrl = await browser.getUrl(); - await expect(await browserUrl).toContain(IncorrectAnswerPage.pageName); + await expect(browserUrl).toContain(IncorrectAnswerPage.pageName); }); }); }); @@ -273,7 +273,7 @@ describe("Feature: Routing on a Date", () => { const browserUrl = await browser.getUrl(); - await expect(await browserUrl).toContain(CorrectAnswerPage.pageName); + await expect(browserUrl).toContain(CorrectAnswerPage.pageName); }); it("When I enter a date greater than today, Then I should be routed to the incorrect page", async () => { @@ -284,7 +284,7 @@ describe("Feature: Routing on a Date", () => { const browserUrl = await browser.getUrl(); - await expect(await browserUrl).toContain(IncorrectAnswerPage.pageName); + await expect(browserUrl).toContain(IncorrectAnswerPage.pageName); }); }); });