summaryrefslogtreecommitdiff
path: root/packages/astro/e2e/content-collections.test.js
blob: 63c5077c9b75f1a4684918fd5d1299a7a0f8a988 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { expect } from '@playwright/test';
import { testFactory } from './test-utils.js';

const test = testFactory({ root: './fixtures/content-collections/' });

let devServer;

test.beforeAll(async ({ astro }) => {
	devServer = await astro.startDevServer();
});

test.afterAll(async ({ astro }) => {
	await devServer.stop();
	astro.resetAllFiles();
});

test.describe('Content Collections', () => {
	test('HMR', async ({ page, astro }) => {
		await page.goto(astro.resolveUrl('/'));

		await astro.editFile('./src/components/MyComponent.astro', (original) =>
			original.replace('red', 'green'),
		);

		const h1 = page.locator('#my-heading');

		await expect(h1, 'should have green color').toHaveCSS('color', 'rgb(0, 128, 0)');
	});
});