docs(testrunners): brush up testrunners doc

This commit is contained in:
Pavel 2020-04-30 12:28:10 -07:00
parent 12edf4f03f
commit 671e465450
2 changed files with 25 additions and 12 deletions

View file

@ -53,12 +53,10 @@
- [CircleCI](./ci.md#circleci) - [CircleCI](./ci.md#circleci)
- [AppVeyor](./ci.md#appveyor) - [AppVeyor](./ci.md#appveyor)
- [Troubleshooting](./troubleshooting.md) - [Troubleshooting](./troubleshooting.md)
1. Test runners 1. [Test runners](./test-runners.md)
- Jest - [Jest / Jasmine](./test-runners.md#jest--jasmine)
- Mocha - [AVA](./test-runners.md#ava)
- Karma - [Mocha](./test-runners.md#mocha)
- Jasmine
- Storybooks
1. [Selector engines](./selectors.md) 1. [Selector engines](./selectors.md)
1. [Extensibility](./extensibility.md) 1. [Extensibility](./extensibility.md)
- [Custom selector engines](./extensibility.md#custom-selector-engines) - [Custom selector engines](./extensibility.md#custom-selector-engines)

View file

@ -1,9 +1,20 @@
# Test Runners # Test Runners
## Basic Setup
With a few lines of code, you can hook up Playwright to your favorite JavaScript test runner. With a few lines of code, you can hook up Playwright to your favorite JavaScript test runner.
### Jest / Jasmine <!-- GEN:toc -->
- [Jest / Jasmine](#jest--jasmine)
- [AVA](#ava)
- [Mocha](#mocha)
- [IDE support](#ide-support)
- [Multiple Browsers](#multiple-browsers)
<!-- GEN:stop -->
<br>
<br>
## 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. 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 <br>
## AVA
Tests run concurrently in AVA, so a single page variable cannot be shared between tests. Instead, create new pages with a macro function. 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 <br>
## Mocha
Mocha looks very similar to the Jest/Jasmine setup, and functions in the same way. 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'); assert.equal(await page.title(), 'Example Domain');
}); });
``` ```
<br>
## IDE support
## Types
If using TypeScript, add types to your variables like: If using TypeScript, add types to your variables like:
```ts ```ts