regressify 1.2.12 → 1.2.14
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.
|
@@ -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,11 +12,17 @@ function getStorageState(stateName) {
|
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
module.exports = async (page, scenario, viewport, isReference, browserContext) => {
|
|
15
|
+
const chalk = await chalkImport;
|
|
16
|
+
const logPrefix = chalk.yellow(`[${scenario.index} of ${scenario.total}] `);
|
|
14
17
|
await require('./loadCookies')(browserContext, scenario);
|
|
15
18
|
|
|
16
19
|
if (scenario.restore) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
+
}
|
|
20
27
|
}
|
|
21
28
|
};
|
package/bun.lockb
CHANGED
|
Binary file
|
package/common/test-schema.json
CHANGED