astro/packages/astro/e2e/invalidate-script-deps.test.js
Tony Sullivan 1c6895884c
Testing perf improvements for e2e tests (#4354)
* 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.
2022-08-17 19:37:10 +00:00

31 lines
745 B
JavaScript

import { expect } from '@playwright/test';
import { testFactory } from './test-utils.js';
const test = testFactory({
root: './fixtures/invalidate-script-deps/',
});
let devServer;
test.beforeAll(async ({ astro }) => {
devServer = await astro.startDevServer();
});
test.afterAll(async () => {
await devServer.stop();
});
test.describe('Scripts with dependencies', () => {
test('refresh with HMR', async ({ page, astro }) => {
await page.goto(astro.resolveUrl('/'));
const h = page.locator('h1');
await expect(h, 'original text set').toHaveText('before');
await astro.editFile('./src/scripts/heading.js', (original) =>
original.replace('before', 'after')
);
await expect(h, 'text changed').toHaveText('after');
});
});