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
+40-2Lines changed: 40 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -55,9 +55,47 @@ npm run lint:format
55
55
```
56
56
57
57
## Testing Stacks
58
-
Stacks has implemented visual regression testing with [Backstop](https://github.com/garris/BackstopJS). To test if your new feature introduces visual regressions, run `npm run test` in a new Terminal window while Stacks is running. After the tests have run, a new browser window with any regressions will show. If the regressions are desired, you can run `npm run approve` to establish the new baseline.
59
58
60
-
Individual routes to test are found in [backstop.json](/backstop.json)
59
+
Run all test suites by running:
60
+
```sh
61
+
npm test
62
+
```
63
+
### Unit/Component Tests
64
+
65
+
Unit/Component tests are written with [DOM Testing Library](https://testing-library.com/docs/dom-testing-library/intro).
66
+
Please follow the library's principles and documentation to write tests.
67
+
68
+
Stacks uses [Web Test Runner](https://modern-web.dev/docs/test-runner/overview/) and [Playwright](https://modern-web.dev/docs/test-runner/browser-launchers/playwright/) to run tests in a real browser context.
69
+
70
+
Execute the unit/component tests suite by running:
71
+
```sh
72
+
npm run test:unit
73
+
```
74
+
or if you prefer watch mode run:
75
+
```sh
76
+
npm run test:unit:watch
77
+
```
78
+
79
+
### Visual Regression Tests
80
+
81
+
**Prerequisite:**
82
+
In order to pull and upload baseline images you need to have `git lfs` installed in your local machine. Please follow [this guide](https://docs.github.com/en/repositories/working-with-files/managing-large-files/installing-git-large-file-storage) to install that.
83
+
84
+
85
+
This [Web Test Runner plugin](https://www.npmjs.com/package/@web/test-runner-visual-regression) is used to run visual regression tests. [DOM Testing Library](https://testing-library.com/docs/dom-testing-library/intro).
86
+
Visual regression tests end with this suffix `*.visual.test.ts`.
87
+
88
+
Execute the visual regression tests suite by running:
89
+
```sh
90
+
npm run test:visual
91
+
```
92
+
93
+
Update the visual baseline via:
94
+
```sh
95
+
npm run test:visual:update
96
+
```
97
+
98
+
Failing tests (including diffs) can be found under `screenshots/[browser]/failed/` folders.
61
99
62
100
## Bugs and feature requests
63
101
Have a bug or feature request? First search existing or closed issues to make sure the issue hasn’t been noted yet. If not, review our [issue guidelines](/CONTRIBUTING.md#open-an-issue) for submitting [a bug report](/CONTRIBUTING.md#reporting-bugs) or [feature request](/CONTRIBUTING.md#feature-requests).
0 commit comments