diff --git a/.travis.yml b/.travis.yml index 8ff9ebc36f84b924031ae00786629ca7046f2082..7247ee3d8a43f48ddc848f9bacdcad3a148179e0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,13 +18,7 @@ env: script: - node test-html5-check.js - - node test-chat.js - - node test-draw.js - - node test-status.js - - node test-switch-slides.js - - node test-upload.js -# - node tests/puppeteer/test-hotkeys.js -# - node tests/puppeteer/test-hotkeys-mic-first.js + - npm test after_script: - docker stop $docker diff --git a/bigbluebutton-html5/test-html5.sh b/bigbluebutton-html5/test-html5.sh index f9ffac10ac549f6a7a954d3a1e1c710e0ca1b2c1..932445ec99ee9c70f75ad5114c655a1d3b378314 100755 --- a/bigbluebutton-html5/test-html5.sh +++ b/bigbluebutton-html5/test-html5.sh @@ -9,7 +9,7 @@ echo $docker # Check if HTML5 client is ready cd tests/puppeteer -node test-html5-check.js +node html5-check.js status=$? echo $status @@ -20,11 +20,7 @@ echo $BBB_SHARED_SECRET # Run tests if [ $status -eq 0 ]; then - node test-chat.js - node test-draw.js - node test-upload.js - node test-switch-slides.js - node test-status.js + npm test fi # Stop Docker container diff --git a/bigbluebutton-html5/tests/puppeteer/test-html5-check.js b/bigbluebutton-html5/tests/puppeteer/html5-check.js similarity index 82% rename from bigbluebutton-html5/tests/puppeteer/test-html5-check.js rename to bigbluebutton-html5/tests/puppeteer/html5-check.js index d9e7a43788849a7c727452fba0fea3a4de1dc971..f6db7d8b993c43ec21862075d6239b18b1a9fbd3 100644 --- a/bigbluebutton-html5/tests/puppeteer/test-html5-check.js +++ b/bigbluebutton-html5/tests/puppeteer/html5-check.js @@ -3,7 +3,7 @@ const axios = require('axios'); const url = require('url'); const helper = require('./helper'); -(async() => +(async () => { var bbb = url.parse(process.env.BBB_SERVER_URL) var check = bbb.protocol + "//" + bbb.hostname + "/html5client/check"; @@ -28,6 +28,7 @@ const helper = require('./helper'); } else { + console.log("Too many attempts. Exiting..."); process.exit(1); } } @@ -40,10 +41,11 @@ const helper = require('./helper'); } else { + console.log("Too many attempts. Exiting..."); process.exit(1); } } - console.log("Retrying (attempt " + (retryCount + 1) + "/" + maxRetries + ")..."); + console.log("Retrying (attempt " + (retryCount) + "/" + maxRetries + ")..."); await helper.sleep(delay); } })(); \ No newline at end of file diff --git a/bigbluebutton-html5/tests/puppeteer/jest.config.js b/bigbluebutton-html5/tests/puppeteer/jest.config.js new file mode 100644 index 0000000000000000000000000000000000000000..e4b75f6ed33e6187543eceb407fd407c5482219a --- /dev/null +++ b/bigbluebutton-html5/tests/puppeteer/jest.config.js @@ -0,0 +1,4 @@ +module.exports = +{ + setupTestFrameworkScriptFile: './jest.setup.js' +}; \ No newline at end of file diff --git a/bigbluebutton-html5/tests/puppeteer/jest.setup.js b/bigbluebutton-html5/tests/puppeteer/jest.setup.js new file mode 100644 index 0000000000000000000000000000000000000000..6e00fcb8a414d35debcf9b64f5cdcc11b6383c56 --- /dev/null +++ b/bigbluebutton-html5/tests/puppeteer/jest.setup.js @@ -0,0 +1 @@ +jest.setTimeout(60000); \ No newline at end of file diff --git a/bigbluebutton-html5/tests/puppeteer/package.json b/bigbluebutton-html5/tests/puppeteer/package.json index 96b7c4162cc5f0dd5657d8217f6bfe68b5b24a2f..32f72ff3d99861a8460dd33f795b31032c5f7444 100644 --- a/bigbluebutton-html5/tests/puppeteer/package.json +++ b/bigbluebutton-html5/tests/puppeteer/package.json @@ -4,14 +4,19 @@ "description": "", "main": "app.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "jest" + }, + "jest": { + "verbose": false }, "author": "", "license": "ISC", "dependencies": { "axios": "^0.18.0", "dotenv": "^6.0.0", + "jest": "^23.5.0", "puppeteer": "^1.7.0", "sha1": "^1.1.1" - } + }, + "devDependencies": {} } diff --git a/bigbluebutton-html5/tests/puppeteer/test-chat.js b/bigbluebutton-html5/tests/puppeteer/page-chat.js similarity index 87% rename from bigbluebutton-html5/tests/puppeteer/test-chat.js rename to bigbluebutton-html5/tests/puppeteer/page-chat.js index e3499cadb558f1d3168f066f6d612a6ed2fb2933..7c570a06e08a990d16d9a4452fc3b8a762b42d61 100644 --- a/bigbluebutton-html5/tests/puppeteer/test-chat.js +++ b/bigbluebutton-html5/tests/puppeteer/page-chat.js @@ -55,18 +55,4 @@ class ChatTestPage extends Page } }; -var test = new ChatTestPage(); -(async() => -{ - try - { - await test.init(Page.getArgs()); - await test.test(); - await test.close(); - } - catch(e) - { - console.log(e); - process.exit(1); - } -})(); \ No newline at end of file +module.exports = exports = ChatTestPage; \ No newline at end of file diff --git a/bigbluebutton-html5/tests/puppeteer/page-chat.test.js b/bigbluebutton-html5/tests/puppeteer/page-chat.test.js new file mode 100644 index 0000000000000000000000000000000000000000..bf2a9984a1506ffaa905b9c7d7295bbf89e51014 --- /dev/null +++ b/bigbluebutton-html5/tests/puppeteer/page-chat.test.js @@ -0,0 +1,19 @@ +const Page = require('./page'); +const ChatTestPage = require('./page-chat'); + +test("Tests sending a message in chat", async () => +{ + var test = new ChatTestPage(); + try + { + await test.init(Page.getArgs()); + await test.test(); + await test.close(); + } + catch(e) + { + console.log(e); + await test.close(); + throw new Error("Test failed"); + } +}); \ No newline at end of file diff --git a/bigbluebutton-html5/tests/puppeteer/test-draw.js b/bigbluebutton-html5/tests/puppeteer/page-draw.js similarity index 84% rename from bigbluebutton-html5/tests/puppeteer/test-draw.js rename to bigbluebutton-html5/tests/puppeteer/page-draw.js index 11030b5e6533298b9eed4ae819932e4a85af83a4..faa31587cac6c1b2b970db833b3751e64730a309 100644 --- a/bigbluebutton-html5/tests/puppeteer/test-draw.js +++ b/bigbluebutton-html5/tests/puppeteer/page-draw.js @@ -1,5 +1,3 @@ -// Test: Drawing a box - const Page = require('./page'); const helper = require('./helper'); const e = require('./elements'); @@ -43,18 +41,4 @@ class DrawTestPage extends Page } }; -var test = new DrawTestPage(); -(async() => -{ - try - { - await test.init(Page.getArgs()); - await test.test(); - await test.close(); - } - catch(e) - { - console.log(e); - process.exit(1); - } -})(); \ No newline at end of file +module.exports = exports = DrawTestPage; \ No newline at end of file diff --git a/bigbluebutton-html5/tests/puppeteer/page-draw.test.js b/bigbluebutton-html5/tests/puppeteer/page-draw.test.js new file mode 100644 index 0000000000000000000000000000000000000000..26971186f65a47a9cabd385c04640d75921b2e14 --- /dev/null +++ b/bigbluebutton-html5/tests/puppeteer/page-draw.test.js @@ -0,0 +1,19 @@ +const Page = require('./page'); +const DrawTestPage = require('./page-draw'); + +test("Tests drawing a box on the whiteboard", async () => +{ + var test = new DrawTestPage(); + try + { + await test.init(Page.getArgs()); + await test.test(); + await test.close(); + } + catch(e) + { + console.log(e); + await test.close(); + throw new Error("Test failed"); + } +}); \ No newline at end of file diff --git a/bigbluebutton-html5/tests/puppeteer/test-status.js b/bigbluebutton-html5/tests/puppeteer/page-status.js similarity index 86% rename from bigbluebutton-html5/tests/puppeteer/test-status.js rename to bigbluebutton-html5/tests/puppeteer/page-status.js index faad989bac984915b5b9b44c3f8d95c107118a1f..0c68c624f45396545453100c4fbcf9fd87d7f7a6 100644 --- a/bigbluebutton-html5/tests/puppeteer/test-status.js +++ b/bigbluebutton-html5/tests/puppeteer/page-status.js @@ -1,5 +1,3 @@ -// Test: Setting/changing/clearing a user's status - const Page = require('./page'); const helper = require('./helper'); const e = require('./elements'); @@ -50,18 +48,4 @@ class StatusTestPage extends Page } }; -var test = new StatusTestPage(); -(async() => -{ - try - { - await test.init(Page.getArgs()); - await test.test(); - await test.close(); - } - catch(e) - { - console.log(e); - process.exit(1); - } -})(); \ No newline at end of file +module.exports = exports = StatusTestPage; \ No newline at end of file diff --git a/bigbluebutton-html5/tests/puppeteer/page-status.test.js b/bigbluebutton-html5/tests/puppeteer/page-status.test.js new file mode 100644 index 0000000000000000000000000000000000000000..06c6ff91eec8df059639495eede872100658e9b0 --- /dev/null +++ b/bigbluebutton-html5/tests/puppeteer/page-status.test.js @@ -0,0 +1,19 @@ +const Page = require('./page'); +const StatusTestPage = require('./page-status'); + +test("Tests setting/changing/clearing a user's status", async () => +{ + var test = new StatusTestPage(); + try + { + await test.init(Page.getArgs()); + await test.test(); + await test.close(); + } + catch(e) + { + console.log(e); + await test.close(); + throw new Error("Test failed"); + } +}); \ No newline at end of file diff --git a/bigbluebutton-html5/tests/puppeteer/test-switch-slides.js b/bigbluebutton-html5/tests/puppeteer/page-switch-slides.js similarity index 83% rename from bigbluebutton-html5/tests/puppeteer/test-switch-slides.js rename to bigbluebutton-html5/tests/puppeteer/page-switch-slides.js index 360942475b989d180aac1fe4940c340e320a93f9..b5bed75ece9a2480a93ab738a9da1b0730bef26c 100644 --- a/bigbluebutton-html5/tests/puppeteer/test-switch-slides.js +++ b/bigbluebutton-html5/tests/puppeteer/page-switch-slides.js @@ -1,5 +1,3 @@ -// Test: Switching slides - const Page = require('./page'); const helper = require('./helper'); const e = require('./elements'); @@ -40,18 +38,4 @@ class SlideSwitchTestPage extends Page } }; -var test = new SlideSwitchTestPage(); -(async() => -{ - try - { - await test.init(Page.getArgs()); - await test.test(); - await test.close(); - } - catch(e) - { - console.log(e); - process.exit(1); - } -})(); \ No newline at end of file +module.exports = exports = SlideSwitchTestPage; \ No newline at end of file diff --git a/bigbluebutton-html5/tests/puppeteer/page-switch-slides.test.js b/bigbluebutton-html5/tests/puppeteer/page-switch-slides.test.js new file mode 100644 index 0000000000000000000000000000000000000000..0e5f47f4593841cdc02abc32cf9a590e86197a50 --- /dev/null +++ b/bigbluebutton-html5/tests/puppeteer/page-switch-slides.test.js @@ -0,0 +1,19 @@ +const Page = require('./page'); +const SlideSwitchTestPage = require('./page-switch-slides'); + +test("Tests switching slides", async () => +{ + var test = new SlideSwitchTestPage(); + try + { + await test.init(Page.getArgs()); + await test.test(); + await test.close(); + } + catch(e) + { + console.log(e); + await test.close(); + throw new Error("Test failed"); + } +}); \ No newline at end of file diff --git a/bigbluebutton-html5/tests/puppeteer/test-upload.js b/bigbluebutton-html5/tests/puppeteer/page-upload.js similarity index 86% rename from bigbluebutton-html5/tests/puppeteer/test-upload.js rename to bigbluebutton-html5/tests/puppeteer/page-upload.js index 91927dd58e1d5b24de7a4f9354d62fd67e6a5cbe..ee9666894de934923cd7ce7c9dcaf670996d57a7 100644 --- a/bigbluebutton-html5/tests/puppeteer/test-upload.js +++ b/bigbluebutton-html5/tests/puppeteer/page-upload.js @@ -1,5 +1,3 @@ -// Test: Uploading an image - const Page = require('./page'); const helper = require('./helper'); const e = require('./elements'); @@ -48,18 +46,4 @@ class UploadTestPage extends Page } }; -var test = new UploadTestPage(); -(async() => -{ - try - { - await test.init(Page.getArgs()); - await test.test(); - await test.close(); - } - catch(e) - { - console.log(e); - process.exit(1); - } -})(); \ No newline at end of file +module.exports = exports = UploadTestPage; \ No newline at end of file diff --git a/bigbluebutton-html5/tests/puppeteer/page-upload.test.js b/bigbluebutton-html5/tests/puppeteer/page-upload.test.js new file mode 100644 index 0000000000000000000000000000000000000000..835589ca64c8447839f5dbe08cf3e051db057b8e --- /dev/null +++ b/bigbluebutton-html5/tests/puppeteer/page-upload.test.js @@ -0,0 +1,19 @@ +const Page = require('./page'); +const UploadTestPage = require('./page-upload'); + +test("Tests uploading an image as a presentation", async () => +{ + var test = new UploadTestPage(); + try + { + await test.init(Page.getArgs()); + await test.test(); + await test.close(); + } + catch(e) + { + console.log(e); + await test.close(); + throw new Error("Test failed"); + } +}); \ No newline at end of file diff --git a/bigbluebutton-html5/tests/puppeteer/tests-not-ready/page-hotkeys-mic-first-test.js b/bigbluebutton-html5/tests/puppeteer/tests-not-ready/page-hotkeys-mic-first-test.js new file mode 100644 index 0000000000000000000000000000000000000000..8f4d9fa3ef9f07e5e4276c2ed39aaea46175779e --- /dev/null +++ b/bigbluebutton-html5/tests/puppeteer/tests-not-ready/page-hotkeys-mic-first-test.js @@ -0,0 +1,19 @@ +const Page = require('./page'); +const HotkeysMicFirstTestPage = require('./page-hotkeys-mic-first'); + +test("Tests hotkeys when a user first joins a meeting with a microphone: Leaving audio, rejoining as Listen Only, then rejoining with microphone", async () => +{ + var test = new HotkeysMicFirstTestPage(); + try + { + await test.init(Page.getArgs()); + await test.test(); + await test.close(); + } + catch(e) + { + console.log(e); + await test.close(); + throw new Error("Test failed"); + } +}); \ No newline at end of file diff --git a/bigbluebutton-html5/tests/puppeteer/test-hotkeys-mic-first.js b/bigbluebutton-html5/tests/puppeteer/tests-not-ready/page-hotkeys-mic-first.js similarity index 84% rename from bigbluebutton-html5/tests/puppeteer/test-hotkeys-mic-first.js rename to bigbluebutton-html5/tests/puppeteer/tests-not-ready/page-hotkeys-mic-first.js index d41b64b9928b21263c573f4516e87b783ab78acc..9717004ce48a126a44779c547f2b99f663294de5 100644 --- a/bigbluebutton-html5/tests/puppeteer/test-hotkeys-mic-first.js +++ b/bigbluebutton-html5/tests/puppeteer/tests-not-ready/page-hotkeys-mic-first.js @@ -1,5 +1,3 @@ -// Test: Hotkeys when a user first joins a meeting with a microphone: Leaving audio, rejoining as Listen Only, then rejoining with microphone - const Page = require('./page'); const helper = require('./helper'); const e = require('./elements'); @@ -67,18 +65,4 @@ class HotkeysMicFirstTestPage extends Page } }; -var test = new HotkeysMicFirstTestPage(); -(async() => -{ - try - { - await test.init(Page.getArgs()); - await test.test(); - await test.close(); - } - catch(e) - { - console.log(e); - process.exit(1); - } -})(); \ No newline at end of file +module.exports = exports = HotkeysMicFirstTestPage; \ No newline at end of file diff --git a/bigbluebutton-html5/tests/puppeteer/tests-not-ready/page-hotkeys-test.js b/bigbluebutton-html5/tests/puppeteer/tests-not-ready/page-hotkeys-test.js new file mode 100644 index 0000000000000000000000000000000000000000..f938e4ad2cdc9ee32ecbb152e181a886f69d121a --- /dev/null +++ b/bigbluebutton-html5/tests/puppeteer/tests-not-ready/page-hotkeys-test.js @@ -0,0 +1,19 @@ +const Page = require('./page'); +const HotkeysTestPage = require('./page-hotkeys'); + +test("Tests hotkeys: Options, User List, Leave/Join Audio, Mute/Unmute, Toggle Public Chat, Actions Menu, Status Menu", async () => +{ + var test = new HotkeysTestPage(); + try + { + await test.init(Page.getArgs()); + await test.test(); + await test.close(); + } + catch(e) + { + console.log(e); + await test.close(); + throw new Error("Test failed"); + } +}); \ No newline at end of file diff --git a/bigbluebutton-html5/tests/puppeteer/test-hotkeys.js b/bigbluebutton-html5/tests/puppeteer/tests-not-ready/page-hotkeys.js similarity index 93% rename from bigbluebutton-html5/tests/puppeteer/test-hotkeys.js rename to bigbluebutton-html5/tests/puppeteer/tests-not-ready/page-hotkeys.js index c172aee5fd8e1d67278a8446abe1a6d69ae44858..a3d0130d320582f25cb69c31f943a29fd5c5e558 100644 --- a/bigbluebutton-html5/tests/puppeteer/test-hotkeys.js +++ b/bigbluebutton-html5/tests/puppeteer/tests-not-ready/page-hotkeys.js @@ -1,5 +1,3 @@ -// Test: Hotkeys: Options, User List, Leave/Join Audio, Mute/Unmute, Toggle Public Chat, Actions Menu, Status Menu - const Page = require('./page'); const helper = require('./helper'); const e = require('./elements'); @@ -163,18 +161,4 @@ class HotkeysTestPage extends Page } }; -var test = new HotkeysTestPage(); -(async() => -{ - try - { - await test.init(Page.getArgs()); - await test.test(); - await test.close(); - } - catch(e) - { - console.log(e); - process.exit(1); - } -})(); \ No newline at end of file +module.exports = exports = HotkeysTestPage; \ No newline at end of file diff --git a/bigbluebutton-html5/tests/puppeteer/upload-test.png b/bigbluebutton-html5/tests/puppeteer/upload-test.png index 89849fb8408ed62d8b2195f51beb14ef3b4a0846..d957a9ebf3b6c2e83df03ecc9f14ca88956fb78f 100644 Binary files a/bigbluebutton-html5/tests/puppeteer/upload-test.png and b/bigbluebutton-html5/tests/puppeteer/upload-test.png differ