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.
Files changed (81) hide show
  1. package/dist/IRunner.js +2 -0
  2. package/dist/generate.js +62 -0
  3. package/dist/generator.js +33 -32
  4. package/dist/getPort.js +20 -0
  5. package/dist/index.js +58 -18
  6. package/dist/index_custom.js +100 -0
  7. package/dist/index_debug.js +8 -3
  8. package/dist/server.js +1 -1
  9. package/package.json +3 -6
  10. package/tmp/{browsertests-71yT6w → browsertests-9PMQFx}/index1.html +2 -2
  11. package/tmp/browsertests-9PMQFx/index2.html +25 -0
  12. package/tmp/{browsertests-nIABth → browsertests-CRhBRJ}/index1.html +2 -2
  13. package/tmp/browsertests-CRhBRJ/index2.html +25 -0
  14. package/tmp/{browsertests-nIABth/mocha1.test.js → browsertests-CRhBRJ/mocha.test.js} +54 -9
  15. package/tmp/{browsertests-sBNC3W → browsertests-CRhBRJ}/nightwatch.json +1 -1
  16. package/tmp/{browsertests-3rqPiu → browsertests-Ef8QDb}/index1.html +2 -4
  17. package/tmp/browsertests-Ef8QDb/index2.html +25 -0
  18. package/tmp/{browsertests-71yT6w/mocha1.test.js → browsertests-Ef8QDb/mocha.test.js} +54 -10
  19. package/tmp/{browsertests-71yT6w → browsertests-Ef8QDb}/nightwatch.json +1 -1
  20. package/tmp/{browsertests-sBNC3W → browsertests-FNrySD}/index1.html +2 -13
  21. package/tmp/browsertests-FNrySD/index2.html +25 -0
  22. package/tmp/browsertests-FNrySD/mocha.test.js +100 -0
  23. package/tmp/browsertests-FNrySD/nightwatch.json +1 -0
  24. package/tmp/browsertests-HnV7W1/index1.html +25 -0
  25. package/tmp/browsertests-HnV7W1/index2.html +25 -0
  26. package/tmp/browsertests-HnV7W1/mocha.test.js +100 -0
  27. package/tmp/browsertests-HnV7W1/nightwatch.json +1 -0
  28. package/tmp/browsertests-Kr11Ep/index1.html +25 -0
  29. package/tmp/browsertests-Kr11Ep/index2.html +25 -0
  30. package/tmp/browsertests-Kr11Ep/mocha.test.js +100 -0
  31. package/tmp/browsertests-Kr11Ep/nightwatch.json +1 -0
  32. package/tmp/browsertests-QTo9jV/index1.html +25 -0
  33. package/tmp/browsertests-QTo9jV/index2.html +25 -0
  34. package/tmp/browsertests-QTo9jV/mocha.test.js +100 -0
  35. package/tmp/browsertests-QTo9jV/nightwatch.json +1 -0
  36. package/tmp/browsertests-VXReLQ/index1.html +25 -0
  37. package/tmp/browsertests-VXReLQ/index2.html +25 -0
  38. package/tmp/browsertests-VXReLQ/mocha.test.js +100 -0
  39. package/tmp/browsertests-VXReLQ/nightwatch.json +1 -0
  40. package/tmp/browsertests-dat86a/index1.html +25 -0
  41. package/tmp/browsertests-dat86a/index2.html +25 -0
  42. package/tmp/browsertests-dat86a/mocha.test.js +94 -0
  43. package/tmp/browsertests-dat86a/nightwatch.json +1 -0
  44. package/tmp/browsertests-eI4Px3/index1.html +25 -0
  45. package/tmp/browsertests-eI4Px3/index2.html +25 -0
  46. package/tmp/browsertests-eI4Px3/mocha.test.js +100 -0
  47. package/tmp/browsertests-eI4Px3/nightwatch.json +1 -0
  48. package/tmp/browsertests-eQY4O5/index1.html +25 -0
  49. package/tmp/browsertests-eQY4O5/index2.html +25 -0
  50. package/tmp/browsertests-eQY4O5/mocha.test.js +100 -0
  51. package/tmp/browsertests-eQY4O5/nightwatch.json +1 -0
  52. package/tmp/browsertests-gOUWdm/index1.html +25 -0
  53. package/tmp/browsertests-gOUWdm/index2.html +25 -0
  54. package/tmp/browsertests-gOUWdm/mocha.test.js +100 -0
  55. package/tmp/browsertests-gOUWdm/nightwatch.json +1 -0
  56. package/tmp/browsertests-jhoSdz/index1.html +25 -0
  57. package/tmp/browsertests-jhoSdz/index2.html +25 -0
  58. package/tmp/browsertests-jhoSdz/mocha.test.js +100 -0
  59. package/tmp/browsertests-jhoSdz/nightwatch.json +1 -0
  60. package/tmp/browsertests-koaNEn/index1.html +25 -0
  61. package/tmp/browsertests-koaNEn/index2.html +25 -0
  62. package/tmp/browsertests-koaNEn/mocha.test.js +100 -0
  63. package/tmp/browsertests-koaNEn/nightwatch.json +1 -0
  64. package/tmp/browsertests-ngYMnq/index1.html +25 -0
  65. package/tmp/browsertests-ngYMnq/index2.html +25 -0
  66. package/tmp/browsertests-ngYMnq/mocha.test.js +100 -0
  67. package/tmp/browsertests-ngYMnq/nightwatch.json +1 -0
  68. package/tmp/browsertests-oAq8xk/index1.html +25 -0
  69. package/tmp/browsertests-oAq8xk/index2.html +25 -0
  70. package/tmp/browsertests-oAq8xk/mocha.test.js +100 -0
  71. package/tmp/browsertests-oAq8xk/nightwatch.json +1 -0
  72. package/tmp/browsertests-q1rpZj/index1.html +25 -0
  73. package/tmp/browsertests-q1rpZj/index2.html +25 -0
  74. package/tmp/browsertests-q1rpZj/mocha.test.js +100 -0
  75. package/tmp/browsertests-q1rpZj/nightwatch.json +1 -0
  76. package/tmp/browsertests-zYgHlc/index1.html +25 -0
  77. package/tmp/browsertests-zYgHlc/index2.html +25 -0
  78. package/tmp/browsertests-zYgHlc/mocha.test.js +100 -0
  79. package/tmp/browsertests-zYgHlc/nightwatch.json +1 -0
  80. package/tmp/browsertests-nIABth/nightwatch.json +0 -1
  81. 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
- })