提交 a1b2f26a 编写于 作者: J Joao Moreno

more cleanup

上级 225d7e5a
......@@ -22,6 +22,7 @@ const DEBUG_STATUS_BAR = `.statusbar.debugging`;
const NOT_DEBUG_STATUS_BAR = `.statusbar:not(debugging)`;
const TOOLBAR_HIDDEN = `.debug-actions-widget.monaco-builder-hidden`;
const STACK_FRAME = `${VIEWLET} .monaco-tree-row .stack-frame`;
const SPECIFIC_STACK_FRAME = filename => `${STACK_FRAME} .file[title$="${filename}"]`;
const VARIABLE = `${VIEWLET} .debug-variables .monaco-tree-row .expression`;
const CONSOLE_OUTPUT = `.repl .output.expression`;
const CONSOLE_INPUT_OUTPUT = `.repl .input-output-pair .output.expression .value`;
......@@ -29,7 +30,6 @@ const CONSOLE_INPUT_OUTPUT = `.repl .input-output-pair .output.expression .value
const REPL_FOCUSED = '.repl-input-wrapper .monaco-editor textarea';
export interface IStackFrame {
id: string;
name: string;
lineNumber: number;
}
......@@ -102,12 +102,11 @@ export class Debug extends Viewlet {
}
async waitForStackFrameLength(length: number): Promise<any> {
return await this.spectron.client.waitFor(() => this.getStackFrames(), stackFrames => stackFrames.length === length);
await this.spectron.client.waitForElements(STACK_FRAME, result => result.length === length);
}
async focusStackFrame(name: string, message: string): Promise<any> {
const stackFrame = await this.waitForStackFrame(sf => sf.name === name, message);
await this.spectron.client.spectron.client.elementIdClick(stackFrame.id);
await this.spectron.client.waitAndClick(SPECIFIC_STACK_FRAME(name));
await this.spectron.workbench.waitForTab(name);
}
......@@ -130,11 +129,6 @@ export class Debug extends Viewlet {
return await this.spectron.webclient.selectorExecute(VARIABLE, div => (Array.isArray(div) ? div : [div]).length);
}
async getStackFramesLength(): Promise<number> {
const stackFrames = await this.getStackFrames();
return stackFrames.length;
}
private async getStackFrames(): Promise<IStackFrame[]> {
const result = await this.spectron.webclient.selectorExecute(STACK_FRAME,
div => (Array.isArray(div) ? div : [div]).map(element => {
......
......@@ -109,7 +109,7 @@ export class Editor {
await this.spectron.client.waitForActiveElement(textarea);
// https://github.com/Microsoft/vscode/issues/34203#issuecomment-334441786
await this.spectron.client.spectron.client.selectorExecute(textarea, (elements, text) => {
await this.spectron.webclient.selectorExecute(textarea, (elements, text) => {
const textarea = (Array.isArray(elements) ? elements : [elements])[0] as HTMLTextAreaElement;
const start = textarea.selectionStart;
const newStart = start + text.length;
......
......@@ -15,7 +15,7 @@ export class SpectronClient {
private readonly retryDuration = 100; // in milliseconds
constructor(
readonly spectron: Application,
private spectron: Application,
private application: SpectronApplication,
waitTime: number
) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册