@digital-commons-official/codeceptjs-storyboard 0.4.8 → 0.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -2
- package/package.json +1 -1
- package/src/index.d.ts +2 -0
- package/src/index.js +6 -5
package/README.md
CHANGED
|
@@ -64,6 +64,25 @@ When the run ends, open `_output/index.html` to browse its storyboards. The page
|
|
|
64
64
|
|
|
65
65
|
A filtered run lists only the scenarios it ran. In baseline-update mode, `storyboards/index.html` lists the passing scenarios from that update; failed scenarios never replace reviewed storyboards. Run the full suite in update mode to rebuild the complete reviewed gallery.
|
|
66
66
|
|
|
67
|
+
### Replay commands
|
|
68
|
+
|
|
69
|
+
The gallery and SVG default to `npx codeceptjs run --steps --grep "{tag}"`.
|
|
70
|
+
`{tag}` becomes the scenario's last tag. This command works in a standalone
|
|
71
|
+
CodeceptJS project with a local installation and its default configuration file.
|
|
72
|
+
|
|
73
|
+
Toolbox projects can set their Task command on the plugin:
|
|
74
|
+
|
|
75
|
+
```javascript
|
|
76
|
+
storyboard: {
|
|
77
|
+
require: '@digital-commons-official/codeceptjs-storyboard',
|
|
78
|
+
enabled: true,
|
|
79
|
+
replayCommand: 'task test -- --grep "{tag}"'
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
For another configuration file, include its `--config` argument in the template.
|
|
84
|
+
Use a unique scenario tag so the command selects the intended journey.
|
|
85
|
+
|
|
67
86
|
### Colours and fonts
|
|
68
87
|
|
|
69
88
|
Set `theme` on the storyboard plugin to an object, a CSS file path, or an HTTP(S) URL:
|
|
@@ -164,7 +183,9 @@ The [multilingual storyboard](tests/e2e/storyboards/05-languages/storyboard-lang
|
|
|
164
183
|
TASK_E2E_UPDATE_BASELINES=1 npx codeceptjs run
|
|
165
184
|
```
|
|
166
185
|
|
|
167
|
-
|
|
186
|
+
Only the exact value `1` enables recording. An empty value, `0` or `false` keeps
|
|
187
|
+
strict comparison. Every baseline written in recording mode must be inspected
|
|
188
|
+
by a human, which is why that mode throws when `CI` is set.
|
|
168
189
|
|
|
169
190
|
## API 📚
|
|
170
191
|
|
|
@@ -202,7 +223,8 @@ It opens the generated `index.html` and SVG, repeats the run with strict baselin
|
|
|
202
223
|
|
|
203
224
|
The [consumer manifest](tests/e2e/consumer/package.json) pins those tools and overrides vulnerable transitive dependencies. Its lockfile makes the test repeatable. This verifies that combination; the wider peer dependency ranges are not a tested version matrix. The complete installation and run logs are kept in `tests/e2e/_output/consumer-install.log`.
|
|
204
225
|
|
|
205
|
-
|
|
226
|
+
The clean-consumer test also copies the replay command from the generated gallery
|
|
227
|
+
and executes it unchanged, then checks that every strict baseline hash is intact.
|
|
206
228
|
|
|
207
229
|
## Licence 📜
|
|
208
230
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digital-commons-official/codeceptjs-storyboard",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.10",
|
|
4
4
|
"description": "Storyboard plugin for CodeceptJS: one Gherkin sentence = one card = one pixel baseline, and every scenario renders itself as a single SVG storyboard",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
package/src/index.d.ts
CHANGED
|
@@ -91,6 +91,8 @@ export interface Theme {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
export interface StoryboardConfig {
|
|
94
|
+
/** Replay command template; {tag} is the scenario's last tag. Defaults to npx codeceptjs run --steps --grep "{tag}". */
|
|
95
|
+
replayCommand?: string
|
|
94
96
|
/** Theme object, CSS file relative to codecept.conf.js, or HTTP(S) CSS URL. */
|
|
95
97
|
theme?: Theme | string
|
|
96
98
|
[option: string]: unknown
|
package/src/index.js
CHANGED
|
@@ -214,10 +214,10 @@ function assertFrameNotEmpty (png) {
|
|
|
214
214
|
* visual regression.
|
|
215
215
|
*/
|
|
216
216
|
async function assertOrUpdateBaseline (I, baselineName) {
|
|
217
|
-
if (process.env.TASK_E2E_UPDATE_BASELINES && process.env.CI) {
|
|
217
|
+
if (process.env.TASK_E2E_UPDATE_BASELINES === '1' && process.env.CI) {
|
|
218
218
|
throw new Error('TASK_E2E_UPDATE_BASELINES is forbidden in CI — baselines must be regenerated and inspected locally')
|
|
219
219
|
}
|
|
220
|
-
if (process.env.TASK_E2E_UPDATE_BASELINES) {
|
|
220
|
+
if (process.env.TASK_E2E_UPDATE_BASELINES === '1') {
|
|
221
221
|
// tryTo: the recorder marks the test failed on a plain try/catch around
|
|
222
222
|
// an actor call; tryTo is the supported way to probe an assert. Since
|
|
223
223
|
// CodeceptJS 4 it is no longer a plugin exposing a global — it is an
|
|
@@ -781,6 +781,7 @@ function logVisualRegression (frame, outputSvg) {
|
|
|
781
781
|
// ---------------------------------------------------------------------------
|
|
782
782
|
module.exports = function storyboardPlugin (config = {}) {
|
|
783
783
|
const { event, recorder } = require('codeceptjs')
|
|
784
|
+
const replayCommand = config.replayCommand ?? 'npx codeceptjs run --steps --grep "{tag}"'
|
|
784
785
|
const writeGallery = require('./gallery')
|
|
785
786
|
const entries = new Map()
|
|
786
787
|
let themePromise
|
|
@@ -816,7 +817,7 @@ module.exports = function storyboardPlugin (config = {}) {
|
|
|
816
817
|
featureFile: test.file,
|
|
817
818
|
occurrence: Math.max(0, (test.parent.tests || []).filter(other => other.title === test.title).indexOf(test)),
|
|
818
819
|
baseDir: base,
|
|
819
|
-
rerun: tag ?
|
|
820
|
+
rerun: tag ? replayCommand.replaceAll('{tag}', tag) : ''
|
|
820
821
|
})
|
|
821
822
|
if (board.exampleLine) board.baseDir += `-example-${board.exampleLine}`
|
|
822
823
|
if (config.theme) {
|
|
@@ -856,7 +857,7 @@ module.exports = function storyboardPlugin (config = {}) {
|
|
|
856
857
|
sentence: failure && failure.frame ? failure.frame.sentence : ''
|
|
857
858
|
})
|
|
858
859
|
if (failure && failure.frame) logVisualRegression(failure.frame, outputSvg)
|
|
859
|
-
if (passed && process.env.TASK_E2E_UPDATE_BASELINES) {
|
|
860
|
+
if (passed && process.env.TASK_E2E_UPDATE_BASELINES === '1') {
|
|
860
861
|
render(path.join(global.codecept_dir, 'storyboards', `${board.baseDir}.svg`), {
|
|
861
862
|
imageDir: path.join(global.codecept_dir, 'screenshots', 'base', board.baseDir)
|
|
862
863
|
})
|
|
@@ -873,7 +874,7 @@ module.exports = function storyboardPlugin (config = {}) {
|
|
|
873
874
|
try {
|
|
874
875
|
const stories = [...entries.values()]
|
|
875
876
|
writeGallery(path.join(global.codecept_dir, '_output'), stories)
|
|
876
|
-
if (process.env.TASK_E2E_UPDATE_BASELINES && !process.env.CI) {
|
|
877
|
+
if (process.env.TASK_E2E_UPDATE_BASELINES === '1' && !process.env.CI) {
|
|
877
878
|
writeGallery(path.join(global.codecept_dir, 'storyboards'), stories.filter(entry => entry.passed))
|
|
878
879
|
}
|
|
879
880
|
} catch (err) {
|