Skip to content
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

E2E test: ensure mikhail-arkhipov.r cannot be installed #6411

Merged
merged 1 commit into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion src/vs/workbench/services/dialogs/common/dialogService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ export class DialogService extends Disposable implements IDialogService {
return true; // integration tests
}

return !!this.environmentService.enableSmokeTestDriver; // smoke tests
// --- Start Positron ---
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No one seems to object. May as well do it now!

return false;
// --- End Positron ---
}

async confirm(confirmation: IConfirmation): Promise<IConfirmationResult> {
Expand Down
1 change: 1 addition & 0 deletions test/e2e/infra/test-runner/test-tags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export enum TestTags {
DEBUG = '@:debug',
DUCK_DB = '@:duck-db',
EDITOR_ACTION_BAR = '@:editor-action-bar',
EXTENSIONS = '@:extensions',
HELP = '@:help',
HTML = '@:html',
INTERPRETER = '@:interpreter',
Expand Down
10 changes: 6 additions & 4 deletions test/e2e/pages/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,16 @@ export class Extensions {
}
}

async installExtension(id: string, waitUntilEnabled: boolean): Promise<void> {
async installExtension(id: string, waitUntilEnabled: boolean, attemptInstallOnly: boolean = false): Promise<void> {
await this.searchForExtension(id);
const locator = this.code.driver.page.locator(`div.extensions-viewlet[id="workbench.view.extensions"] .monaco-list-row[data-extension-id="${id}"] .extension-list-item .monaco-action-bar .action-item:not(.disabled) .extension-action.install`).first();
await expect(locator).toBeVisible();
await locator.click();
await expect(this.code.driver.page.locator(`.extension-editor .monaco-action-bar .action-item:not(.disabled) .extension-action.uninstall`).first()).toBeVisible();
if (waitUntilEnabled) {
await expect(this.code.driver.page.locator(`.extension-editor .monaco-action-bar .action-item:not(.disabled) a[aria-label="Disable this extension"]`)).toBeVisible();
if (!attemptInstallOnly) {
await expect(this.code.driver.page.locator(`.extension-editor .monaco-action-bar .action-item:not(.disabled) .extension-action.uninstall`).first()).toBeVisible();
if (waitUntilEnabled) {
await expect(this.code.driver.page.locator(`.extension-editor .monaco-action-bar .action-item:not(.disabled) a[aria-label="Disable this extension"]`)).toBeVisible();
}
}
}

Expand Down
28 changes: 28 additions & 0 deletions test/e2e/tests/extensions/blocked-installs.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*---------------------------------------------------------------------------------------------
* Copyright (C) 2025 Posit Software, PBC. All rights reserved.
* Licensed under the Elastic License 2.0. See LICENSE.txt for license information.
*--------------------------------------------------------------------------------------------*/

import { expect } from '@playwright/test';
import { test, tags } from '../_test.setup';

test.use({
suiteId: __filename
});


test.describe('Extensions', {
tag: [tags.EXTENSIONS, tags.WEB],
}, () => {

test('Verify block of R extension installation', {
tag: [tags.WEB_ONLY]
}, async function ({ app }) {

await app.workbench.extensions.installExtension('mikhail-arkhipov.r', false, true);

expect(app.code.driver.page.getByText('Cannot install the \'R Tools\' extension')).toBeVisible();

});
});

Loading