Skip to content

Commit

Permalink
Add feedback component to e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
jamdelion committed Nov 19, 2024
1 parent cc6c573 commit 4b2e0af
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 48 deletions.
7 changes: 7 additions & 0 deletions e2e/tests/ui-driven/src/create-flow.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ test.describe("Flow creation, publish and preview", () => {
await editor.createNextSteps();
await editor.createReview();
await editor.createConfirmation();
await editor.createFeedback();

await expect(editor.nodeList).toContainText([
"Is this a test?",
Expand All @@ -92,6 +93,7 @@ test.describe("Flow creation, publish and preview", () => {
"Next steps",
"Check your answers before sending your application",
"Confirmation",
"Tell us what you think"
]);
});

Expand Down Expand Up @@ -293,5 +295,10 @@ test.describe("Flow creation, publish and preview", () => {
await expect(
page.locator("h1", { hasText: "Application sent" }),
).toBeVisible();
await clickContinue({ page });
await expect(
page.locator("h1", { hasText: "Tell us what you think" }),
).toBeVisible();

});
});
73 changes: 39 additions & 34 deletions e2e/tests/ui-driven/src/helpers/addComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const createBaseComponent = async (
locatingNode: Locator,
type: ComponentType,
title?: string,
options?: string[],
options?: string[]
) => {
await locatingNode.click();
await page.getByRole("dialog").waitFor();
Expand Down Expand Up @@ -114,6 +114,7 @@ const createBaseComponent = async (
.fill(options?.[0] || "");
break;
case ComponentType.Filter:
case ComponentType.Feedback:
break;
case ComponentType.InternalPortal:
await page.getByPlaceholder("Portal name").fill(title || "");
Expand All @@ -129,128 +130,128 @@ export const createQuestionWithOptions = async (
page: Page,
locatingNode: Locator,
questionText: string,
options: string[],
options: string[]
) => {
await createBaseComponent(
page,
locatingNode,
ComponentType.Question,
questionText,
options,
options
);
};

export const createNotice = async (
page: Page,
locatingNode: Locator,
noticeText: string,
noticeText: string
) => {
await createBaseComponent(
page,
locatingNode,
ComponentType.Notice,
noticeText,
noticeText
);
};

export const createChecklist = async (
page: Page,
locatingNode: Locator,
checklistTitle: string,
checklistOptions: string[],
checklistOptions: string[]
) => {
await createBaseComponent(
page,
locatingNode,
ComponentType.Checklist,
checklistTitle,
checklistOptions,
checklistOptions
);
};

export const createTextInput = async (
page: Page,
locatingNode: Locator,
inputTitle: string,
inputTitle: string
) => {
await createBaseComponent(
page,
locatingNode,
ComponentType.TextInput,
inputTitle,
inputTitle
);
};

export const createNumberInput = async (
page: Page,
locatingNode: Locator,
inputTitle: string,
inputUnits: string,
inputUnits: string
) => {
await createBaseComponent(
page,
locatingNode,
ComponentType.NumberInput,
inputTitle,
[inputUnits],
[inputUnits]
);
};

export const createDateInput = async (
page: Page,
locatingNode: Locator,
inputTitle: string,
inputTitle: string
) => {
await createBaseComponent(
page,
locatingNode,
ComponentType.DateInput,
inputTitle,
inputTitle
);
};

export const createAddressInput = async (
page: Page,
locatingNode: Locator,
inputTitle: string,
inputDataField: string,
inputDataField: string
) => {
await createBaseComponent(
page,
locatingNode,
ComponentType.AddressInput,
inputTitle,
[inputDataField],
[inputDataField]
);
};

export const createContactInput = async (
page: Page,
locatingNode: Locator,
inputTitle: string,
inputDataField: string,
inputDataField: string
) => {
await createBaseComponent(
page,
locatingNode,
ComponentType.ContactInput,
inputTitle,
[inputDataField],
[inputDataField]
);
};

export const createTaskList = async (
page: Page,
locatingNode: Locator,
title: string,
taskListOptions: string[],
taskListOptions: string[]
) => {
await createBaseComponent(
page,
locatingNode,
ComponentType.TaskList,
title,
taskListOptions,
taskListOptions
);
};

Expand All @@ -264,12 +265,12 @@ export const createFindProperty = async (page: Page, locatingNode: Locator) => {

export const createPlanningConstraints = async (
page: Page,
locatingNode: Locator,
locatingNode: Locator
) => {
await createBaseComponent(
page,
locatingNode,
ComponentType.PlanningConstraints,
ComponentType.PlanningConstraints
);
};

Expand All @@ -280,35 +281,35 @@ export const createDrawBoundary = async (page: Page, locatingNode: Locator) => {
export const createNextSteps = async (
page: Page,
locatingNode: Locator,
nextSteps: string[],
nextSteps: string[]
) => {
await createBaseComponent(
page,
locatingNode,
ComponentType.NextSteps,
undefined,
nextSteps,
nextSteps
);
};

export const createFileUpload = async (
page: Page,
locatingNode: Locator,
dataField: string,
dataField: string
) => {
await createBaseComponent(
page,
locatingNode,
ComponentType.FileUpload,
undefined,
[dataField],
[dataField]
);
};

async function createComponentOptions(
options: string[],
buttonText: string,
page: Page,
page: Page
) {
let index = 0;
for (const option of options) {
Expand All @@ -322,14 +323,14 @@ export const createList = async (
page: Page,
locatingNode: Locator,
inputTitle: string,
inputDataField: string,
inputDataField: string
) => {
await createBaseComponent(
page,
locatingNode,
ComponentType.List,
inputTitle,
[inputDataField],
[inputDataField]
);
};

Expand All @@ -345,28 +346,28 @@ export const createUploadAndLabel = async (
page: Page,
locatingNode: Locator,
fileType: string,
dataField: string,
dataField: string
) => {
await createBaseComponent(
page,
locatingNode,
ComponentType.FileUploadAndLabel,
undefined,
[fileType, dataField],
[fileType, dataField]
);
};

export const createContent = async (
page: Page,
locatingNode: Locator,
content: string,
content: string
) => {
await createBaseComponent(
page,
locatingNode,
ComponentType.Content,
undefined,
[content],
[content]
);
};

Expand All @@ -377,12 +378,16 @@ export const createFilter = async (page: Page, locatingNode: Locator) => {
export const createInternalPortal = async (
page: Page,
locatingNode: Locator,
portalName: string,
portalName: string
) => {
await createBaseComponent(
page,
locatingNode,
ComponentType.InternalPortal,
portalName,
portalName
);
};

export const createFeedback = async (page: Page, locatingNode: Locator) => {
await createBaseComponent(page, locatingNode, ComponentType.Feedback);
};
Loading

0 comments on commit 4b2e0af

Please sign in to comment.