diff --git a/test/e2e/tests/a11y/index.spec.ts b/test/e2e/tests/a11y/index.spec.ts index 637148ce3f..d61044fe01 100644 --- a/test/e2e/tests/a11y/index.spec.ts +++ b/test/e2e/tests/a11y/index.spec.ts @@ -1,34 +1,11 @@ import { test, expect } from "@playwright/test"; import AxeBuilder from "@axe-core/playwright"; +import * as routes from "../fixtures/routes"; -const staticRoutes = [ - "/", - "/dashboard", - "/faq", - "/profile", - "/new-submission", - "/new-submission/spa", - "/new-submission/spa/medicaid", - "/new-submission/spa/chip", - "/new-submission/waiver", - "/new-submission/waiver/b", - "/new-submission/waiver/b/b4", - "/new-submission/waiver/b/capitated", - "/new-submission/spa/medicaid/landing/medicaid-eligibility", - "/new-submission/waiver/b/capitated/amendment/create", - "/new-submission/waiver/b/capitated/renewal/create", - "/new-submission/waiver/b/capitated/initial/create", - "/new-submission/waiver/b/b4/initial/create", - "/new-submission/waiver/b/b4/amendment/create", - "/new-submission/waiver/b/b4/renewal/create", - "/new-submission/spa/medicaid/create", - "/new-submission/spa/chip/create", - "/new-submission/waiver/app-k", - "/new-submission/waiver/temporary-extensions", -]; +const STATIC_ROUTES = routes.STATIC; -test.describe("test a11y on static routes", {tag: ["@CI"]}, () => { - for (const route of staticRoutes) { +test.describe("test a11y on static routes", {tag: ["@CI", "@a11y"] }, () => { + for (const route of STATIC_ROUTES) { test(`${route} should not have any automatically detectable accessibility issues`, async ({ page, }) => { @@ -44,34 +21,11 @@ test.describe("test a11y on static routes", {tag: ["@CI"]}, () => { } }); -const webformRoutes = [ - "/guides/abp", - "/webform/g3/202401", - "/webform/g2b/202401", - "/webform/g2a/202401", - "/webform/g1/202401", - "/webform/cs8/202401", - "/webform/cs3/202401", - "/webform/cs7/202401", - "/webform/abp11/202401", - "/webform/abp10/202401", - "/webform/abp9/202401", - "/webform/abp7/202401", - "/webform/abp6/202401", - "/webform/abp5/202401", - "/webform/abp4/202401", - "/webform/abp3_1/202401", - "/webform/abp3/202401", - "/webform/abp2c/202401", - "/webform/abp2b/202401", - "/webform/abp2a/202401", - "/webform/abp1/202401", - "/webform/abp1/202402", -]; +const WEBFORM_ROUTES = routes.WEBFORM; // Add to CI when prior to going to Prod -test.describe("test a11y on webform routes", {tag: ["@CI"]}, () => { - for (const route of webformRoutes) { +test.describe("test a11y on webform routes", {tag: ["@CI", "@a11y"] }, () => { + for (const route of WEBFORM_ROUTES) { test(`${route} should not have any automatically detectable accessibility issues`, async ({ page, }) => { diff --git a/test/e2e/tests/fixtures/routes.ts b/test/e2e/tests/fixtures/routes.ts new file mode 100644 index 0000000000..a88d3a2f56 --- /dev/null +++ b/test/e2e/tests/fixtures/routes.ts @@ -0,0 +1,50 @@ +export const STATIC = [ + "/", + "/dashboard", + "/faq", + "/profile", + "/new-submission", + "/new-submission/spa", + "/new-submission/spa/medicaid", + "/new-submission/spa/chip", + "/new-submission/waiver", + "/new-submission/waiver/b", + "/new-submission/waiver/b/b4", + "/new-submission/waiver/b/capitated", + "/new-submission/spa/medicaid/landing/medicaid-eligibility", + "/new-submission/waiver/b/capitated/amendment/create", + "/new-submission/waiver/b/capitated/renewal/create", + "/new-submission/waiver/b/capitated/initial/create", + "/new-submission/waiver/b/b4/initial/create", + "/new-submission/waiver/b/b4/amendment/create", + "/new-submission/waiver/b/b4/renewal/create", + "/new-submission/spa/medicaid/create", + "/new-submission/spa/chip/create", + "/new-submission/waiver/app-k", + "/new-submission/waiver/temporary-extensions", +]; + +export const WEBFORM = [ + "/guides/abp", + "/webform/g3/202401", + "/webform/g2b/202401", + "/webform/g2a/202401", + "/webform/g1/202401", + "/webform/cs8/202401", + "/webform/cs3/202401", + "/webform/cs7/202401", + "/webform/abp11/202401", + "/webform/abp10/202401", + "/webform/abp9/202401", + "/webform/abp7/202401", + "/webform/abp6/202401", + "/webform/abp5/202401", + "/webform/abp4/202401", + "/webform/abp3_1/202401", + "/webform/abp3/202401", + "/webform/abp2c/202401", + "/webform/abp2b/202401", + "/webform/abp2a/202401", + "/webform/abp1/202401", + "/webform/abp1/202402", +]; \ No newline at end of file diff --git a/test/e2e/tests/perf/index.spec.ts b/test/e2e/tests/perf/index.spec.ts new file mode 100644 index 0000000000..51071f7115 --- /dev/null +++ b/test/e2e/tests/perf/index.spec.ts @@ -0,0 +1,42 @@ +import { test } from "@playwright/test"; +import * as routes from "../fixtures/routes"; + +const STATIC_ROUTES = routes.STATIC; + +test.describe("test performance on static routes", { tag: ["@perf"] }, () => { + for (const route of STATIC_ROUTES) { + test(`Time to First Byte for ${route}`, { tag: ["@ttfb"] }, async({ page }) => { + await page.goto(route); + const ttfb = await page.evaluate(() => performance.timing.responseStart - performance.timing.requestStart) + console.log(`TTFB for ${route}: ${ttfb} ms`); + }); + + test(`Largest Contentful Paint for ${route}`, { tag: ["@lcp"] }, async ({ page }) => { + await page.goto(route); + const lcp = await page.evaluate(async () => { + return new Promise((resolve) => { + new PerformanceObserver((entryList) => { + const entries = entryList.getEntries(); + resolve(entries[entries.length - 1]); + }).observe({ type: 'largest-contentful-paint', buffered: true }); + }); + }); + + console.log(`Largest Contentful Paint for ${route} is: ${lcp.startTime} ms`); + }); + + test(`First Contentful Paint for ${route}`, { tag: ["@fcp"] }, async ({ page }) => { + await page.goto(route); + const fcp = await page.evaluate(async () => { + return new Promise((resolve) => { + new PerformanceObserver((entryList) => { + const entries = entryList.getEntries(); + resolve(entries[0]); + }).observe({ type: 'paint', buffered: true }); + }); + }); + + console.log(`First Contentful Paint for ${route} is: ${fcp.startTime} ms`); + }); + } +}); \ No newline at end of file