Skip to content

Commit

Permalink
✅ test: continue to add the test for vultr
Browse files Browse the repository at this point in the history
  • Loading branch information
futjesus committed Jan 8, 2025
1 parent 059ff63 commit 91fd7a5
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 33 deletions.
8 changes: 2 additions & 6 deletions cypress/e2e/create/physical-cluster.akamai.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ describe("Test to validate physical cluster creation on AKAMAI", () => {
it("should create a physical cluster", async () => {
physicalCluster.visitClusterPage();

const workloadButton = physicalCluster.getWorkloadClusterButton();

workloadButton.click();
physicalCluster.clickOnWorkloadClusterButton();

const region = physicalCluster.getRegion(cloudProvider);

Expand All @@ -41,9 +39,7 @@ describe("Test to validate physical cluster creation on AKAMAI", () => {
intanceSize: new RegExp("g6-standard-6", "i"),
});

const createCluterButton = physicalCluster.getButtonCreateCluster();

createCluterButton.click();
physicalCluster.clickOnCreateCluster();

cy.wait(2000);

Expand Down
10 changes: 4 additions & 6 deletions cypress/e2e/create/physical-cluster.civo.cy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import ms from "ms";

import { Account } from "../../../types/accouts";
import { PhysicalCluster } from "../../utils/create-cluster/physical";

const CLUSTER_NAME = Cypress.env("CLUSTER_NAME");
Expand Down Expand Up @@ -28,22 +29,21 @@ describe("Test to validate physical cluster creation on CIVO", () => {
it("should create a physical cluster", async () => {
physicalCluster.visitClusterPage();

const workloadButton = physicalCluster.getWorkloadClusterButton();
const cloudAccounts = physicalCluster.getClodAccounts();

cloudAccounts.then((cloudAccounts) => {
expect(cloudAccounts).to.be.an("array");
expect(cloudAccounts).to.have.length.greaterThan(0);

const defaultAccount = cloudAccounts.find(
(account) => account.name === "default"
(account: Account) => account.name === "default"
);

expect(defaultAccount).to.exist;

const region = physicalCluster.getRegion(cloudProvider);

workloadButton.click();
physicalCluster.clickOnWorkloadClusterButton();

region.then((region) => {
physicalCluster.filloutCivoForm({
Expand All @@ -52,9 +52,7 @@ describe("Test to validate physical cluster creation on CIVO", () => {
intanceSize: new RegExp("g4s.kube.small", "i"),
});

const createCluterButton = physicalCluster.getButtonCreateCluster();

createCluterButton.click();
physicalCluster.clickOnCreateCluster();

cy.wait(2000);

Expand Down
22 changes: 9 additions & 13 deletions cypress/e2e/create/physical-cluster.vultr.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@ describe("Test to validate physical cluster creation on VULTR", () => {
physicalCluster.login(username, password);
});

it("should create a physical cluster", async () => {
it.only("should create a physical cluster", async () => {
physicalCluster.visitClusterPage();

const workloadButton = physicalCluster.getWorkloadClusterButton();

workloadButton.click();
physicalCluster.clickOnWorkloadClusterButton();

const region = physicalCluster.getRegion(cloudProvider);

Expand All @@ -41,18 +39,16 @@ describe("Test to validate physical cluster creation on VULTR", () => {
intanceSize: new RegExp("g6-standard-6", "i"),
});

const createCluterButton = physicalCluster.getButtonCreateCluster();

createCluterButton.click();
// physicalCluster.clickOnCreateCluster();

cy.wait(2000);
// cy.wait(2000);

cy.findByRole("heading", {
name: new RegExp(CLUSTER_NAME, "i"),
timeout: Number(ms(MAX_TIME_TO_WAIT)),
}).should("exist");
// cy.findByRole("heading", {
// name: new RegExp(CLUSTER_NAME, "i"),
// timeout: Number(ms(MAX_TIME_TO_WAIT)),
// }).should("exist");

cy.contains("Provisioning").should("exist");
// cy.contains("Provisioning").should("exist");
});
});

Expand Down
16 changes: 10 additions & 6 deletions cypress/utils/create-cluster/physical/Physical.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,20 @@ export class PhysicalCluster extends PhysicalClusterClass {
cy.log("Visited cluster page");
}

getWorkloadClusterButton(): Cypress.Chainable<JQuery<HTMLElement>> {
cy.log("Getting workload cluster button");
clickOnWorkloadClusterButton() {
cy.log("Click on workload cluster button");

return cy.findByRole("button", { name: /add workload cluster/i });
const button = cy.findByRole("button", { name: /add workload cluster/i });

button.click();
}

getButtonCreateCluster(): Cypress.Chainable<JQuery<HTMLElement>> {
cy.log("Getting create cluster button");
clickOnCreateCluster() {
cy.log("Click on create cluster button");

const button = cy.findByRole("button", { name: /create cluster/i });

return cy.findByRole("button", { name: /create cluster/i });
button.click();
}

getClodAccounts(): Cypress.Chainable {
Expand Down
4 changes: 2 additions & 2 deletions cypress/utils/create-cluster/physical/Physical.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ type ClusterOptions = {
export abstract class PhysicalClusterClass {
abstract login(username: string, password: string): void;
abstract visitClusterPage(): void;
abstract getWorkloadClusterButton(): Cypress.Chainable<JQuery<HTMLElement>>;
abstract getButtonCreateCluster(): Cypress.Chainable<JQuery<HTMLElement>>;
abstract clickOnWorkloadClusterButton(): void;
abstract clickOnCreateCluster(): void;
abstract getClodAccounts(): Cypress.Chainable<Account[]>;
abstract getRegion(clusterName: string): Cypress.Chainable<string>;
abstract filloutAkamaiForm({
Expand Down

0 comments on commit 91fd7a5

Please sign in to comment.