Skip to content

Commit

Permalink
test: add test for portfolio screenshot functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
ax-sh committed Dec 3, 2024
1 parent 840d6ab commit f570928
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions __test__/puppet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ test.describe("Playwright Browser Testing", () => {
.catch(() => false);
expect(exists).toBe(true);
});
test("should take a portfolio screenshot", async ({ page }) => {
const screenshotLocalFilePath = path.join(__dirname, "portfolio.png");
const url = "https://ax-sh.github.io/";
await page.goto(url);
await page.screenshot({ path: screenshotLocalFilePath });
// Optionally check the file existence
const fs = await import("node:fs/promises");
const exists = await fs
.access(screenshotLocalFilePath)
.then(() => true)
.catch(() => false);
expect(exists).toBe(true);
});
test("should download a pdf", async ({ page }) => {
const pdfLocalFilePath = path.join(__dirname, "output.pdf");
const core = await import("../api/core");
Expand Down

0 comments on commit f570928

Please sign in to comment.