Nav menu overhaul New folder for material overrides Custom font classes Fix global font, add back resets, and update link colors Fix project list layout Expose material typography tokens as css classes Add button story and scss file for storybook Implementation of top app bar New project multiselect New timerange picker e2e fixes responsive layout fixes
151 lines
5.4 KiB
TypeScript
151 lines
5.4 KiB
TypeScript
import { seedBackend, requestLogin } from "./utils.cy";
|
|
import {
|
|
seededOrg,
|
|
secondSeededTeam,
|
|
newProject,
|
|
seededProject1,
|
|
} from "../fixtures/variables";
|
|
|
|
describe("Create New Project", () => {
|
|
beforeEach(() => {
|
|
seedBackend();
|
|
requestLogin();
|
|
});
|
|
|
|
it("should render appropriate field and server side errors", () => {
|
|
cy.visit(`/${seededOrg.slug}/settings/projects/new`);
|
|
cy.contains("Create a New Project");
|
|
cy.get("[data-cy=create-project-submit]").click();
|
|
cy.get("[data-cy='project-name-error-required']");
|
|
cy.get("input[formcontrolname=name]").type(
|
|
"While having too many characters in a project name would be rare, this test ensures that the server error field works.",
|
|
);
|
|
cy.get("[data-cy=project-name-error-length]");
|
|
});
|
|
|
|
it("create new project with new team but no platform", () => {
|
|
cy.visit(`/${seededOrg.slug}/settings/projects/new`);
|
|
cy.contains("Create a New Project");
|
|
cy.get("#create-team-from-projects").click();
|
|
cy.contains(
|
|
"Your team slug can only consist of letters, numbers, underscores and/or hyphens.",
|
|
);
|
|
cy.get("input[formcontrolname=slug]").type(secondSeededTeam.slug);
|
|
cy.get("#create-team-submit").click();
|
|
cy.contains(new RegExp("^" + secondSeededTeam.slug + "$", "g"));
|
|
cy.intercept("POST", `api/0/teams/${seededOrg.slug}/*/projects/`).as(
|
|
"createProjectRequest",
|
|
);
|
|
cy.get("input[formcontrolname=name]").type(newProject.name);
|
|
cy.get("[data-cy=create-project-form]").submit();
|
|
cy.wait("@createProjectRequest").then(({ response }) =>
|
|
cy
|
|
.url()
|
|
.should(
|
|
"contain",
|
|
`/${seededOrg.slug}/issues?project=${response?.body.id}`,
|
|
),
|
|
);
|
|
});
|
|
|
|
it("create new project with platform and existing team", () => {
|
|
cy.visit(`/${seededOrg.slug}/settings/projects/new`);
|
|
cy.contains("Create a New Project");
|
|
cy.get("input[formcontrolname=name]").type(newProject.name);
|
|
cy.get("[formcontrolname=platform] [data-test]").first().click();
|
|
cy.get("[data-cy=create-project-submit]").click();
|
|
});
|
|
});
|
|
|
|
describe("Edit and Delete a project", () => {
|
|
beforeEach(() => {
|
|
seedBackend();
|
|
requestLogin();
|
|
cy.visit(`/${seededOrg.slug}/settings/projects/${seededProject1.slug}`);
|
|
});
|
|
|
|
it("should edit the name of a project", () => {
|
|
cy.get("input[formcontrolname=name]")
|
|
.clear()
|
|
.type(
|
|
"While having too many characters in a project name would be rare, this test ensures that the server error field works.",
|
|
);
|
|
cy.get("#update-project-name").click();
|
|
cy.get("[data-cy='project-name-error-length']");
|
|
cy.get("input[formcontrolname=name]").clear();
|
|
cy.get("#update-project-name").click();
|
|
cy.get("[data-cy='project-name-error-required']");
|
|
cy.get("input[formcontrolname=name]").type("New Project Name");
|
|
cy.get("#update-project-name").click();
|
|
cy.contains("Settings for New Project Name");
|
|
// delete from db
|
|
cy.get("#delete-project").click();
|
|
});
|
|
|
|
it("edit the project platform", () => {
|
|
cy.get("[data-cy='platform-input']").type("WSGI");
|
|
cy.get("[data-cy='platform-option']").last().click();
|
|
cy.get("#update-project-platform").click();
|
|
cy.contains("Your project platform has been updated to WSGI");
|
|
});
|
|
|
|
it("should remove the project and redirect to projects page", () => {
|
|
cy.get("#delete-project").click();
|
|
cy.contains("Your project has been sucessfully deleted");
|
|
cy.url().should(
|
|
"eq",
|
|
`http://localhost:4200/${seededOrg.slug}/settings/projects`,
|
|
);
|
|
});
|
|
});
|
|
|
|
describe("Add and edit alerts", () => {
|
|
beforeEach(() => {
|
|
seedBackend(true);
|
|
requestLogin();
|
|
cy.visit(`/${seededOrg.slug}/settings/projects/${seededProject1.slug}`);
|
|
});
|
|
|
|
it("should add a project alert, remove email recipient, add email recipient back", () => {
|
|
cy.get("#create-new-alert").click();
|
|
cy.get("[data-cy=quantity]").clear().type("2");
|
|
cy.get("button").contains("submit").click();
|
|
cy.contains("Remove Alert 1");
|
|
cy.get("[data-cy=quantity]").should("have.value", "2");
|
|
|
|
cy.get("#delete-recipient").click();
|
|
cy.contains("This alert isn't being sent anywhere.");
|
|
|
|
cy.get("button").contains("Add An Alert Recipient").click();
|
|
cy.get("[data-cy=recipient-type]")
|
|
.click()
|
|
.get("mat-select")
|
|
.get("mat-option")
|
|
.contains("Email")
|
|
.click();
|
|
cy.get("button").contains("Add Recipient").click();
|
|
cy.contains("Send an email to team members on this project.");
|
|
});
|
|
|
|
it("should add an alert for uptime notifications, then update it to work for error notifications", () => {
|
|
cy.get("#create-new-alert").click();
|
|
cy.get("[data-cy=error-check]").click();
|
|
cy.contains(
|
|
"Please select events or uptime monitor triggers for your alert.",
|
|
);
|
|
cy.get("[data-cy=uptime-check]").click();
|
|
cy.get("button").contains("submit").click();
|
|
cy.contains("Success! Your new alert has been added.");
|
|
|
|
cy.get("[data-cy=error-check]").find("input").should("not.be.checked");
|
|
cy.get("[data-cy=uptime-check]").find("input").should("be.checked");
|
|
|
|
cy.get("[data-cy=error-check]").click();
|
|
cy.get("[data-cy=update-button]").contains("Update").click();
|
|
cy.contains("Success: Your alert has been updated");
|
|
|
|
cy.get("[data-cy=error-check]").find("input").should("be.checked");
|
|
cy.get("[data-cy=uptime-check]").find("input").should("be.checked");
|
|
});
|
|
});
|