Download slate/playwright/integration/examples/markdown-shortcuts.test.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.98 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/slate/playwright/integration/examples/markdown-shortcuts.test.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/slate/playwright/integration/examples/markdown-shortcuts.test.ts
-
curl -L -o markdown-shortcuts.test.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/slate/playwright/integration/examples/markdown-shortcuts.test.ts
1.98 kB
| import { test, expect } from '@playwright/test' | |
| test.describe('On markdown-shortcuts example', () => { | |
| test.beforeEach(async ({ page }) => { | |
| await page.goto('http://localhost:3000/examples/markdown-shortcuts') | |
| }) | |
| test('contains quote', async ({ page }) => { | |
| expect( | |
| await page.getByRole('textbox').locator('blockquote').textContent() | |
| ).toContain('A wise quote.') | |
| }) | |
| test('can add list items', async ({ page }, testInfo) => { | |
| await expect(page.getByRole('textbox').locator('ul')).toHaveCount(0) | |
| await page.getByRole('textbox').click() | |
| await page | |
| .getByRole('textbox') | |
| .press(testInfo.project.name === 'webkit' ? 'Meta+ArrowLeft' : 'Home') | |
| await page.getByRole('textbox').pressSequentially('* ') | |
| await page.getByRole('textbox').pressSequentially('1st Item') | |
| await page.keyboard.press('Enter') | |
| await page.getByRole('textbox').pressSequentially('2nd Item') | |
| await page.keyboard.press('Enter') | |
| await page.getByRole('textbox').pressSequentially('3rd Item') | |
| await page.keyboard.press('Enter') | |
| await page.keyboard.press('Backspace') | |
| await expect(page.locator('ul > li')).toHaveCount(3) | |
| expect(await page.locator('ul > li').nth(0).innerText()).toContain( | |
| '1st Item' | |
| ) | |
| expect(await page.locator('ul > li').nth(1).innerText()).toContain( | |
| '2nd Item' | |
| ) | |
| expect(await page.locator('ul > li').nth(2).innerText()).toContain( | |
| '3rd Item' | |
| ) | |
| }) | |
| test('can add a h1 item', async ({ page }) => { | |
| await expect(page.getByRole('textbox').locator('h1')).toHaveCount(0) | |
| await page.getByRole('textbox').press('Enter') | |
| await page.getByRole('textbox').press('ArrowLeft') | |
| await page.getByRole('textbox').pressSequentially('# ') | |
| await page.getByRole('textbox').pressSequentially('Heading') | |
| await expect(page.locator('h1')).toHaveCount(1) | |
| expect( | |
| await page.getByRole('textbox').locator('h1').textContent() | |
| ).toContain('Heading') | |
| }) | |
| }) | |