Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
RODO94 committed Nov 29, 2024
1 parent 2908dd8 commit 80bf6a1
Show file tree
Hide file tree
Showing 12 changed files with 76 additions and 85 deletions.
9 changes: 6 additions & 3 deletions e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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",
Expand All @@ -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();
Expand Down
17 changes: 9 additions & 8 deletions e2e/tests/ui-driven/src/create-flow.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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", {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 5 additions & 3 deletions e2e/tests/ui-driven/src/helpers/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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`
Expand Down
25 changes: 12 additions & 13 deletions e2e/tests/ui-driven/src/helpers/serviceData.ts
Original file line number Diff line number Diff line change
@@ -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"],
};
export const externalPortalFlowData = {
title: "Is this an External Portal?",
answers: ["It is an external portal", "No it is not an External Portal"],
};
26 changes: 12 additions & 14 deletions e2e/tests/ui-driven/src/helpers/types.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
import { CoreDomainClient } from "@opensystemslab/planx-core";
import { User } from "@opensystemslab/planx-core/dist/types";


type NewTeam = Parameters<CoreDomainClient["team"]["create"]>[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<User, "teams">;
team: { id?: number } & NewTeam;
flow?: Flow;
externalPortalFlow?:Flow;
sessionIds?: string[];
}
user: Omit<User, "teams">;
team: { id?: number } & NewTeam;
flow?: Flow;
externalPortalFlow?: Flow;
sessionIds?: string[];
}
12 changes: 5 additions & 7 deletions e2e/tests/ui-driven/src/invite-to-pay/agent.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/ui-driven/src/invite-to-pay/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
16 changes: 8 additions & 8 deletions e2e/tests/ui-driven/src/invite-to-pay/nominee.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

Expand Down Expand Up @@ -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");

Check warning on line 89 in e2e/tests/ui-driven/src/invite-to-pay/nominee.spec.ts

View workflow job for this annotation

GitHub Actions / E2E tests

Unexpected use of networkidle

Expand Down
10 changes: 2 additions & 8 deletions e2e/tests/ui-driven/src/pages/Editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
13 changes: 6 additions & 7 deletions e2e/tests/ui-driven/src/pay.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
Expand Down
11 changes: 5 additions & 6 deletions e2e/tests/ui-driven/src/save-and-return.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`;

Expand Down
12 changes: 5 additions & 7 deletions e2e/tests/ui-driven/src/sections.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down

0 comments on commit 80bf6a1

Please sign in to comment.