forked from apache/incubator-kie-tools
-
Notifications
You must be signed in to change notification settings - Fork 2
/
serverless-workflow-editor-extension-diagram-navigation.test.ts
84 lines (68 loc) · 2.89 KB
/
serverless-workflow-editor-extension-diagram-navigation.test.ts
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
75
76
77
78
79
80
81
82
83
84
/*
* Copyright 2023 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { expect } from "chai";
import * as path from "path";
import SwfEditorTestHelper from "./helpers/swf/SwfEditorTestHelper";
import SwfTextEditorTestHelper from "./helpers/swf/SwfTextEditorTestHelper";
import { VSCodeTestHelper } from "@kie-tools/vscode-extension-common-test-helpers";
describe("Serverless workflow editor - Diagram navigation tests", () => {
const TEST_PROJECT_FOLDER: string = path.resolve("it-tests-tmp", "resources", "diagram-navigation");
const DIST_IT_TESTS_FOLDER: string = path.resolve("dist-it-tests");
let testHelper: VSCodeTestHelper;
before(async function () {
this.timeout(30000);
testHelper = new VSCodeTestHelper();
await testHelper.openFolder(TEST_PROJECT_FOLDER);
});
beforeEach(async function () {
this.timeout(15000);
await testHelper.closeAllEditors();
await testHelper.closeAllNotifications();
});
afterEach(async function () {
this.timeout(15000);
await testHelper.takeScreenshotOnTestFailure(this, DIST_IT_TESTS_FOLDER);
await testHelper.closeAllEditors();
await testHelper.closeAllNotifications();
});
//TOD - fix test environment
it.skip("Select states", async function () {
this.timeout(30000);
const WORKFLOW_NAME = "applicant-request-decision.sw.json";
try {
const editorWebViews = await testHelper.openFileFromSidebar(WORKFLOW_NAME);
const swfTextEditor = new SwfTextEditorTestHelper(editorWebViews[0]);
const swfEditor = new SwfEditorTestHelper(editorWebViews[1]);
const nodeIds = await swfEditor.getAllNodeIds();
expect(nodeIds.length).equal(6);
// Select CheckApplication node
await swfEditor.selectNode(nodeIds[1]);
const textEditor = await swfTextEditor.getSwfTextEditor();
let lineNumber = (await textEditor.getCoordinates())[0];
let columnNumber = (await textEditor.getCoordinates())[1];
expect(lineNumber).equal(16);
expect(columnNumber).equal(7);
// Select StartApplication node
await swfEditor.selectNode(nodeIds[2]);
lineNumber = (await textEditor.getCoordinates())[0];
columnNumber = (await textEditor.getCoordinates())[1];
expect(lineNumber).equal(33);
expect(columnNumber).equal(7);
} catch (error) {
console.error("Select states: " + error);
}
});
});