1c6895884c
* WIP: testing fixes to share the dev server in e2e test suites * temp: testing multiple workers * Revert "temp: testing multiple workers" This reverts commit 9c7bc9d93c9c3f6dd62e3732f878f2d86016b213.
96 lines
2.9 KiB
JavaScript
96 lines
2.9 KiB
JavaScript
import { test as base, expect } from '@playwright/test';
|
|
import { loadFixture } from './test-utils.js';
|
|
|
|
const test = base.extend({
|
|
astro: async ({}, use) => {
|
|
const fixture = await loadFixture({ root: './fixtures/nested-recursive/' });
|
|
await use(fixture);
|
|
},
|
|
});
|
|
|
|
let devServer;
|
|
|
|
test.beforeAll(async ({ astro }) => {
|
|
devServer = await astro.startDevServer();
|
|
});
|
|
|
|
test.afterAll(async () => {
|
|
await devServer.stop();
|
|
});
|
|
|
|
test.describe('Recursive Nested Frameworks', () => {
|
|
test('React counter', async ({ astro, page }) => {
|
|
await page.goto('/');
|
|
|
|
const counter = await page.locator('#react-counter');
|
|
await expect(counter, 'component is visible').toBeVisible();
|
|
|
|
const count = await counter.locator('#react-counter-count');
|
|
await expect(count, 'initial count is 0').toHaveText('0');
|
|
|
|
const increment = await counter.locator('#react-counter-increment');
|
|
await increment.click();
|
|
|
|
await expect(count, 'count incremented by 1').toHaveText('1');
|
|
});
|
|
|
|
test('Preact counter', async ({ astro, page }) => {
|
|
await page.goto('/');
|
|
|
|
const counter = await page.locator('#preact-counter');
|
|
await expect(counter, 'component is visible').toBeVisible();
|
|
|
|
const count = await counter.locator('#preact-counter-count');
|
|
await expect(count, 'initial count is 0').toHaveText('0');
|
|
|
|
const increment = await counter.locator('#preact-counter-increment');
|
|
await increment.click();
|
|
|
|
await expect(count, 'count incremented by 1').toHaveText('1');
|
|
});
|
|
|
|
test('Solid counter', async ({ astro, page }) => {
|
|
await page.goto('/');
|
|
|
|
const counter = await page.locator('#solid-counter');
|
|
await expect(counter, 'component is visible').toBeVisible();
|
|
|
|
const count = await counter.locator('#solid-counter-count');
|
|
await expect(count, 'initial count is 0').toHaveText('0');
|
|
|
|
const increment = await counter.locator('#solid-counter-increment');
|
|
await increment.click();
|
|
|
|
await expect(count, 'count incremented by 1').toHaveText('1');
|
|
});
|
|
|
|
test('Vue counter', async ({ astro, page }) => {
|
|
await page.goto('/');
|
|
|
|
const counter = await page.locator('#vue-counter');
|
|
await expect(counter, 'component is visible').toBeVisible();
|
|
|
|
const count = await counter.locator('#vue-counter-count');
|
|
await expect(count, 'initial count is 0').toHaveText('0');
|
|
|
|
const increment = await counter.locator('#vue-counter-increment');
|
|
await increment.click();
|
|
|
|
await expect(count, 'count incremented by 1').toHaveText('1');
|
|
});
|
|
|
|
test('Svelte counter', async ({ astro, page }) => {
|
|
await page.goto('/');
|
|
|
|
const counter = await page.locator('#svelte-counter');
|
|
await expect(counter, 'component is visible').toBeVisible();
|
|
|
|
const count = await counter.locator('#svelte-counter-count');
|
|
await expect(count, 'initial count is 0').toHaveText('0');
|
|
|
|
const increment = await counter.locator('#svelte-counter-increment');
|
|
await increment.click();
|
|
|
|
await expect(count, 'count incremented by 1').toHaveText('1');
|
|
});
|
|
});
|