Playwright Snippets
Playwright test snippets for VS Code.
Snippets
The following snippets are provided by this package. If you have ideas of other snippets that would be helpful, please open an issue.
Test blocks
pw-describe
test.describe('$1', () => {
$0
})
pw-test
test('$1', async ({ page }) => {
$0
})
pw-beforeEach
test.beforeEach(async ({ page }) => {
$0
})
pw-afterEach
test.afterEach(async ({ page }) => {
$0
})
pw-beforeAll
test.beforeAll(async ({ browser }) => {
$0
})
pw-afterAll
test.afterAll(async ({ browser }) => {
$0
})
pw-step
await test.step('$1', async () => {
$0
})
pw-use
test.use({ $0 })
Lariat
Lariat is a Playwright page object framework that simplifies page object construction. We've included some useful Lariat snippets as part of this extension.
pw-collection
import Collection from 'lariat'
export class MyPage extends Collection {
$0
}
pw-page-object
import { Page } from '@playwright/test'
import Collection from 'lariat'
export class MyPage extends Collection {
constructor(page: Page) {
super(page.locator('$1'))
}
$0
}