Files
wehub-resource-sync dde272c4b8
CD - Docker - GHCR Images / Build and Push Images (push) Waiting to run
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:55:53 +08:00

78 lines
2.5 KiB
TypeScript

import { test, expect } from '@playwright/test';
import translations from '../client/i18n/locales/english/translations.json';
test.describe('Desktop view', () => {
test.skip(({ isMobile }) => isMobile, 'Only test on desktop');
test.describe('Pages with previews', () => {
test.beforeEach(async ({ page }) => {
await page.goto(
'/learn/responsive-web-design-v9/lab-event-flyer-page/build-an-event-flyer-page'
);
});
test('Clicking instructions button hides the instructions panel', async ({
page
}) => {
const instructionsButton = page.getByTestId('instructions-button');
await instructionsButton.click();
const instructionsPanelTitle = page.getByRole('heading', {
name: 'Build an Event Flyer Page'
});
await expect(instructionsPanelTitle).toBeHidden();
});
test('Clicking Console button shows console panel', async ({ page }) => {
const actionRow = page.getByTestId('action-row');
const consoleText = translations.learn['editor-tabs'].console;
const consoleBtn = actionRow.getByRole('button', { name: consoleText });
await consoleBtn.click();
const consolePanel = page.getByLabel(consoleText);
await expect(consolePanel).toBeVisible();
});
test('Clicking Preview Pane button hides preview', async ({ page }) => {
const previewButton = page.getByTestId('preview-pane-button');
const previewFrame = page.getByTitle('challenge preview');
await previewButton.click();
await expect(previewFrame).toBeHidden();
});
test('Clicking Preview Portal button opens the preview in a new tab', async ({
page
}) => {
const previewPortalButton = page.getByRole('button', {
name: translations.aria['move-preview-to-new-window']
});
const browserContext = page.context();
const [newPage] = await Promise.all([
browserContext.waitForEvent('page'),
previewPortalButton.click()
]);
await newPage.waitForLoadState();
await expect(newPage).toHaveURL('about:blank');
await newPage.close();
});
});
});
test.describe('Mobile view', () => {
test.skip(({ isMobile }) => !isMobile, 'Only test on mobile');
test('Action row is hidden', async ({ page }) => {
await page.goto(
'/learn/responsive-web-design-v9/lab-survey-form/build-a-survey-form'
);
const actionRow = page.getByTestId('action-row');
await expect(actionRow).toBeHidden();
});
});