astro/packages/astro/e2e/solid-recurse.test.js
2023-05-19 22:46:31 +08:00

31 lines
844 B
JavaScript

import { expect } from '@playwright/test';
import { testFactory, waitForHydrate } from './test-utils.js';
const test = testFactory({ root: './fixtures/solid-recurse/' });
let devServer;
test.beforeAll(async ({ astro }) => {
devServer = await astro.startDevServer();
});
test.afterAll(async () => {
await devServer.stop();
});
test.describe('Recursive elements with Solid', () => {
test('Counter', async ({ astro, page }) => {
await page.goto(astro.resolveUrl('/'));
const wrapper = page.locator('#case1');
await expect(wrapper, 'component is visible').toBeVisible();
const increment = page.locator('#case1-B');
await expect(increment, 'initial count is 0').toHaveText('B: 0');
await waitForHydrate(page, wrapper);
await increment.click();
await expect(increment, 'count is incremented').toHaveText('B: 1');
});
});