astro/packages/astro/e2e/hydration-race.test.js
2022-08-22 10:39:16 -04:00

36 lines
967 B
JavaScript

import { expect } from '@playwright/test';
import { testFactory } from './test-utils.js';
const test = testFactory({
root: './fixtures/hydration-race/',
});
let devServer;
test.beforeEach(async ({ astro }) => {
devServer = await astro.startDevServer();
});
test.afterEach(async () => {
await devServer.stop();
});
test.describe('Hydration race', () => {
test('Islands inside of slots hydrate', async ({ page, astro }) => {
await page.goto('/slot');
const html = await page.content();
const one = page.locator('#one');
await expect(one, 'updated text').toHaveText('Hello One in the client');
const two = page.locator('#two');
await expect(two, 'updated text').toHaveText('Hello Two in the client');
const three = page.locator('#three');
await expect(three, 'updated text').toHaveText('Hello Three in the client');
const four = page.locator('#four');
await expect(four, 'updated text').toHaveText('Hello Four in the client');
});
});