Skip to content

Commit 7d90c78

Browse files
committed
integration test: manual, test-cases-config fix
1 parent 91a3260 commit 7d90c78

File tree

24 files changed

+189
-130
lines changed

24 files changed

+189
-130
lines changed

test/integration/man.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
const yargs = require("yargs");
2+
3+
const Manual = require("./modules/manual/manual.js");
4+
5+
6+
try {
7+
var argv = yargs
8+
.usage("Usage: [options]")
9+
10+
.help("h")
11+
.alias("h", "help")
12+
.version(false)
13+
14+
.alias("p", "port")
15+
.describe("p", "Change workspace host's port")
16+
.nargs("p", 1)
17+
.default("p", "8080")
18+
19+
.array("c")
20+
.alias("c", "configs")
21+
.nargs("c", 1)
22+
.describe("c",
23+
"Change the list of config file's path of the test cases" +
24+
"\n(relative or absolute path where the repo folder is the root)" +
25+
"\n")
26+
.default("c",
27+
["/test/integration/test_cases/test_cases.json"])
28+
.argv;
29+
30+
let manual = new Manual(argv.configs, argv.port);
31+
manual.runManual();
32+
} catch (err) {
33+
process.exitCode = 1;
34+
console.error(err);
35+
}

test/integration/manual/manual.js

Lines changed: 0 additions & 107 deletions
This file was deleted.

test/integration/modules/integration-test/test-case/test-case-result.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const path = require("path");
55
const fs = require("fs");
66

77
const TestEnv = require("../../../modules/integration-test/test-env.js");
8-
const VizzuUrl = require("../../../modules/integration-test/vizzu-url.js");
8+
const VizzuUrl = require("../../../modules/vizzu/vizzu-url.js");
99

1010

1111
class TestCaseResult {

test/integration/modules/integration-test/test-case/test-case.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const path = require("path");
22

3-
const VizzuUrl = require("../../../modules/integration-test/vizzu-url.js");
3+
const VizzuUrl = require("../../../modules/vizzu/vizzu-url.js");
44
const TestEnv = require("../../../modules/integration-test/test-env.js");
55
const TestCaseResult = require("../../../modules/integration-test/test-case/test-case-result.js");
66

test/integration/modules/integration-test/test-case/test-cases-config.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ class TestCasesConfig {
1515
let configsReady = [];
1616
let configs = {suites: [], tests: {}};
1717
assert(Array.isArray(configPathList), "configPathList is array");
18-
configPathList.forEach((configPath, index) => {
19-
configPathList[index] = WorkspacePath.resolvePath(configPath, TestEnv.getWorkspacePath(), TestEnv.getTestSuitePath());
18+
let configPathListClone = configPathList.slice();
19+
configPathListClone.forEach((configPath, index) => {
20+
configPathListClone[index] = WorkspacePath.resolvePath(configPath, TestEnv.getWorkspacePath(), TestEnv.getTestSuitePath());
2021
let configReady = new Promise((resolve, reject) => {
21-
TestCasesConfig.readConfig(configPathList[index]).then(config => {
22+
TestCasesConfig.readConfig(configPathListClone[index]).then(config => {
2223
const validate = ajv.compile(TestCasesConfig.getConfigSchema());
2324
assert(validate(config), "config schema validation failed");
2425
let suite = {

test/integration/modules/integration-test/test-suite-result.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class TestSuiteResult {
4949
this.#cnsl.log(("tests failed:".padEnd(15, " ") + this.#testSuiteResults.FAILED.length).error);
5050
process.exitCode = 1;
5151
this.#testSuiteResults.FAILED.forEach(testCase => {
52-
this.#cnsl.log("".padEnd(this.#cnsl.getTestStatusPad() + 5, " ") + path.relative(TestEnv.getTestSuitePath(), path.join(TestEnv.getWorkspacePath(), testCase)) + " http://127.0.0.1:8080/test/integration/manual/?version=localhost&testCase=" + testCase);
52+
this.#cnsl.log("".padEnd(this.#cnsl.getTestStatusPad() + 5, " ") + path.relative(TestEnv.getTestSuitePath(), path.join(TestEnv.getWorkspacePath(), testCase)) + " http://127.0.0.1:8080/test/integration/modules/manual/client?version=localhost&testCase=" + testCase);
5353
});
5454
} else {
5555
this.#cnsl.log("tests failed:".padEnd(15, " ") + this.#testSuiteResults.FAILED.length);

test/integration/modules/integration-test/test-suite.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const AggregateErrorReady = import("aggregate-error");
66

77
const WorkspaceHost = require("../../modules/workspace/workspace-host.js");
88
const BrowsersChrome = require("../../modules/browser/browsers-chrome.js");
9-
const VizzuUrl = require("../../modules/integration-test/vizzu-url.js");
9+
const VizzuUrl = require("../../modules/vizzu/vizzu-url.js");
1010
const TestEnv = require("../../modules/integration-test/test-env.js");
1111
const TestConsole = require("../../modules/integration-test/test-console.js");
1212
const TestCase = require("../../modules/integration-test/test-case/test-case.js");
@@ -182,7 +182,7 @@ class TestSuite {
182182
this.#workspaceHostReady.then(serverPort => {
183183
this.#workspaceHostServerPort = serverPort;
184184
this.#cnsl.log("[ " + "W. HOST".padEnd(this.#cnsl.getTestStatusPad(), " ") + " ]" + " " + "[ " + "http://127.0.0.1:" + String(serverPort) + " ]");
185-
});
185+
});
186186

187187
this.#browsersChrome.setBrowsersNum(((this.#testCases.filteredTestCases.length < this.#browsersChrome.getBrowsersNum()) ?
188188
this.#testCases.filteredTestCases.length :
File renamed without changes.
File renamed without changes.

test/integration/manual/frame.js renamed to test/integration/modules/manual/client/frame.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,19 @@ let vizzuUrl = urlParams.get('vizzuUrl');
77
let canvas = document.getElementById('vizzuCanvas');
88
let chart;
99

10-
import(vizzuUrl + '/vizzu.js').then(vizzuModule => {
10+
if (!vizzuUrl.endsWith('/vizzu.js') && !vizzuUrl.endsWith('/vizzu.min.js')) {
11+
vizzuUrl = vizzuUrl + '/vizzu.js';
12+
}
13+
14+
import(vizzuUrl).then(vizzuModule => {
1115
let Vizzu = vizzuModule.default;
1216
chart = new Vizzu(canvas);
1317
return chart.initializing;
1418
}).then(chart => {
1519
chart.module._vizzu_setLogging(true);
1620
console.log(chart.version());
1721
initSlider(chart);
18-
return import('/test/integration/test_cases/' + testCase + '.mjs')
22+
return import(testCase + '.mjs');
1923
}).then(testModule => {
2024
let anim = chart.initializing;
2125
for (let step of testModule.default) anim = anim.then(step);

0 commit comments

Comments
 (0)