Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/test/automation/src/problems.ts
3520 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { Code } from './code';
7
import { QuickAccess } from './quickaccess';
8
9
export const enum ProblemSeverity {
10
WARNING = 0,
11
ERROR = 1
12
}
13
14
export class Problems {
15
16
static PROBLEMS_VIEW_SELECTOR = '.panel .markers-panel';
17
18
constructor(private code: Code, private quickAccess: QuickAccess) { }
19
20
async showProblemsView(): Promise<any> {
21
await this.quickAccess.runCommand('workbench.panel.markers.view.focus');
22
await this.waitForProblemsView();
23
}
24
25
async hideProblemsView(): Promise<any> {
26
await this.quickAccess.runCommand('workbench.actions.view.problems');
27
await this.code.waitForElement(Problems.PROBLEMS_VIEW_SELECTOR, el => !el);
28
}
29
30
async waitForProblemsView(): Promise<void> {
31
await this.code.waitForElement(Problems.PROBLEMS_VIEW_SELECTOR);
32
}
33
34
static getSelectorInProblemsView(problemType: ProblemSeverity): string {
35
const selector = problemType === ProblemSeverity.WARNING ? 'codicon-warning' : 'codicon-error';
36
return `div[id="workbench.panel.markers"] .monaco-tl-contents .marker-icon .${selector}`;
37
}
38
39
static getSelectorInEditor(problemType: ProblemSeverity): string {
40
const selector = problemType === ProblemSeverity.WARNING ? 'squiggly-warning' : 'squiggly-error';
41
return `.view-overlays .cdr.${selector}`;
42
}
43
}
44
45