You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+33-13Lines changed: 33 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,8 @@
6
6
**BackstopJS automates visual regression testing of your responsive web UI by comparing DOM screenshots over time.**
7
7
8
8
## News
9
+
**Backstop 6.0.1 -- now with Playwright engine!** Many thanks to our friend @FrostyShosty who came out of nowhere and made it happen!
10
+
9
11
**EmberJS users** -- check out our ember-backstop test helper! https://github.com/garris/ember-backstop
10
12
11
13
**Want to learn how to Backstop from a pro?** Check out [visual regression testing with BackstopJS on udemy.com](https://www.udemy.com/course/visual-regression-testing-with-backstopjs/) by [Walmyr Filho](https://www.udemy.com/user/walmyr/)
@@ -24,7 +26,7 @@
24
26
- Integrated Docker rendering -- to eliminate cross-platform rendering shenanigans
25
27
- CLI reports
26
28
- Render tests with **Chrome Headless**
27
-
- Simulate user interactions with **Puppeteer** scripts
29
+
- Simulate user interactions with **Playwright** or **Puppeteer** scripts
28
30
- JUnit reports
29
31
- Plays nice with CI and source control
30
32
- Run globally or locally as a standalone package app or `require('backstopjs')` right into your node app
@@ -106,7 +108,7 @@ Pass a `--config=<configFilePathStr>` argument to test using a different config
106
108
107
109
**JS based config file**
108
110
109
-
You may use a javascript based config file to allow connents in your config. Be sure to _export your config object as a node module_.
111
+
You may use a javascript based config file to allow comments in your config. Be sure to _export your config object as a node module_.
110
112
111
113
Example: Create a backstop.config.js
112
114
@@ -182,9 +184,9 @@ removeSelectors // Array of selectors set to display: none
182
184
onReadyScript // After the above conditions are met -- use this script to modify UI state prior to screen shots e.g. hovers, clicks etc.
183
185
keyPressSelectors // Takes array of selector and string values -- simulates multiple sequential keypress interactions.
184
186
hoverSelector // Move the pointer over the specified DOM element prior to screen shot.
clickSelectors // *Playwright and Puppeteer only* takes array of selectors -- simulates multiple sequential click interactions.
188
190
postInteractionWait // Wait for a selector after interacting with hoverSelector or clickSelector (optionally accepts wait time in ms. Ideal for use with a click or hover element transition. available with default onReadyScript)
189
191
scrollToSelector // Scrolls the specified DOM element into view prior to screen shot (available with default onReadyScript)
190
192
selectors // Array of selectors to capture. Defaults to document if omitted. Use "viewport" to capture the viewport size. See Targeting elements in the next section for more info...
@@ -206,15 +208,15 @@ The above would tell BackstopJS to wait for your app to generate an element with
206
208
207
209
You can use these properties independent of each other to easily test various click and or hover states in your app. These are obviously simple scenarios -- if you have more complex needs then this example should serve as a pretty good starting point create your own onReady scripts.
208
210
209
-
NOTE: Puppeteer version optionally takes`clickSelectors` & `hoverSelectors` as arrays of selectors...
211
+
NOTE: Playwright and Puppeteer versions optionally take`clickSelectors` & `hoverSelectors` as arrays of selectors...
Puppeteer is currently the default value and will be installed by default.
586
+
Both Puppeteer and Playwright are installed by default, though the default configuration is set to Puppeteer.
585
587
586
588
#### Chrome-Headless (The latest webkit library)
587
589
To use chrome headless you can currently use _puppeteer_ (https://github.com/GoogleChrome/puppeteer).
588
590
589
-
590
591
```json
591
592
"engine": "puppeteer"
592
593
```
593
594
594
-
### Setting Puppeteer option flags
595
-
Backstop sets two defaults for Puppeteer:
595
+
#### Playwright
596
+
To use firefox or webkit, you can currently use _playwright_ (https://github.com/microsoft/playwright).
597
+
598
+
Be sure to also switch the onBefore and onReady scripts to the Playwright defaults. Playwright supports setting `engineOptions.browser` to `chromium`, `firefox`, or `webkit`.
599
+
600
+
```json
601
+
...
602
+
"onBeforeScript": "playwright/onBefore.js",
603
+
"onReadyScript": "playwright/onReady.js",
604
+
...
605
+
"engine": "playwright"
606
+
...
607
+
"engineOptions": {
608
+
"browser": "chromium"
609
+
}
610
+
...
611
+
```
612
+
613
+
### Setting Puppeteer and Playwright option flags
614
+
Backstop sets two defaults for both Puppeteer and Playwright:
596
615
597
616
```json
598
617
ignoreHTTPSErrors: true,
@@ -607,8 +626,9 @@ You can add more settings (or override the defaults) with the engineOptions prop
More info here: [Puppeteer on github](https://github.com/GoogleChrome/puppeteer).
629
+
More info here:
630
+
*[Puppeteer on github](https://github.com/GoogleChrome/puppeteer).
631
+
*[Playwright on github](https://github.com/microsoft/playwright).
612
632
613
633
### Using Docker for testing across different environments
614
634
We've found that different environments can render the same webpage in slightly different ways -- in particular with text. E.G. see the text in this example rendering slightly differently between Linux and Mac...
0 commit comments