Revert "Enable edit context" (#237468)

Revert "Enable edit context (#235386)"

This reverts commit 3958e26f65.
This commit is contained in:
Aiday Marlen Kyzy
2025-01-08 11:43:30 +01:00
committed by GitHub
parent 46fdeafcce
commit be5c64a3df
11 changed files with 39 additions and 84 deletions
+3 -6
View File
@@ -12,7 +12,6 @@ import { launch as launchPlaywrightBrowser } from './playwrightBrowser';
import { PlaywrightDriver } from './playwrightDriver';
import { launch as launchPlaywrightElectron } from './playwrightElectron';
import { teardown } from './processes';
import { Quality } from './application';
export interface LaunchOptions {
codePath?: string;
@@ -29,7 +28,6 @@ export interface LaunchOptions {
readonly tracing?: boolean;
readonly headless?: boolean;
readonly browser?: 'chromium' | 'webkit' | 'firefox';
readonly quality: Quality;
}
interface ICodeInstance {
@@ -79,7 +77,7 @@ export async function launch(options: LaunchOptions): Promise<Code> {
const { serverProcess, driver } = await measureAndLog(() => launchPlaywrightBrowser(options), 'launch playwright (browser)', options.logger);
registerInstance(serverProcess, options.logger, 'server');
return new Code(driver, options.logger, serverProcess, options.quality);
return new Code(driver, options.logger, serverProcess);
}
// Electron smoke tests (playwright)
@@ -87,7 +85,7 @@ export async function launch(options: LaunchOptions): Promise<Code> {
const { electronProcess, driver } = await measureAndLog(() => launchPlaywrightElectron(options), 'launch playwright (electron)', options.logger);
registerInstance(electronProcess, options.logger, 'electron');
return new Code(driver, options.logger, electronProcess, options.quality);
return new Code(driver, options.logger, electronProcess);
}
}
@@ -98,8 +96,7 @@ export class Code {
constructor(
driver: PlaywrightDriver,
readonly logger: Logger,
private readonly mainProcess: cp.ChildProcess,
readonly quality: Quality
private readonly mainProcess: cp.ChildProcess
) {
this.driver = new Proxy(driver, {
get(target, prop) {
+3 -6
View File
@@ -9,7 +9,6 @@ import { Code, findElement } from './code';
import { Editors } from './editors';
import { Editor } from './editor';
import { IElement } from './driver';
import { Quality } from './application';
const VIEWLET = 'div[id="workbench.view.debug"]';
const DEBUG_VIEW = `${VIEWLET}`;
@@ -32,8 +31,7 @@ const CONSOLE_OUTPUT = `.repl .output.expression .value`;
const CONSOLE_EVALUATION_RESULT = `.repl .evaluation-result.expression .value`;
const CONSOLE_LINK = `.repl .value a.link`;
const REPL_FOCUSED_NATIVE_EDIT_CONTEXT = '.repl-input-wrapper .monaco-editor .native-edit-context';
const REPL_FOCUSED_TEXTAREA = '.repl-input-wrapper .monaco-editor textarea';
const REPL_FOCUSED = '.repl-input-wrapper .monaco-editor textarea';
export interface IStackFrame {
name: string;
@@ -129,9 +127,8 @@ export class Debug extends Viewlet {
async waitForReplCommand(text: string, accept: (result: string) => boolean): Promise<void> {
await this.commands.runCommand('Debug: Focus on Debug Console View');
const selector = this.code.quality === Quality.Stable ? REPL_FOCUSED_TEXTAREA : REPL_FOCUSED_NATIVE_EDIT_CONTEXT;
await this.code.waitForActiveElement(selector);
await this.code.waitForSetValue(selector, text);
await this.code.waitForActiveElement(REPL_FOCUSED);
await this.code.waitForSetValue(REPL_FOCUSED, text);
// Wait for the keys to be picked up by the editor model such that repl evaluates what just got typed
await this.editor.waitForEditorContents('debug:replinput', s => s.indexOf(text) >= 0);
+5 -10
View File
@@ -6,7 +6,6 @@
import { References } from './peek';
import { Commands } from './workbench';
import { Code } from './code';
import { Quality } from './application';
const RENAME_BOX = '.monaco-editor .monaco-editor.rename-box';
const RENAME_INPUT = `${RENAME_BOX} .rename-input`;
@@ -79,10 +78,10 @@ export class Editor {
async waitForEditorFocus(filename: string, lineNumber: number, selectorPrefix = ''): Promise<void> {
const editor = [selectorPrefix || '', EDITOR(filename)].join(' ');
const line = `${editor} .view-lines > .view-line:nth-child(${lineNumber})`;
const editContext = `${editor} ${this._editContextSelector()}`;
const textarea = `${editor} textarea`;
await this.code.waitAndClick(line, 1, 1);
await this.code.waitForActiveElement(editContext);
await this.code.waitForActiveElement(textarea);
}
async waitForTypeInEditor(filename: string, text: string, selectorPrefix = ''): Promise<any> {
@@ -93,18 +92,14 @@ export class Editor {
await this.code.waitForElement(editor);
const editContext = `${editor} ${this._editContextSelector()}`;
await this.code.waitForActiveElement(editContext);
const textarea = `${editor} textarea`;
await this.code.waitForActiveElement(textarea);
await this.code.waitForTypeInEditor(editContext, text);
await this.code.waitForTypeInEditor(textarea, text);
await this.waitForEditorContents(filename, c => c.indexOf(text) > -1, selectorPrefix);
}
private _editContextSelector() {
return this.code.quality === Quality.Stable ? 'textarea' : '.native-edit-context';
}
async waitForEditorContents(filename: string, accept: (contents: string) => boolean, selectorPrefix = ''): Promise<any> {
const selector = [selectorPrefix || '', `${EDITOR(filename)} .view-lines`].join(' ');
return this.code.waitForTextContent(selector, undefined, c => accept(c.replace(/\u00a0/g, ' ')));
+1 -2
View File
@@ -3,7 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Quality } from './application';
import { Code } from './code';
export class Editors {
@@ -54,7 +53,7 @@ export class Editors {
}
async waitForActiveEditor(fileName: string, retryCount?: number): Promise<any> {
const selector = `.editor-instance .monaco-editor[data-uri$="${fileName}"] ${this.code.quality === Quality.Stable ? 'textarea' : '.native-edit-context'}`;
const selector = `.editor-instance .monaco-editor[data-uri$="${fileName}"] textarea`;
return this.code.waitForActiveElement(selector, retryCount);
}
+1 -2
View File
@@ -8,7 +8,6 @@ import { Code } from './code';
import { ncp } from 'ncp';
import { promisify } from 'util';
import { Commands } from './workbench';
import { Quality } from './application';
import path = require('path');
import fs = require('fs');
@@ -21,7 +20,7 @@ export class Extensions extends Viewlet {
async searchForExtension(id: string): Promise<any> {
await this.commands.runCommand('Extensions: Focus on Extensions View', { exactLabelMatch: true });
await this.code.waitForTypeInEditor(`div.extensions-viewlet[id="workbench.view.extensions"] .monaco-editor ${this.code.quality === Quality.Stable ? 'textarea' : '.native-edit-context'}`, `@id:${id}`);
await this.code.waitForTypeInEditor('div.extensions-viewlet[id="workbench.view.extensions"] .monaco-editor textarea', `@id:${id}`);
await this.code.waitForTextContent(`div.part.sidebar div.composite.title h2`, 'Extensions: Marketplace');
let retrials = 1;
+3 -4
View File
@@ -3,7 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Quality } from './application';
import { Code } from './code';
import { QuickAccess } from './quickaccess';
import { QuickInput } from './quickinput';
@@ -47,10 +46,10 @@ export class Notebook {
await this.code.waitForElement(editor);
const editContext = `${editor} ${this.code.quality === Quality.Stable ? 'textarea' : '.native-edit-context'}`;
await this.code.waitForActiveElement(editContext);
const textarea = `${editor} textarea`;
await this.code.waitForActiveElement(textarea);
await this.code.waitForTypeInEditor(editContext, text);
await this.code.waitForTypeInEditor(textarea, text);
await this._waitForActiveCellEditorContents(c => c.indexOf(text) > -1);
}
+5 -11
View File
@@ -6,11 +6,9 @@
import { Viewlet } from './viewlet';
import { IElement } from './driver';
import { findElement, findElements, Code } from './code';
import { Quality } from './application';
const VIEWLET = 'div[id="workbench.view.scm"]';
const SCM_INPUT_NATIVE_EDIT_CONTEXT = `${VIEWLET} .scm-editor .native-edit-context`;
const SCM_INPUT_TEXTAREA = `${VIEWLET} .scm-editor textarea`;
const SCM_INPUT = `${VIEWLET} .scm-editor textarea`;
const SCM_RESOURCE = `${VIEWLET} .monaco-list-row .resource`;
const REFRESH_COMMAND = `div[id="workbench.parts.sidebar"] .actions-container a.action-label[aria-label="Refresh"]`;
const COMMIT_COMMAND = `div[id="workbench.parts.sidebar"] .actions-container a.action-label[aria-label="Commit"]`;
@@ -46,7 +44,7 @@ export class SCM extends Viewlet {
async openSCMViewlet(): Promise<any> {
await this.code.dispatchKeybinding('ctrl+shift+g');
await this.code.waitForElement(this._editContextSelector());
await this.code.waitForElement(SCM_INPUT);
}
async waitForChange(name: string, type?: string): Promise<void> {
@@ -73,13 +71,9 @@ export class SCM extends Viewlet {
}
async commit(message: string): Promise<void> {
await this.code.waitAndClick(this._editContextSelector());
await this.code.waitForActiveElement(this._editContextSelector());
await this.code.waitForSetValue(this._editContextSelector(), message);
await this.code.waitAndClick(SCM_INPUT);
await this.code.waitForActiveElement(SCM_INPUT);
await this.code.waitForSetValue(SCM_INPUT, message);
await this.code.waitAndClick(COMMIT_COMMAND);
}
private _editContextSelector(): string {
return this.code.quality === Quality.Stable ? SCM_INPUT_TEXTAREA : SCM_INPUT_NATIVE_EDIT_CONTEXT;
}
}
+4 -10
View File
@@ -7,10 +7,8 @@ import { Editor } from './editor';
import { Editors } from './editors';
import { Code } from './code';
import { QuickAccess } from './quickaccess';
import { Quality } from './application';
const SEARCH_BOX_NATIVE_EDIT_CONTEXT = '.settings-editor .suggest-input-container .monaco-editor .native-edit-context';
const SEARCH_BOX_TEXTAREA = '.settings-editor .suggest-input-container .monaco-editor textarea';
const SEARCH_BOX = '.settings-editor .suggest-input-container .monaco-editor textarea';
export class SettingsEditor {
constructor(private code: Code, private editors: Editors, private editor: Editor, private quickaccess: QuickAccess) { }
@@ -59,13 +57,13 @@ export class SettingsEditor {
async openUserSettingsUI(): Promise<void> {
await this.quickaccess.runCommand('workbench.action.openSettings2');
await this.code.waitForActiveElement(this._editContextSelector());
await this.code.waitForActiveElement(SEARCH_BOX);
}
async searchSettingsUI(query: string): Promise<void> {
await this.openUserSettingsUI();
await this.code.waitAndClick(this._editContextSelector());
await this.code.waitAndClick(SEARCH_BOX);
if (process.platform === 'darwin') {
await this.code.dispatchKeybinding('cmd+a');
} else {
@@ -73,11 +71,7 @@ export class SettingsEditor {
}
await this.code.dispatchKeybinding('Delete');
await this.code.waitForElements('.settings-editor .settings-count-widget', false, results => !results || (results?.length === 1 && !results[0].textContent));
await this.code.waitForTypeInEditor(this._editContextSelector(), query);
await this.code.waitForTypeInEditor('.settings-editor .suggest-input-container .monaco-editor textarea', query);
await this.code.waitForElements('.settings-editor .settings-count-widget', false, results => results?.length === 1 && results[0].textContent.includes('Found'));
}
private _editContextSelector() {
return this.code.quality === Quality.Stable ? SEARCH_BOX_TEXTAREA : SEARCH_BOX_NATIVE_EDIT_CONTEXT;
}
}