Skip to content

Commit

Permalink
Update E2Es
Browse files Browse the repository at this point in the history
  • Loading branch information
rich committed Sep 17, 2024
1 parent d303dc2 commit cdca047
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 7 deletions.
2 changes: 1 addition & 1 deletion e2es/seedTestData.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { copyFile, mkdir } from "fs/promises";

export const createDestinationDirectory = async () => {
console.info("Creating destination directory...");
await mkdir("./data");
await mkdir("./data", { recursive: true });
};

export const seedTestData = async () => {
Expand Down
8 changes: 4 additions & 4 deletions e2es/testData/repos.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"updatedAt": "2024-07-08T12:39:14Z",
"language": "PHP",
"topics": ["composer", "govpress", "packagist", "php"],
"openIssues": 0,
"openIssues": 10,
"dependencies": [],
"openPrCount": 0,
"openBotPrCount": 0
Expand All @@ -28,8 +28,8 @@
"topics": ["govpress", "wordpress-theme"],
"openIssues": 1,
"dependencies": [],
"openPrCount": 0,
"openBotPrCount": 1
"openPrCount": 20,
"openBotPrCount": 10
},
{
"name": "php-missing",
Expand All @@ -43,7 +43,7 @@
"topics": ["composer", "govpress", "packagist", "php"],
"openIssues": 7,
"dependencies": [],
"openPrCount": 2,
"openPrCount": 200,
"openBotPrCount": 3
}
]
Expand Down
56 changes: 54 additions & 2 deletions e2es/towtruck.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,62 @@ test("has dependency info", async ({ page, baseURL }) => {
"Language",
"Last Updated",
"Open issues count",
"Open PRs count",
"Open PR count",
"Dependencies",
];
tableHeadings.forEach((heading) => {
page.getByRole("columnheader", { name: heading });
expect(page.getByRole("columnheader", { name: heading })).toBeTruthy();
});

await testSortingForColumn(
{
name: "Open issues count",
topAscending: "govuk-blogs",
topDescending: "optionparser",
},
page
);

await testSortingForColumn(
{
name: "Open bot PR count",
topAscending: "optionparse",
topDescending: "govuk-blogs",
},
page
);

await testSortingForColumn(
{
name: "Open PR count",
topAscending: "optionparser",
topDescending: "php-missing",
},
page
);

await testSortingForColumn(
{
name: "Updated at",
topAscending: "optionparser",
topDescending: "govuk-blogs ",
},
page
);
});

const testSortingForColumn = async (
{ name, topAscending, topDescending },
page
) => {
await page.getByRole("link", { name, exact: true }).click();
await assertFirstDependencyRow(topAscending, page);

await page.getByRole("link", { name, exact: true }).click();
await assertFirstDependencyRow(topDescending, page);
};

const assertFirstDependencyRow = async (expectedFirstDependency, page) => {
const firstDependencyRow = page.getByRole("row").nth(1);
await expect(firstDependencyRow).toContainText(expectedFirstDependency);
};

0 comments on commit cdca047

Please sign in to comment.