-
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: the first steps to the cluster creaion were added
- Loading branch information
Showing
3 changed files
with
123 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import { Account } from "../../types/accouts"; | ||
|
||
// Utility function to fill out the form to create a physical cluster | ||
const fillOutForm = () => { | ||
cy.get("form").as("form"); | ||
cy.get("@form").should("exist"); | ||
|
||
cy.findByRole("textbox").type("test-cluster", { | ||
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(); | ||
}); | ||
}; | ||
|
||
describe("Test to validate physical cluster creation", () => { | ||
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(); | ||
|
||
cy.findByRole("button", { | ||
name: /create cluster/i, | ||
}).click(); | ||
|
||
cy.wait(2000); | ||
|
||
cy.findByRole("heading", { name: /test-cluster/i }).should("exist"); | ||
cy.contains("Provisioning").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 |
---|---|---|
@@ -1,7 +1,6 @@ | ||
afterEach(function () { | ||
if (this.currentTest.state === "failed") { | ||
const retryDelay = Cypress.env("RETRY_DELAY"); | ||
|
||
cy.wait(+retryDelay); | ||
} | ||
// if (this.currentTest.isFailed()) { | ||
// const retryDelay = Cypress.env("RETRY_DELAY"); | ||
// cy.wait(+retryDelay); | ||
// } | ||
}); |
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 type Account = { | ||
id: string; | ||
name: string; | ||
creation_timestamp: string; | ||
is_enabled: boolean; | ||
type: string; | ||
is_default: boolean; | ||
auth: Auth; | ||
}; | ||
|
||
export type Auth = { | ||
akamai_auth: AkamaiAuthClass; | ||
aws_auth: AwsAuth; | ||
civo_auth: AkamaiAuthClass; | ||
do_auth: DoAuth; | ||
vultr_auth: AkamaiAuthClass; | ||
google_auth: GoogleAuth; | ||
}; | ||
|
||
export type AkamaiAuthClass = { | ||
token: string; | ||
}; | ||
|
||
export type AwsAuth = { | ||
role_arn: string; | ||
}; | ||
|
||
export type DoAuth = { | ||
token: string; | ||
spaces_key: string; | ||
spaces_secret: string; | ||
}; | ||
|
||
export type GoogleAuth = {}; |