Skip to content

Commit

Permalink
DEVPROD-10200: Implement "Go to Date" feature (#512)
Browse files Browse the repository at this point in the history
  • Loading branch information
minnakt authored Nov 25, 2024
1 parent b711b6a commit 2502de5
Show file tree
Hide file tree
Showing 32 changed files with 294 additions and 213 deletions.
48 changes: 0 additions & 48 deletions apps/parsley/src/gql/generated/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,29 +230,6 @@ export type CloudProviderConfig = {
aws?: Maybe<AwsConfig>;
};

/**
* CommitQueue is returned by the commitQueue query.
* It contains information about the patches on the commit queue (e.g. author, code changes) for a given project.
*/
export type CommitQueue = {
__typename?: "CommitQueue";
message?: Maybe<Scalars["String"]["output"]>;
owner?: Maybe<Scalars["String"]["output"]>;
projectId?: Maybe<Scalars["String"]["output"]>;
queue?: Maybe<Array<CommitQueueItem>>;
repo?: Maybe<Scalars["String"]["output"]>;
};

export type CommitQueueItem = {
__typename?: "CommitQueueItem";
enqueueTime?: Maybe<Scalars["Time"]["output"]>;
issue?: Maybe<Scalars["String"]["output"]>;
modules?: Maybe<Array<Module>>;
patch?: Maybe<Patch>;
source?: Maybe<Scalars["String"]["output"]>;
version?: Maybe<Scalars["String"]["output"]>;
};

export type CommitQueueParams = {
__typename?: "CommitQueueParams";
enabled?: Maybe<Scalars["Boolean"]["output"]>;
Expand Down Expand Up @@ -1202,12 +1179,6 @@ export type MetadataLinkInput = {
url: Scalars["String"]["input"];
};

export type Module = {
__typename?: "Module";
issue?: Maybe<Scalars["String"]["output"]>;
module?: Maybe<Scalars["String"]["output"]>;
};

export type ModuleCodeChange = {
__typename?: "ModuleCodeChange";
branchName: Scalars["String"]["output"];
Expand Down Expand Up @@ -1251,15 +1222,13 @@ export type Mutation = {
detachVolumeFromHost: Scalars["Boolean"]["output"];
editAnnotationNote: Scalars["Boolean"]["output"];
editSpawnHost: Host;
enqueuePatch: Patch;
forceRepotrackerRun: Scalars["Boolean"]["output"];
migrateVolume: Scalars["Boolean"]["output"];
moveAnnotationIssue: Scalars["Boolean"]["output"];
overrideTaskDependencies: Task;
promoteVarsToRepo: Scalars["Boolean"]["output"];
removeAnnotationIssue: Scalars["Boolean"]["output"];
removeFavoriteProject: Project;
removeItemFromCommitQueue?: Maybe<Scalars["String"]["output"]>;
removePublicKey: Array<PublicKey>;
removeVolume: Scalars["Boolean"]["output"];
reprovisionToNew: Scalars["Int"]["output"];
Expand Down Expand Up @@ -1389,11 +1358,6 @@ export type MutationEditSpawnHostArgs = {
spawnHost?: InputMaybe<EditSpawnHostInput>;
};

export type MutationEnqueuePatchArgs = {
commitMessage?: InputMaybe<Scalars["String"]["input"]>;
patchId: Scalars["String"]["input"];
};

export type MutationForceRepotrackerRunArgs = {
projectId: Scalars["String"]["input"];
};
Expand Down Expand Up @@ -1429,11 +1393,6 @@ export type MutationRemoveFavoriteProjectArgs = {
opts: RemoveFavoriteProjectInput;
};

export type MutationRemoveItemFromCommitQueueArgs = {
commitQueueId: Scalars["String"]["input"];
issue: Scalars["String"]["input"];
};

export type MutationRemovePublicKeyArgs = {
keyName: Scalars["String"]["input"];
};
Expand Down Expand Up @@ -1686,10 +1645,8 @@ export type Patch = {
authorDisplayName: Scalars["String"]["output"];
baseTaskStatuses: Array<Scalars["String"]["output"]>;
builds: Array<Build>;
canEnqueueToCommitQueue: Scalars["Boolean"]["output"];
childPatchAliases?: Maybe<Array<ChildPatchAlias>>;
childPatches?: Maybe<Array<Patch>>;
commitQueuePosition?: Maybe<Scalars["Int"]["output"]>;
createTime?: Maybe<Scalars["Time"]["output"]>;
description: Scalars["String"]["output"];
duration?: Maybe<PatchDuration>;
Expand Down Expand Up @@ -2224,7 +2181,6 @@ export type Query = {
buildBaron: BuildBaron;
buildVariantsForTaskName?: Maybe<Array<BuildVariantTuple>>;
clientConfig?: Maybe<ClientConfig>;
commitQueue: CommitQueue;
distro?: Maybe<Distro>;
distroEvents: DistroEventsPayload;
distroTaskQueue: Array<TaskQueueItem>;
Expand Down Expand Up @@ -2281,10 +2237,6 @@ export type QueryBuildVariantsForTaskNameArgs = {
taskName: Scalars["String"]["input"];
};

export type QueryCommitQueueArgs = {
projectIdentifier: Scalars["String"]["input"];
};

export type QueryDistroArgs = {
distroId: Scalars["String"]["input"];
};
Expand Down
163 changes: 163 additions & 0 deletions apps/spruce/cypress/integration/waterfall/filters.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
describe("requester filtering", () => {
beforeEach(() => {
cy.visit("/project/spruce/waterfall");
});

it("filters on periodic builds and trigger", () => {
cy.dataCy("inactive-versions-button").first().contains("1");
cy.dataCy("requester-filter").click();
cy.dataCy("ad_hoc-option").click();
cy.dataCy("inactive-versions-button").first().contains("6");
cy.dataCy("version-label-active").should("have.length", 0);

cy.dataCy("requester-filter").click();
cy.dataCy("trigger_request-option").click();
cy.dataCy("inactive-versions-button").first().contains("5");
cy.dataCy("version-label-active").should("have.length", 1);
cy.dataCy("version-label-active").contains("Triggered by:");
});

it("filters on git tags", () => {
cy.dataCy("requester-filter").click();
cy.dataCy("git_tag_request-option").click();
cy.dataCy("inactive-versions-button").should("have.length", 2);
cy.dataCy("inactive-versions-button").first().contains("3");
cy.dataCy("inactive-versions-button").eq(1).contains("2");
cy.dataCy("version-label-active").contains("Git Tag");
});

it("clears requester filters", () => {
cy.dataCy("requester-filter").click();
cy.dataCy("gitter_request-option").click();
cy.dataCy("version-label-active").should("have.length", 3);

cy.dataCy("requester-filter").within(() => {
cy.get("button[aria-label='Clear selection']").click();
});
cy.dataCy("version-label-active").should("have.length", 5);
});
});

describe("build variant filtering", () => {
beforeEach(() => {
cy.visit("/project/evergreen/waterfall");
});

it("submitting a build variant filter updates the url, creates a badge and filters the grid", () => {
cy.dataCy("build-variant-label").should("have.length", 2);
cy.get("[placeholder='Filter build variants'").type("P{enter}");
cy.dataCy("filter-badge").first().should("have.text", "buildVariants: P");
cy.location().should((loc) => {
expect(loc.search).to.include("buildVariants=P");
});
cy.dataCy("build-variant-label").should("have.length", 0);

cy.dataTestId("chip-dismiss-button").click();
cy.dataCy("build-variant-label").should("have.length", 2);

cy.get("[placeholder='Filter build variants'").type("Lint{enter}");
cy.location().should((loc) => {
expect(loc.search).to.include("buildVariants=Lint");
});
cy.dataCy("filter-badge")
.first()
.should("have.text", "buildVariants: Lint");

cy.dataCy("build-variant-label")
.should("have.length", 1)
.should("have.text", "Lint");
cy.get("[placeholder='Filter build variants'").type("P{enter}");
cy.location().should((loc) => {
expect(loc.search).to.include("buildVariants=Lint,P");
});
});
});

describe("task filtering", () => {
beforeEach(() => {
cy.visit("/project/evergreen/waterfall");
});

it("filters grid squares, removes inactive build variants, creates a badge, and updates the url", () => {
cy.dataCy("build-variant-label").should("have.length", 2);
cy.dataCy("tuple-select-dropdown").click({ force: true });
cy.get('[role="listbox"]').should("have.length", 1);
cy.get('[role="listbox"]').within(() => {
cy.contains("Task").click();
});
cy.get("[placeholder='Filter tasks'").type("agent{enter}");

cy.dataCy("build-variant-label").should("have.length", 1);
cy.location().should((loc) => {
expect(loc.search).to.include("tasks=agent");
});
cy.dataCy("filter-badge").first().should("have.text", "tasks: agent");
cy.get("a[data-tooltip]").should("have.length", 1);
cy.get("a[data-tooltip]").should(
"have.attr",
"data-tooltip",
"test-agent - Inactive",
);

cy.get("[placeholder='Filter tasks'").type("lint{enter}");
cy.location().should((loc) => {
expect(loc.search).to.include("tasks=agent,lint");
});
cy.dataCy("build-variant-label").should("have.length", 2);
cy.dataCy("filter-badge").eq(1).should("have.text", "tasks: lint");
cy.get("a[data-tooltip]").should("have.length", 2);
});

it("correctly applies build variant and task filters", () => {
cy.get("[placeholder='Filter build variants'").type("Lint{enter}");
cy.dataCy("build-variant-label").should("have.length", 1);
cy.dataCy("tuple-select-dropdown").click({ force: true });
cy.get('[role="listbox"]').should("have.length", 1);
cy.get('[role="listbox"]').within(() => {
cy.contains("Task").click();
});
cy.get("[placeholder='Filter tasks'").type("agent{enter}");
cy.dataCy("build-variant-label").should("have.length", 0);
cy.dataCy("filter-badge").should("have.length", 2);
});
});

describe("date filter", () => {
it("url query params update when date filter is applied", () => {
cy.visit("/project/spruce/waterfall");
cy.dataCy("waterfall-skeleton").should("not.exist");
cy.location("search").should("equal", "");

cy.dataCy("date-picker").click();
cy.get("[aria-label^='Select year']").click();
cy.contains("li", "2022").click({ force: true });
cy.get("[aria-label^='Select month']").click();
cy.contains("li", "Feb").click({ force: true });
cy.get("[data-iso='2022-02-28']").click();

cy.location("search").should("contain", "date=2022-02-28");
});

it("date is cleared when paginating", () => {
cy.visit("/project/spruce/waterfall?date=2022-02-28");
cy.dataCy("waterfall-skeleton").should("not.exist");
cy.dataCy("prev-page-button").should("have.attr", "aria-disabled", "false");
cy.dataCy("prev-page-button").click();
cy.location("search").should("not.contain", "date");
});

it("versions update correctly when date filter is applied", () => {
const commit20220228 = "e391612";
const commit20220303 = "2c9056d";

cy.visit("/project/spruce/waterfall?date=2022-02-28");
cy.dataCy("waterfall-skeleton").should("not.exist");
cy.dataCy("version-labels").children().should("have.length", 5);
cy.dataCy("version-labels").children().eq(0).contains(commit20220228);

cy.visit("/project/spruce/waterfall?date=2022-03-03");
cy.dataCy("waterfall-skeleton").should("not.exist");
cy.dataCy("version-labels").children().should("have.length", 6);
cy.dataCy("version-labels").children().eq(0).contains(commit20220303);
});
});
Loading

0 comments on commit 2502de5

Please sign in to comment.