Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test[e2e]: add more components to create-flow test #3630

Merged
merged 34 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b11f728
Add more guidance to readme
jamdelion Sep 3, 2024
1700ad9
Extract out createQuestion and createNotice helpers
jamdelion Sep 3, 2024
f3b6848
Add checklist component to flow
jamdelion Sep 3, 2024
4aea059
Prettier
jamdelion Sep 3, 2024
9c89e5d
Create text input
jamdelion Sep 3, 2024
8fac0eb
Add number input
jamdelion Sep 3, 2024
f3a796a
Create date input
jamdelion Sep 3, 2024
1a1b618
Prettier
jamdelion Sep 3, 2024
414dff4
Use uuid for random id
jamdelion Sep 2, 2024
71e1a37
Address input component
jamdelion Sep 4, 2024
42a5338
Add contact input
jamdelion Sep 4, 2024
a4458b5
Restructure helper files
jamdelion Sep 4, 2024
5b523a5
Prettier
jamdelion Sep 4, 2024
f18162a
Merge branch 'main' into jh/playwright-initial
jamdelion Sep 4, 2024
107e7ae
Refactor to use createBaseInput helper
jamdelion Sep 4, 2024
5efb97a
Prettier again
jamdelion Sep 4, 2024
7cf8e6b
Merge branch 'main' into jh/playwright-more-components
jamdelion Sep 5, 2024
fbafa6e
Add tasklist component
jamdelion Sep 5, 2024
f120cef
Add review component
jamdelion Sep 5, 2024
d753c08
Add find property node
jamdelion Sep 5, 2024
4ac804d
Add planning contraints component
jamdelion Sep 5, 2024
888f26b
Add draw boundary component
jamdelion Sep 5, 2024
a3af6fd
Use an enum instead of magic strings
jamdelion Sep 5, 2024
fe9d645
Lint fix
jamdelion Sep 5, 2024
d48a205
Create next steps component
jamdelion Sep 5, 2024
614626e
Lint fix again
jamdelion Sep 5, 2024
fa6ce2e
Add file upload component
jamdelion Sep 5, 2024
ceba074
I really need to learn to run lint fix before committing
jamdelion Sep 5, 2024
780964a
getNextNode as function
jamdelion Sep 16, 2024
e3eaf8d
Simplify button selector and use existing enum from planx-core
jamdelion Sep 16, 2024
658b48e
Add linting to husky for e2e dir
jamdelion Sep 16, 2024
24d2bd6
Test lint
jamdelion Sep 16, 2024
a58a216
Fix linting
jamdelion Sep 16, 2024
4529ca3
Remove husky changes
jamdelion Sep 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api.planx.uk/.husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
cd api.planx.uk
pnpm dlx lint-staged
pnpm dlx lint-staged
57 changes: 42 additions & 15 deletions e2e/tests/ui-driven/src/create-flow/create-flow.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@ import {
createChecklist,
createContactInput,
createDateInput,
createDrawBoundary,
createFileUpload,
createFindProperty,
createNextSteps,
createNotice,
createNumberInput,
createPlanningConstraints,
createQuestionWithOptions,
createReview,
createTaskList,
createTextInput,
} from "../helpers/addComponent";
import type { Context } from "../helpers/context";
Expand Down Expand Up @@ -142,39 +149,49 @@ test.describe("Navigation", () => {
noBranchNoticeText,
);

// TODO: find a nicer way to find the next node
let nextNode = page.locator(".hanger > a").nth(5);
await createChecklist(page, nextNode, "A checklist title", [
const getNextNode = () => page.locator(".hanger > a").last();

await createChecklist(page, getNextNode(), "A checklist title", [
"Checklist item 1",
"Second checklist item",
"The third checklist item",
]);

nextNode = page.locator(".hanger > a").nth(7);
await createTextInput(page, nextNode, "Tell us about your trees.");

nextNode = page.locator(".hanger > a").nth(8);
await createNumberInput(page, nextNode, "How old are you?", "years");

nextNode = page.locator(".hanger > a").nth(9);
await createDateInput(page, nextNode, "When is your birthday?");
await createTextInput(page, getNextNode(), "Tell us about your trees.");
await createNumberInput(page, getNextNode(), "How old are you?", "years");
await createDateInput(page, getNextNode(), "When is your birthday?");

nextNode = page.locator(".hanger > a").nth(10);
await createAddressInput(
page,
nextNode,
getNextNode(),
"What is your address?",
"some data field",
);

nextNode = page.locator(".hanger > a").nth(11);
await createContactInput(
page,
nextNode,
getNextNode(),
"What is your contact info?",
"some data field",
);

await createTaskList(page, getNextNode(), "What you should do next", [
"Have a cup of tea",
"Continue through this flow",
]);

await createFindProperty(page, getNextNode());
await createDrawBoundary(page, getNextNode());
await createPlanningConstraints(page, getNextNode());
await createFileUpload(page, getNextNode(), "some data field");

await createNextSteps(page, getNextNode(), [
"A possible next step",
"Another option",
]);

await createReview(page, getNextNode());

const nodes = page.locator(".card");
await expect(nodes.getByText(questionText)).toBeVisible();
await expect(nodes.getByText(yesBranchNoticeText)).toBeVisible();
Expand All @@ -185,6 +202,16 @@ test.describe("Navigation", () => {
await expect(nodes.getByText("When is your birthday?")).toBeVisible();
await expect(nodes.getByText("What is your address?")).toBeVisible();
await expect(nodes.getByText("What is your contact info?")).toBeVisible();
await expect(nodes.getByText("What you should do next")).toBeVisible();
await expect(nodes.getByText("Find property")).toBeVisible();
await expect(nodes.getByText("Confirm your location plan")).toBeVisible();
await expect(nodes.getByText("Planning constraints")).toBeVisible();
await expect(nodes.getByText("File upload")).toBeVisible();

await expect(nodes.getByText("Next steps")).toBeVisible();
await expect(
nodes.getByText("Check your answers before sending your application"),
).toBeVisible();
});

test("Cannot preview an unpublished flow", async ({
Expand Down
Loading
Loading