Skip to content

Commit

Permalink
refactor(nw): use findpath to get path to ChromeDriver
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushmanchhabra committed Dec 17, 2023
1 parent 7aa0956 commit a57a4e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
9 changes: 3 additions & 6 deletions chrome/webgl/test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { equal } from "node:assert";
import { after, before, describe, it } from "node:test";
import { dirname, relative } from "node:path";
import { cwd, platform } from "node:process";
import { cwd } from "node:process";

import { findpath } from "nw";
import { By } from "selenium-webdriver";
import chrome from "selenium-webdriver/chrome.js";

Expand All @@ -22,11 +23,7 @@ describe("chrome WebGL tests", async () => {
];
options.addArguments(args);

const service = new ServiceBuilder(
`${cwd()}/node_modules/nw/nwjs/chromedriver${
platform === "win32" ? ".exe" : ""
}`,
).build();
const service = new ServiceBuilder(findpath('chromedriver')).build();

driver = Driver.createSession(options, service);
});
Expand Down
12 changes: 3 additions & 9 deletions nw/window/test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { equal } from "node:assert";
import { after, before, describe, it } from "node:test";
import { dirname, relative, resolve } from "node:path";
import { dirname, relative } from "node:path";
import { cwd, platform } from "node:process";

import { findpath } from "nw";
import { By } from "selenium-webdriver";
import chrome from "selenium-webdriver/chrome.js";

Expand All @@ -22,14 +23,7 @@ describe("nw.Window tests", async () => {
];
options.addArguments(args);

const service = new ServiceBuilder(
resolve(
"node_modules",
"nw",
"nwjs",
`chromedriver${platform === "win32" ? ".exe" : ""}`,
),
).build();
const service = new ServiceBuilder(findpath()).build();

driver = Driver.createSession(options, service);
});
Expand Down

0 comments on commit a57a4e6

Please sign in to comment.