-
Notifications
You must be signed in to change notification settings - Fork 166
Move screenshot-related utilities to a separate package. #8951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -4,8 +4,8 @@ | |||||
import 'dart:async'; | ||||||
|
||||||
import 'package:puppeteer/puppeteer.dart'; | ||||||
import 'package:screenshot_tools/screenshot_utils.dart'; | ||||||
|
import 'package:screenshot_tools/screenshot_utils.dart'; | |
import 'package:browser_screenshots/browser_screenshots.dart'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about puppeteer_screenshots
?
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Screenshots | ||
|
||
This tool helps create and compare screenshots before/after changes that affect visual styles. | ||
|
||
## Creating screenshots | ||
|
||
The screenshots are created during the `puppeteer` tests, if the `SCREENSHOT_DIR` | ||
environment variable is set. | ||
|
||
The tests are instrumented with calls to take screenshots on selected parts of | ||
the screens. During the method call, it will change the viewport and the main | ||
theme of the page, taking 6 screenshots for each call. | ||
|
||
## Before/after screenshots | ||
|
||
To create before/after screenshot comparisons, use the following workflow: | ||
|
||
1. Generate screenshots by running tests with `SCREENSHOT_DIR=/path/to/before/dir`. | ||
1. Make the changes. | ||
1. Generate screenshots by running tests with `SCREENSHOT_DIR=/path/to/after/dir`. | ||
1. Run `dart bin/compare_screenshots.dart <before-dir> <after-dir> <diff-dir>` | ||
|
||
The comparison will put the files into the `<diff-dir>` with the before/after/diff | ||
versions, alongside a summary `index.html` file to have a quick overview of them. | ||
|
||
### Required tool for comparisons | ||
|
||
The comparison is created by the `odiff` tool running in a container using `docker`. | ||
To build the `odiff` container, user the following command: | ||
|
||
``` | ||
cd tool | ||
docker build . -f Dockerfile.odiff -t odiff | ||
``` | ||
|
||
## Missing features | ||
|
||
- Create a better side-by-side comparison for images, as right now everything is only a list of images. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Should we change the name of the main library to align with the package name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do the library name changes in a follow-up, after more changes has been done, e.g. the dartdoc-related tooling is also implemented.