Skip to content

Commit

Permalink
Restore accidentally removed e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
markafitzgerald1 committed Jun 5, 2023
1 parent 2ef8387 commit 5b9e018
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions tests-e2e/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,62 @@ test(`HTML language '${expectedHtmlLanguage}' is specified`, async ({
expect(await page.$(`html[lang="${expectedHtmlLanguage}"]`)).not.toBeNull();
});

const expectedCharset = "utf-8";

test(`HTML charset '${expectedCharset}' is specified`, async ({ page }) => {
await page.goto("/");
expect(await page.$(`meta[charset="${expectedCharset}"]`)).not.toBeNull();
});

test("double tap zoom disabled to speed up mobile onclick handling", async ({
page,
}) => {
await page.goto("/");
expect(
await page.$('meta[name="viewport"][content="width=device-width"]')
).not.toBeNull();
});

const expectedTitle = "Cribbage Trainer";

test(`has title '${expectedTitle}'`, async ({ page }) => {
await page.goto("/");
await expect(page).toHaveTitle(expectedTitle);
});

test("styles.css is linked", async ({ page }) => {
await page.goto("/");
expect(
await page.$('link[rel="stylesheet"][href*="index."][href$=".css"]')
).not.toBeNull();
});

test("initial page render with fixed random seed still visually the same", async ({
page,
}) => {
await page.goto("/?seed=1");
await expect(page).toHaveScreenshot();
});

test("pre-cut hand points show after select of two discards", async ({
page,
}) => {
await page.goto("/");

const discardCount = 2;
for (let index = 0; index < discardCount; index += 1) {
// eslint-disable-next-line no-await-in-loop
await page.click(`.hand li:nth-child(${index + 1})`);
}

expect(
await Promise.all(
(
await page.$$("figcaption")
).map(
async (figcaption) =>
(await figcaption.textContent()) === "Pre-cut hand points:"
)
).then((results) => results.some(Boolean))
).toBe(true);
});

0 comments on commit 5b9e018

Please sign in to comment.