Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
RODO94 committed Nov 27, 2024
1 parent 2354832 commit 208b3e3
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 32 deletions.
18 changes: 11 additions & 7 deletions e2e/tests/ui-driven/src/create-flow.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ import {
createExternalPortal,
createQuestionWithOptions,
} from "./helpers/addComponent";
import { navigateToService, publishService, turnServiceOnline } from "./helpers/navigateAndPublish";
import {
navigateToService,
publishService,
turnServiceOnline,
} from "./helpers/navigateAndPublish";

test.describe("Flow creation, publish and preview", () => {
let context: Context = {
Expand Down Expand Up @@ -129,7 +133,7 @@ test.describe("Flow creation, publish and preview", () => {

await page.goto(`/${context.team.slug}/${serviceProps.slug}`);

await publishService(page)
await publishService(page);

const previewLink = page.getByRole("link", {
name: "Open published service",
Expand Down Expand Up @@ -164,7 +168,7 @@ test.describe("Flow creation, publish and preview", () => {

await page.goto(`/${context.team.slug}/${serviceProps.slug}`);

await turnServiceOnline(page)
await turnServiceOnline(page);

// Exit back to main Editor page
page.locator('[aria-label="Editor"]').click();
Expand Down Expand Up @@ -209,18 +213,18 @@ await turnServiceOnline(page)
externalPortalFlowData.answers[1],
]);

await publishService(page)
await turnServiceOnline(page)
await publishService(page);
await turnServiceOnline(page);

navigateToService(page, serviceProps.slug)
navigateToService(page, serviceProps.slug);

await createExternalPortal(page, page.locator("li:nth-child(6)"));

await expect(
page.getByRole("link", { name: "E2E/an-external-portal-service" }),
).toBeVisible();

await publishService(page)
await publishService(page);
});

test("Can preview a published flow", async ({
Expand Down
43 changes: 20 additions & 23 deletions e2e/tests/ui-driven/src/helpers/navigateAndPublish.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
import { expect, Page } from "@playwright/test";
import { contextDefaults } from "./context";

export const navigateToService = async (page: Page, slug:string) => {

await page.goto(`/${contextDefaults.team.slug}/${slug}`);
export const navigateToService = async (page: Page, slug: string) => {
await page.goto(`/${contextDefaults.team.slug}/${slug}`);

await expect(
page.getByRole("link", { name: slug }),
).toBeVisible();
await expect(page.getByRole("link", { name: slug })).toBeVisible();

return true
}
return true;
};

export const publishService = async (page:Page) => {
page.getByRole("button", { name: "CHECK FOR CHANGES TO PUBLISH" }).click();
await expect(
page.getByRole("heading", { name: "Check for changes to publish" }),
).toBeVisible();
page.getByRole("button", { name: "PUBLISH", exact: true }).click();
}
export const publishService = async (page: Page) => {
page.getByRole("button", { name: "CHECK FOR CHANGES TO PUBLISH" }).click();
await expect(
page.getByRole("heading", { name: "Check for changes to publish" }),
).toBeVisible();
page.getByRole("button", { name: "PUBLISH", exact: true }).click();
};

export const turnServiceOnline = async (page: Page) =>{
page.locator('[aria-label="Service settings"]').click();
page.getByLabel("Offline").click();
export const turnServiceOnline = async (page: Page) => {
page.locator('[aria-label="Service settings"]').click();
page.getByLabel("Offline").click();

page.getByRole("button", { name: "Save", disabled: false }).click();
await expect(
page.getByText("Service settings updated successfully"),
).toBeVisible();
}
page.getByRole("button", { name: "Save", disabled: false }).click();
await expect(
page.getByText("Service settings updated successfully"),
).toBeVisible();
};
5 changes: 3 additions & 2 deletions e2e/tests/ui-driven/src/invite-to-pay/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ import {
* Navigates to pay component whilst completing the minimum requirements for an Invite to Pay flow
*/
export async function navigateToPayComponent(page: Page, context: Context) {
const previewURL = `/${context.team!.slug!}/${context.flows?.[0]
.slug}/published?analytics=false`;
const previewURL = `/${context.team!.slug!}/${
context.flows?.[0].slug
}/published?analytics=false`;
await page.goto(previewURL);

await fillInEmail({ page, context });
Expand Down

0 comments on commit 208b3e3

Please sign in to comment.