forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproblems.ts
More file actions
50 lines (39 loc) · 2.04 KB
/
problems.ts
File metadata and controls
50 lines (39 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';
// tslint:disable: no-invalid-this no-function-expression
import * as assert from 'assert';
import { expect } from 'chai';
import { Then } from 'cucumber';
import { CucumberRetryMax5Seconds } from '../constants';
import { retryWrapper } from '../helpers';
// Wait for some time as it take take at least 1s to appear.
// Surely problems won't take more than 5 seconds to appear.
// Why 5? Well, needs to be > 1, but most certainly not more than 5.
Then('there are no problems in the problems panel', CucumberRetryMax5Seconds, async function() {
const count = await this.app.problems.getProblemCount();
assert.equal(count, 0);
});
Then('there are no problems in the problems panel within {int} seconds', async function(retrySeconds: number) {
const checkProblems = async () => {
const count = await this.app.problems.getProblemCount();
assert.equal(count, 0);
};
await retryWrapper({ timeout: retrySeconds * 1000 }, checkProblems);
});
Then('there is at least one problem in the problems panel', CucumberRetryMax5Seconds, async function() {
const count = await this.app.problems.getProblemCount();
expect(count).to.greaterThan(0);
});
Then('there are at least {int} problems in the problems panel', CucumberRetryMax5Seconds, async function(expectedMinimumCount: number) {
const count = await this.app.problems.getProblemCount();
expect(count).to.greaterThan(expectedMinimumCount - 1);
});
Then('there is a problem with the message {string}', CucumberRetryMax5Seconds, async function(message: string) {
const messages = await this.app.problems.getProblemMessages();
expect(messages.join(', ').toLowerCase()).to.include(message.toLowerCase());
});
Then('there is a problem with the file named {string}', CucumberRetryMax5Seconds, async function(fileName: string) {
const messages = await this.app.problems.getProblemFiles();
expect(messages.join(', ').toLowerCase()).to.include(fileName.toLowerCase());
});