Disable workspace trust during tests

This commit is contained in:
Ladislau Szomoru 2021-06-03 10:21:19 +02:00
parent 732769073a
commit b0509196f6
No known key found for this signature in database
GPG key ID: 2B88287CB9DB080B
5 changed files with 3 additions and 21 deletions

View file

@ -46,7 +46,7 @@ if %errorlevel% neq 0 exit /b %errorlevel%
:: Tests in the extension host
set ALL_PLATFORMS_API_TESTS_EXTRA_ARGS=--disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-keytar --disable-extensions --user-data-dir=%VSCODEUSERDATADIR%
set ALL_PLATFORMS_API_TESTS_EXTRA_ARGS=--disable-telemetry --crash-reporter-directory=%VSCODECRASHDIR% --no-cached-data --disable-updates --disable-keytar --disable-extensions --disable-workspace-trust --user-data-dir=%VSCODEUSERDATADIR%
call "%INTEGRATION_TEST_ELECTRON_PATH%" %~dp0\..\extensions\vscode-api-tests\testWorkspace --enable-proposed-api=vscode.vscode-api-tests --extensionDevelopmentPath=%~dp0\..\extensions\vscode-api-tests --extensionTestsPath=%~dp0\..\extensions\vscode-api-tests\out\singlefolder-tests %ALL_PLATFORMS_API_TESTS_EXTRA_ARGS%
if %errorlevel% neq 0 exit /b %errorlevel%

View file

@ -62,7 +62,7 @@ after_suite
# Tests in the extension host
ALL_PLATFORMS_API_TESTS_EXTRA_ARGS="--disable-telemetry --crash-reporter-directory=$VSCODECRASHDIR --no-cached-data --disable-updates --disable-keytar --disable-extensions --user-data-dir=$VSCODEUSERDATADIR"
ALL_PLATFORMS_API_TESTS_EXTRA_ARGS="--disable-telemetry --crash-reporter-directory=$VSCODECRASHDIR --no-cached-data --disable-updates --disable-keytar --disable-extensions --disable-workspace-trust --user-data-dir=$VSCODEUSERDATADIR"
"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS $ROOT/extensions/vscode-api-tests/testWorkspace --enable-proposed-api=vscode.vscode-api-tests --extensionDevelopmentPath=$ROOT/extensions/vscode-api-tests --extensionTestsPath=$ROOT/extensions/vscode-api-tests/out/singlefolder-tests $ALL_PLATFORMS_API_TESTS_EXTRA_ARGS
after_suite

View file

@ -233,10 +233,6 @@ export class WorkspaceTrustManagementService extends Disposable implements IWork
return this._remoteAuthority.options.isTrusted;
}
if (this.environmentService.extensionTestsLocationURI) {
return true; // trust running tests with vscode-test
}
if (this.workspaceService.getWorkbenchState() === WorkbenchState.EMPTY) {
// Use memento if present, otherwise default to restricted mode
// Workspace may transition to trusted based on the opened editors

View file

@ -71,7 +71,6 @@ export class Application {
async start(expectWalkthroughPart = true): Promise<any> {
await this._start();
await this.code.waitForElement('.explorer-folders-view');
await this.dismissTrustDialog();
// https://github.com/microsoft/vscode/issues/118748
// if (expectWalkthroughPart) {
@ -84,20 +83,6 @@ export class Application {
await new Promise(c => setTimeout(c, 1000));
await this._start(options.workspaceOrFolder, options.extraArgs);
await this.code.waitForElement('.explorer-folders-view');
await this.dismissTrustDialog();
}
private async dismissTrustDialog(): Promise<void> {
if (this.options.web) {
return;
}
try {
// Dismiss workspace trust dialog, if found
await this.code.waitAndClick(`.monaco-workbench .dialog-buttons-row a:nth-child(1)`, 10, 10, 50);
} catch {
// there musn't be any trust dialog, maybe workspace is trusted?
}
}
private async _start(workspaceOrFolder = this.workspacePathOrFolder, extraArgs: string[] = []): Promise<any> {

View file

@ -140,6 +140,7 @@ export async function spawn(options: SpawnOptions): Promise<Code> {
'--disable-updates',
'--disable-keytar',
'--disable-crash-reporter',
'--disable-workspace-trust',
`--extensions-dir=${options.extensionsPath}`,
`--user-data-dir=${options.userDataDir}`,
'--driver', handle