1
0

static-generation.spec.js 700 B

123456789101112131415161718192021
  1. // @ts-check
  2. const { test, expect } = require("@playwright/test");
  3. test("button click", async ({ page }) => {
  4. await page.goto("http://localhost:2222");
  5. await page.waitForTimeout(1000);
  6. // Expect the page to contain the counter text.
  7. const main = page.locator("#main");
  8. await expect(main).toContainText("hello axum! 12345");
  9. // Expect the page to contain the server data
  10. await expect(main).toContainText('Server said: Ok("Hello from the server!")');
  11. // Click the increment button.
  12. let button = page.locator("button.increment-button");
  13. await button.click();
  14. // Expect the page to contain the updated counter text.
  15. await expect(main).toContainText("hello axum! 12346");
  16. });