Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
docs: Add Vitest example (#15356)
jfgreffiercfd00c0baf35
diff --git a/docs/src/test-runners-js.md b/docs/src/test-runners-js.mdindex 716c67f7f9..85e8f41e3a 100644--- a/docs/src/test-runners-js.md+++ b/docs/src/test-runners-js.md@@ -91,6 +91,35 @@ it('should work', async () => {assert.equal(await page.title(), 'Example Domain');});```++## Vitest++Vitest looks very similar to the Jest/Jasmine setup, and functions in the same way.++```+import { chromium } from 'playwright';+import { afterAll, afterEach, beforeAll, beforeEach, expect, test } from 'vitest';+let browser;+let page;+beforeAll(async () => {+ browser = await chromium.launch();+});+afterAll(async () => {+ await browser.close();+});+beforeEach(async () => {+ page = await browser.newPage();+});+afterEach(async () => {+ await page.close();+});++test('should work', async () => {+ await page.goto('https://www.example.com/');+ expect(await page.title()).toBe('Example Domain');+});+```+## Multiple BrowsersThese simple examples can be extended to support multiple browsers using an environment variable.