From 671e465450ee6061302eb5457c424a7a0e3c7983 Mon Sep 17 00:00:00 2001 From: Pavel Date: Thu, 30 Apr 2020 12:28:10 -0700 Subject: [PATCH] docs(testrunners): brush up testrunners doc --- docs/README.md | 10 ++++------ docs/test-runners.md | 27 +++++++++++++++++++++------ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/docs/README.md b/docs/README.md index a5521a04f8..fc1526a3c9 100644 --- a/docs/README.md +++ b/docs/README.md @@ -53,12 +53,10 @@ - [CircleCI](./ci.md#circleci) - [AppVeyor](./ci.md#appveyor) - [Troubleshooting](./troubleshooting.md) -1. Test runners - - Jest - - Mocha - - Karma - - Jasmine - - Storybooks +1. [Test runners](./test-runners.md) + - [Jest / Jasmine](./test-runners.md#jest--jasmine) + - [AVA](./test-runners.md#ava) + - [Mocha](./test-runners.md#mocha) 1. [Selector engines](./selectors.md) 1. [Extensibility](./extensibility.md) - [Custom selector engines](./extensibility.md#custom-selector-engines) diff --git a/docs/test-runners.md b/docs/test-runners.md index a860c3bded..d5db9c8590 100644 --- a/docs/test-runners.md +++ b/docs/test-runners.md @@ -1,9 +1,20 @@ # Test Runners -## Basic Setup With a few lines of code, you can hook up Playwright to your favorite JavaScript test runner. -### Jest / Jasmine + +- [Jest / Jasmine](#jest--jasmine) +- [AVA](#ava) +- [Mocha](#mocha) +- [IDE support](#ide-support) +- [Multiple Browsers](#multiple-browsers) + + +
+ +
+ +## Jest / Jasmine For Jest, [jest-playwright](https://github.com/playwright-community/jest-playwright) can be used. However for a light-weight solution, requiring playwright directly works fine. Jest shares it's syntax with Jasmine, so this applies to Jasmine as well. @@ -30,7 +41,9 @@ it('should work', async () => { }); ``` -### AVA +
+ +## AVA Tests run concurrently in AVA, so a single page variable cannot be shared between tests. Instead, create new pages with a macro function. @@ -55,7 +68,9 @@ test('should work', pageMacro, async (t, page) => { }); ``` -### Mocha +
+ +## Mocha Mocha looks very similar to the Jest/Jasmine setup, and functions in the same way. @@ -81,9 +96,9 @@ it('should work', async () => { assert.equal(await page.title(), 'Example Domain'); }); ``` +
- -## Types +## IDE support If using TypeScript, add types to your variables like: ```ts