2023-06-05 18:48:58 +00:00
|
|
|
// @ts-check
|
|
|
|
const { test, expect } = require('@playwright/test');
|
|
|
|
|
|
|
|
test('button click', async ({ page }) => {
|
|
|
|
await page.goto('http://localhost:3333');
|
2024-02-05 21:41:12 +00:00
|
|
|
await page.waitForTimeout(1000);
|
2023-06-05 18:48:58 +00:00
|
|
|
|
|
|
|
// Expect the page to contain the counter text.
|
|
|
|
const main = page.locator('#main');
|
|
|
|
await expect(main).toContainText('hello axum! 12345');
|
|
|
|
|
|
|
|
// Click the increment button.
|
2023-07-24 16:36:16 +00:00
|
|
|
let button = page.locator('button.increment-button');
|
2023-06-05 18:48:58 +00:00
|
|
|
await button.click();
|
|
|
|
|
|
|
|
// Expect the page to contain the updated counter text.
|
|
|
|
await expect(main).toContainText('hello axum! 12346');
|
|
|
|
});
|
|
|
|
|
|
|
|
test('fullstack communication', async ({ page }) => {
|
|
|
|
await page.goto('http://localhost:3333');
|
2024-02-05 21:41:12 +00:00
|
|
|
await page.waitForTimeout(1000);
|
2023-06-05 18:48:58 +00:00
|
|
|
|
|
|
|
// Expect the page to contain the counter text.
|
|
|
|
const main = page.locator('#main');
|
|
|
|
await expect(main).toContainText('Server said: ...');
|
|
|
|
|
|
|
|
// Click the increment button.
|
2023-07-24 16:36:16 +00:00
|
|
|
let button = page.locator('button.server-button');
|
2023-06-05 18:48:58 +00:00
|
|
|
await button.click();
|
|
|
|
|
|
|
|
// Expect the page to contain the updated counter text.
|
|
|
|
await expect(main).toContainText('Server said: Hello from the server!');
|
|
|
|
});
|