70bf21e064
Deploy (to testing) and Test Playground Preview Worker / Deploy Playground Preview Worker (testing) (push) Has been skipped
Deploy Workers Shared Staging / Deploy Workers Shared Staging (push) Failing after 0s
Prerelease / build (push) Has been skipped
Handle Changesets / Handle Changesets (push) Has been cancelled
Semgrep OSS scan / semgrep-oss (push) Has been cancelled
19 lines
681 B
TypeScript
19 lines
681 B
TypeScript
import { test, vi } from "vitest";
|
|
import { page, WAIT_FOR_OPTIONS } from "../../__test-utils__";
|
|
|
|
test("returns the correct home page", async ({ expect }) => {
|
|
const content = await page.textContent("h1");
|
|
expect(content).toBe("Vite + React");
|
|
});
|
|
|
|
test("returns the response from the API", async ({ expect }) => {
|
|
const button = page.getByRole("button", { name: "get-name" });
|
|
const contentBefore = await button.innerText();
|
|
expect(contentBefore).toBe("Name from API is: unknown");
|
|
await button.click();
|
|
await vi.waitFor(async () => {
|
|
const contentAfter = await button.innerText();
|
|
expect(contentAfter).toBe("Name from API is: Cloudflare");
|
|
}, WAIT_FOR_OPTIONS);
|
|
});
|