Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix failing MAAS UI e2e tests #5198

Merged
1 change: 1 addition & 0 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
run: |
export API_KEY=`sudo maas apikey --username=admin`
maas login admin http://localhost:5240/MAAS $API_KEY
while [ $(maas admin boot-resources is-importing | cat) == "true" ]; do sleep 10; done; echo "syncing finished"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think ideally it should be moved to a separate step (e.g. with a name "Wait for MAAS boot resources") which would help track its progress (and execution time).

maas admin users create username=user password=test [email protected] is_superuser=0
- name: Run Cypress tests with a user
uses: cypress-io/github-action@v4
Expand Down
13 changes: 9 additions & 4 deletions cypress/e2e/with-users/base/footer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,22 @@ context("Footer", () => {
});

it("navigates to the local documentation", () => {
cy.get(".p-footer__link:contains(Local documentation)").click();
cy.location("pathname").should("eq", "/MAAS/docs/");
cy.findByRole("link", { name: /local documentation/i })
.should("have.attr", "href")
.and("include", "/MAAS/docs/");
});

it("has a link to legal", () => {
cy.get(".p-footer__link:contains(Legal information)")
cy.findByRole("link", {
name: /legal information/i,
})
.should("have.attr", "href")
.and("include", "https://www.ubuntu.com/legal");
});

it("displays the feedback link", () => {
cy.get(".p-footer__nav button:contains(Give feedback)").should("exist");
cy.findByRole("button", {
name: /give feedback/i,
}).should("exist");
});
});
2 changes: 1 addition & 1 deletion cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Cypress.Commands.add("addMachine", (hostname = generateName()) => {
cy.get("input[name='hostname']").type(hostname);
cy.get("input[name='pxe_mac']").type(generateMac());
cy.get("select[name='power_type']").select("manual").blur();
cy.get("button[type='submit']").click();
cy.findByRole("button", { name: /save machine/i }).click();
cy.get(`[data-testid='message']:contains(${hostname} added successfully.)`, {
timeout: LONG_TIMEOUT,
});
Expand Down