regressify 1.2.0 → 1.2.1

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.
@@ -178,12 +178,6 @@ module.exports = async (context) => {
178
178
  const states = await browserContext.storageState();
179
179
  fs.writeFileSync(getStatePath(), JSON.stringify(states, null, 2));
180
180
  }
181
-
182
- if (action.restore) {
183
- console.log(logPrefix + 'restore:', action.restore);
184
- const states = JSON.parse(getStatePath(), 'utf8');
185
- await browserContext.storageState(states);
186
- }
187
181
  }
188
182
  };
189
183
 
@@ -2,7 +2,17 @@ const autoScroll = require('../auto-scroll');
2
2
  const scrollTop = require('../scroll-top');
3
3
  const chalkImport = import('chalk').then((m) => m.default);
4
4
 
5
+ function getStatePath(stateName) {
6
+ return process.cwd() + `/states/storage-states--${stateName}.json`;
7
+ }
8
+
5
9
  module.exports = async (page, scenario, viewport, isReference, browserContext) => {
10
+ if (scenario.restore) {
11
+ console.log(logPrefix + 'restore:', action.restore);
12
+ const states = JSON.parse(getStatePath(), 'utf8');
13
+ await browserContext.storageState(states);
14
+ }
15
+
6
16
  await require('./embedFiles')(scenario, page);
7
17
  await page.evaluate(autoScroll);
8
18
  const chalk = await chalkImport;
@@ -160,6 +160,9 @@
160
160
  "noScrollTop": {
161
161
  "type": "boolean"
162
162
  },
163
+ "restore": {
164
+ "type": "string"
165
+ },
163
166
  "actions": {
164
167
  "type": "array",
165
168
  "items": {
@@ -182,6 +185,9 @@
182
185
  {
183
186
  "$ref": "#/definitions/InputFileAction"
184
187
  },
188
+ {
189
+ "$ref": "#/definitions/PersitAction"
190
+ },
185
191
  {
186
192
  "$ref": "#/definitions/PressAction"
187
193
  },
@@ -649,28 +655,6 @@
649
655
  ]
650
656
  }
651
657
  }
652
- },
653
- "RestoreAction": {
654
- "type": "object",
655
- "additionalProperties": false,
656
- "properties": {
657
- "restore": {
658
- "type": "string"
659
- },
660
- "frame": {
661
- "oneOf": [
662
- {
663
- "type": "string"
664
- },
665
- {
666
- "type": "array",
667
- "items": {
668
- "type": "string"
669
- }
670
- }
671
- ]
672
- }
673
- }
674
658
  }
675
659
  }
676
660
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "regressify",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Visual regression tests support",
5
5
  "main": "src/index.ts",
6
6
  "type": "module",