@browsermation/test 0.0.28 → 0.0.29
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/dist/bin/cli.js +1 -1
- package/dist/index.js +0 -33
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
|
@@ -42258,7 +42258,7 @@ var {
|
|
|
42258
42258
|
// package.json
|
|
42259
42259
|
var package_default = {
|
|
42260
42260
|
name: "@browsermation/test",
|
|
42261
|
-
version: "0.0.
|
|
42261
|
+
version: "0.0.29",
|
|
42262
42262
|
description: "The testing platform for Playwright by Browsermation.",
|
|
42263
42263
|
main: "./dist/index.js",
|
|
42264
42264
|
types: "./dist/index.d.ts",
|
package/dist/index.js
CHANGED
|
@@ -601,39 +601,6 @@ async function fetchEndpoint() {
|
|
|
601
601
|
}
|
|
602
602
|
return new Promise((resolve, reject) => {
|
|
603
603
|
protocol.get(process.env.SERVER_URL || "", (res) => {
|
|
604
|
-
if (res.statusCode && res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
605
|
-
const redirectUrl = new URL(
|
|
606
|
-
res.headers.location,
|
|
607
|
-
process.env.SERVER_URL
|
|
608
|
-
).toString();
|
|
609
|
-
console.log(source_default.blue(`Following redirect to: ${redirectUrl}`));
|
|
610
|
-
let redirectProtocol = redirectUrl.startsWith("https:") ? import_node_https.default : import_node_http.default;
|
|
611
|
-
redirectProtocol.get(redirectUrl, (redirectRes) => {
|
|
612
|
-
if (redirectRes.statusCode && (redirectRes.statusCode < 200 || redirectRes.statusCode >= 300)) {
|
|
613
|
-
return reject(
|
|
614
|
-
new Error(
|
|
615
|
-
`HTTP status code ${redirectRes.statusCode} received from redirect`
|
|
616
|
-
)
|
|
617
|
-
);
|
|
618
|
-
}
|
|
619
|
-
redirectRes.on("error", (err) => {
|
|
620
|
-
reject(err);
|
|
621
|
-
});
|
|
622
|
-
redirectRes.on("data", async (chunk) => {
|
|
623
|
-
try {
|
|
624
|
-
const parsedData = JSON.parse(chunk.toString());
|
|
625
|
-
if (parsedData.type === "ws-endpoint") {
|
|
626
|
-
await new Promise((resolve2) => setTimeout(resolve2, 500));
|
|
627
|
-
resolve(parsedData.wsEndpoint);
|
|
628
|
-
redirectRes.destroy();
|
|
629
|
-
}
|
|
630
|
-
} catch (error) {
|
|
631
|
-
console.log(chunk.toString());
|
|
632
|
-
}
|
|
633
|
-
});
|
|
634
|
-
});
|
|
635
|
-
return;
|
|
636
|
-
}
|
|
637
604
|
if (res.statusCode && (res.statusCode < 200 || res.statusCode >= 300)) {
|
|
638
605
|
return reject(new Error(`HTTP status code ${res.statusCode} received`));
|
|
639
606
|
}
|