-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✅ chore: ordering files to a better way to test on different providers
- Loading branch information
Showing
8 changed files
with
206 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import ms from "ms"; | ||
|
||
import { Account } from "../../types/accouts"; | ||
|
||
import { fillOutForm } from "./utils"; | ||
|
||
const CLUSTER_NAME = "test-cluster"; | ||
const isAWS = Cypress.env("CLOUD_PROVIDER") === "aws"; | ||
const MAX_TIME_TO_WAIT = Cypress.env("MAX_TIME_TO_WAIT"); | ||
|
||
describe("Test to validate physical cluster creation on AWS", () => { | ||
beforeEach(function () { | ||
if (!isAWS) { | ||
cy.log("This test is only for AWS"); | ||
|
||
this.skip(); | ||
} | ||
}); | ||
|
||
beforeEach(() => { | ||
const username = Cypress.env("USERNAME"); | ||
const password = Cypress.env("PASSWORD"); | ||
|
||
cy.login(username, password); | ||
}); | ||
|
||
it("should create a physical cluster", () => { | ||
cy.visit("/"); | ||
cy.findByRole("button", { name: /add workload cluster/i }).as("button"); | ||
|
||
cy.request("GET", "/api/proxy?url=%2Fcloud-account").then( | ||
({ status, body }) => { | ||
expect(status).to.eq(200); | ||
|
||
const { cloud_accounts: cloudAccounts } = body; | ||
cy.wrap(cloudAccounts as Account[]).as("accounts"); | ||
} | ||
); | ||
|
||
cy.get("@accounts").then((accounts) => { | ||
const cloudAccounts = accounts as unknown as Account[]; | ||
expect(cloudAccounts).to.be.an("array"); | ||
expect(cloudAccounts).to.have.length.greaterThan(0); | ||
|
||
const defaultAccount = cloudAccounts.find( | ||
(account) => account.name === "default" | ||
); | ||
|
||
expect(defaultAccount).to.exist; | ||
}); | ||
|
||
cy.get("@button").click(); | ||
|
||
fillOutForm(CLUSTER_NAME); | ||
|
||
cy.findByRole("button", { | ||
name: /create cluster/i, | ||
}).click(); | ||
|
||
cy.wait(2000); | ||
|
||
cy.findByRole("heading", { name: new RegExp(CLUSTER_NAME, "i") }).should( | ||
"exist" | ||
); | ||
cy.contains("Provisioning").should("exist"); | ||
}); | ||
|
||
it("should validate the cluster is provisioning", () => { | ||
cy.visit("/"); | ||
|
||
cy.goClusterManagement(); | ||
|
||
cy.findAllByRole("button", { name: new RegExp(CLUSTER_NAME, "i") }) | ||
.eq(0) | ||
.as("clusterProvisioningButton"); | ||
|
||
cy.get("@clusterProvisioningButton").should("exist"); | ||
|
||
cy.get("@clusterProvisioningButton").within(() => { | ||
cy.findByText(/provisioning/i).should("exist"); | ||
}); | ||
}); | ||
|
||
it("should validate the cluster is provisioned", { retries: 3 }, () => { | ||
cy.visit("/"); | ||
|
||
cy.goClusterManagement(); | ||
|
||
cy.findAllByRole("button", { name: new RegExp(CLUSTER_NAME, "i") }) | ||
.eq(0) | ||
.as("clusterProvisionedButton"); | ||
|
||
cy.get("@clusterProvisionedButton").should("exist"); | ||
|
||
cy.get("@clusterProvisionedButton").within(() => { | ||
cy.findByText(/provisioned/i, { | ||
timeout: Number(ms(MAX_TIME_TO_WAIT)), | ||
}).should("exist"); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { Account } from "../../types/accouts"; | ||
|
||
import { fillOutForm } from "./utils"; | ||
|
||
const CLUSTER_NAME = "test-cluster"; | ||
const isCivo = Cypress.env("CLOUD_PROVIDER") === "civo"; | ||
|
||
describe("Test to validate physical cluster creation", () => { | ||
beforeEach(function () { | ||
if (!isCivo) { | ||
cy.log("This test is only for Civo"); | ||
|
||
this.skip(); | ||
} | ||
}); | ||
|
||
beforeEach(() => { | ||
const username = Cypress.env("USERNAME"); | ||
const password = Cypress.env("PASSWORD"); | ||
|
||
cy.login(username, password); | ||
}); | ||
|
||
it("should create a physical cluster", () => { | ||
cy.visit("/"); | ||
cy.findByRole("button", { name: /add workload cluster/i }).as("button"); | ||
|
||
cy.request("GET", "/api/proxy?url=%2Fcloud-account").then( | ||
({ status, body }) => { | ||
expect(status).to.eq(200); | ||
|
||
const { cloud_accounts: cloudAccounts } = body; | ||
cy.wrap(cloudAccounts as Account[]).as("accounts"); | ||
} | ||
); | ||
|
||
cy.get("@accounts").then((accounts) => { | ||
const cloudAccounts = accounts as unknown as Account[]; | ||
expect(cloudAccounts).to.be.an("array"); | ||
expect(cloudAccounts).to.have.length.greaterThan(0); | ||
|
||
const defaultAccount = cloudAccounts.find( | ||
(account) => account.name === "default" | ||
); | ||
|
||
expect(defaultAccount).to.exist; | ||
}); | ||
|
||
cy.get("@button").click(); | ||
|
||
fillOutForm(CLUSTER_NAME); | ||
|
||
// cy.findByRole("button", { | ||
// name: /create cluster/i, | ||
// }).click(); | ||
|
||
// cy.wait(2000); | ||
|
||
// cy.findByRole("heading", { name: new RegExp(CLUSTER_NAME, "i") }).should( | ||
// "exist" | ||
// ); | ||
// cy.contains("Provisioning").should("exist"); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./physical/fill-out-form"; |
34 changes: 34 additions & 0 deletions
34
cypress/e2e/utils/create-cluster/physical/fill-out-form.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
export const fillOutForm = (clusterName: string) => { | ||
cy.get("form").as("form"); | ||
cy.get("@form").should("exist"); | ||
|
||
cy.findByRole("textbox").type(clusterName, { | ||
delay: 10, | ||
}); | ||
|
||
cy.findByRole("radio", { name: /physical/i }).click(); | ||
|
||
cy.findAllByRole("combobox").eq(1).as("clusterHost"); | ||
|
||
cy.get("@clusterHost").click(); | ||
|
||
cy.findByRole("listbox").within(() => { | ||
cy.findByRole("option", { name: /default/i }).click(); | ||
}); | ||
|
||
cy.findAllByRole("combobox").eq(2).as("clusterRegion"); | ||
|
||
cy.get("@clusterRegion").click(); | ||
|
||
cy.findByRole("listbox").within(() => { | ||
cy.findByRole("option", { name: /us-east-1/i }).click(); | ||
}); | ||
|
||
cy.findAllByRole("combobox").eq(3).as("instanceSize"); | ||
|
||
cy.get("@instanceSize").click(); | ||
|
||
cy.findByRole("listbox").within(() => { | ||
cy.findByRole("option", { name: /t2.nano/i }).click(); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./create-cluster"; |