Skip to content

Commit 42712d9

Browse files
kaushiki069tanwigeetika1618shatakshiiii
authored
fix: Electron dependency addition related fix for lightspeed [ACA-4624] (#2377)
* Code changes for fixing the issue and unmarking skip in ui tests * lint fix --------- Co-authored-by: tanwigeetika1618 <84617407+tanwigeetika1618@users.noreply.github.com> Co-authored-by: Shatakshi Mishra <shatakshimishra01@gmail.com>
1 parent 65bd055 commit 42712d9

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

src/features/lightspeed/api.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,15 @@ const UNKNOWN_ERROR: string = "An unknown error occurred.";
4242

4343
export function getFetch() {
4444
try {
45-
return require("electron")?.net?.fetch;
45+
const electronFetch = require("electron")?.net?.fetch;
46+
if (electronFetch) {
47+
return electronFetch;
48+
}
4649
} catch {
47-
return globalThis.fetch;
50+
// electron not available (e.g., in tests or web environment)
4851
}
52+
// Fallback to global fetch
53+
return globalThis.fetch;
4954
}
5055

5156
export class LightSpeedAPI {

test/ui/lightspeedUiTestPlaybookGenWebviewPart1Test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ describe("playbook generation features work", function () {
2222
let adtView: ViewSection;
2323

2424
beforeEach(function () {
25-
this.skip();
26-
// if (!process.env.TEST_LIGHTSPEED_URL) {
27-
// this.skip();
28-
// }
25+
if (!process.env.TEST_LIGHTSPEED_URL) {
26+
this.skip();
27+
}
2928
});
3029

3130
before(async function () {

test/ui/lightspeedUiTestPlaybookGenWebviewPart2Test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ import { PlaybookGenerationActionEvent } from "../../src/interfaces/lightspeed";
2121
config.truncateThreshold = 0;
2222

2323
before(function () {
24-
// Apparently broken on linux too
25-
this.skip();
24+
if (process.platform === "darwin") {
25+
this.skip();
26+
}
2627
});
2728

2829
describe("playbook generation features work", function () {

0 commit comments

Comments
 (0)