Skip to content

Add downloadChromeDriverForChromiumVersion #2037

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions packages/extester/src/extester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export * from '@redhat-developer/page-objects';
export interface SetupOptions {
/** version of VS Code to test against, defaults to latest */
vscodeVersion?: string;
/** version of chromium to test against */
chromiumVersion?: string;
/** when true run `vsce package` with the `--yarn` flag */
useYarn?: boolean;
/** install the extension's dependencies from the marketplace. Defaults to `false`. */
Expand Down Expand Up @@ -180,6 +182,15 @@ export class ExTester {
return await this.chrome.downloadChromeDriverForChromiumVersion(chromiumVersion, noCache);
}

/**
* Download the chromedriver with a given version
* @param chromiumVersion fixed version of chromium
* @param noCache whether to skip using cached version
*/
async downloadChromeDriverForChromiumVersion(chromiumVersion: string, noCache: boolean = false): Promise<string> {
return await this.chrome.downloadChromeDriverForChromiumVersion(chromiumVersion, noCache);
}

/**
* Performs all necessary setup: getting VS Code + ChromeDriver
* and packaging/installing extension into the test instance
Expand All @@ -190,12 +201,16 @@ export class ExTester {
* @param noCache whether to skip using cached version
*/
async setupRequirements(options: SetupOptions = DEFAULT_SETUP_OPTIONS, offline = false, cleanup = false): Promise<void> {
const { useYarn, vscodeVersion, installDependencies, noCache } = options;
const { useYarn, vscodeVersion, chromiumVersion, installDependencies, noCache } = options;

const vscodeParsedVersion = loadCodeVersion(vscodeVersion);
if (!offline) {
await this.downloadCode(vscodeParsedVersion, noCache);
await this.downloadChromeDriver(vscodeParsedVersion, noCache);
if (!chromiumVersion) {
await this.downloadChromeDriver(vscodeParsedVersion, noCache);
} else {
await this.downloadChromeDriverForChromiumVersion(chromiumVersion, noCache);
}
} else {
console.log('Attempting Setup in offline mode');
const expectedChromeVersion = this.code.checkOfflineRequirements().split('.')[0];
Expand Down