This repository has been archived by the owner on Jul 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EVG-20815: Enable test isolation for project_settings/notifications a…
…nd resolve flake (#2088)
- Loading branch information
Showing
8 changed files
with
946 additions
and
925 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,63 @@ | ||
import { | ||
getAccessRoute, | ||
project, | ||
projectUseRepoEnabled, | ||
saveButtonEnabled, | ||
} from "./constants"; | ||
import { clickSave } from "../../utils"; | ||
|
||
describe("Access page", () => { | ||
const origin = getAccessRoute(projectUseRepoEnabled); | ||
beforeEach(() => { | ||
cy.visit(origin); | ||
saveButtonEnabled(false); | ||
cy.dataCy("default-to-repo-button") | ||
.should("be.visible") | ||
.should("be.enabled") | ||
.should("not.have.attr", "aria-disabled", "true"); | ||
}); | ||
|
||
it("Changing settings and clicking the save button produces a success toast and the changes are persisted", () => { | ||
cy.contains("label", "Unrestricted").click(); | ||
cy.getInputByLabel("Unrestricted").should("be.checked"); | ||
// Input and save username | ||
cy.contains("Add Username").click(); | ||
cy.getInputByLabel("Username").as("usernameInput"); | ||
cy.get("@usernameInput").type("admin"); | ||
cy.get("@usernameInput").should("have.value", "admin").should("be.visible"); | ||
clickSave(); | ||
cy.validateToast("success", "Successfully updated project"); | ||
// Assert persistence | ||
cy.reload(); | ||
cy.get("@usernameInput").should("have.value", "admin").should("be.visible"); | ||
// Delete a username | ||
cy.dataCy("delete-item-button").should("be.visible").click(); | ||
cy.get("@usernameInput").should("not.exist"); | ||
clickSave(); | ||
cy.validateToast("success", "Successfully updated project"); | ||
// Assert persistence | ||
cy.reload(); | ||
cy.get("@usernameInput").should("not.exist"); | ||
}); | ||
|
||
it("Clicking on 'Default to Repo on Page' selects the 'Default to repo (unrestricted)' radio box and produces a success banner", () => { | ||
cy.dataCy("default-to-repo-button").click(); | ||
cy.dataCy("default-to-repo-modal").contains("Confirm").click(); | ||
cy.validateToast("success", "Successfully defaulted page to repo"); | ||
cy.getInputByLabel("Default to repo (unrestricted)").should("be.checked"); | ||
}); | ||
|
||
it("Submitting an invalid admin username produces an error toast", () => { | ||
cy.visit(getAccessRoute(project)); | ||
cy.contains("Add Username").click(); | ||
cy.get("[aria-label='Username'") | ||
.should("have.length", 4) | ||
.first() | ||
.type("mongodb_user"); | ||
clickSave(); | ||
cy.validateToast( | ||
"error", | ||
"There was an error saving the project: error updating project admin roles: no admin role for project 'spruce' found" | ||
); | ||
}); | ||
}); |
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,40 @@ | ||
import { getGeneralRoute, project } from "./constants"; | ||
import { clickSave } from "../../utils"; | ||
|
||
describe("Attaching Spruce to a repo", () => { | ||
const origin = getGeneralRoute(project); | ||
|
||
beforeEach(() => { | ||
cy.visit(origin); | ||
}); | ||
|
||
it("Saves and attaches new repo and shows warnings on the Github/Commit Queue page", () => { | ||
cy.dataCy("repo-input").as("repoInput").clear(); | ||
cy.get("@repoInput").type("evergreen"); | ||
cy.dataCy("attach-repo-button").should( | ||
"have.attr", | ||
"aria-disabled", | ||
"true" | ||
); | ||
clickSave(); | ||
cy.validateToast("success", "Successfully updated project"); | ||
cy.dataCy("attach-repo-button").click(); | ||
cy.dataCy("attach-repo-modal").contains("button", "Attach").click(); | ||
cy.validateToast("success", "Successfully attached to repo"); | ||
cy.dataCy("navitem-github-commitqueue").click(); | ||
cy.dataCy("pr-testing-enabled-radio-box") | ||
.prev() | ||
.dataCy("warning-banner") | ||
.should("exist"); | ||
cy.dataCy("manual-pr-testing-enabled-radio-box") | ||
.prev() | ||
.dataCy("warning-banner") | ||
.should("exist"); | ||
cy.dataCy("github-checks-enabled-radio-box").prev().should("not.exist"); | ||
cy.dataCy("cq-card").dataCy("warning-banner").should("exist"); | ||
cy.dataCy("cq-enabled-radio-box").within(($el) => { | ||
cy.wrap($el).getInputByLabel("Enabled").parent().click(); | ||
}); | ||
cy.dataCy("cq-card").dataCy("error-banner").should("exist"); | ||
}); | ||
}); |
Oops, something went wrong.