|
1 | 1 | // @ts-check
|
2 | 2 | import { test, expect } from "@playwright/test";
|
3 | 3 | import AxeBuilder from "@axe-core/playwright";
|
| 4 | +import { getTotalStats } from "pages/api/statistics/totals"; |
| 5 | +import { abbreviateNumber } from "@services/utils/abbreviateNumbers"; |
4 | 6 |
|
5 | 7 | test("homepage has title", async ({ page }) => {
|
6 | 8 | await page.goto("/");
|
@@ -49,3 +51,25 @@ test.describe("accessibility tests (dark)", () => {
|
49 | 51 | expect(accessibilityScanResults.violations).toEqual([]);
|
50 | 52 | });
|
51 | 53 | });
|
| 54 | + |
| 55 | +test.describe("Data rendered correctly on home page", () => { |
| 56 | + test("Total active rendered", async ({ page }) => { |
| 57 | + const { stats: totalStats } = await getTotalStats(); |
| 58 | + const abbreviatedActive = abbreviateNumber(totalStats.active); |
| 59 | + await page.goto("/"); |
| 60 | + const section = page.getByText("Active Users"); |
| 61 | + const parent = section.locator(".."); |
| 62 | + const item = parent.locator("dd div:nth-child(1)"); |
| 63 | + await expect(item).toHaveText(abbreviatedActive); |
| 64 | + }); |
| 65 | + |
| 66 | + test("Profile views rendered", async ({ page }) => { |
| 67 | + const { stats: totalStats } = await getTotalStats(); |
| 68 | + const abbreviatedViews = abbreviateNumber(totalStats.views); |
| 69 | + await page.goto("/"); |
| 70 | + const section = page.getByText("Profile Views"); |
| 71 | + const parent = section.locator(".."); |
| 72 | + const item = parent.locator("dd div:nth-child(1)"); |
| 73 | + await expect(item).toHaveText(abbreviatedViews); |
| 74 | + }); |
| 75 | +}); |
0 commit comments