From ba44ccad2f58109c9c67a135b2b837bd20a4924f Mon Sep 17 00:00:00 2001 From: Alexander Lee Date: Fri, 14 Jul 2023 09:53:21 +0800 Subject: [PATCH] chore: update settings fixture to use email login --- cypress/support/settings.ts | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/cypress/support/settings.ts b/cypress/support/settings.ts index bb5f349e8..1d1c77d89 100644 --- a/cypress/support/settings.ts +++ b/cypress/support/settings.ts @@ -1,26 +1,36 @@ import { BASE_SEO_LINK, - COOKIE_NAME, - COOKIE_VALUE, - E2E_USER, - LOCAL_STORAGE_USERID_KEY, - LOCAL_STORAGE_USER_KEY, + E2E_EMAIL_TEST_SITE, TEST_PRIMARY_COLOR, TEST_REPO_NAME, } from "../fixtures/constants" -import { setCookieWithDomain } from "../utils/cookies" Cypress.Commands.add("saveSettings", () => { - cy.intercept("POST", "/v2/sites/e2e-test-repo/settings").as("awaitSave") + cy.intercept("POST", `/v2/sites/${E2E_EMAIL_TEST_SITE.repo}/settings`).as( + "awaitSave" + ) + cy.intercept( + "POST", + `/v2/sites/${E2E_EMAIL_TEST_SITE.repo}/settings/repo-password` + ).as("awaitSavePassword") cy.contains("button", "Save").click() - cy.wait("@awaitSave") + cy.wait(["@awaitSavePassword", "@awaitSave"], { + timeout: 10000, + requestTimeout: 10000, + }) }) // Reusable visit command Cypress.Commands.add("visitLoadSettings", (siteName, sitePath) => { cy.intercept("GET", `/v2/sites/${siteName}/settings`).as("awaitSettings") + cy.intercept("GET", `/v2/sites/${siteName}/settings/repo-password`).as( + "awaitPassword" + ) cy.visit(sitePath) - cy.wait("@awaitSettings") + cy.wait(["@awaitPassword", "@awaitSettings"], { + timeout: 10000, + requestTimeout: 10000, + }) }) Cypress.Commands.add("setDefaultSettings", () => {