mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-04-30 16:01:14 -04:00
refactor(e2e): consolidate tests in preview.spec.ts (#63652)
This commit is contained in:
@@ -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('<h1>FreeCodeCamp</h1>');
|
||||
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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user