aboutsummaryrefslogtreecommitdiff
path: root/packages/astro/e2e/content-collections.test.js
blob: fdb8d5e00733745096023534197ecf5193d2dbb3 (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(import.meta.url, { 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)');
	});
});