Skip to content

Commit 1709a95

Browse files
committed
Integration test option to use custom ref vizzulib
1 parent 0115863 commit 1709a95

File tree

4 files changed

+52
-8
lines changed

4 files changed

+52
-8
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,18 @@ class TestCaseResult {
1515

1616
#browserChrome;
1717
#vizzuUrl;
18+
#vizzuRefUrl;
1819

1920
#runTestCaseRef;
2021

21-
constructor(testCaseObj, testData, browserChrome, vizzuUrl, runTestCaseRef) {
22+
constructor(testCaseObj, testData, browserChrome, vizzuUrl, vizzuRefUrl, runTestCaseRef) {
2223
this.#cnsl = testCaseObj.cnsl;
2324

2425
this.#testCaseObj = testCaseObj;
2526
this.#testData = testData;
2627
this.#browserChrome = browserChrome;
2728
this.#vizzuUrl = vizzuUrl;
29+
this.#vizzuRefUrl = vizzuRefUrl;
2830

2931
this.#runTestCaseRef = runTestCaseRef;
3032
}
@@ -118,11 +120,11 @@ class TestCaseResult {
118120
} else {
119121
if (
120122
this.#testCaseObj.createImages !== "DISABLED" &&
121-
!this.#vizzuUrl.includes(VizzuUrl.getRemoteStableBucket())
123+
this.#vizzuUrl !== this.#vizzuRefUrl
122124
) {
123125
let testCaseObj = Object.assign({}, this.#testCaseObj);
124126
testCaseObj.createImages = "ALL";
125-
this.#runTestCaseRef(testCaseObj, this.#browserChrome).then(
127+
this.#runTestCaseRef(testCaseObj, this.#browserChrome, this.#vizzuRefUrl).then(
126128
(testDataRef) => {
127129
let failureMsgs = [];
128130
this.#createImage(testDataRef, "-2ref");

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const TestEnv = require("../../../modules/integration-test/test-env.js");
55
const TestCaseResult = require("../../../modules/integration-test/test-case/test-case-result.js");
66

77
class TestCase {
8-
static runTestCase(testCaseObj, vizzuUrl) {
8+
static runTestCase(testCaseObj, vizzuUrl, vizzuRefUrl) {
99
return new Promise((resolve, reject) => {
1010
let browserChrome = testCaseObj.browsersChrome.shiftBrowser();
1111
TestCase.runTestCaseClient(testCaseObj, browserChrome, vizzuUrl).then(
@@ -17,6 +17,7 @@ class TestCase {
1717
testData,
1818
browserChrome,
1919
vizzuUrl,
20+
vizzuRefUrl,
2021
TestCase.runTestCaseRef
2122
);
2223
testCaseResult.createTestCaseResult().then(() => {
@@ -28,10 +29,8 @@ class TestCase {
2829
});
2930
}
3031

31-
static runTestCaseRef(testCaseObj, browserChrome) {
32+
static runTestCaseRef(testCaseObj, browserChrome, vizzuUrl) {
3233
return new Promise((resolve, reject) => {
33-
let vizzuUrl =
34-
VizzuUrl.getRemoteStableBucket() + "/lib" + VizzuUrl.getVizzuMinJs();
3534
TestCase.runTestCaseClient(testCaseObj, browserChrome, vizzuUrl)
3635
.then((testDataRef) => {
3736
return resolve(testDataRef);

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

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ class TestSuite {
2323

2424
#vizzuUrl;
2525
#vizzuUrlReady;
26+
#vizzuRefUrl;
27+
#vizzuRefUrlReady;
2628

2729
#workspaceHost;
2830
#workspaceHostReady;
@@ -54,6 +56,7 @@ class TestSuite {
5456
browsersNum,
5557
browserGui,
5658
vizzuUrl,
59+
vizzuRefUrl,
5760
Werror,
5861
createImages,
5962
createHashes
@@ -69,6 +72,7 @@ class TestSuite {
6972
);
7073

7174
this.#vizzuUrl = vizzuUrl;
75+
this.#vizzuRefUrl = vizzuRefUrl;
7276

7377
this.#Werror = Werror;
7478
this.#createImages = createImages;
@@ -136,7 +140,7 @@ class TestSuite {
136140
cnsl: this.#cnsl,
137141
};
138142
return limit(() =>
139-
TestCase.runTestCase(testCaseObj, this.#vizzuUrl)
143+
TestCase.runTestCase(testCaseObj, this.#vizzuUrl, this.#vizzuRefUrl)
140144
);
141145
}
142146
);
@@ -239,6 +243,25 @@ class TestSuite {
239243
);
240244
});
241245

246+
this.#vizzuRefUrlReady = VizzuUrl.resolveVizzuUrl(
247+
this.#vizzuRefUrl,
248+
TestEnv.getWorkspacePath(),
249+
TestEnv.getTestSuitePath()
250+
);
251+
startTestSuiteReady.push(this.#vizzuRefUrlReady);
252+
this.#vizzuRefUrlReady.then((url) => {
253+
this.#vizzuRefUrl = url;
254+
this.#cnsl.log(
255+
"[ " +
256+
"V.R. URL".padEnd(this.#cnsl.getTestStatusPad(), " ") +
257+
" ]" +
258+
" " +
259+
"[ " +
260+
url +
261+
" ]"
262+
);
263+
});
264+
242265
this.#workspaceHost = new WorkspaceHost(TestEnv.getWorkspacePath());
243266
this.#workspaceHostReady = this.#workspaceHost.serverPortReady();
244267
startTestSuiteReady.push(this.#workspaceHostReady);

test/integration/test.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,25 @@ try {
112112
)
113113
.default("vizzu", "/example/lib/vizzu.js")
114114

115+
.string("vizzu-ref")
116+
.nargs("vizzu-ref", 1)
117+
.describe(
118+
"vizzu-ref",
119+
"Change reference Vizzu url" +
120+
"\n(can be forced to use vizzu.js or vizzu.min.js if its given)" +
121+
'\n\n- "head": select the last stable Vizzu from the main branch' +
122+
"\n(default: vizzu.min.js)" +
123+
"\n\n- [sha]: select Vizzu with a short commit number" +
124+
"\n(default: vizzu.min.js)" +
125+
"\n\n- [version]: select Vizzu with a version number" +
126+
"\n(vizzu.min.js only)" +
127+
"\n\n- path: select Vizzu from the local file system" +
128+
"\n(relative or absolute path where the repo folder is the root)" +
129+
"\n(default: vizzu.js)" +
130+
"\n"
131+
)
132+
.default("vizzu-ref", "head")
133+
115134
.boolean("g")
116135
.alias("g", "gui")
117136
.describe("g", "Use browser with graphical user interface" + "\n")
@@ -177,6 +196,7 @@ try {
177196
argv.browsers,
178197
argv.gui,
179198
argv.vizzu,
199+
argv.vizzuRef,
180200
(argv.Werror || []),
181201
argv.images,
182202
argv.hashes

0 commit comments

Comments
 (0)