This commit is contained in:
Sandeep Somavarapu 2020-10-28 19:49:03 +01:00
parent 68b73059e8
commit 6a2535e0ab
3 changed files with 7 additions and 15 deletions

View file

@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import { Code } from './code'; import { Code } from './code';
import { QuickAccess } from './quickaccess';
export const enum ProblemSeverity { export const enum ProblemSeverity {
WARNING = 0, WARNING = 0,
@ -14,26 +15,18 @@ export class Problems {
static PROBLEMS_VIEW_SELECTOR = '.panel .markers-panel'; static PROBLEMS_VIEW_SELECTOR = '.panel .markers-panel';
constructor(private code: Code) { } constructor(private code: Code, private quickAccess: QuickAccess) { }
public async showProblemsView(): Promise<any> { public async showProblemsView(): Promise<any> {
await this.toggleProblemsView(); await this.quickAccess.runCommand('workbench.panel.markers.view.focus');
await this.waitForProblemsView(); await this.waitForProblemsView();
} }
public async hideProblemsView(): Promise<any> { public async hideProblemsView(): Promise<any> {
await this.toggleProblemsView(); await this.quickAccess.runCommand('workbench.actions.view.problems');
await this.code.waitForElement(Problems.PROBLEMS_VIEW_SELECTOR, el => !el); await this.code.waitForElement(Problems.PROBLEMS_VIEW_SELECTOR, el => !el);
} }
private async toggleProblemsView(): Promise<void> {
if (process.platform === 'darwin') {
await this.code.dispatchKeybinding('cmd+shift+m');
} else {
await this.code.dispatchKeybinding('ctrl+shift+m');
}
}
public async waitForProblemsView(): Promise<void> { public async waitForProblemsView(): Promise<void> {
await this.code.waitForElement(Problems.PROBLEMS_VIEW_SELECTOR); await this.code.waitForElement(Problems.PROBLEMS_VIEW_SELECTOR);
} }

View file

@ -56,7 +56,7 @@ export class Workbench {
this.scm = new SCM(code); this.scm = new SCM(code);
this.debug = new Debug(code, this.quickaccess, this.editors, this.editor); this.debug = new Debug(code, this.quickaccess, this.editors, this.editor);
this.statusbar = new StatusBar(code); this.statusbar = new StatusBar(code);
this.problems = new Problems(code); this.problems = new Problems(code, this.quickaccess);
this.settingsEditor = new SettingsEditor(code, userDataPath, this.editors, this.editor, this.quickaccess); this.settingsEditor = new SettingsEditor(code, userDataPath, this.editors, this.editor, this.quickaccess);
this.keybindingsEditor = new KeybindingsEditor(code); this.keybindingsEditor = new KeybindingsEditor(code);
this.terminal = new Terminal(code, this.quickaccess); this.terminal = new Terminal(code, this.quickaccess);

View file

@ -34,10 +34,9 @@ export function setup() {
await app.code.waitForElement(Problems.getSelectorInEditor(ProblemSeverity.ERROR)); await app.code.waitForElement(Problems.getSelectorInEditor(ProblemSeverity.ERROR));
const problems = new Problems(app.code); await app.workbench.problems.showProblemsView();
await problems.showProblemsView();
await app.code.waitForElement(Problems.getSelectorInProblemsView(ProblemSeverity.ERROR)); await app.code.waitForElement(Problems.getSelectorInProblemsView(ProblemSeverity.ERROR));
await problems.hideProblemsView(); await app.workbench.problems.hideProblemsView();
}); });
}); });
} }