diff --git a/cypress/e2e/sites.spec.ts b/cypress/e2e/sites.spec.ts deleted file mode 100644 index 2136850a4..000000000 --- a/cypress/e2e/sites.spec.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { - CMS_BASEURL, - Interceptors, - TEST_REPO_NAME, -} from "../fixtures/constants" - -describe("Sites page", () => { - beforeEach(() => { - cy.setGithubSessionDefaults() - cy.setupDefaultInterceptors() - }) - - it("Sites page should have sites header", () => { - cy.visit(`${CMS_BASEURL}/sites`).wait(Interceptors.GET) - cy.contains("Get help").should("exist") - }) - - it("Sites page should allow user to click into a test site repo", () => { - cy.visit(`${CMS_BASEURL}/sites`) - // NOTE: `/whoami` and `/sites` - .wait(Interceptors.GET) - .wait(Interceptors.GET) - - cy.contains("Loading sites").should("not.exist") - - cy.contains(TEST_REPO_NAME).click() - cy.url().should( - "include", - `${CMS_BASEURL}/sites/${TEST_REPO_NAME}/workspace` - ) - }) -}) diff --git a/e2e/sites.spec.ts b/e2e/sites.spec.ts new file mode 100644 index 000000000..f71796cd4 --- /dev/null +++ b/e2e/sites.spec.ts @@ -0,0 +1,38 @@ +import { test, expect, Page } from "@playwright/test" + +import { E2E_EMAIL_TEST_SITE } from "./fixtures/constants" +import { setEmailSessionDefaults } from "./utils/session" + +test.describe("Sites flow", () => { + test.beforeEach(async ({ page, context }) => { + setEmailSessionDefaults(context, "Email admin") + await page.goto(`/sites`) + }) + + test("Sites page should have sites header", async ({ page }) => { + const closeButton = page.getByRole("button", { name: "Close" }) + await closeButton.click() + + const header = page.getByText("Get help") + + await expect(header).toBeVisible() + }) + + test("Sites page should allow user to click into a test site repo", async ({ + page, + }) => { + // Arrange + await page.waitForLoadState("domcontentloaded") + const closeButton = page.getByRole("button", { name: "Close" }) + await closeButton.click() + const site = page.getByRole("link", { name: E2E_EMAIL_TEST_SITE.repo }) + + // Act + await site.click() + + // Assert + await expect(page.url()).toContain( + `/sites/${E2E_EMAIL_TEST_SITE.repo}/dashboard` + ) + }) +})