-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathplaywright-async.config.js
48 lines (40 loc) · 1.14 KB
/
playwright-async.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require("dotenv").config();
import * as dotenv from "dotenv"; // see https://github.com/motdotla/dotenv#how-do-i-use-dotenv-with-import
dotenv.config();
// const th = (msg) => new Error(`playwright-async.config.js error: ${msg}`);
//
// const protocolRegex = /^https?:\/\//;
//
// function envcheck(name) {
// if (typeof process.env[name] !== "string") {
// throw th(`process.env.${name} is not a string`);
// }
//
// if (!process.env[name].trim()) {
// throw th(`process.env.${name} is an ampty string`);
// }
// }
//
// envcheck("BASE_URL");
//
// if (!protocolRegex.test(process.env.BASE_URL)) {
// throw th(`process.env.BASE_URL don't match ${protocolRegex}`);
// }
const delay = (ms) => new Promise((res) => setTimeout(res, ms));
/**
* Collect any params you need here, sync or async way
* You will end up with object which you can use
* to assemble playwright.config.js normal synchronous way.
*/
(async function () {
const data = {
start: true,
};
// await delay(3000);
data.end = true;
console.log(JSON.stringify(data));
})();