Skip to content

Commit

Permalink
Updated Ci.yml file
Browse files Browse the repository at this point in the history
  • Loading branch information
david emioma committed Mar 15, 2024
1 parent 4601c2f commit 4bd0665
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ jobs:
TEST_USER_EMAIL: ${{ secrets.TEST_USER_EMAIL }}
TEST_USER_PASSWORD: ${{ secrets.TEST_USER_PASSWORD }}
TEST_USER_PRODUCT_ID: ${{ secrets.TEST_USER_PRODUCT_ID }}
VERCEL_PREVIEW_SESSION_ID: ${{ secrets.VERCEL_PREVIEW_SESSION_ID }}
VERCEL_PREVIEW_VC_SESSION_ID: ${{ secrets.VERCEL_PREVIEW_VC_SESSION_ID }}
VERCEL_PREVIEW_AUTHORISATION_ID: ${{ secrets.VERCEL_PREVIEW_AUTHORISATION_ID }}
VERCEL_PREVIEW_JWT: ${{ secrets.VERCEL_PREVIEW_JWT }}

deploy:
needs: test
Expand Down
5 changes: 5 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ export default defineConfig({
user_email: process.env.TEST_USER_EMAIL,
user_password: process.env.TEST_USER_PASSWORD,
public_url: process.env.CYPRESS_BASE_URL,

vercel_session_id: process.env.VERCEL_PREVIEW_SESSION_ID,
vercel_vc_session_id: process.env.VERCEL_PREVIEW_VC_SESSION_ID,
vercel_authorisaion_id: process.env.VERCEL_PREVIEW_AUTHORISATION_ID,
vercel_jwt: process.env.VERCEL_PREVIEW_JWT,
},
},
});
2 changes: 2 additions & 0 deletions cypress/e2e/login.cy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
describe("Login Form", () => {
beforeEach(() => {
cy.bypassVercelAuth();

cy.visit(`${Cypress.env("public_url")}/auth/sign-in`);
});

Expand Down
2 changes: 2 additions & 0 deletions cypress/e2e/payment.cy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
describe("Cart and payment", () => {
beforeEach(() => {
cy.bypassVercelAuth();

cy.login(Cypress.env("user_email"), Cypress.env("user_password"));

cy.url({ timeout: 10000 }).should("include", "/");
Expand Down
2 changes: 2 additions & 0 deletions cypress/e2e/product.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import "cypress-file-upload";

describe("Product Form", () => {
beforeEach(() => {
cy.bypassVercelAuth();

cy.login(Cypress.env("auth_email"), Cypress.env("auth_password"));

cy.get('[data-cy="go-to-store"]', { timeout: 15000 }).should("be.visible");
Expand Down
2 changes: 2 additions & 0 deletions cypress/e2e/register.cy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
describe("Register Form", () => {
beforeEach(() => {
cy.bypassVercelAuth();

cy.visit(`${Cypress.env("public_url")}/auth/sign-up`);
});

Expand Down
2 changes: 2 additions & 0 deletions cypress/e2e/store.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import "cypress-file-upload";

describe("Store Form", () => {
beforeEach(() => {
cy.bypassVercelAuth();

cy.login(Cypress.env("auth_email"), Cypress.env("auth_password"));

cy.get('[data-cy="go-to-store"]', { timeout: 10000 }).should("be.visible");
Expand Down
2 changes: 2 additions & 0 deletions cypress/e2e/update-product.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ const formNum = 1;

describe("Update a product", () => {
beforeEach(() => {
cy.bypassVercelAuth();

cy.login(Cypress.env("auth_email"), Cypress.env("auth_password"));

cy.get('[data-cy="go-to-store"]', { timeout: 15000 }).should("be.visible");
Expand Down
2 changes: 2 additions & 0 deletions cypress/e2e/user.cy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
describe("Users Interactions", () => {
beforeEach(() => {
cy.bypassVercelAuth();

cy.login(Cypress.env("user_email"), Cypress.env("user_password"));

cy.url({ timeout: 10000 }).should("include", "/");
Expand Down
11 changes: 11 additions & 0 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,21 @@ declare global {
login(email: string, password: string): Chainable<void>;
addToCart(): Chainable<void>;
removeFromCart(): Chainable<void>;
bypassVercelAuth(): Chainable<void>;
}
}
}

Cypress.Commands.add("bypassVercelAuth", () => {
cy.setCookie("vercel_session_id", `${Cypress.env("vercel_session_id")}`);

cy.setCookie("authorization", `${Cypress.env("vercel_authorisaion_id")}`);

cy.setCookie("vc-session-id", `${Cypress.env("vercel_authorisaion_id")}`);

cy.setCookie("_vercel_jwt", `${Cypress.env("vercel_jwt")}`);
});

Cypress.Commands.add("login", (email: string, password: string) => {
cy.visit(`${Cypress.env("public_url")}/auth/sign-in`);

Expand Down

0 comments on commit 4bd0665

Please sign in to comment.