Skip to content

Commit

Permalink
test(e2e): Update tests to account for flow status
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed May 31, 2024
1 parent 43a4139 commit 95235e6
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 10 deletions.
2 changes: 1 addition & 1 deletion e2e/tests/api-driven/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"dependencies": {
"@cucumber/cucumber": "^9.3.0",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#550634a",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#5710d52",
"axios": "^1.6.8",
"dotenv": "^16.3.1",
"dotenv-expand": "^10.0.0",
Expand Down
8 changes: 4 additions & 4 deletions e2e/tests/api-driven/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions e2e/tests/api-driven/src/invite-to-pay/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export async function buildITPFlow({
const flowId: string = await $admin.flow.create({
teamId,
slug: `test-invite-to-pay-flow-with-send-to-${destination.toLowerCase()}`,
status: "online",
data: flowGraph,
});
const publishedFlowId = await $admin.flow.publish({
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/ui-driven/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"postinstall": "./install-dependencies.sh"
},
"dependencies": {
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#550634a",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#5710d52",
"axios": "^1.6.8",
"dotenv": "^16.3.1",
"eslint": "^8.56.0",
Expand Down
8 changes: 4 additions & 4 deletions e2e/tests/ui-driven/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions e2e/tests/ui-driven/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export async function setUpTestContext(
slug: context.flow.slug,
teamId: context.team.id,
data: context.flow!.data!,
status: "online",
});
context.flow.publishedId = await $admin.flow.publish({
flow: {
Expand Down
46 changes: 46 additions & 0 deletions e2e/tests/ui-driven/src/create-flow/create-flow.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,52 @@ test.describe("Navigation", () => {
await expect(previewLink).toBeVisible();
});

test("Cannot preview an offline flow", async ({
browser,
}: {
browser: Browser;
}) => {
const page = await createAuthenticatedSession({
browser,
userId: context.user!.id!,
});

await page.goto(
`/${context.team.slug}/${serviceProps.slug}/published?analytics=false`,
);

await expect(page.getByText("Not Found")).toBeVisible();
});

test("Turn a flow online", async ({ browser }) => {
const page = await createAuthenticatedSession({
browser,
userId: context.user!.id!,
});

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

// Open flow settings
// TODO: Access via sidebar when EDITOR_NAVIGATION flag is removed
page.getByLabel("Toggle Menu").click();
page.getByText("Flow Settings").click();

// Toggle flow online
page.getByLabel("Offline").click();
page.getByRole("button", { name: "Save", disabled: false }).click();
await expect(
page.getByText("Service settings updated successfully"),
).toBeVisible();

// Exit back to main Editor page
page.getByRole("link", { name: "Close" }).click();

const previewLink = page.getByRole("link", {
name: "Open published service",
});
await expect(previewLink).toBeVisible();
});

test("Can preview a published flow", async ({
browser,
}: {
Expand Down

0 comments on commit 95235e6

Please sign in to comment.