diff --git a/e2e/preview.spec.ts b/e2e/preview.spec.ts index 5cdb6eb06d4..9ae36127d6f 100644 --- a/e2e/preview.spec.ts +++ b/e2e/preview.spec.ts @@ -9,7 +9,7 @@ test.beforeEach(async ({ page }) => { }); test.describe('Challenge Preview Component', () => { - test('should render correct output of default code', async ({ + test('should render correct output for default and changed code', async ({ page, isMobile }) => { @@ -18,30 +18,27 @@ test.describe('Challenge Preview Component', () => { .getByRole('tab', { name: translations.learn['editor-tabs'].preview }) .click(); } + + // Check default code output await expect( page .frameLocator('.challenge-preview-frame') - .first() .getByRole('heading', { name: 'CatPhotoApp' }) ).toBeVisible(); - }); - test('should render correct output of changed code', async ({ - page, - isMobile - }) => { + // Change code await focusEditor({ page, isMobile }); - await page.keyboard.insertText('

FreeCodeCamp

'); if (isMobile) { await page .getByRole('tab', { name: translations.learn['editor-tabs'].preview }) .click(); } + + // Check changed code output await expect( page .frameLocator('.challenge-preview-frame') - .first() .getByRole('heading', { name: 'FreeCodeCamp' }) ).toBeVisible(); });