2024-05-07 07:02:40 +00:00
|
|
|
import { test, expect } from '@playwright/test';
|
2024-05-08 18:21:56 +00:00
|
|
|
|
|
|
|
import { getEditors } from './utils/editor';
|
|
|
|
|
2024-05-07 07:02:40 +00:00
|
|
|
test.use({ storageState: 'playwright/.auth/certified-user.json' });
|
|
|
|
test.describe('Challenge with editor', function () {
|
2024-07-03 04:45:35 +00:00
|
|
|
test.skip(({ isMobile }) => isMobile);
|
2024-05-07 07:02:40 +00:00
|
|
|
test('the shortcut "Ctrl + S" saves the code', async ({ page }) => {
|
|
|
|
await page.goto(
|
|
|
|
'/learn/2022/responsive-web-design/learn-html-by-building-a-cat-photo-app/step-2'
|
|
|
|
);
|
|
|
|
|
2024-05-08 18:21:56 +00:00
|
|
|
const editor = getEditors(page);
|
2024-05-07 07:02:40 +00:00
|
|
|
|
|
|
|
await editor.fill('Something funny');
|
|
|
|
await page.keyboard.down('Control');
|
|
|
|
await page.keyboard.press('S');
|
|
|
|
|
|
|
|
await expect(
|
|
|
|
page.getByText(
|
|
|
|
"Saved! Your code was saved to your browser's local storage."
|
|
|
|
)
|
|
|
|
).toBeVisible();
|
|
|
|
|
|
|
|
await page.reload();
|
|
|
|
|
|
|
|
// check editor content
|
|
|
|
await expect(editor).toHaveValue(/Something funny/);
|
|
|
|
});
|
|
|
|
});
|