Fix playwright tests (#2695)
This commit is contained in:
1 parent
9479d2376d
commit
bd484842bd
28 files changed
+477
-330
No files matched your search
@@ -1,12 +1,14 @@
|
||||
// @ts-check
|
||||
const { test, expect } = require("@playwright/test");
|
||||
|
||||
test("button click", async ({ page }) => {
|
||||
test("hydration", async ({ page }) => {
|
||||
await page.goto("http://localhost:3333");
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Expect the page to contain the pending text.
|
||||
const main = page.locator("#main");
|
||||
await expect(main).toContainText("Server said: ...");
|
||||
|
||||
// Expect the page to contain the counter text.
|
||||
const main = page.locator("#main");
|
||||
await expect(main).toContainText("hello axum! 12345");
|
||||
// Expect the title to contain the counter text.
|
||||
await expect(page).toHaveTitle("hello axum! 12345");
|
||||
@@ -15,23 +17,14 @@ test("button click", async ({ page }) => {
|
||||
let button = page.locator("button.increment-button");
|
||||
await button.click();
|
||||
|
||||
// Click the server button.
|
||||
let serverButton = page.locator("button.server-button");
|
||||
await serverButton.click();
|
||||
|
||||
// Expect the page to contain the updated counter text.
|
||||
await expect(main).toContainText("hello axum! 12346");
|
||||
// Expect the title to contain the updated counter text.
|
||||
await expect(page).toHaveTitle("hello axum! 12346");
|
||||
});
|
||||
|
||||
test("fullstack communication", async ({ page }) => {
|
||||
await page.goto("http://localhost:3333");
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Expect the page to contain the counter text.
|
||||
const main = page.locator("#main");
|
||||
await expect(main).toContainText("Server said: ...");
|
||||
|
||||
// Click the increment button.
|
||||
let button = page.locator("button.server-button");
|
||||
await button.click();
|
||||
|
||||
// Expect the page to contain the updated counter text.
|
||||
await expect(main).toContainText("Server said: Hello from the server!");
|
||||
|
||||
Reference in new issue
Block a user