add server cli test

This commit is contained in:
Sandeep Somavarapu 2021-02-03 21:42:12 +01:00
parent 9c479a4518
commit 4e6d9ce2b7
4 changed files with 29 additions and 1 deletions

View file

@ -51,6 +51,10 @@ export class Application {
return !!this.options.remote;
}
get web(): boolean {
return !!this.options.web;
}
private _workspacePathOrFolder: string;
get workspacePathOrFolder(): string {
return this._workspacePathOrFolder;

View file

@ -32,6 +32,12 @@ export class Extensions extends Viewlet {
await this.code.waitAndClick(SEARCH_BOX);
await this.code.waitForActiveElement(SEARCH_BOX);
await this.code.waitForTypeInEditor(SEARCH_BOX, `@id:${id}`);
await this.code.waitForElement(`div.extensions-viewlet[id="workbench.view.extensions"] .monaco-list-row[data-extension-id="${id}"]`);
}
async openExtension(id: string): Promise<any> {
await this.searchForExtension(id);
await this.code.waitAndClick(`div.extensions-viewlet[id="workbench.view.extensions"] .monaco-list-row[data-extension-id="${id}"]`);
}
async installExtension(id: string, waitUntilEnabled: boolean): Promise<void> {

View file

@ -101,8 +101,10 @@ export async function launch(userDataDir: string, _workspacePath: string, codeSe
VSCODE_REMOTE_SERVER_PATH: codeServerPath,
...process.env
};
const args = ['--browser', 'none', '--driver', 'web', '--extensions-dir', extPath];
let serverLocation: string | undefined;
if (codeServerPath) {
args.push(...['--install-builtin-extension', 'github.vscode-pull-request-github', '--start-server']);
serverLocation = join(codeServerPath, `server.${process.platform === 'win32' ? 'cmd' : 'sh'}`);
console.log(`Starting built server from '${serverLocation}'`);
} else {
@ -111,7 +113,7 @@ export async function launch(userDataDir: string, _workspacePath: string, codeSe
}
server = spawn(
serverLocation,
['--browser', 'none', '--driver', 'web', '--extensions-dir', extPath],
args,
{ env }
);
server.stderr?.on('data', error => console.log(`Server stderr: ${error}`));

View file

@ -27,6 +27,22 @@ export function setup() {
await app.workbench.statusbar.waitForStatusbarText('smoke test', 'VS Code Smoke Test Check');
});
it(`extension installed by server cli`, async function () {
const app = this.app as Application;
if (app.quality === Quality.Dev || !app.web) {
this.skip();
return;
}
await app.workbench.extensions.openExtensionsViewlet();
await app.workbench.extensions.openExtension('github.vscode-pull-request-github');
await this.code.waitForElement(`.extension-editor .monaco-action-bar .action-item:not(.disabled) .extension-action.uninstall`);
await this.code.waitForElement(`.extension-editor .monaco-action-bar .action-item:not(.disabled) .extension-action[title="Disable this extension"]`);
});
after(async function () {
const app = this.app as Application;
await app.workbench.settingsEditor.clearUserSettings();