Skip to content
This repository was archived by the owner on Aug 7, 2024. It is now read-only.

Commit 0f26554

Browse files
test: home page stats #9384 (#9462)
* Update home.spec.js * Update home.spec.js * Update home.spec.js * Update home.spec.js * Update tests/home.spec.js * Update tests/home.spec.js --------- Co-authored-by: Eddie Jaoude <eddie@jaoudestudios.com>
1 parent 456a4fa commit 0f26554

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/home.spec.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// @ts-check
22
import { test, expect } from "@playwright/test";
33
import AxeBuilder from "@axe-core/playwright";
4+
import { getTotalStats } from "pages/api/statistics/totals";
5+
import { abbreviateNumber } from "@services/utils/abbreviateNumbers";
46

57
test("homepage has title", async ({ page }) => {
68
await page.goto("/");
@@ -49,3 +51,25 @@ test.describe("accessibility tests (dark)", () => {
4951
expect(accessibilityScanResults.violations).toEqual([]);
5052
});
5153
});
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

Comments
 (0)