@browsermation/test 0.0.40 → 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 CHANGED
@@ -42258,7 +42258,7 @@ var {
42258
42258
  // package.json
42259
42259
  var package_default = {
42260
42260
  name: "@browsermation/test",
42261
- version: "0.0.40",
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 && (res.statusCode < 200 || res.statusCode >= 400)) {
621
- console.error(
622
- source_default.red.bold(
623
- `\u274C Error: HTTP status code ${res.statusCode} received`
624
- )
625
- );
626
- return reject(new Error(`HTTP status code ${res.statusCode} received`));
627
- }
628
- res.on("error", (err) => {
629
- console.log("err", err);
630
- console.error(
631
- source_default.red.bold("\u274C Error: Failed to fetch WebSocket endpoint.")
632
- );
633
- reject(err);
634
- });
635
- res.on("data", async (chunk) => {
636
- if (process.env.BM_DEBUG) {
637
- console.log("Received chunk:", chunk.toString());
638
- }
639
- try {
640
- const parsedData = JSON.parse(chunk.toString().trim());
641
- if (parsedData.type === "ws-endpoint") {
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@browsermation/test",
3
- "version": "0.0.40",
3
+ "version": "0.0.41",
4
4
  "description": "The testing platform for Playwright by Browsermation.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",