Skip to content

Commit

Permalink
ci(cypress): add maas cli commands
Browse files Browse the repository at this point in the history
  • Loading branch information
petermakowski committed Jan 25, 2024
1 parent e0283a8 commit c1104e3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ Cypress.Commands.add("addMachine", (hostname = generateName()) => {
});
});

Cypress.Commands.add(
"addMachineCLI",
(hostname = generateName(), macAddress = generateMac()) => {
const maasCLICommand = `maas admin machines create hostname=${hostname} mac_addresses=${macAddress}`;
cy.exec(maasCLICommand).then((result) => {
expect(result.code).to.eq(0);
});
}
);

Cypress.Commands.add("deleteMachine", (hostname: string) => {
cy.visit(generateMAASURL("/machines"));
cy.findByRole("combobox", { name: "Group by" }).select("No grouping");
Expand Down
1 change: 1 addition & 0 deletions cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ declare global {
namespace Cypress {
interface Chainable {
addMachine(hostname?: string): void;
addMachineCLI(hostname?: string, macAddress?: string): void;
addMachines(hostname: string[]): void;
deleteMachine(hostname: string): void;
deletePool(pool: string): void;
Expand Down

0 comments on commit c1104e3

Please sign in to comment.