Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add project cards view issues links #23

Merged
merged 2 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions cypress/e2e/project-list.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import capitalize from "lodash/capitalize";
import mockProjects from "../fixtures/projects.json";

describe("Project List", () => {
Expand Down Expand Up @@ -41,7 +40,6 @@ describe("Project List", () => {
});

it("renders the projects", () => {
const languageNames = ["React", "Node.js", "Python"];
const statusNames = ["Critical", "Warning", "Stable"];

// get all project cards
Expand All @@ -50,13 +48,21 @@ describe("Project List", () => {
.each(($el, index) => {
// check that project data is rendered
cy.wrap($el).contains(mockProjects[index].name);
cy.wrap($el).contains(languageNames[index]);
cy.wrap($el).contains(mockProjects[index].language, {
matchCase: false,
});
cy.wrap($el).contains(mockProjects[index].numIssues);
cy.wrap($el).contains(mockProjects[index].numEvents24h);
cy.wrap($el).contains(capitalize(statusNames[index]));
cy.wrap($el).contains(statusNames[index]);
cy.wrap($el)
.find("a")
.should("have.attr", "href", "/dashboard/issues");
.should("have.attr", "href")
.and(
"contains",
"/dashboard/issues?project=".concat(
mockProjects[index].name.match(/^[^\s]+/)?.[0] as string,
),
);
});
});
});
Expand Down
5 changes: 4 additions & 1 deletion features/projects/components/project-card/project-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ export function ProjectCard({ project }: ProjectCardProps) {
</div>
</div>
<div className={styles.bottomContainer}>
<Link href={Routes.issues} className={styles.viewIssuesAnchor}>
<Link
href={`${Routes.issues}` + `?project=${name}`}
className={styles.viewIssuesAnchor}
>
View issues
</Link>
</div>
Expand Down
Loading