From 5899401ec5a94c9693adf124250724dadba88d11 Mon Sep 17 00:00:00 2001 From: Jo Humphrey <31373245+jamdelion@users.noreply.github.com> Date: Mon, 30 Sep 2024 15:20:17 +0100 Subject: [PATCH 1/6] Test that can add a filter into the flow --- e2e/tests/ui-driven/src/create-flow.spec.ts | 4 ++++ e2e/tests/ui-driven/src/helpers/addComponent.ts | 7 ++++++- e2e/tests/ui-driven/src/pages/Editor.ts | 5 +++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/e2e/tests/ui-driven/src/create-flow.spec.ts b/e2e/tests/ui-driven/src/create-flow.spec.ts index f9b92265b9..acdb18003d 100644 --- a/e2e/tests/ui-driven/src/create-flow.spec.ts +++ b/e2e/tests/ui-driven/src/create-flow.spec.ts @@ -68,6 +68,9 @@ test.describe("Flow creation, publish and preview", () => { await editor.createList(); await editor.createTaskList(); await editor.createContent(); + await editor.createFilter(); + // create internal portal + // create external portal await editor.createResult(); await editor.createNextSteps(); await editor.createReview(); @@ -86,6 +89,7 @@ test.describe("Flow creation, publish and preview", () => { "A list title", "What you should do next", "Some content", + "(Flags Filter)", "Planning permission", // default result flag "Next steps", "Check your answers before sending your application", diff --git a/e2e/tests/ui-driven/src/helpers/addComponent.ts b/e2e/tests/ui-driven/src/helpers/addComponent.ts index 61cbec97de..48818a2d08 100644 --- a/e2e/tests/ui-driven/src/helpers/addComponent.ts +++ b/e2e/tests/ui-driven/src/helpers/addComponent.ts @@ -112,7 +112,8 @@ const createBaseComponent = async ( await page .locator("p[data-placeholder='Content']") .fill(options?.[0] || ""); - + break; + case ComponentType.Filter: break; default: throw new Error(`Unsupported type: ${type}`); @@ -365,3 +366,7 @@ export const createContent = async ( [content], ); }; + +export const createFilter = async (page: Page, locatingNode: Locator) => { + await createBaseComponent(page, locatingNode, ComponentType.Filter); +}; diff --git a/e2e/tests/ui-driven/src/pages/Editor.ts b/e2e/tests/ui-driven/src/pages/Editor.ts index 9891e8b1d6..8de245d1f8 100644 --- a/e2e/tests/ui-driven/src/pages/Editor.ts +++ b/e2e/tests/ui-driven/src/pages/Editor.ts @@ -8,6 +8,7 @@ import { createDateInput, createDrawBoundary, createFileUpload, + createFilter, createFindProperty, createList, createNextSteps, @@ -205,4 +206,8 @@ export class PlaywrightEditor { async createContent() { await createContent(this.page, this.getNextNode(), "Some content"); } + + async createFilter() { + await createFilter(this.page, this.getNextNode()); + } } From 405bc28fb900ce8c5a4d4ec5f1efda8d3fc6611f Mon Sep 17 00:00:00 2001 From: Jo Humphrey <31373245+jamdelion@users.noreply.github.com> Date: Mon, 30 Sep 2024 15:34:05 +0100 Subject: [PATCH 2/6] Add internal portal test --- e2e/tests/ui-driven/src/create-flow.spec.ts | 3 ++- e2e/tests/ui-driven/src/helpers/addComponent.ts | 16 ++++++++++++++++ e2e/tests/ui-driven/src/pages/Editor.ts | 9 +++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/e2e/tests/ui-driven/src/create-flow.spec.ts b/e2e/tests/ui-driven/src/create-flow.spec.ts index acdb18003d..9082efcca9 100644 --- a/e2e/tests/ui-driven/src/create-flow.spec.ts +++ b/e2e/tests/ui-driven/src/create-flow.spec.ts @@ -69,7 +69,7 @@ test.describe("Flow creation, publish and preview", () => { await editor.createTaskList(); await editor.createContent(); await editor.createFilter(); - // create internal portal + await editor.createInternalPortal(); // create external portal await editor.createResult(); await editor.createNextSteps(); @@ -90,6 +90,7 @@ test.describe("Flow creation, publish and preview", () => { "What you should do next", "Some content", "(Flags Filter)", + "an internal portal", "Planning permission", // default result flag "Next steps", "Check your answers before sending your application", diff --git a/e2e/tests/ui-driven/src/helpers/addComponent.ts b/e2e/tests/ui-driven/src/helpers/addComponent.ts index 48818a2d08..9b41eacf4e 100644 --- a/e2e/tests/ui-driven/src/helpers/addComponent.ts +++ b/e2e/tests/ui-driven/src/helpers/addComponent.ts @@ -115,6 +115,9 @@ const createBaseComponent = async ( break; case ComponentType.Filter: break; + case ComponentType.InternalPortal: + await page.getByPlaceholder("Portal name").fill(title || ""); + break; default: throw new Error(`Unsupported type: ${type}`); } @@ -370,3 +373,16 @@ export const createContent = async ( export const createFilter = async (page: Page, locatingNode: Locator) => { await createBaseComponent(page, locatingNode, ComponentType.Filter); }; + +export const createInternalPortal = async ( + page: Page, + locatingNode: Locator, + portalName: string, +) => { + await createBaseComponent( + page, + locatingNode, + ComponentType.InternalPortal, + portalName, + ); +}; diff --git a/e2e/tests/ui-driven/src/pages/Editor.ts b/e2e/tests/ui-driven/src/pages/Editor.ts index 8de245d1f8..c06b4e6891 100644 --- a/e2e/tests/ui-driven/src/pages/Editor.ts +++ b/e2e/tests/ui-driven/src/pages/Editor.ts @@ -10,6 +10,7 @@ import { createFileUpload, createFilter, createFindProperty, + createInternalPortal, createList, createNextSteps, createNotice, @@ -210,4 +211,12 @@ export class PlaywrightEditor { async createFilter() { await createFilter(this.page, this.getNextNode()); } + + async createInternalPortal() { + await createInternalPortal( + this.page, + this.getNextNode(), + "an internal portal", + ); + } } From 47220f870e554fe4b62422e71e3271c7169cec1c Mon Sep 17 00:00:00 2001 From: Jo Humphrey <31373245+jamdelion@users.noreply.github.com> Date: Mon, 30 Sep 2024 15:42:55 +0100 Subject: [PATCH 3/6] Re-add in checklist test --- e2e/tests/ui-driven/src/create-flow.spec.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/e2e/tests/ui-driven/src/create-flow.spec.ts b/e2e/tests/ui-driven/src/create-flow.spec.ts index 9082efcca9..69b4544dbb 100644 --- a/e2e/tests/ui-driven/src/create-flow.spec.ts +++ b/e2e/tests/ui-driven/src/create-flow.spec.ts @@ -59,7 +59,7 @@ test.describe("Flow creation, publish and preview", () => { await editor.createQuestion(); await editor.createNoticeOnEachBranch(); - // await editor.createChecklist(); + await editor.createChecklist(); await editor.createTextInput(); await editor.createNumberInput(); await editor.createDateInput(); @@ -70,7 +70,6 @@ test.describe("Flow creation, publish and preview", () => { await editor.createContent(); await editor.createFilter(); await editor.createInternalPortal(); - // create external portal await editor.createResult(); await editor.createNextSteps(); await editor.createReview(); @@ -80,7 +79,7 @@ test.describe("Flow creation, publish and preview", () => { "Is this a test?", "Yes! this is a test", "Sorry, this is a test", - // "Checklist item 1", + "Checklist item 1", "Tell us about your trees.", "How old are you?", "When is your birthday?", From 76ad536b526ef2de4c0f9767ecba75e4c4dd96fc Mon Sep 17 00:00:00 2001 From: Jo Humphrey <31373245+jamdelion@users.noreply.github.com> Date: Mon, 30 Sep 2024 18:27:24 +0100 Subject: [PATCH 4/6] Update aws sso credentials doc --- doc/how-to/how-to-setup-aws-sso-credentials.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/how-to/how-to-setup-aws-sso-credentials.md b/doc/how-to/how-to-setup-aws-sso-credentials.md index 7cf3aae254..6d01566b64 100644 --- a/doc/how-to/how-to-setup-aws-sso-credentials.md +++ b/doc/how-to/how-to-setup-aws-sso-credentials.md @@ -4,9 +4,15 @@ This document describes the process of setting up credentials for your local AWS ## Process As part of onboarding, you should be set up to access AWS via [the SSO portal](https://opensystemslab.awsapps.com/start#/). Please ensure that you have set up and enabled MFA. -1. Download the AWS CLI -1. Run `aws configure sso` - the required details can be found via the SSO portal -1. For the "profile" field please use the format `planx-`, e.g. `planx-staging` +1. Download the AWS CLI - see https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html +1. Run `aws configure sso` - some of the required details can be found via [the SSO portal](https://opensystemslab.awsapps.com/start#/) in the 'Access keys' section: + - e.g. `SSO start URL` and `SSO Region` are listed under `AWS IAM Identity Center credentials (Recommended)`. + - `SSO registration scopes` can be left as the default (`sso:account:access`). +1. Allow access from the authorisation page that should open in your browser. +1. You should be prompted for more details in the terminal: + - `CLI default client region` should be `eu-west-2` + - `CLI default output format` should be `json` + - For the `CLI profile name` field, please use the format `planx-`, e.g. `planx-staging` 1. Repeat for all environments (staging, production) 1. Test! You should be able to call commands using the CLI, for example `aws sts get-caller-identity --profile planx-staging` and get the expected result. From 1425174cc33056587229e377d022a895cd3f1894 Mon Sep 17 00:00:00 2001 From: Jo Humphrey <31373245+jamdelion@users.noreply.github.com> Date: Mon, 30 Sep 2024 22:36:51 +0100 Subject: [PATCH 5/6] Move components to other test --- .../src/create-flow-with-geospatial.spec.ts | 6 ++++++ e2e/tests/ui-driven/src/create-flow.spec.ts | 18 ++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts b/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts index a5aa95f5b9..a456d2ca21 100644 --- a/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts +++ b/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts @@ -48,6 +48,8 @@ test.describe("Flow creation, publish and preview", () => { context.flow = { ...serviceProps }; await editor.createFindProperty(); + await editor.createFilter(); + await editor.createInternalPortal(); await editor.createUploadAndLabel(); // TODO: editor.createPropertyInfo() await editor.createDrawBoundary(); @@ -56,6 +58,8 @@ test.describe("Flow creation, publish and preview", () => { await expect(editor.nodeList).toContainText([ "Find property", + "(Flags Filter)", + "an internal portal", "Upload and label", "Confirm your location plan", "Planning constraints", @@ -106,6 +110,8 @@ test.describe("Flow creation, publish and preview", () => { ).toBeVisible(); await answerFindProperty(page); await clickContinue({ page }); + // TODO: answer filter? + // TODO: answer internal portal? // TODO: answer uploadAndLabel // TODO: answerPropertyInfo, answerDrawBoundary, answerPlanningConstraints }); diff --git a/e2e/tests/ui-driven/src/create-flow.spec.ts b/e2e/tests/ui-driven/src/create-flow.spec.ts index 69b4544dbb..8a17b5deb9 100644 --- a/e2e/tests/ui-driven/src/create-flow.spec.ts +++ b/e2e/tests/ui-driven/src/create-flow.spec.ts @@ -9,6 +9,7 @@ import { getTeamPage } from "./helpers/getPage"; import { createAuthenticatedSession } from "./helpers/globalHelpers"; import { answerAddressInput, + answerChecklist, answerContactInput, answerDateInput, answerListInput, @@ -68,8 +69,7 @@ test.describe("Flow creation, publish and preview", () => { await editor.createList(); await editor.createTaskList(); await editor.createContent(); - await editor.createFilter(); - await editor.createInternalPortal(); + await editor.createResult(); await editor.createNextSteps(); await editor.createReview(); @@ -88,8 +88,6 @@ test.describe("Flow creation, publish and preview", () => { "A list title", "What you should do next", "Some content", - "(Flags Filter)", - "an internal portal", "Planning permission", // default result flag "Next steps", "Check your answers before sending your application", @@ -206,12 +204,12 @@ test.describe("Flow creation, publish and preview", () => { ).toBeVisible(); await clickContinue({ page }); - // await answerChecklist({ - // page, - // title: "A checklist title", - // answers: ["Checklist item 1", "Second checklist item"], - // }); - // await clickContinue({ page }); + await answerChecklist({ + page, + title: "A checklist title", + answers: ["Checklist item 1", "Second checklist item"], + }); + await clickContinue({ page }); await answerTextInput(page, { expectedQuestion: "Tell us about your trees.", From 57368a6b03431201d2a4911768ee08b923ad187b Mon Sep 17 00:00:00 2001 From: Jo Humphrey <31373245+jamdelion@users.noreply.github.com> Date: Tue, 1 Oct 2024 12:46:27 +0100 Subject: [PATCH 6/6] Navigate through an internal portal --- .../src/create-flow-with-geospatial.spec.ts | 16 ++++++++++---- e2e/tests/ui-driven/src/pages/Editor.ts | 21 +++++++++++++++++++ 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts b/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts index a456d2ca21..691f83a257 100644 --- a/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts +++ b/e2e/tests/ui-driven/src/create-flow-with-geospatial.spec.ts @@ -48,8 +48,11 @@ test.describe("Flow creation, publish and preview", () => { context.flow = { ...serviceProps }; await editor.createFindProperty(); - await editor.createFilter(); + await expect(editor.nodeList).toContainText(["Find property"]); await editor.createInternalPortal(); + await editor.populateInternalPortal(); + await page.getByRole("link", { name: "start" }).click(); // return to main flow + await editor.createFilter(); await editor.createUploadAndLabel(); // TODO: editor.createPropertyInfo() await editor.createDrawBoundary(); @@ -58,8 +61,8 @@ test.describe("Flow creation, publish and preview", () => { await expect(editor.nodeList).toContainText([ "Find property", - "(Flags Filter)", - "an internal portal", + "an internal portalEdit Portal", + "(Flags Filter)ImmuneMissing informationPermission neededPrior approvalNoticePermitted developmentNot development(No Result)", "Upload and label", "Confirm your location plan", "Planning constraints", @@ -110,8 +113,13 @@ test.describe("Flow creation, publish and preview", () => { ).toBeVisible(); await answerFindProperty(page); await clickContinue({ page }); + + await expect( + page.locator("h1", { hasText: "A notice inside a portal!" }), + ).toBeVisible(); + await clickContinue({ page }); + // TODO: answer filter? - // TODO: answer internal portal? // TODO: answer uploadAndLabel // TODO: answerPropertyInfo, answerDrawBoundary, answerPlanningConstraints }); diff --git a/e2e/tests/ui-driven/src/pages/Editor.ts b/e2e/tests/ui-driven/src/pages/Editor.ts index c06b4e6891..eeda650d88 100644 --- a/e2e/tests/ui-driven/src/pages/Editor.ts +++ b/e2e/tests/ui-driven/src/pages/Editor.ts @@ -1,3 +1,5 @@ +import { ComponentType } from "@opensystemslab/planx-core/types"; + import { expect, type Locator, type Page } from "@playwright/test"; import { createAddressInput, @@ -46,6 +48,7 @@ export class PlaywrightEditor { this.yesBranch = page.locator("#flow .card .options .option").nth(0); this.noBranch = page.locator("#flow .card .options .option").nth(1); this.nodeList = page.locator(".card"); + this.answers = { questionText: "Is this a test?", yesBranchNoticeText: "Yes! this is a test", @@ -219,4 +222,22 @@ export class PlaywrightEditor { "an internal portal", ); } + + async populateInternalPortal() { + const internalPortalButton = this.page.getByRole("link", { + name: "an internal portal", + }); + await internalPortalButton.click(); + + // create a notice inside the portal + await this.page.locator(".hanger > a").last().click(); + await this.page.getByRole("dialog").waitFor(); + await this.page + .locator("select") + .selectOption({ value: ComponentType.Notice.toString() }); + await this.page + .getByPlaceholder("Notice") + .fill("A notice inside a portal!"); + await this.page.locator('button[form="modal"][type="submit"]').click(); + } }