Skip to content

Commit

Permalink
DEVPROD-977 Add stepback bisect to project settings page (evergreen-c…
Browse files Browse the repository at this point in the history
  • Loading branch information
ZackarySantana authored Dec 21, 2023
1 parent cc5b551 commit 6d24d2f
Show file tree
Hide file tree
Showing 10 changed files with 100 additions and 0 deletions.
61 changes: 61 additions & 0 deletions cypress/integration/projectSettings/stepback_bisect.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { clickSave } from "../../utils";
import { getGeneralRoute, project, projectUseRepoEnabled } from "./constants";

describe("Stepback bisect setting", () => {
describe("Repo project present", () => {
const destination = getGeneralRoute(projectUseRepoEnabled);

beforeEach(() => {
cy.visit(destination);
});

it("Starts as default to repo", () => {
cy.dataCy("stepback-bisect-group")
.contains("Default to repo")
.find("input")
.should("have.attr", "aria-checked", "true");
});

it("Clicking on enabled and then save shows a success toast", () => {
cy.dataCy("stepback-bisect-group").contains("Enable").click();
clickSave();
cy.validateToast("success", "Successfully updated project");

cy.reload();

cy.dataCy("stepback-bisect-group")
.contains("Enable")
.find("input")
.should("have.attr", "aria-checked", "true");
});
});

describe("Repo project not present", () => {
const destination = getGeneralRoute(project);

beforeEach(() => {
cy.visit(destination);
});

it("Starts as disabled", () => {
cy.dataCy("stepback-bisect-group")
.contains("Disable")
.find("input")
.should("have.attr", "aria-checked", "true");
});

it("Clicking on enabled and then save shows a success toast", () => {
cy.dataCy("stepback-bisect-group").contains("Enable").click();

clickSave();
cy.validateToast("success", "Successfully updated project");

cy.reload();

cy.dataCy("stepback-bisect-group")
.contains("Enable")
.find("input")
.should("have.attr", "aria-checked", "true");
});
});
});
2 changes: 2 additions & 0 deletions src/gql/fragments/projectSettings/general.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ fragment ProjectGeneralSettings on Project {
repo
repotrackerDisabled
spawnHostScriptPath
stepbackBisect
stepbackDisabled
taskSync {
configEnabled
Expand All @@ -32,6 +33,7 @@ fragment RepoGeneralSettings on RepoRef {
repo
repotrackerDisabled
spawnHostScriptPath
stepbackBisect
stepbackDisabled
taskSync {
configEnabled
Expand Down
11 changes: 11 additions & 0 deletions src/gql/generated/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3459,6 +3459,7 @@ export type ProjectGeneralSettingsFragment = {
repo: string;
repotrackerDisabled?: boolean | null;
spawnHostScriptPath: string;
stepbackBisect?: boolean | null;
stepbackDisabled?: boolean | null;
versionControlEnabled?: boolean | null;
taskSync: {
Expand All @@ -3481,6 +3482,7 @@ export type RepoGeneralSettingsFragment = {
repo: string;
repotrackerDisabled: boolean;
spawnHostScriptPath: string;
stepbackBisect?: boolean | null;
stepbackDisabled: boolean;
versionControlEnabled: boolean;
taskSync: {
Expand Down Expand Up @@ -3628,6 +3630,7 @@ export type ProjectSettingsFieldsFragment = {
repo: string;
repotrackerDisabled?: boolean | null;
spawnHostScriptPath: string;
stepbackBisect?: boolean | null;
stepbackDisabled?: boolean | null;
versionControlEnabled?: boolean | null;
notifyOnBuildFailure?: boolean | null;
Expand Down Expand Up @@ -3834,6 +3837,7 @@ export type RepoSettingsFieldsFragment = {
repo: string;
repotrackerDisabled: boolean;
spawnHostScriptPath: string;
stepbackBisect?: boolean | null;
stepbackDisabled: boolean;
versionControlEnabled: boolean;
notifyOnBuildFailure: boolean;
Expand Down Expand Up @@ -4235,6 +4239,7 @@ export type ProjectEventSettingsFragment = {
repo: string;
repotrackerDisabled?: boolean | null;
spawnHostScriptPath: string;
stepbackBisect?: boolean | null;
stepbackDisabled?: boolean | null;
notifyOnBuildFailure?: boolean | null;
githubTriggerAliases?: Array<string> | null;
Expand Down Expand Up @@ -6698,6 +6703,7 @@ export type ProjectEventLogsQuery = {
repo: string;
repotrackerDisabled?: boolean | null;
spawnHostScriptPath: string;
stepbackBisect?: boolean | null;
stepbackDisabled?: boolean | null;
notifyOnBuildFailure?: boolean | null;
githubTriggerAliases?: Array<string> | null;
Expand Down Expand Up @@ -6910,6 +6916,7 @@ export type ProjectEventLogsQuery = {
repo: string;
repotrackerDisabled?: boolean | null;
spawnHostScriptPath: string;
stepbackBisect?: boolean | null;
stepbackDisabled?: boolean | null;
notifyOnBuildFailure?: boolean | null;
githubTriggerAliases?: Array<string> | null;
Expand Down Expand Up @@ -7197,6 +7204,7 @@ export type ProjectSettingsQuery = {
repo: string;
repotrackerDisabled?: boolean | null;
spawnHostScriptPath: string;
stepbackBisect?: boolean | null;
stepbackDisabled?: boolean | null;
versionControlEnabled?: boolean | null;
notifyOnBuildFailure?: boolean | null;
Expand Down Expand Up @@ -7455,6 +7463,7 @@ export type RepoEventLogsQuery = {
repo: string;
repotrackerDisabled?: boolean | null;
spawnHostScriptPath: string;
stepbackBisect?: boolean | null;
stepbackDisabled?: boolean | null;
notifyOnBuildFailure?: boolean | null;
githubTriggerAliases?: Array<string> | null;
Expand Down Expand Up @@ -7667,6 +7676,7 @@ export type RepoEventLogsQuery = {
repo: string;
repotrackerDisabled?: boolean | null;
spawnHostScriptPath: string;
stepbackBisect?: boolean | null;
stepbackDisabled?: boolean | null;
notifyOnBuildFailure?: boolean | null;
githubTriggerAliases?: Array<string> | null;
Expand Down Expand Up @@ -7883,6 +7893,7 @@ export type RepoSettingsQuery = {
repo: string;
repotrackerDisabled: boolean;
spawnHostScriptPath: string;
stepbackBisect?: boolean | null;
stepbackDisabled: boolean;
versionControlEnabled: boolean;
notifyOnBuildFailure: boolean;
Expand Down
1 change: 1 addition & 0 deletions src/pages/projectSettings/CopyProjectModal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ const projectSettingsMock: ApolloMock<
deactivatePrevious: true,
repotrackerDisabled: false,
stepbackDisabled: null,
stepbackBisect: null,
patchingDisabled: false,
taskSync: {
configEnabled: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ const projectEventsQuery: ProjectEventLogsQuery = {
deactivatePrevious: true,
repotrackerDisabled: false,
stepbackDisabled: null,
stepbackBisect: null,
patchingDisabled: false,
taskSync: {
configEnabled: false,
Expand Down Expand Up @@ -186,6 +187,7 @@ const projectEventsQuery: ProjectEventLogsQuery = {
deactivatePrevious: true,
repotrackerDisabled: false,
stepbackDisabled: null,
stepbackBisect: null,
patchingDisabled: false,
taskSync: {
configEnabled: false,
Expand Down
14 changes: 14 additions & 0 deletions src/pages/projectSettings/tabs/GeneralTab/getFormSchema.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,14 @@ export const getFormSchema = (
true
),
},
stepbackBisection: {
type: ["boolean", "null"],
title: "Stepback Bisection",
oneOf: radioBoxOptions(
["Enabled", "Disabled"],
repoData?.projectFlags?.scheduling?.stepbackBisection
),
},
deactivateStepback: {
type: "null" as "null",
},
Expand Down Expand Up @@ -342,6 +350,12 @@ export const getFormSchema = (
"ui:description":
"Disabling this setting will override all enabled stepback settings for the project. Disabling stepback won't cancel any active stepback tasks, but it will prevent any future ones.",
},
stepbackBisection: {
"ui:widget": widgets.RadioBoxWidget,
"ui:description":
"Bisection will cause your stepback to activate the midway task between the last failing task and last passing task.",
"ui:data-cy": "stepback-bisect-group",
},
deactivateStepback: {
"ui:field": "deactivateStepbackTask",
"ui:showLabel": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const repoForm: GeneralFormState = {
scheduling: {
deactivatePrevious: true,
stepbackDisabled: true,
stepbackBisection: true,
deactivateStepback: null,
},
repotracker: {
Expand Down Expand Up @@ -81,6 +82,7 @@ const repoResult: Pick<RepoSettingsInput, "projectRef"> = {
repotrackerDisabled: false,
patchingDisabled: false,
stepbackDisabled: true,
stepbackBisect: true,
taskSync: {
configEnabled: true,
patchEnabled: true,
Expand Down Expand Up @@ -111,6 +113,7 @@ const projectForm: GeneralFormState = {
scheduling: {
deactivatePrevious: null,
stepbackDisabled: null,
stepbackBisection: null,
deactivateStepback: null,
},
repotracker: {
Expand Down Expand Up @@ -148,6 +151,7 @@ const projectResult: Pick<ProjectSettingsInput, "projectRef"> = {
repotrackerDisabled: null,
patchingDisabled: null,
stepbackDisabled: null,
stepbackBisect: null,
taskSync: {
configEnabled: null,
patchEnabled: null,
Expand Down
2 changes: 2 additions & 0 deletions src/pages/projectSettings/tabs/GeneralTab/transformers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const gqlToForm = ((data, options = {}) => {
scheduling: {
deactivatePrevious: projectRef.deactivatePrevious,
stepbackDisabled: projectRef.stepbackDisabled,
stepbackBisection: projectRef.stepbackBisect,
deactivateStepback: null,
},
repotracker: {
Expand Down Expand Up @@ -91,6 +92,7 @@ export const formToGql = ((
deactivatePrevious: projectFlags.scheduling.deactivatePrevious,
repotrackerDisabled: projectFlags.repotracker.repotrackerDisabled,
stepbackDisabled: projectFlags.scheduling.stepbackDisabled,
stepbackBisect: projectFlags.scheduling.stepbackBisection,
patchingDisabled: projectFlags.patch.patchingDisabled,
taskSync: {
configEnabled: projectFlags.taskSync.configEnabled,
Expand Down
1 change: 1 addition & 0 deletions src/pages/projectSettings/tabs/GeneralTab/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface GeneralFormState {
scheduling: {
deactivatePrevious: boolean | null;
stepbackDisabled: boolean | null;
stepbackBisection: boolean | null;
deactivateStepback: null;
};
repotracker: {
Expand Down
2 changes: 2 additions & 0 deletions src/pages/projectSettings/tabs/testData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const projectBase: ProjectSettingsQuery["projectSettings"] = {
repotrackerDisabled: null,
patchingDisabled: null,
stepbackDisabled: null,
stepbackBisect: null,
taskSync: {
configEnabled: null,
patchEnabled: null,
Expand Down Expand Up @@ -174,6 +175,7 @@ const repoBase: RepoSettingsQuery["repoSettings"] = {
notifyOnBuildFailure: false,
patchingDisabled: false,
stepbackDisabled: true,
stepbackBisect: true,
taskSync: {
configEnabled: true,
patchEnabled: true,
Expand Down

0 comments on commit 6d24d2f

Please sign in to comment.