bt-runner 2.1.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/IRunner.js +2 -0
- package/dist/generate.js +62 -0
- package/dist/generator.js +33 -32
- package/dist/getPort.js +20 -0
- package/dist/index.js +58 -18
- package/dist/index_custom.js +100 -0
- package/dist/index_debug.js +8 -3
- package/dist/server.js +1 -1
- package/package.json +3 -6
- package/tmp/{browsertests-71yT6w → browsertests-9PMQFx}/index1.html +2 -2
- package/tmp/browsertests-9PMQFx/index2.html +25 -0
- package/tmp/{browsertests-nIABth → browsertests-CRhBRJ}/index1.html +2 -2
- package/tmp/browsertests-CRhBRJ/index2.html +25 -0
- package/tmp/{browsertests-nIABth/mocha1.test.js → browsertests-CRhBRJ/mocha.test.js} +54 -9
- package/tmp/{browsertests-sBNC3W → browsertests-CRhBRJ}/nightwatch.json +1 -1
- package/tmp/{browsertests-3rqPiu → browsertests-Ef8QDb}/index1.html +2 -4
- package/tmp/browsertests-Ef8QDb/index2.html +25 -0
- package/tmp/{browsertests-71yT6w/mocha1.test.js → browsertests-Ef8QDb/mocha.test.js} +54 -10
- package/tmp/{browsertests-71yT6w → browsertests-Ef8QDb}/nightwatch.json +1 -1
- package/tmp/{browsertests-sBNC3W → browsertests-FNrySD}/index1.html +2 -13
- package/tmp/browsertests-FNrySD/index2.html +25 -0
- package/tmp/browsertests-FNrySD/mocha.test.js +100 -0
- package/tmp/browsertests-FNrySD/nightwatch.json +1 -0
- package/tmp/browsertests-HnV7W1/index1.html +25 -0
- package/tmp/browsertests-HnV7W1/index2.html +25 -0
- package/tmp/browsertests-HnV7W1/mocha.test.js +100 -0
- package/tmp/browsertests-HnV7W1/nightwatch.json +1 -0
- package/tmp/browsertests-Kr11Ep/index1.html +25 -0
- package/tmp/browsertests-Kr11Ep/index2.html +25 -0
- package/tmp/browsertests-Kr11Ep/mocha.test.js +100 -0
- package/tmp/browsertests-Kr11Ep/nightwatch.json +1 -0
- package/tmp/browsertests-QTo9jV/index1.html +25 -0
- package/tmp/browsertests-QTo9jV/index2.html +25 -0
- package/tmp/browsertests-QTo9jV/mocha.test.js +100 -0
- package/tmp/browsertests-QTo9jV/nightwatch.json +1 -0
- package/tmp/browsertests-VXReLQ/index1.html +25 -0
- package/tmp/browsertests-VXReLQ/index2.html +25 -0
- package/tmp/browsertests-VXReLQ/mocha.test.js +100 -0
- package/tmp/browsertests-VXReLQ/nightwatch.json +1 -0
- package/tmp/browsertests-dat86a/index1.html +25 -0
- package/tmp/browsertests-dat86a/index2.html +25 -0
- package/tmp/browsertests-dat86a/mocha.test.js +94 -0
- package/tmp/browsertests-dat86a/nightwatch.json +1 -0
- package/tmp/browsertests-eI4Px3/index1.html +25 -0
- package/tmp/browsertests-eI4Px3/index2.html +25 -0
- package/tmp/browsertests-eI4Px3/mocha.test.js +100 -0
- package/tmp/browsertests-eI4Px3/nightwatch.json +1 -0
- package/tmp/browsertests-eQY4O5/index1.html +25 -0
- package/tmp/browsertests-eQY4O5/index2.html +25 -0
- package/tmp/browsertests-eQY4O5/mocha.test.js +100 -0
- package/tmp/browsertests-eQY4O5/nightwatch.json +1 -0
- package/tmp/browsertests-gOUWdm/index1.html +25 -0
- package/tmp/browsertests-gOUWdm/index2.html +25 -0
- package/tmp/browsertests-gOUWdm/mocha.test.js +100 -0
- package/tmp/browsertests-gOUWdm/nightwatch.json +1 -0
- package/tmp/browsertests-jhoSdz/index1.html +25 -0
- package/tmp/browsertests-jhoSdz/index2.html +25 -0
- package/tmp/browsertests-jhoSdz/mocha.test.js +100 -0
- package/tmp/browsertests-jhoSdz/nightwatch.json +1 -0
- package/tmp/browsertests-koaNEn/index1.html +25 -0
- package/tmp/browsertests-koaNEn/index2.html +25 -0
- package/tmp/browsertests-koaNEn/mocha.test.js +100 -0
- package/tmp/browsertests-koaNEn/nightwatch.json +1 -0
- package/tmp/browsertests-ngYMnq/index1.html +25 -0
- package/tmp/browsertests-ngYMnq/index2.html +25 -0
- package/tmp/browsertests-ngYMnq/mocha.test.js +100 -0
- package/tmp/browsertests-ngYMnq/nightwatch.json +1 -0
- package/tmp/browsertests-oAq8xk/index1.html +25 -0
- package/tmp/browsertests-oAq8xk/index2.html +25 -0
- package/tmp/browsertests-oAq8xk/mocha.test.js +100 -0
- package/tmp/browsertests-oAq8xk/nightwatch.json +1 -0
- package/tmp/browsertests-q1rpZj/index1.html +25 -0
- package/tmp/browsertests-q1rpZj/index2.html +25 -0
- package/tmp/browsertests-q1rpZj/mocha.test.js +100 -0
- package/tmp/browsertests-q1rpZj/nightwatch.json +1 -0
- package/tmp/browsertests-zYgHlc/index1.html +25 -0
- package/tmp/browsertests-zYgHlc/index2.html +25 -0
- package/tmp/browsertests-zYgHlc/mocha.test.js +100 -0
- package/tmp/browsertests-zYgHlc/nightwatch.json +1 -0
- package/tmp/browsertests-nIABth/nightwatch.json +0 -1
- package/tmp/browsertests-sBNC3W/mocha1.test.js +0 -69
@@ -0,0 +1,100 @@
|
|
1
|
+
const expect = require("chai").expect
|
2
|
+
|
3
|
+
describe("Browser Mocha Tests", function () {
|
4
|
+
before((client, done) => {
|
5
|
+
client.captureBrowserConsoleLogs((event) => {
|
6
|
+
const args = event.args.map((arg) => arg.value)
|
7
|
+
console.log.apply(console, args)
|
8
|
+
})
|
9
|
+
|
10
|
+
done()
|
11
|
+
})
|
12
|
+
|
13
|
+
after((client, done) => {
|
14
|
+
client.end(() => done())
|
15
|
+
})
|
16
|
+
|
17
|
+
|
18
|
+
it("Should run the Mocha tests without error (runner 1)", async (client) => {
|
19
|
+
client.url("http://localhost:7777/test-browser/index1.html")
|
20
|
+
|
21
|
+
client.waitForElementVisible("#main")
|
22
|
+
|
23
|
+
const executeFunction = (done) => {
|
24
|
+
const mocha = window.mocha
|
25
|
+
|
26
|
+
//add required test librarys in this if statement
|
27
|
+
if (!mocha) {
|
28
|
+
console.log("Required library 'mocha' not loaded. Aborting...")
|
29
|
+
done({ failures: 1 })
|
30
|
+
return
|
31
|
+
}
|
32
|
+
|
33
|
+
if (!window.TEST) {
|
34
|
+
console.log("Required library 'TEST' not loaded. Aborting...")
|
35
|
+
done({ failures: 1 })
|
36
|
+
return
|
37
|
+
}
|
38
|
+
if (!window.TEST2) {
|
39
|
+
console.log("Required library 'TEST2' not loaded. Aborting...")
|
40
|
+
done({ failures: 1 })
|
41
|
+
return
|
42
|
+
}
|
43
|
+
|
44
|
+
mocha.run(function (failures) {
|
45
|
+
done({ failures: failures })
|
46
|
+
})
|
47
|
+
}
|
48
|
+
|
49
|
+
const result = await new Promise(resolve => client.timeoutsAsyncScript(1500000).executeAsyncScript(
|
50
|
+
executeFunction,
|
51
|
+
(result) => resolve(result)
|
52
|
+
))
|
53
|
+
|
54
|
+
expect(result.value).to.not.be.undefined
|
55
|
+
expect(result.value.failures).to.equal(0)
|
56
|
+
})
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
it("Should run the Mocha tests without error (runner 2)", async (client) => {
|
61
|
+
client.url("http://localhost:7777/test-browser/index2.html")
|
62
|
+
|
63
|
+
client.waitForElementVisible("#main")
|
64
|
+
|
65
|
+
const executeFunction = (done) => {
|
66
|
+
const mocha = window.mocha
|
67
|
+
|
68
|
+
//add required test librarys in this if statement
|
69
|
+
if (!mocha) {
|
70
|
+
console.log("Required library 'mocha' not loaded. Aborting...")
|
71
|
+
done({ failures: 1 })
|
72
|
+
return
|
73
|
+
}
|
74
|
+
|
75
|
+
if (!window.TEST) {
|
76
|
+
console.log("Required library 'TEST' not loaded. Aborting...")
|
77
|
+
done({ failures: 1 })
|
78
|
+
return
|
79
|
+
}
|
80
|
+
if (!window.TEST2) {
|
81
|
+
console.log("Required library 'TEST2' not loaded. Aborting...")
|
82
|
+
done({ failures: 1 })
|
83
|
+
return
|
84
|
+
}
|
85
|
+
|
86
|
+
mocha.run(function (failures) {
|
87
|
+
done({ failures: failures })
|
88
|
+
})
|
89
|
+
}
|
90
|
+
|
91
|
+
const result = await new Promise(resolve => client.timeoutsAsyncScript(1500000).executeAsyncScript(
|
92
|
+
executeFunction,
|
93
|
+
(result) => resolve(result)
|
94
|
+
))
|
95
|
+
|
96
|
+
expect(result.value).to.not.be.undefined
|
97
|
+
expect(result.value.failures).to.equal(0)
|
98
|
+
})
|
99
|
+
|
100
|
+
})
|
@@ -0,0 +1 @@
|
|
1
|
+
{"src_folders":["/home/julian/git/jss/docker-node-browsertests/test-runner/tmp/browsertests-ngYMnq"],"filter":"*.test.js","webdriver":{"start_process":true,"server_path":"/home/julian/.local/lib/node_modules/chromedriver/lib/chromedriver/chromedriver","port":9515,"timeout_options":{"timeout":1500000}},"test_runner":{"type":"mocha","options":{"ui":"bdd","reporter":"spec"}},"test_settings":{"default":{"request_timeout_options":{"timeout":1500000},"desiredCapabilities":{"javascriptEnabled":true,"acceptSslCerts":true,"acceptInsecureCerts":true,"browserName":"chrome","goog:chromeOptions":{"w3c":true,"args":["--headless","--disable-gpu","--ignore-certificate-errors","--no-sandbox","--disable-features=NetworkService"],"binary":"/usr/bin/google-chrome"}}}},"globals":{"waitForConditionTimeout":100000,"asyncHookTimeout":1500000,"unitTestsTimeout":100000,"customReporterCallbackTimeout":100000,"retryAssertionTimeout":50000}}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Mocha Tests</title>
|
5
|
+
</head>
|
6
|
+
|
7
|
+
<body>
|
8
|
+
<div id="mocha"></div>
|
9
|
+
|
10
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/mocha/10.0.0/mocha.min.js"></script>
|
11
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/chai/4.3.6/chai.min.js"></script>
|
12
|
+
<script>
|
13
|
+
mocha.setup("bdd")
|
14
|
+
mocha.reporter("spec")
|
15
|
+
</script>
|
16
|
+
<script>
|
17
|
+
window.TEST = {}
|
18
|
+
window.TEST2 = {}
|
19
|
+
</script>
|
20
|
+
|
21
|
+
<script src="/test/test.js"></script>
|
22
|
+
|
23
|
+
<div id="main">Test</div>
|
24
|
+
</body>
|
25
|
+
</html>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Mocha Tests</title>
|
5
|
+
</head>
|
6
|
+
|
7
|
+
<body>
|
8
|
+
<div id="mocha"></div>
|
9
|
+
|
10
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/mocha/10.0.0/mocha.min.js"></script>
|
11
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/chai/4.3.6/chai.min.js"></script>
|
12
|
+
<script>
|
13
|
+
mocha.setup("bdd")
|
14
|
+
mocha.reporter("spec")
|
15
|
+
</script>
|
16
|
+
<script>
|
17
|
+
window.TEST = {}
|
18
|
+
window.TEST2 = {}
|
19
|
+
</script>
|
20
|
+
|
21
|
+
<script src="/test/test.js"></script>
|
22
|
+
|
23
|
+
<div id="main">Test</div>
|
24
|
+
</body>
|
25
|
+
</html>
|
@@ -0,0 +1,100 @@
|
|
1
|
+
const expect = require("chai").expect
|
2
|
+
|
3
|
+
describe("Browser Mocha Tests", function () {
|
4
|
+
before((client, done) => {
|
5
|
+
client.captureBrowserConsoleLogs((event) => {
|
6
|
+
const args = event.args.map((arg) => arg.value)
|
7
|
+
console.log.apply(console, args)
|
8
|
+
})
|
9
|
+
|
10
|
+
done()
|
11
|
+
})
|
12
|
+
|
13
|
+
after((client, done) => {
|
14
|
+
client.end(() => done())
|
15
|
+
})
|
16
|
+
|
17
|
+
|
18
|
+
it("Should run the Mocha tests without error (runner 1)", async (client) => {
|
19
|
+
client.url("http://localhost:7777/test-browser/index1.html")
|
20
|
+
|
21
|
+
client.waitForElementVisible("#main")
|
22
|
+
|
23
|
+
const executeFunction = (done) => {
|
24
|
+
const mocha = window.mocha
|
25
|
+
|
26
|
+
//add required test librarys in this if statement
|
27
|
+
if (!mocha) {
|
28
|
+
console.log("Required library 'mocha' not loaded. Aborting...")
|
29
|
+
done({ failures: 1 })
|
30
|
+
return
|
31
|
+
}
|
32
|
+
|
33
|
+
if (!window.TEST) {
|
34
|
+
console.log("Required library 'TEST' not loaded. Aborting...")
|
35
|
+
done({ failures: 1 })
|
36
|
+
return
|
37
|
+
}
|
38
|
+
if (!window.TEST2) {
|
39
|
+
console.log("Required library 'TEST2' not loaded. Aborting...")
|
40
|
+
done({ failures: 1 })
|
41
|
+
return
|
42
|
+
}
|
43
|
+
|
44
|
+
mocha.run(function (failures) {
|
45
|
+
done({ failures: failures })
|
46
|
+
})
|
47
|
+
}
|
48
|
+
|
49
|
+
const result = await new Promise(resolve => client.timeoutsAsyncScript(1500000).executeAsyncScript(
|
50
|
+
executeFunction,
|
51
|
+
(result) => resolve(result)
|
52
|
+
))
|
53
|
+
|
54
|
+
expect(result.value).to.not.be.undefined
|
55
|
+
expect(result.value.failures).to.equal(0)
|
56
|
+
})
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
it("Should run the Mocha tests without error (runner 2)", async (client) => {
|
61
|
+
client.url("http://localhost:7777/test-browser/index2.html")
|
62
|
+
|
63
|
+
client.waitForElementVisible("#main")
|
64
|
+
|
65
|
+
const executeFunction = (done) => {
|
66
|
+
const mocha = window.mocha
|
67
|
+
|
68
|
+
//add required test librarys in this if statement
|
69
|
+
if (!mocha) {
|
70
|
+
console.log("Required library 'mocha' not loaded. Aborting...")
|
71
|
+
done({ failures: 1 })
|
72
|
+
return
|
73
|
+
}
|
74
|
+
|
75
|
+
if (!window.TEST) {
|
76
|
+
console.log("Required library 'TEST' not loaded. Aborting...")
|
77
|
+
done({ failures: 1 })
|
78
|
+
return
|
79
|
+
}
|
80
|
+
if (!window.TEST2) {
|
81
|
+
console.log("Required library 'TEST2' not loaded. Aborting...")
|
82
|
+
done({ failures: 1 })
|
83
|
+
return
|
84
|
+
}
|
85
|
+
|
86
|
+
mocha.run(function (failures) {
|
87
|
+
done({ failures: failures })
|
88
|
+
})
|
89
|
+
}
|
90
|
+
|
91
|
+
const result = await new Promise(resolve => client.timeoutsAsyncScript(1500000).executeAsyncScript(
|
92
|
+
executeFunction,
|
93
|
+
(result) => resolve(result)
|
94
|
+
))
|
95
|
+
|
96
|
+
expect(result.value).to.not.be.undefined
|
97
|
+
expect(result.value.failures).to.equal(0)
|
98
|
+
})
|
99
|
+
|
100
|
+
})
|
@@ -0,0 +1 @@
|
|
1
|
+
{"src_folders":["/home/julian/git/jss/docker-node-browsertests/test-runner/tmp/browsertests-oAq8xk"],"filter":"*.test.js","webdriver":{"start_process":true,"server_path":"/home/julian/.local/lib/node_modules/chromedriver/lib/chromedriver/chromedriver","port":9515,"timeout_options":{"timeout":1500000}},"test_runner":{"type":"mocha","options":{"ui":"bdd","reporter":"spec"}},"test_settings":{"default":{"request_timeout_options":{"timeout":1500000},"desiredCapabilities":{"javascriptEnabled":true,"acceptSslCerts":true,"acceptInsecureCerts":true,"browserName":"chrome","goog:chromeOptions":{"w3c":true,"args":["--headless","--disable-gpu","--ignore-certificate-errors","--no-sandbox","--disable-features=NetworkService"],"binary":"/usr/bin/google-chrome"}}}},"globals":{"waitForConditionTimeout":100000,"asyncHookTimeout":1500000,"unitTestsTimeout":100000,"customReporterCallbackTimeout":100000,"retryAssertionTimeout":50000}}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Mocha Tests</title>
|
5
|
+
</head>
|
6
|
+
|
7
|
+
<body>
|
8
|
+
<div id="mocha"></div>
|
9
|
+
|
10
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/mocha/10.0.0/mocha.min.js"></script>
|
11
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/chai/4.3.6/chai.min.js"></script>
|
12
|
+
<script>
|
13
|
+
mocha.setup("bdd")
|
14
|
+
mocha.reporter("spec")
|
15
|
+
</script>
|
16
|
+
<script>
|
17
|
+
window.TEST = {}
|
18
|
+
window.TEST2 = {}
|
19
|
+
</script>
|
20
|
+
|
21
|
+
<script src="/test/test.js"></script>
|
22
|
+
|
23
|
+
<div id="main">Test</div>
|
24
|
+
</body>
|
25
|
+
</html>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Mocha Tests</title>
|
5
|
+
</head>
|
6
|
+
|
7
|
+
<body>
|
8
|
+
<div id="mocha"></div>
|
9
|
+
|
10
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/mocha/10.0.0/mocha.min.js"></script>
|
11
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/chai/4.3.6/chai.min.js"></script>
|
12
|
+
<script>
|
13
|
+
mocha.setup("bdd")
|
14
|
+
mocha.reporter("spec")
|
15
|
+
</script>
|
16
|
+
<script>
|
17
|
+
window.TEST = {}
|
18
|
+
window.TEST2 = {}
|
19
|
+
</script>
|
20
|
+
|
21
|
+
<script src="/test/test.js"></script>
|
22
|
+
|
23
|
+
<div id="main">Test</div>
|
24
|
+
</body>
|
25
|
+
</html>
|
@@ -0,0 +1,100 @@
|
|
1
|
+
const expect = require("chai").expect
|
2
|
+
|
3
|
+
describe("Browser Mocha Tests", function () {
|
4
|
+
before((client, done) => {
|
5
|
+
client.captureBrowserConsoleLogs((event) => {
|
6
|
+
const args = event.args.map((arg) => arg.value)
|
7
|
+
console.log.apply(console, args)
|
8
|
+
})
|
9
|
+
|
10
|
+
done()
|
11
|
+
})
|
12
|
+
|
13
|
+
after((client, done) => {
|
14
|
+
client.end(() => done())
|
15
|
+
})
|
16
|
+
|
17
|
+
|
18
|
+
it("Should run the Mocha tests without error (runner 1)", async (client) => {
|
19
|
+
client.url("http://localhost:7777/test-browser/index1.html")
|
20
|
+
|
21
|
+
client.waitForElementVisible("#main")
|
22
|
+
|
23
|
+
const executeFunction = (done) => {
|
24
|
+
const mocha = window.mocha
|
25
|
+
|
26
|
+
//add required test librarys in this if statement
|
27
|
+
if (!mocha) {
|
28
|
+
console.log("Required library 'mocha' not loaded. Aborting...")
|
29
|
+
done({ failures: 1 })
|
30
|
+
return
|
31
|
+
}
|
32
|
+
|
33
|
+
if (!window.TEST) {
|
34
|
+
console.log("Required library 'TEST' not loaded. Aborting...")
|
35
|
+
done({ failures: 1 })
|
36
|
+
return
|
37
|
+
}
|
38
|
+
if (!window.TEST2) {
|
39
|
+
console.log("Required library 'TEST2' not loaded. Aborting...")
|
40
|
+
done({ failures: 1 })
|
41
|
+
return
|
42
|
+
}
|
43
|
+
|
44
|
+
mocha.run(function (failures) {
|
45
|
+
done({ failures: failures })
|
46
|
+
})
|
47
|
+
}
|
48
|
+
|
49
|
+
const result = await new Promise(resolve => client.timeoutsAsyncScript(1500000).executeAsyncScript(
|
50
|
+
executeFunction,
|
51
|
+
(result) => resolve(result)
|
52
|
+
))
|
53
|
+
|
54
|
+
expect(result.value).to.not.be.undefined
|
55
|
+
expect(result.value.failures).to.equal(0)
|
56
|
+
})
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
it("Should run the Mocha tests without error (runner 2)", async (client) => {
|
61
|
+
client.url("http://localhost:7777/test-browser/index2.html")
|
62
|
+
|
63
|
+
client.waitForElementVisible("#main")
|
64
|
+
|
65
|
+
const executeFunction = (done) => {
|
66
|
+
const mocha = window.mocha
|
67
|
+
|
68
|
+
//add required test librarys in this if statement
|
69
|
+
if (!mocha) {
|
70
|
+
console.log("Required library 'mocha' not loaded. Aborting...")
|
71
|
+
done({ failures: 1 })
|
72
|
+
return
|
73
|
+
}
|
74
|
+
|
75
|
+
if (!window.TEST) {
|
76
|
+
console.log("Required library 'TEST' not loaded. Aborting...")
|
77
|
+
done({ failures: 1 })
|
78
|
+
return
|
79
|
+
}
|
80
|
+
if (!window.TEST2) {
|
81
|
+
console.log("Required library 'TEST2' not loaded. Aborting...")
|
82
|
+
done({ failures: 1 })
|
83
|
+
return
|
84
|
+
}
|
85
|
+
|
86
|
+
mocha.run(function (failures) {
|
87
|
+
done({ failures: failures })
|
88
|
+
})
|
89
|
+
}
|
90
|
+
|
91
|
+
const result = await new Promise(resolve => client.timeoutsAsyncScript(1500000).executeAsyncScript(
|
92
|
+
executeFunction,
|
93
|
+
(result) => resolve(result)
|
94
|
+
))
|
95
|
+
|
96
|
+
expect(result.value).to.not.be.undefined
|
97
|
+
expect(result.value.failures).to.equal(0)
|
98
|
+
})
|
99
|
+
|
100
|
+
})
|
@@ -0,0 +1 @@
|
|
1
|
+
{"src_folders":["/home/julian/git/jss/docker-node-browsertests/test-runner/tmp/browsertests-q1rpZj"],"filter":"*.test.js","webdriver":{"start_process":true,"server_path":"/home/julian/.local/lib/node_modules/chromedriver/lib/chromedriver/chromedriver","port":9515,"timeout_options":{"timeout":1500000}},"test_runner":{"type":"mocha","options":{"ui":"bdd","reporter":"spec"}},"test_settings":{"default":{"request_timeout_options":{"timeout":1500000},"desiredCapabilities":{"javascriptEnabled":true,"acceptSslCerts":true,"acceptInsecureCerts":true,"browserName":"chrome","goog:chromeOptions":{"w3c":true,"args":["--headless","--disable-gpu","--ignore-certificate-errors","--no-sandbox","--disable-features=NetworkService"],"binary":"/usr/bin/google-chrome"}}}},"globals":{"waitForConditionTimeout":100000,"asyncHookTimeout":1500000,"unitTestsTimeout":100000,"customReporterCallbackTimeout":100000,"retryAssertionTimeout":50000}}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Mocha Tests</title>
|
5
|
+
</head>
|
6
|
+
|
7
|
+
<body>
|
8
|
+
<div id="mocha"></div>
|
9
|
+
|
10
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/mocha/10.0.0/mocha.min.js"></script>
|
11
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/chai/4.3.6/chai.min.js"></script>
|
12
|
+
<script>
|
13
|
+
mocha.setup("bdd")
|
14
|
+
mocha.reporter("spec")
|
15
|
+
</script>
|
16
|
+
<script>
|
17
|
+
window.TEST = {}
|
18
|
+
window.TEST2 = {}
|
19
|
+
</script>
|
20
|
+
|
21
|
+
<script src="/test/test.js"></script>
|
22
|
+
|
23
|
+
<div id="main">Test</div>
|
24
|
+
</body>
|
25
|
+
</html>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Mocha Tests</title>
|
5
|
+
</head>
|
6
|
+
|
7
|
+
<body>
|
8
|
+
<div id="mocha"></div>
|
9
|
+
|
10
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/mocha/10.0.0/mocha.min.js"></script>
|
11
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/chai/4.3.6/chai.min.js"></script>
|
12
|
+
<script>
|
13
|
+
mocha.setup("bdd")
|
14
|
+
mocha.reporter("spec")
|
15
|
+
</script>
|
16
|
+
<script>
|
17
|
+
window.TEST = {}
|
18
|
+
window.TEST2 = {}
|
19
|
+
</script>
|
20
|
+
|
21
|
+
<script src="/test/test.js"></script>
|
22
|
+
|
23
|
+
<div id="main">Test</div>
|
24
|
+
</body>
|
25
|
+
</html>
|
@@ -0,0 +1,100 @@
|
|
1
|
+
const expect = require("chai").expect
|
2
|
+
|
3
|
+
describe("Browser Mocha Tests", function () {
|
4
|
+
before((client, done) => {
|
5
|
+
client.captureBrowserConsoleLogs((event) => {
|
6
|
+
const args = event.args.map((arg) => arg.value)
|
7
|
+
console.log.apply(console, args)
|
8
|
+
})
|
9
|
+
|
10
|
+
done()
|
11
|
+
})
|
12
|
+
|
13
|
+
after((client, done) => {
|
14
|
+
client.end(() => done())
|
15
|
+
})
|
16
|
+
|
17
|
+
|
18
|
+
it("Should run the Mocha tests without error (runner 1)", async (client) => {
|
19
|
+
client.url("http://localhost:7777/test-browser/index1.html")
|
20
|
+
|
21
|
+
client.waitForElementVisible("#main")
|
22
|
+
|
23
|
+
const executeFunction = (done) => {
|
24
|
+
const mocha = window.mocha
|
25
|
+
|
26
|
+
//add required test librarys in this if statement
|
27
|
+
if (!mocha) {
|
28
|
+
console.log("Required library 'mocha' not loaded. Aborting...")
|
29
|
+
done({ failures: 1 })
|
30
|
+
return
|
31
|
+
}
|
32
|
+
|
33
|
+
if (!window.TEST) {
|
34
|
+
console.log("Required library 'TEST' not loaded. Aborting...")
|
35
|
+
done({ failures: 1 })
|
36
|
+
return
|
37
|
+
}
|
38
|
+
if (!window.TEST2) {
|
39
|
+
console.log("Required library 'TEST2' not loaded. Aborting...")
|
40
|
+
done({ failures: 1 })
|
41
|
+
return
|
42
|
+
}
|
43
|
+
|
44
|
+
mocha.run(function (failures) {
|
45
|
+
done({ failures: failures })
|
46
|
+
})
|
47
|
+
}
|
48
|
+
|
49
|
+
const result = await new Promise(resolve => client.timeoutsAsyncScript(1500000).executeAsyncScript(
|
50
|
+
executeFunction,
|
51
|
+
(result) => resolve(result)
|
52
|
+
))
|
53
|
+
|
54
|
+
expect(result.value).to.not.be.undefined
|
55
|
+
expect(result.value.failures).to.equal(0)
|
56
|
+
})
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
it("Should run the Mocha tests without error (runner 2)", async (client) => {
|
61
|
+
client.url("http://localhost:7777/test-browser/index2.html")
|
62
|
+
|
63
|
+
client.waitForElementVisible("#main")
|
64
|
+
|
65
|
+
const executeFunction = (done) => {
|
66
|
+
const mocha = window.mocha
|
67
|
+
|
68
|
+
//add required test librarys in this if statement
|
69
|
+
if (!mocha) {
|
70
|
+
console.log("Required library 'mocha' not loaded. Aborting...")
|
71
|
+
done({ failures: 1 })
|
72
|
+
return
|
73
|
+
}
|
74
|
+
|
75
|
+
if (!window.TEST) {
|
76
|
+
console.log("Required library 'TEST' not loaded. Aborting...")
|
77
|
+
done({ failures: 1 })
|
78
|
+
return
|
79
|
+
}
|
80
|
+
if (!window.TEST2) {
|
81
|
+
console.log("Required library 'TEST2' not loaded. Aborting...")
|
82
|
+
done({ failures: 1 })
|
83
|
+
return
|
84
|
+
}
|
85
|
+
|
86
|
+
mocha.run(function (failures) {
|
87
|
+
done({ failures: failures })
|
88
|
+
})
|
89
|
+
}
|
90
|
+
|
91
|
+
const result = await new Promise(resolve => client.timeoutsAsyncScript(1500000).executeAsyncScript(
|
92
|
+
executeFunction,
|
93
|
+
(result) => resolve(result)
|
94
|
+
))
|
95
|
+
|
96
|
+
expect(result.value).to.not.be.undefined
|
97
|
+
expect(result.value.failures).to.equal(0)
|
98
|
+
})
|
99
|
+
|
100
|
+
})
|
@@ -0,0 +1 @@
|
|
1
|
+
{"src_folders":["/home/julian/git/jss/docker-node-browsertests/test-runner/tmp/browsertests-zYgHlc"],"filter":"*.test.js","webdriver":{"start_process":true,"server_path":"/home/julian/.local/lib/node_modules/chromedriver/lib/chromedriver/chromedriver","port":9515,"timeout_options":{"timeout":1500000}},"test_runner":{"type":"mocha","options":{"ui":"bdd","reporter":"spec"}},"test_settings":{"default":{"request_timeout_options":{"timeout":1500000},"desiredCapabilities":{"javascriptEnabled":true,"acceptSslCerts":true,"acceptInsecureCerts":true,"browserName":"chrome","goog:chromeOptions":{"w3c":true,"args":["--headless","--disable-gpu","--ignore-certificate-errors","--no-sandbox","--disable-features=NetworkService"],"binary":"/usr/bin/google-chrome"}}}},"globals":{"waitForConditionTimeout":100000,"asyncHookTimeout":1500000,"unitTestsTimeout":100000,"customReporterCallbackTimeout":100000,"retryAssertionTimeout":50000}}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"src_folders":["/home/julian/git/jss/docker-node-browsertests/test-runner/tmp/browsertests-nIABth"],"filter":"*.test.js","webdriver":{"start_process":true,"server_path":"/home/julian/.local/lib/node_modules/chromedriver/lib/chromedriver/chromedriver","port":9515,"timeout_options":{"timeout":1500000}},"test_runner":{"type":"mocha","options":{"reporter":"List"}},"test_settings":{"default":{"request_timeout_options":{"timeout":1500000},"desiredCapabilities":{"javascriptEnabled":true,"acceptSslCerts":true,"acceptInsecureCerts":true,"browserName":"chrome","goog:chromeOptions":{"w3c":true,"args":["--headless","--disable-gpu","--ignore-certificate-errors","--no-sandbox","--disable-features=NetworkService"],"binary":"/usr/bin/google-chrome"}}}},"globals":{"waitForConditionTimeout":100000,"asyncHookTimeout":1500000,"unitTestsTimeout":100000,"customReporterCallbackTimeout":100000,"retryAssertionTimeout":50000}}
|
@@ -1,69 +0,0 @@
|
|
1
|
-
const expect = require("chai").expect
|
2
|
-
|
3
|
-
describe("Browser Mocha Tests", function () {
|
4
|
-
beforeEach((client, done) => {
|
5
|
-
client.url("http://localhost:7777/test-browser/index1.html")
|
6
|
-
done()
|
7
|
-
})
|
8
|
-
|
9
|
-
after((client, done) => {
|
10
|
-
client.end(() => done())
|
11
|
-
})
|
12
|
-
|
13
|
-
it("Should run the Mocha tests without error", (client) => {
|
14
|
-
const outsideLog = console.log
|
15
|
-
|
16
|
-
client.waitForElementVisible("#main")
|
17
|
-
client.timeoutsAsyncScript(1500000).executeAsync(
|
18
|
-
(_data, done) => {
|
19
|
-
const oldLog = console.log
|
20
|
-
console.log = function () {
|
21
|
-
oldLog.apply(console, arguments)
|
22
|
-
outsideLog.apply(console, arguments)
|
23
|
-
window.logs.push(Array.from(arguments))
|
24
|
-
}
|
25
|
-
|
26
|
-
const localDone = typeof _data === "function" ? _data : done
|
27
|
-
|
28
|
-
const mocha = window.mocha
|
29
|
-
|
30
|
-
//add required test librarys in this if statement
|
31
|
-
if (!mocha) {
|
32
|
-
logs.push(["Required library 'mocha' not loaded. Aborting..."])
|
33
|
-
localDone({ failures: 1, logs: logs })
|
34
|
-
return
|
35
|
-
}
|
36
|
-
|
37
|
-
if (!window.TEST) {
|
38
|
-
logs.push(["Required library 'TEST' not loaded. Aborting..."])
|
39
|
-
localDone({ failures: 1, logs: logs })
|
40
|
-
return
|
41
|
-
}
|
42
|
-
if (!window.TEST2) {
|
43
|
-
logs.push(["Required library 'TEST2' not loaded. Aborting..."])
|
44
|
-
localDone({ failures: 1, logs: logs })
|
45
|
-
return
|
46
|
-
}
|
47
|
-
|
48
|
-
mocha.run(function (failures) {
|
49
|
-
localDone({ failures: failures, logs: logs })
|
50
|
-
})
|
51
|
-
},
|
52
|
-
[],
|
53
|
-
(result) => {
|
54
|
-
console.log("\n--- browser mocha output ---")
|
55
|
-
|
56
|
-
if (result && result.value && result.value.logs) {
|
57
|
-
for (const logs of result.value.logs) {
|
58
|
-
console.log.apply(null, logs)
|
59
|
-
}
|
60
|
-
}
|
61
|
-
|
62
|
-
console.log("--- finished browser mocha output ---")
|
63
|
-
|
64
|
-
expect(result.value).to.not.be.undefined
|
65
|
-
expect(result.value.failures).to.equal(0)
|
66
|
-
}
|
67
|
-
)
|
68
|
-
})
|
69
|
-
})
|