Files
freecodecamp--freecodecamp/e2e/reset-editor-layout.spec.ts
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

49 lines
1.5 KiB
TypeScript

import { test, expect } from '@playwright/test';
test.describe('Reset Editor Layout', () => {
test('drag layout and reset', async ({ page, isMobile }) => {
test.skip(
isMobile,
'The mobile layout does not have resizable panes, so this test is not applicable.'
);
await page.goto(
'/learn/2022/responsive-web-design/learn-basic-css-by-building-a-cafe-menu/step-15'
);
const desktopLayout = page.getByTestId('desktop-layout');
const splitter = page.getByTestId('preview-left-splitter');
const editorPane = desktopLayout.getByTestId('editor-pane');
const initialStyle = await editorPane.getAttribute('style');
expect(initialStyle).toContain('flex: 1');
// Drag the splitter to resize the editor pane
await splitter.hover();
await page.mouse.down();
await page.mouse.move(100, 100);
await page.mouse.up();
const newStyle = await editorPane.getAttribute('style');
expect(newStyle).not.toContain('flex: 1');
await page.goto('/settings#privacy-settings');
const resetButton = page.getByTestId('reset-layout-btn');
await resetButton.click();
await expect(page.getByTestId('flash-message')).toContainText(
'Your editor layout has been reset'
);
await expect(resetButton).toBeDisabled();
await page.goto(
'/learn/2022/responsive-web-design/learn-basic-css-by-building-a-cafe-menu/step-15'
);
const afterReset = await editorPane.getAttribute('style');
expect(afterReset).toContain('flex: 1');
});
});