regressify 1.2.13 → 1.2.15
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.
|
@@ -174,10 +174,10 @@ module.exports = async (context) => {
|
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
if (!!action.
|
|
178
|
-
console.log(logPrefix + '
|
|
177
|
+
if (!!action.persist) {
|
|
178
|
+
console.log(logPrefix + 'persist:', action.persist);
|
|
179
179
|
const states = await browserContext.storageState();
|
|
180
|
-
setStorageState(action.
|
|
180
|
+
setStorageState(action.persist, states);
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const YAML = require('js-yaml');
|
|
4
|
+
const chalkImport = import('chalk').then((m) => m.default);
|
|
4
5
|
|
|
5
6
|
function getStorageState(stateName) {
|
|
6
7
|
const statePath = path.join(process.cwd(), 'states', `${stateName}.yaml`);
|
|
@@ -11,12 +12,17 @@ function getStorageState(stateName) {
|
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
module.exports = async (page, scenario, viewport, isReference, browserContext) => {
|
|
15
|
+
const chalk = await chalkImport;
|
|
14
16
|
const logPrefix = chalk.yellow(`[${scenario.index} of ${scenario.total}] `);
|
|
15
17
|
await require('./loadCookies')(browserContext, scenario);
|
|
16
18
|
|
|
17
19
|
if (scenario.restore) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
const stateNames = typeof scenario.restore === 'string' ? [scenario.restore] : scenario.restore;
|
|
21
|
+
|
|
22
|
+
for (const stateName of stateNames) {
|
|
23
|
+
console.log(logPrefix + 'restore:', stateName);
|
|
24
|
+
const states = getStorageState(stateName);
|
|
25
|
+
await browserContext.storageState(states);
|
|
26
|
+
}
|
|
21
27
|
}
|
|
22
28
|
};
|
package/bun.lockb
CHANGED
|
Binary file
|
package/common/test-schema.json
CHANGED
|
@@ -77,7 +77,17 @@
|
|
|
77
77
|
"type": "number"
|
|
78
78
|
},
|
|
79
79
|
"restore": {
|
|
80
|
-
"
|
|
80
|
+
"oneOf": [
|
|
81
|
+
{
|
|
82
|
+
"type": "string"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"type": "array",
|
|
86
|
+
"items": {
|
|
87
|
+
"type": "string"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
]
|
|
81
91
|
},
|
|
82
92
|
"ignoreSslErrors": {
|
|
83
93
|
"type": "boolean"
|
|
@@ -189,7 +199,7 @@
|
|
|
189
199
|
"$ref": "#/definitions/InputFileAction"
|
|
190
200
|
},
|
|
191
201
|
{
|
|
192
|
-
"$ref": "#/definitions/
|
|
202
|
+
"$ref": "#/definitions/persistAction"
|
|
193
203
|
},
|
|
194
204
|
{
|
|
195
205
|
"$ref": "#/definitions/PressAction"
|
|
@@ -637,11 +647,11 @@
|
|
|
637
647
|
"wait"
|
|
638
648
|
]
|
|
639
649
|
},
|
|
640
|
-
"
|
|
650
|
+
"persistAction": {
|
|
641
651
|
"type": "object",
|
|
642
652
|
"additionalProperties": false,
|
|
643
653
|
"properties": {
|
|
644
|
-
"
|
|
654
|
+
"persist": {
|
|
645
655
|
"type": "string"
|
|
646
656
|
},
|
|
647
657
|
"frame": {
|