mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
feat: convert code storage test to Playwright (#54662)
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
test.use({ storageState: 'playwright/.auth/certified-user.json' });
|
||||
test.describe('Challenge with editor', function () {
|
||||
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'
|
||||
);
|
||||
|
||||
const editor = page.locator('textarea');
|
||||
|
||||
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/);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user