1
0

fullstack.spec.js 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. // @ts-check
  2. const { test, expect } = require("@playwright/test");
  3. test("hydration", async ({ page }) => {
  4. await page.goto("http://localhost:3333");
  5. // Expect the page to contain the pending text.
  6. const main = page.locator("#main");
  7. await expect(main).toContainText("Server said: ...");
  8. // Expect the page to contain the counter text.
  9. await expect(main).toContainText("hello axum! 12345");
  10. // Expect the title to contain the counter text.
  11. await expect(page).toHaveTitle("hello axum! 12345");
  12. // Click the increment button.
  13. let button = page.locator("button.increment-button");
  14. await button.click();
  15. // Click the server button.
  16. let serverButton = page.locator("button.server-button");
  17. await serverButton.click();
  18. // Expect the page to contain the updated counter text.
  19. await expect(main).toContainText("hello axum! 12346");
  20. // Expect the title to contain the updated counter text.
  21. await expect(page).toHaveTitle("hello axum! 12346");
  22. // Expect the page to contain the updated counter text.
  23. await expect(main).toContainText("Server said: Hello from the server!");
  24. });