Skip to content

Commit

Permalink
✅ chore: some changes were did it
Browse files Browse the repository at this point in the history
  • Loading branch information
futjesus committed Dec 17, 2024
1 parent d0a1b7b commit c5c1e2d
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CLUSTER_DOMAIN=
PASSWORD=
USERNAME=
RETRY_DELAY=10000
RETRY_DELAY=20s
CLOUD_PROVIDER= aws| civo
MAX_TIME_TO_WAIT=5m
RETRIES_RUN_MODE=3
Expand Down
2 changes: 2 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineConfig } from "cypress";
import ms from "ms";
import "dotenv/config";

import {
Expand Down Expand Up @@ -30,5 +31,6 @@ export default defineConfig({
applyAtlantisPlan,
});
},
pageLoadTimeout: Number(ms("10m")),
},
});
23 changes: 14 additions & 9 deletions cypress/e2e/atlantis.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ms from "ms";
const MAX_TIME_TO_WAIT = Cypress.env("MAX_TIME_TO_WAIT");

describe("Test atlantis is working correctly", () => {
before(() => {
beforeEach(() => {
const username = Cypress.env("USERNAME");
const password = Cypress.env("PASSWORD");

Expand All @@ -23,7 +23,7 @@ describe("Test atlantis is working correctly", () => {
},
}).then((response) => {
expect(response.status).to.eq(200);
expect(response.body.length).to.equal(2);
expect(response.body.length).to.greaterThan(0);

const [cluster] = response.body;

Expand All @@ -38,7 +38,7 @@ describe("Test atlantis is working correctly", () => {
});
});

it("should do a login and validate cluster data", async () => {
it("should verify the atlantis is up", async () => {
cy.get("@clusterData").then((cluster: any) => {
const { subdomain_name: subdomain, domain_name: domain } = cluster;

Expand All @@ -50,7 +50,7 @@ describe("Test atlantis is working correctly", () => {
});
});

it.only("should create a PR inside the github page", () => {
it("should create a PR inside the github page", () => {
cy.get("@clusterData").then(({ git_auth }: any) => {
const { gitToken, gitOwner, gitUsername } = camelcaseKeys(git_auth);

Expand Down Expand Up @@ -79,18 +79,21 @@ describe("Test atlantis is working correctly", () => {
}).then(({ createPullRequest }: any) => {
if (createPullRequest) {
cy.get("@clusterData").then((cluster: any) => {
const { subdomain_name: subdomain, domain_name: domain } =
cluster;
const {
subdomain_name: subdomain,
domain_name: domain,
git_auth: git,
} = cluster;

cy.wait(10000);
cy.wait(20000);

if (subdomain) {
cy.visit(`https://atlantis.${subdomain}.${domain}`);
} else {
cy.visit(`https://atlantis.${domain}`);
}

cy.findAllByText(/k1-civo\/gitops/i, {
cy.findAllByText(new RegExp(`${git.git_owner}/gitops`, "i"), {
timeout: Number(ms(MAX_TIME_TO_WAIT)),
}).should("exist");

Expand All @@ -105,7 +108,9 @@ describe("Test atlantis is working correctly", () => {
if (apply) {
cy.wait(50000);
cy.reload();
cy.findAllByText(/k1-civo\/gitops/i).should("not.exist");
cy.findAllByText(
new RegExp(`${git.git_owner}/gitops`, "i")
).should("not.exist");
}
});
});
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/create/physical-cluster.civo.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ describe("Test to validate physical cluster creation", () => {
cy.contains("Provisioning").should("exist");
});

it.skip("should validate the cluster is provisioning", () => {
it("should validate the cluster is provisioning", () => {
cy.visit("/");

cy.goClusters();
Expand Down
6 changes: 4 additions & 2 deletions cypress/support/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import ms from "ms";

afterEach(function () {
if (this.currentTest.state === "failed") {
const retryDelay = Cypress.env("RETRY_DELAY");
const retryDelay = Number(ms(Cypress.env("RETRY_DELAY")));

cy.wait(+retryDelay);
cy.wait(retryDelay);
}
});

0 comments on commit c5c1e2d

Please sign in to comment.