@empiricalrun/playwright-utils 0.66.4 → 0.67.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.
- package/CHANGELOG.md +19 -0
- package/dist/config/index.d.ts +0 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +0 -30
- package/dist/config/proxy.d.ts.map +1 -1
- package/dist/config/proxy.js +41 -1
- package/dist/generated/api-worker-openapi.d.ts +310 -56
- package/dist/generated/api-worker-openapi.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/package.json +4 -4
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @empiricalrun/playwright-utils
|
|
2
2
|
|
|
3
|
+
## 0.67.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 735e68a: chore: getProxyConfig uses per-project authentication credentials; no change required for callers
|
|
8
|
+
- @empiricalrun/cua@0.6.0
|
|
9
|
+
- @empiricalrun/reporter@0.30.3
|
|
10
|
+
|
|
11
|
+
## 0.67.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- dc45378: Remove `chromeStablePath()`: in `playwright.config.ts` replace `launchOptions: { executablePath: chromeStablePath() }` with `use: { channel: "chrome" }` and drop the import.
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- @empiricalrun/cua@0.6.0
|
|
20
|
+
- @empiricalrun/reporter@0.30.3
|
|
21
|
+
|
|
3
22
|
## 0.66.4
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { PlaywrightTestConfig } from "@playwright/test";
|
|
2
2
|
import type { DeviceDescriptors } from "./devices/types";
|
|
3
|
-
export declare function chromeStablePath(): string;
|
|
4
3
|
export declare const baseConfig: PlaywrightTestConfig;
|
|
5
4
|
export declare const devices: DeviceDescriptors;
|
|
6
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AA2CzD,eAAO,MAAM,UAAU,EAAE,oBA2BxB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,iBAarB,CAAC"}
|
package/dist/config/index.js
CHANGED
|
@@ -4,38 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.devices = exports.baseConfig = void 0;
|
|
7
|
-
exports.chromeStablePath = chromeStablePath;
|
|
8
7
|
const local_run_id_1 = require("../local-run-id");
|
|
9
8
|
const deviceDescriptorsSource_json_1 = __importDefault(require("./devices/v1.53.2/deviceDescriptorsSource.json"));
|
|
10
|
-
function getPlatformOS() {
|
|
11
|
-
const platform = process.platform;
|
|
12
|
-
if (platform === "win32") {
|
|
13
|
-
return "win";
|
|
14
|
-
}
|
|
15
|
-
else if (platform === "darwin") {
|
|
16
|
-
return "mac";
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
return "linux";
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
function chromeStablePath() {
|
|
23
|
-
if (process.env.CHROMIUM_PATH) {
|
|
24
|
-
return process.env.CHROMIUM_PATH;
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
const platform = getPlatformOS();
|
|
28
|
-
if (platform === "win") {
|
|
29
|
-
return "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe";
|
|
30
|
-
}
|
|
31
|
-
else if (platform === "mac") {
|
|
32
|
-
return "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome";
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
return "/usr/bin/google-chrome-stable";
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
9
|
const runId = (0, local_run_id_1.localRunId)();
|
|
40
10
|
const localReportDir = `playwright-report/${runId}`;
|
|
41
11
|
function getReporters() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../src/config/proxy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../src/config/proxy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE9D,KAAK,WAAW,GAAG,WAAW,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC,CAAC;AAE/D,KAAK,WAAW,GAAG,YAAY,CAAC;AAiDhC,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAM/D"}
|
package/dist/config/proxy.js
CHANGED
|
@@ -1,13 +1,53 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.getProxyConfig = getProxyConfig;
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
4
8
|
const proxyEndpoints = {
|
|
5
9
|
"ap-south-1": "http://prod-proxy-nlb-6b53da958ae0b30e.elb.ap-south-1.amazonaws.com:8080",
|
|
6
10
|
};
|
|
11
|
+
const DEFAULT_TOKEN_FILE = "/tmp/static-ip-proxy-token";
|
|
12
|
+
function tokenExpiry(token) {
|
|
13
|
+
const [payloadB64] = token.split(".");
|
|
14
|
+
if (!payloadB64) {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
const payload = JSON.parse(Buffer.from(payloadB64, "base64").toString("utf8"));
|
|
19
|
+
const exp = payload?.exp;
|
|
20
|
+
return typeof exp === "number" ? exp : undefined;
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function isUnexpiredToken(token) {
|
|
27
|
+
if (!token) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
const exp = tokenExpiry(token);
|
|
31
|
+
return exp !== undefined && exp * 1000 > Date.now();
|
|
32
|
+
}
|
|
33
|
+
function readTokenFile() {
|
|
34
|
+
const path = process.env.EMPIRICAL_STATIC_IP_PROXY_TOKEN_FILE ?? DEFAULT_TOKEN_FILE;
|
|
35
|
+
try {
|
|
36
|
+
return node_fs_1.default.readFileSync(path, "utf8").trim();
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function staticIpProxyToken() {
|
|
43
|
+
return [readTokenFile(), process.env.EMPIRICAL_STATIC_IP_PROXY_TOKEN?.trim()]
|
|
44
|
+
.filter(isUnexpiredToken)
|
|
45
|
+
.at(0);
|
|
46
|
+
}
|
|
7
47
|
function getProxyConfig(region) {
|
|
8
48
|
return {
|
|
9
49
|
server: proxyEndpoints[region],
|
|
10
50
|
username: "proxyuser",
|
|
11
|
-
password: process.env.EMPIRICAL_PROXY_PASSWORD,
|
|
51
|
+
password: staticIpProxyToken() ?? process.env.EMPIRICAL_PROXY_PASSWORD,
|
|
12
52
|
};
|
|
13
53
|
}
|