-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy path8.NoResult.test.ts
More file actions
74 lines (66 loc) · 2.7 KB
/
8.NoResult.test.ts
File metadata and controls
74 lines (66 loc) · 2.7 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import {
By,
CustomTreeSection,
EditorView,
InputBox,
VSBrowser,
WebDriver,
Workbench,
} from "vscode-extension-tester";
import { expect } from "chai";
import { getDetailsView, getResults, initialize, waitForNotificationWithTimeout } from "./utils/utils";
import { CHANGES_CONTAINER, CHANGES_LABEL, CODEBASHING_HEADER, COMMENT_BOX, CX_LOOK_SCAN, GENERAL_LABEL, LEARN_MORE_LABEL, SAST_TYPE, SCAN_KEY_TREE_LABEL, UPDATE_BUTTON, WEBVIEW_TITLE } from "./utils/constants";
import { waitByClassName } from "./utils/waiters";
import { EMPTY_RESULTS_SCAN_ID, SCAN_ID } from "./utils/envs";
import { constants } from "buffer";
import { messages } from "../utils/common/messages";
describe("Scan ID load results test", () => {
let bench: Workbench;
let treeScans: CustomTreeSection;
let driver: WebDriver;
before(async function () {
this.timeout(100000);
bench = new Workbench();
driver = VSBrowser.instance.driver;
});
after(async () => {
await new EditorView().closeAllEditors();
});
it("should load results from scan ID", async function () {
await bench.executeCommand(CX_LOOK_SCAN);
let input = await new InputBox();
await input.setText("e3b2505a-0634-4b41-8fa1-dfeb2edc26f7");
await input.confirm();
});
it("should check scan result is not undefined", async function () {
// Make sure the results are loaded
treeScans = await initialize();
while (treeScans === undefined) {
treeScans = await initialize();
}
let scan = await treeScans?.findItem(
SCAN_KEY_TREE_LABEL
);
await scan?.expand();
let scanChildren = await scan?.getChildren();
let scanResults = await scanChildren[0].getChildren();
expect(scanResults).not.to.be.undefined;
expect(scanResults.length).to.be.equal(0);
});
it("should allow creating a new scan even if the current scan has zero results", async function () {
await bench.executeCommand(CX_LOOK_SCAN);
const input = await InputBox.create();
await input.setText(EMPTY_RESULTS_SCAN_ID);
await input.confirm();
await bench.executeCommand("ast-results.createScan");
let firstNotification = await waitForNotificationWithTimeout(5000)
let message = await firstNotification?.getMessage();
if (message === messages.scanProjectNotMatch) {
let actions = await firstNotification?.getActions()
let action = await actions[0];
await action.click();
firstNotification = await waitForNotificationWithTimeout(5000);
}
expect(firstNotification).to.not.be.undefined;
});
});