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

Commit

Permalink
DEVPROD-4251: Resolve flake in select_execution.ts (#2271)
Browse files Browse the repository at this point in the history
  • Loading branch information
minnakt authored Feb 22, 2024
1 parent 8ecfa7c commit 1ab895f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
5 changes: 4 additions & 1 deletion cypress/integration/task/select_execution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ describe("Selecting Task Execution", () => {
});

it("Should take user to the latest execution if no execution is specified", () => {
cy.location("search").should("include", "execution=1");
cy.dataCy("execution-select").contains("Execution 2 (latest)");
cy.dataCy("task-status-badge").contains("Will Run");
cy.location("search").should("include", "execution=1");
});

it("Toggling a different execution should change the displayed execution", () => {
cy.location("search").should("include", "execution=1");
cy.dataCy("execution-select").contains("Execution 2 (latest)");
cy.dataCy("execution-select").should("have.attr", "aria-disabled", "false");
cy.dataCy("execution-select").click();
cy.dataCy("execution-0").click();
cy.dataCy("task-status-badge").contains("Succeeded");
Expand Down
1 change: 1 addition & 0 deletions src/gql/generated/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2402,6 +2402,7 @@ export type SpruceConfig = {
jira?: Maybe<JiraConfig>;
keys: Array<SshKey>;
providers?: Maybe<CloudProviderConfig>;
secretFields: Array<Scalars["String"]["output"]>;
slack?: Maybe<SlackConfig>;
spawnHost: SpawnHostConfig;
ui?: Maybe<UiConfig>;
Expand Down
13 changes: 7 additions & 6 deletions src/pages/task/executionDropdown/ExecutionSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,17 @@ export const ExecutionSelect: React.FC<ExecutionSelectProps> = ({
const getDateCopy = useDateFormat();
return (
<StyledSelect
placeholder="Choose an execution"
aria-disabled={executionsLoading}
data-cy="execution-select"
disabled={executionsLoading}
key={currentExecution}
data-cy="execution-select"
value={`Execution ${formatZeroIndexForDisplay(currentExecution)}${
currentExecution === latestExecution ? " (latest)" : ""
}`}
onChange={(selected: number | null) => {
updateExecution(selected);
}}
placeholder="Choose an execution"
value={`Execution ${formatZeroIndexForDisplay(currentExecution)}${
currentExecution === latestExecution ? " (latest)" : ""
}`}
>
{allExecutions?.map((singleExecution) => {
const optionText = `Execution ${formatZeroIndexForDisplay(
Expand All @@ -58,9 +59,9 @@ export const ExecutionSelect: React.FC<ExecutionSelectProps> = ({

return (
<Option
data-cy={`execution-${singleExecution.execution}`}
key={singleExecution.execution}
value={singleExecution.execution}
data-cy={`execution-${singleExecution.execution}`}
>
<ExecutionInfo>
<StyledTaskStatusIcon status={singleExecution.status} />
Expand Down

0 comments on commit 1ab895f

Please sign in to comment.