Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' of https://github.com/evergreen-ci/spruce into EV…
Browse files Browse the repository at this point in the history
  • Loading branch information
sophstad committed Jun 7, 2023
2 parents 76b9eb7 + be6effd commit b47f138
Show file tree
Hide file tree
Showing 122 changed files with 4,813 additions and 3,860 deletions.
26 changes: 26 additions & 0 deletions codegen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type { CodegenConfig } from "@graphql-codegen/cli";

const config: CodegenConfig = {
schema: "sdlschema/**/*.graphql",
documents: ["./src/**/*.ts", "./src/**/*.graphql", "./src/**/*.gql"],
hooks: {
afterAllFileWrite: ["prettier --write"],
},
overwrite: true,
generates: {
"./src/gql/generated/types.ts": {
plugins: ["typescript", "typescript-operations"],
config: {
preResolveTypes: true,
arrayInputCoercion: false,
scalars: {
StringMap: "{ [key: string]: any }",
Time: "Date",
Duration: "number",
},
},
},
},
};

export default config;
21 changes: 0 additions & 21 deletions codegen.yml

This file was deleted.

10 changes: 7 additions & 3 deletions cypress/integration/host/host_events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,19 @@ describe("Host events", () => {
},
{
hostType: "host-running-task-set",
text: "Assigned to run task evergreen_ubuntu1604_test_command_patch_5e823e1f28...",
text: "Assigned to run task evergreen_ubuntu1604_test_command_patch_5e823e1f28",
},
{
hostType: "host-running-task-cleared",
text: "Current running task cleared (was:evergreen_ubuntu1604_test_command_patch_5e823e1f28...)",
text: "Current running task cleared (was: ",
},
{
hostType: "host-running-task-cleared",
text: "evergreen_ubuntu1604_test_command_patch_5e823e1f28baeaa22ae00823d83e03082cd148ab_5e4ff3abe3c3317e352062e4_20_02_21_15_13_48",
},
{
hostType: "host-task-finished",
text: "Task evergreen_ubuntu1604_test_command_patch_5e823e1f28... completed with status: test-timed-out",
text: "Task evergreen_ubuntu1604_test_command_patch_5e823e1f28baeaa22ae00823d83e03082cd148ab_5e4ff3abe3c3317e352062e4_20_02_21_15_13_48 completed with status: test-timed-out",
},
];
hostTypes.forEach(({ hostType, text }) => {
Expand Down
54 changes: 51 additions & 3 deletions cypress/integration/preferences/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,65 @@ describe("global subscription settings", () => {
});

describe("user subscriptions table", () => {
it("shows all of a user's subscriptions and expands with details", () => {
beforeEach(() => {
cy.visit(pageRoute);
});

it("shows all of a user's subscriptions and expands with details", () => {
cy.dataCy("subscription-row").should("have.length", 3);

cy.dataCy("regex-selectors").should("not.be.visible");
cy.dataCy("trigger-data").should("not.be.visible");
cy.get("tr button").first().click();
cy.dataCy("subscription-row")
.eq(0)
.within(() => {
cy.get("button").first().click();
});
cy.dataCy("regex-selectors").should("be.visible");
cy.dataCy("trigger-data").should("not.be.visible");
cy.get("tr button").last().click();
cy.dataCy("subscription-row")
.eq(2)
.within(() => {
cy.get("button").first().click();
});
cy.dataCy("regex-selectors").should("be.visible");
cy.dataCy("trigger-data").should("be.visible");
});

it("Shows the selected count in the 'Delete' button", () => {
cy.dataCy("subscription-row")
.eq(0)
.within(() => {
cy.get("input[type=checkbox]").check({ force: true });
});
cy.dataCy("delete-some-button").contains("Delete (1)");

cy.get("thead").within(() => {
cy.get("input[type=checkbox]").check({ force: true });
});
cy.dataCy("delete-some-button").contains("Delete (3)");

cy.get("thead").within(() => {
cy.get("input[type=checkbox]").uncheck({ force: true });
});
cy.dataCy("delete-some-button").contains("Delete");
cy.dataCy("delete-some-button").should(
"have.attr",
"aria-disabled",
"true"
);
});

describe("Deleting subscriptions", { testIsolation: false }, () => {
it("Deletes a single subscription", () => {
cy.dataCy("subscription-row")
.eq(0)
.within(() => {
cy.get("input[type=checkbox]").check({ force: true });
});
cy.dataCy("delete-some-button").click();
cy.validateToast("success", "Deleted 1 subscription.");
cy.dataCy("subscription-row").should("have.length", 2);
});
});
});
7 changes: 7 additions & 0 deletions cypress/integration/project/patches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,11 @@ describe("Project Patches Page", () => {
cy.location("pathname").should("eq", adminPatchesRoute);
cy.dataCy("patch-card").should("exist");
});

it("Project dropdown navigates to another project patches page upon selection", () => {
cy.visit(evergreenPatchesRoute);
cy.dataCy("project-select").click();
cy.dataCy("project-display-name").contains("Spruce").click();
cy.location("pathname").should("eq", "/project/spruce/patches");
});
});
21 changes: 21 additions & 0 deletions cypress/integration/projectSettings/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,27 @@ export const getPluginsRoute = (identifier: string) =>
export const getContainersRoute = (identifier: string) =>
`${getSettingsRoute(identifier)}/containers`;

export const getViewsAndFiltersRoute = (identifier: string) =>
`${getSettingsRoute(identifier)}/views-and-filters`;

export const project = "spruce";
export const projectUseRepoEnabled = "evergreen";
export const repo = "602d70a2b2373672ee493184";

/**
* `saveButtonEnabled` checks if the save button is enabled or disabled.
* @param isEnabled - if true, the save button should be enabled. If false, the save button should be disabled.
*/
export const saveButtonEnabled = (isEnabled: boolean = true) => {
cy.dataCy("save-settings-button").should(
isEnabled ? "not.have.attr" : "have.attr",
"aria-disabled",
"true"
);
};

export const clickSave = () => {
cy.dataCy("save-settings-button")
.should("not.have.attr", "aria-disabled", "true")
.click();
};
31 changes: 9 additions & 22 deletions cypress/integration/projectSettings/project_settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import {
project,
projectUseRepoEnabled,
repo,
saveButtonEnabled,
clickSave,
} from "./constants";

describe("Access page", { testIsolation: false }, () => {
Expand Down Expand Up @@ -603,9 +605,12 @@ describe(
cy.dataCy("display-name-input").should("not.have.attr", "placeholder");
});

it.skip("Shows a navigation warning modal when navigating away from project settings", () => {
it("Shows a navigation warning modal that lists the general page when navigating away from project settings", () => {
cy.contains("My Patches").click();
cy.dataCy("navigation-warning-modal").should("be.visible");
cy.dataCy("unsaved-pages").within(() => {
cy.get("li").should("have.length", 1);
});
cy.get("body").type("{esc}");
});

Expand Down Expand Up @@ -1053,9 +1058,9 @@ describe("Notifications", { testIsolation: false }, () => {
cy.selectLGOption("Event", "Any Task Finishes");
cy.selectLGOption("Notification Method", "Comment on a JIRA issue");
cy.getInputByLabel("JIRA Issue").type("JIRA-123");
cy.contains(
"JIRA comment subscription not allowed for tasks in a project"
).should("exist");
cy.contains("Subscription type not allowed for tasks in a project.").should(
"exist"
);
cy.dataCy("save-settings-button").scrollIntoView();
saveButtonEnabled(false);
});
Expand Down Expand Up @@ -1205,21 +1210,3 @@ describe("Containers", () => {
cy.validateToast("success", "Successfully updated project");
});
});

/**
* `saveButtonEnabled` checks if the save button is enabled or disabled.
* @param isEnabled - if true, the save button should be enabled. If false, the save button should be disabled.
*/
const saveButtonEnabled = (isEnabled: boolean = true) => {
cy.dataCy("save-settings-button").should(
isEnabled ? "not.have.attr" : "have.attr",
"aria-disabled",
"true"
);
};

const clickSave = () => {
cy.dataCy("save-settings-button")
.should("not.have.attr", "aria-disabled", "true")
.click();
};
61 changes: 61 additions & 0 deletions cypress/integration/projectSettings/views_and_filters.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import {
getViewsAndFiltersRoute,
saveButtonEnabled,
clickSave,
} from "./constants";

describe("Views & filters page", () => {
const destination = getViewsAndFiltersRoute("sys-perf");

beforeEach(() => {
cy.visit(destination);
// Wait for page content to finish loading.
cy.dataCy("parsley-filter-list").children().should("have.length", 2);
saveButtonEnabled(false);
});

describe("parsley filters", () => {
it("does not allow saving with invalid regular expression or empty expression", () => {
cy.contains("button", "Add filter").should("be.visible").click();
cy.dataCy("parsley-filter-expression").first().type("*");
saveButtonEnabled(false);
cy.contains("Value should be a valid regex expression.");
cy.dataCy("parsley-filter-expression").first().clear();
saveButtonEnabled(false);
});

it("does not allow saving with duplicate filter expressions", () => {
cy.contains("button", "Add filter").should("be.visible").click();
cy.dataCy("parsley-filter-expression").first().type("filter_1");
saveButtonEnabled(false);
cy.contains("Filter expression already appears in this project.");
});

it("can successfully save and delete filter", () => {
cy.contains("button", "Add filter").should("be.visible").click();
cy.dataCy("parsley-filter-expression").first().type("my_filter");
saveButtonEnabled(true);
clickSave();
cy.validateToast("success", "Successfully updated project");
cy.dataCy("parsley-filter-list").children().should("have.length", 3);

cy.dataCy("delete-item-button").first().should("be.visible").click();
clickSave();
cy.validateToast("success", "Successfully updated project");
cy.dataCy("parsley-filter-list").children().should("have.length", 2);
});
});

describe("project view", () => {
it("updates field to 'all' view and back to 'default'", () => {
cy.getInputByLabel("All tasks view").click({ force: true });
clickSave();
cy.validateToast("success", "Successfully updated project");
cy.getInputByLabel("All tasks view").should("be.checked");

cy.getInputByLabel("Default view").click({ force: true });
clickSave();
cy.validateToast("success", "Successfully updated project");
});
});
});
37 changes: 37 additions & 0 deletions cypress/integration/version/name_change_modal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
describe("Name change modal", () => {
beforeEach(() => {
cy.visit("version/5f74d99ab2373627c047c5e5");
});

it("Use the name change modal to change the name of a patch", () => {
const originalName = "main: EVG-7823 add a commit queue message (#4048)";
cy.contains(originalName);
cy.dataCy("name-change-modal-trigger").click();
const newName = "a different name";
cy.get("textarea").clear().type(newName);
cy.contains("Confirm").click();
cy.get("textarea").should("not.exist");
cy.contains(newName);
cy.validateToast("success", "Patch name was successfully updated.", true);
// revert name change
cy.dataCy("name-change-modal-trigger").click();
cy.get("textarea").clear().type(originalName);
cy.contains("Confirm").click();
cy.get("textarea").should("not.exist");
cy.validateToast("success", "Patch name was successfully updated.", true);
cy.contains(originalName);
});

it("The confirm button is disabled when the text area value is empty or greater than 300 characters", () => {
cy.dataCy("name-change-modal-trigger").click();
cy.get("textarea").clear();
cy.contains("button", "Confirm").should("be.disabled");
cy.get("textarea").type("lol");
cy.contains("button", "Confirm").should("not.be.disabled");
const over300Chars =
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
cy.get("textarea").type(over300Chars);
cy.contains("button", "Confirm").should("be.disabled");
cy.contains("should NOT be longer than 300 characters");
});
});
2 changes: 1 addition & 1 deletion cypress/integration/version/restart_modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("Restarting a patch", { testIsolation: false }, () => {
cy.dataCy("task-status-badge").should("contain.text", "1 of 1 Selected");
});

it("Selecting on the patch status filter should toggle the tasks that have matching statuses to it", () => {
it("Selecting on the task status filter should toggle the tasks that have matching statuses to it", () => {
cy.dataCy("task-status-filter").click();
cy.getInputByLabel("All").check({ force: true });
cy.dataCy("task-status-filter").click();
Expand Down
Loading

0 comments on commit b47f138

Please sign in to comment.