diff options
Diffstat (limited to 'packages/astro/e2e/astro-component.test.js')
-rw-r--r-- | packages/astro/e2e/astro-component.test.js | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/packages/astro/e2e/astro-component.test.js b/packages/astro/e2e/astro-component.test.js index 65499499f..5dcf2daea 100644 --- a/packages/astro/e2e/astro-component.test.js +++ b/packages/astro/e2e/astro-component.test.js @@ -1,4 +1,5 @@ import { test as base, expect } from '@playwright/test'; +import os from 'os'; import { loadFixture } from './test-utils.js'; const test = base.extend({ @@ -18,8 +19,8 @@ test.afterEach(async () => { await devServer.stop(); }); -test.describe('Astro components', () => { - test('HMR', async ({ page, astro }) => { +test.describe('Astro component HMR', () => { + test('component styles', async ({ page, astro }) => { await page.goto(astro.resolveUrl('/')); const hero = page.locator('section'); @@ -39,4 +40,23 @@ test.describe('Astro components', () => { 'rgb(230, 230, 230)' ); }); + + // TODO: Re-enable this test on windows when #3424 is fixed + // https://github.com/withastro/astro/issues/3424 + const it = os.platform() === 'win32' ? test.skip : test; + it('hoisted scripts', async ({ page, astro }) => { + const initialLog = page.waitForEvent('console', (message) => message.text() === 'Hello, Astro!'); + + await page.goto(astro.resolveUrl('/')); + await initialLog; + + const updatedLog = page.waitForEvent('console', (message) => message.text() === 'Hello, updated Astro!'); + + // Edit the hoisted script on the page + await astro.editFile('./src/pages/index.astro', (content) => + content.replace('Hello, Astro!', 'Hello, updated Astro!') + ); + + await updatedLog; + }); }); |