From 5595b9bccd86e33775fcedbd7b795fd3a00e457a Mon Sep 17 00:00:00 2001 From: Daniel Clarke Date: Thu, 7 Nov 2024 16:12:13 +0000 Subject: [PATCH] test --- .../playwright/tests/smoke-tests.spec.ts | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/tests/Dfe.EarlyYearsQualification.SmokeTests/playwright/tests/smoke-tests.spec.ts b/tests/Dfe.EarlyYearsQualification.SmokeTests/playwright/tests/smoke-tests.spec.ts index 1e93064b..da520735 100644 --- a/tests/Dfe.EarlyYearsQualification.SmokeTests/playwright/tests/smoke-tests.spec.ts +++ b/tests/Dfe.EarlyYearsQualification.SmokeTests/playwright/tests/smoke-tests.spec.ts @@ -1,41 +1,49 @@ import { test, expect } from '@playwright/test'; test.describe("A spec used to smoke test the environment once a deployment has happened", () => { - test.beforeEach(async ({ page , context}) => { + test("should return search results", async ({ page }) => { + + // attempt to set cookie and navigate to start page await context.addCookies([ { name: 'auth-secret', value: process.env.AUTH_SECRET, path: '/', domain: process.env.WEBAPP_URL } ]); + await page.goto("/"); - await expect(page.getByTestId("start-button")).toBeVisible(); - }); - - test("should return search results", async ({ page }) => { + + //if we end up navigated to the challenge page, then fill in the password and continue + if (page.url().includes("challenge")) { + await page.locator("#PasswordValue").type(process.env.AUTH_SECRET); + await page.locator("#question-submit").click(); + await page.waitForURL("/"); + } + // home page + await expect(page.getByTestId("start-button")).toBeVisible(); await page.getByTestId("start-button").click(); - await page.waitForURL("/questions/where-was-the-qualification-awarded"); // where-was-the-qualification-awarded page + await page.waitForURL("/questions/where-was-the-qualification-awarded"); await page.locator("#england").click(); await page.locator("#question-submit").click(); - await page.waitForURL("/questions/when-was-the-qualification-started"); // when-was-the-qualification-started page + await page.waitForURL("/questions/when-was-the-qualification-started"); await page.locator("#date-started-month").type("7"); await page.locator("#date-started-year").type("2015"); await page.locator("#question-submit").click(); - await page.waitForURL("/questions/what-level-is-the-qualification"); // what-level-is-the-qualification page + await page.waitForURL("/questions/what-level-is-the-qualification"); await page.locator("#0").click(); await page.locator("#question-submit").click(); - await page.waitForURL("/questions/what-is-the-awarding-organisation"); // what-is-the-awarding-organisation page + await page.waitForURL("/questions/what-is-the-awarding-organisation"); await page.locator("#awarding-organisation-not-in-list").click(); await page.locator("#question-submit").click(); - await page.waitForURL("/qualifications"); // qualifications page + await page.waitForURL("/qualifications"); // If this shows then no qualifications are getting returned indicating possible issue await expect(page.locator("#no-result-content")).not.toBeVisible(); });