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

DEVPROD-1968 Convert AnnotationTicketsTable into a list #2180

Merged
merged 14 commits into from
Dec 15, 2023

Conversation

khelif96
Copy link
Contributor

@khelif96 khelif96 commented Dec 1, 2023

DEVPROD-1968

Description

This "Table" is also not technically a table and is more of a list of elements. This refactors it to reflect that and also removes some of the ANTD dependencies

Screenshots

Testing

Evergreen PR

Copy link

cypress bot commented Dec 1, 2023

Passing run #14607 ↗︎

0 544 10 0 Flakiness 0

Details:

CR
Project: Spruce Commit: 2d85352fb9
Status: Passed Duration: 24:31 💡
Started: Dec 13, 2023 1:16 PM Ended: Dec 13, 2023 1:40 PM

Review all test suite changes for PR #2180 ↗︎

@khelif96 khelif96 requested a review from a team December 11, 2023 21:16
@khelif96 khelif96 marked this pull request as ready for review December 11, 2023 21:16
Comment on lines 8 to 12
const validateAnnotationRowCount = (listName: string, count: number) => {
cy.dataCy(listName).within(() =>
cy.dataCy("annotation-ticket-row").should("have.length", count)
);
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The readability and debugging overhead of this function can be reduced by aliasing in beforeEach. Check it out:

Suggested change
const validateAnnotationRowCount = (listName: string, count: number) => {
cy.dataCy(listName).within(() =>
cy.dataCy("annotation-ticket-row").should("have.length", count)
);
};

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woah cool suggestion!

cy.dataCy(listName).within(() =>
cy.dataCy("annotation-ticket-row").should("have.length", count)
);
};
describe("Task Annotation Tab", () => {
beforeEach(() => {
cy.visit(taskRoute);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cy.visit(taskRoute);
cy.visit(taskRoute);
cy.dataCy("loading-annotation-ticket").should("not.exist");
const rowSelector = "[data-cy='annotation-ticket-row']"
cy.dataCy("issues-list").find(rowSelector).as("issueRows")
cy.dataCy("suspected-issues-list").find(rowSelector).as("susIssueRows")
);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super neat use of aliases Thanks!

Comment on lines 21 to 22
validateAnnotationRowCount(issuesList, 1);
validateAnnotationRowCount(suspectedIssuesList, 3);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
validateAnnotationRowCount(issuesList, 1);
validateAnnotationRowCount(suspectedIssuesList, 3);
cy.get("@issueRows").should("have.length", 1);
cy.get("@susIssueRows").should("have.length", 3);

@@ -118,3 +129,6 @@ const BottomMetaDataWrapper = styled.div`
margin-top: ${size.xs};
width: 80%;
`;

export default AnnotationTicketRow;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not leave this as a named export since named exports for React components is already an established pattern?

Comment on lines 44 to 56
<JiraSummaryLink
href={url}
target="_blank"
data-cy={issueKey}
onClick={() =>
annotationAnalytics.sendEvent({
name: "Click Annotation Ticket Link",
})
}
>
{issueKey}
{summary && `: ${summary}`}
</JiraSummaryLink>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Save this as a variable in the function body so there isn't repeated JSX

dispatchToast.success(
`Successfully moved ${issueString} to ${
isIssue ? "suspected issues" : "issues"
}`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}`
}.`

@khelif96 khelif96 requested a review from SupaJoon December 13, 2023 14:42
@khelif96 khelif96 merged commit 3ab4a87 into evergreen-ci:main Dec 15, 2023
6 checks passed
@khelif96 khelif96 deleted the DEVPROD-1968 branch December 15, 2023 18:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants