forked from freeCodeCamp/freeCodeCamp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: convert "editor spec" to Playwright (freeCodeCamp#54970)
Co-authored-by: Huyen Nguyen <[email protected]>
- Loading branch information
1 parent
07bef7a
commit 98d85ed
Showing
2 changed files
with
36 additions
and
29 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { focusEditor } from './utils/editor'; | ||
|
||
test.describe('Editor Shortcuts', () => { | ||
test('Should add a new line if the user presses Alt+Enter', async ({ | ||
page, | ||
isMobile | ||
}) => { | ||
await page.goto( | ||
'learn/responsive-web-design/basic-html-and-html5/say-hello-to-html-elements' | ||
); | ||
await focusEditor({ page, isMobile }); | ||
|
||
await page.keyboard.press('Alt+Enter'); | ||
await expect( | ||
page | ||
.getByTestId('editor-container-indexhtml') | ||
.getByText('<h1>Hello</h1>\n') | ||
).toBeVisible(); | ||
}); | ||
|
||
test('Should not add a new line if the user presses Ctrl+Enter', async ({ | ||
page, | ||
isMobile | ||
}) => { | ||
await page.goto( | ||
'learn/responsive-web-design/basic-html-and-html5/say-hello-to-html-elements' | ||
); | ||
await focusEditor({ page, isMobile }); | ||
|
||
await page.keyboard.press('Control+Enter'); | ||
await expect( | ||
page.getByTestId('editor-container-indexhtml').getByText('<h1>Hello</h1>') | ||
).toBeVisible(); | ||
}); | ||
}); |