diff --git a/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts b/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts index e6a1b5f7d0..bf88ebeb8b 100644 --- a/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts +++ b/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts @@ -8,7 +8,10 @@ import { getTeamPage } from "./helpers/getPage"; import { createAuthenticatedSession } from "./helpers/globalHelpers"; import { answerFindProperty, clickContinue } from "./helpers/userActions"; import { PlaywrightEditor } from "./pages/Editor"; -import { publishService, turnServiceOnline } from "./helpers/navigateAndPublish"; +import { + publishService, + turnServiceOnline, +} from "./helpers/navigateAndPublish"; import { TestContext } from "./helpers/types"; import { serviceProps } from "./helpers/serviceData"; @@ -74,7 +77,7 @@ test.describe("Flow creation, publish and preview", () => { }); // publish flow await page.goto(`/${context.team.slug}/${serviceProps.slug}`); - publishService(page) + publishService(page); let previewLink = page.getByRole("link", { name: "Open published service", @@ -83,7 +86,7 @@ test.describe("Flow creation, publish and preview", () => { await page.goto(`/${context.team.slug}/${serviceProps.slug}`); - turnServiceOnline(page) + turnServiceOnline(page); // Exit back to main Editor page page.locator('[aria-label="Editor"]').click(); diff --git a/e2e/tests/ui-driven/src/create-flow.spec.ts b/e2e/tests/ui-driven/src/create-flow.spec.ts index afb4860416..f233fd9d1d 100644 --- a/e2e/tests/ui-driven/src/create-flow.spec.ts +++ b/e2e/tests/ui-driven/src/create-flow.spec.ts @@ -18,16 +18,17 @@ import { clickContinue, } from "./helpers/userActions"; import { PlaywrightEditor } from "./pages/Editor"; -import { - createExternalPortal, -} from "./helpers/addComponent"; +import { createExternalPortal } from "./helpers/addComponent"; import { navigateToService, publishService, turnServiceOnline, } from "./helpers/navigateAndPublish"; import { TestContext } from "./helpers/types"; -import { externalPortalFlowData, externalPortalServiceProps } from "./helpers/serviceData"; +import { + externalPortalFlowData, + externalPortalServiceProps, +} from "./helpers/serviceData"; test.describe("Flow creation, publish and preview", () => { let context: TestContext = { @@ -129,7 +130,7 @@ test.describe("Flow creation, publish and preview", () => { userId: context.user!.id!, }); - await navigateToService(page, serviceProps.slug) + await navigateToService(page, serviceProps.slug); await publishService(page); const previewLink = page.getByRole("link", { @@ -163,7 +164,7 @@ test.describe("Flow creation, publish and preview", () => { userId: context.user!.id!, }); - await navigateToService(page, serviceProps.slug) + await navigateToService(page, serviceProps.slug); await turnServiceOnline(page); // Exit back to main Editor page @@ -197,9 +198,9 @@ test.describe("Flow creation, publish and preview", () => { // update context to allow new flow to be torn down context.externalPortalFlow = { ...externalPortalServiceProps }; - const {title, answers} = externalPortalFlowData + const { title, answers } = externalPortalFlowData; - await editor.createQuestionWithOptions(title, answers) + await editor.createQuestionWithOptions(title, answers); await expect(editor.nodeList).toContainText([ title, diff --git a/e2e/tests/ui-driven/src/helpers/context.ts b/e2e/tests/ui-driven/src/helpers/context.ts index b924ebc4ea..70069ed844 100644 --- a/e2e/tests/ui-driven/src/helpers/context.ts +++ b/e2e/tests/ui-driven/src/helpers/context.ts @@ -6,7 +6,6 @@ import { log } from "./globalHelpers"; import { $admin } from "../../../api-driven/src/client"; import { Flow, TestContext } from "./types"; - export const contextDefaults: TestContext = { user: { id: 0, @@ -78,7 +77,7 @@ export async function setUpTestContext( export async function tearDownTestContext(context: TestContext) { const adminGQLClient = getGraphQLClient(); if (context.flow || context.externalPortalFlow) { - await $admin.flow._destroyAll() + await $admin.flow._destroyAll(); } if (context.user) { await deleteUser(adminGQLClient, context); @@ -311,7 +310,10 @@ async function deleteTeam(adminGQLClient: GraphQLClient, context: TestContext) { } } -async function setupGovPaySecret($admin: CoreDomainClient, context: TestContext) { +async function setupGovPaySecret( + $admin: CoreDomainClient, + context: TestContext, +) { try { await $admin.client.request( gql` diff --git a/e2e/tests/ui-driven/src/helpers/serviceData.ts b/e2e/tests/ui-driven/src/helpers/serviceData.ts index e20f17f2c1..b1fda6a053 100644 --- a/e2e/tests/ui-driven/src/helpers/serviceData.ts +++ b/e2e/tests/ui-driven/src/helpers/serviceData.ts @@ -1,15 +1,14 @@ - export const serviceProps = { - name: "A Test Service", - slug: "a-test-service", - }; + name: "A Test Service", + slug: "a-test-service", +}; + +export const externalPortalServiceProps = { + name: "An External Portal Service", + slug: "an-external-portal-service", +}; - export const externalPortalServiceProps = { - name: "An External Portal Service", - slug: "an-external-portal-service", - }; - - export const externalPortalFlowData = { - title: "Is this an External Portal?", - answers: ["It is an external portal", "No it is not an External Portal"], - }; \ No newline at end of file +export const externalPortalFlowData = { + title: "Is this an External Portal?", + answers: ["It is an external portal", "No it is not an External Portal"], +}; diff --git a/e2e/tests/ui-driven/src/helpers/types.ts b/e2e/tests/ui-driven/src/helpers/types.ts index 9f94293ff5..194f55510d 100644 --- a/e2e/tests/ui-driven/src/helpers/types.ts +++ b/e2e/tests/ui-driven/src/helpers/types.ts @@ -1,22 +1,20 @@ import { CoreDomainClient } from "@opensystemslab/planx-core"; import { User } from "@opensystemslab/planx-core/dist/types"; - type NewTeam = Parameters[0]; export interface Flow { - id?: string; - publishedId?: number; - slug: string; - name: string; - data?: object; - } - + id?: string; + publishedId?: number; + slug: string; + name: string; + data?: object; +} export interface TestContext { - user: Omit; - team: { id?: number } & NewTeam; - flow?: Flow; - externalPortalFlow?:Flow; - sessionIds?: string[]; - } \ No newline at end of file + user: Omit; + team: { id?: number } & NewTeam; + flow?: Flow; + externalPortalFlow?: Flow; + sessionIds?: string[]; +} diff --git a/e2e/tests/ui-driven/src/invite-to-pay/agent.spec.ts b/e2e/tests/ui-driven/src/invite-to-pay/agent.spec.ts index 068041b720..13a915fddc 100644 --- a/e2e/tests/ui-driven/src/invite-to-pay/agent.spec.ts +++ b/e2e/tests/ui-driven/src/invite-to-pay/agent.spec.ts @@ -23,13 +23,11 @@ import { TestContext } from "../helpers/types"; let context: TestContext = { ...contextDefaults, - flow: - { - slug: "invite-to-pay-test", - name: "Invite to pay test", - data: inviteToPayFlow, - } - , + flow: { + slug: "invite-to-pay-test", + name: "Invite to pay test", + data: inviteToPayFlow, + }, sessionIds: [], // used to collect and clean up sessions }; diff --git a/e2e/tests/ui-driven/src/invite-to-pay/helpers.ts b/e2e/tests/ui-driven/src/invite-to-pay/helpers.ts index 384bb5eaf0..b7a21b667d 100644 --- a/e2e/tests/ui-driven/src/invite-to-pay/helpers.ts +++ b/e2e/tests/ui-driven/src/invite-to-pay/helpers.ts @@ -96,6 +96,6 @@ export async function makePaymentRequest({ await answerInviteToPayForm(page); page.getByRole("button", { name: "Send invitation to pay" }).click(); await page.waitForResponse((res) => res.url().includes("invite-to-pay")); - await expect(page.getByText('Error generating payment')).toBeHidden() + await expect(page.getByText("Error generating payment")).toBeHidden(); return sessionId; } diff --git a/e2e/tests/ui-driven/src/invite-to-pay/nominee.spec.ts b/e2e/tests/ui-driven/src/invite-to-pay/nominee.spec.ts index f33e499af5..f4b8b941b2 100644 --- a/e2e/tests/ui-driven/src/invite-to-pay/nominee.spec.ts +++ b/e2e/tests/ui-driven/src/invite-to-pay/nominee.spec.ts @@ -17,12 +17,11 @@ import { TestContext } from "../helpers/types"; let context: TestContext = { ...contextDefaults, - flow: - { - slug: "invite-to-pay-test", - name: "Invite to pay test", - data: inviteToPayFlow, - }, + flow: { + slug: "invite-to-pay-test", + name: "Invite to pay test", + data: inviteToPayFlow, + }, sessionIds: [], // used to collect and clean up sessions }; @@ -83,8 +82,9 @@ test.describe("Nominee journey @regression", async () => { }); test("navigating to a URL with an invalid ID", async ({ page }) => { - const invalidPaymentRequestURL = `/${context.team!.slug!}/${context - .flow?.slug}/pay?analytics=false&paymentRequestId=INVALID-ID`; + const invalidPaymentRequestURL = `/${context.team!.slug!}/${ + context.flow?.slug + }/pay?analytics=false&paymentRequestId=INVALID-ID`; await page.goto(invalidPaymentRequestURL); await page.waitForLoadState("networkidle"); diff --git a/e2e/tests/ui-driven/src/pages/Editor.ts b/e2e/tests/ui-driven/src/pages/Editor.ts index 5e6f5c1ee2..8e0da26ba5 100644 --- a/e2e/tests/ui-driven/src/pages/Editor.ts +++ b/e2e/tests/ui-driven/src/pages/Editor.ts @@ -74,19 +74,13 @@ export class PlaywrightEditor { ).toBeVisible(); } - async createQuestionWithOptions(title:string, answers:string[]) { - await createQuestionWithOptions( - this.page, - this.firstNode, - title, - answers, - ); + async createQuestionWithOptions(title: string, answers: string[]) { + await createQuestionWithOptions(this.page, this.firstNode, title, answers); await expect( this.page.locator("a").filter({ hasText: this.answers.questionText }), ).toBeVisible(); } - async createNoticeOnEachBranch() { // Add a notice to the "Yes" path await createNotice( diff --git a/e2e/tests/ui-driven/src/pay.spec.ts b/e2e/tests/ui-driven/src/pay.spec.ts index dbb1b950c0..b0a1614870 100644 --- a/e2e/tests/ui-driven/src/pay.spec.ts +++ b/e2e/tests/ui-driven/src/pay.spec.ts @@ -20,13 +20,12 @@ import { TestContext } from "./helpers/types"; let context: TestContext = { ...contextDefaults, - flow: - { - slug: "pay-test", - name: "Pay test", - data: payFlow, - }, - + flow: { + slug: "pay-test", + name: "Pay test", + data: payFlow, + }, + sessionIds: [], // used to collect and clean up sessions }; const previewURL = `/${context.team!.slug!}/${context.flow?.slug}/published?analytics=false`; diff --git a/e2e/tests/ui-driven/src/save-and-return.spec.ts b/e2e/tests/ui-driven/src/save-and-return.spec.ts index 1d334d127c..9631fc177a 100644 --- a/e2e/tests/ui-driven/src/save-and-return.spec.ts +++ b/e2e/tests/ui-driven/src/save-and-return.spec.ts @@ -22,12 +22,11 @@ import { TestContext } from "./helpers/types"; test.describe("Save and return", () => { let context: TestContext = { ...contextDefaults, - flow: - { - slug: "e2e-save-and-return-test-flow", - name: "E2E Save and Return test flow", - data: simpleSendFlow, - }, + flow: { + slug: "e2e-save-and-return-test-flow", + name: "E2E Save and Return test flow", + data: simpleSendFlow, + }, }; const previewURL = `/${context.team?.slug}/${context.flow?.slug}/published?analytics=false`; diff --git a/e2e/tests/ui-driven/src/sections.spec.ts b/e2e/tests/ui-driven/src/sections.spec.ts index ac95e65f1b..159cc99c34 100644 --- a/e2e/tests/ui-driven/src/sections.spec.ts +++ b/e2e/tests/ui-driven/src/sections.spec.ts @@ -36,13 +36,11 @@ export enum SectionStatus { test.describe("Section statuses", () => { let context: TestContext = { ...contextDefaults, - flow: - { - slug: "sections-test-flow", - name: "Sections test flow", - data: flow, - }, - + flow: { + slug: "sections-test-flow", + name: "Sections test flow", + data: flow, + }, }; test.beforeAll(async () => {