@browsermation/test 0.0.39 → 0.0.41
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 +10 -29
- 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.41",
|
|
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
|
@@ -617,36 +617,17 @@ async function fetchEndpoint() {
|
|
|
617
617
|
}
|
|
618
618
|
};
|
|
619
619
|
protocol.get(process.env.BM_SERVER_URL || "", options, (res) => {
|
|
620
|
-
if (res.statusCode &&
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
console.error(
|
|
630
|
-
source_default.red.bold("\u274C Error: Failed to fetch WebSocket endpoint.")
|
|
631
|
-
);
|
|
632
|
-
reject(err);
|
|
633
|
-
});
|
|
634
|
-
res.on("data", async (chunk) => {
|
|
635
|
-
if (process.env.BM_DEBUG) {
|
|
636
|
-
console.log("Received chunk:", chunk.toString());
|
|
637
|
-
}
|
|
638
|
-
try {
|
|
639
|
-
const parsedData = JSON.parse(chunk.toString());
|
|
640
|
-
if (parsedData.type === "ws-endpoint") {
|
|
641
|
-
await new Promise((resolve2) => setTimeout(resolve2, 500));
|
|
642
|
-
resolve(parsedData.wsEndpoint);
|
|
643
|
-
res.destroy();
|
|
644
|
-
}
|
|
645
|
-
} catch (error) {
|
|
646
|
-
console.log("Error parsing JSON:", error);
|
|
647
|
-
console.log(chunk.toString());
|
|
620
|
+
if (res.statusCode && res.statusCode >= 300 && res.statusCode < 400) {
|
|
621
|
+
const redirectUrl = res.headers.location;
|
|
622
|
+
if (redirectUrl) {
|
|
623
|
+
console.log(
|
|
624
|
+
source_default.yellow.bold(
|
|
625
|
+
`\u{1F500} Redirected to ${redirectUrl}, fetching WebSocket endpoint from there...`
|
|
626
|
+
)
|
|
627
|
+
);
|
|
628
|
+
resolve(redirectUrl);
|
|
648
629
|
}
|
|
649
|
-
}
|
|
630
|
+
}
|
|
650
631
|
});
|
|
651
632
|
});
|
|
652
633
|
}
|