Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielClarkeEducation committed Nov 7, 2024
1 parent 47c93a0 commit 5595b9b
Showing 1 changed file with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -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();
});
Expand Down

0 comments on commit 5595b9b

Please sign in to comment.