diff --git a/bigbluebutton-html5/tests/puppeteer/page-chat.js b/bigbluebutton-html5/tests/puppeteer/page-chat.js
index aa3675af11..0edc6fae92 100644
--- a/bigbluebutton-html5/tests/puppeteer/page-chat.js
+++ b/bigbluebutton-html5/tests/puppeteer/page-chat.js
@@ -9,18 +9,15 @@ class ChatTestPage extends Page {
await this.createBBBMeeting();
await this.joinWithoutAudio();
- await this.page.waitFor(e.chatButton);
- await this.page.click(e.chatButton);
+ await this.click(e.chatButton);
await this.page.waitFor(e.chatBox);
await this.page.waitFor(e.chatMessages);
const messages0 = await this.getTestElements();
- await this.page.type(e.chatBox, 'Hello world!');
- await this.page.click(e.sendButton);
- await helper.sleep(500);
-
- await this.page.screenshot({ path: 'screenshots/test-chat.png' });
+ await this.type(e.chatBox, 'Hello world!');
+ await this.click(e.sendButton);
+ await this.screenshot('test-chat.png', true);
const messages1 = await this.getTestElements();
diff --git a/bigbluebutton-html5/tests/puppeteer/page-draw.js b/bigbluebutton-html5/tests/puppeteer/page-draw.js
index 08d6c85442..0802be4ca2 100644
--- a/bigbluebutton-html5/tests/puppeteer/page-draw.js
+++ b/bigbluebutton-html5/tests/puppeteer/page-draw.js
@@ -7,10 +7,8 @@ class DrawTestPage extends Page {
await this.createBBBMeeting();
await this.joinWithoutAudio();
- await this.page.waitFor(e.tools);
- await this.page.click(e.tools);
- await this.page.waitFor(e.rectangle);
- await this.page.click(e.rectangle);
+ await this.click(e.tools);
+ await this.click(e.rectangle);
await this.page.waitFor(e.whiteboard);
const shapes0 = await this.getTestElements();
@@ -22,8 +20,7 @@ class DrawTestPage extends Page {
await this.page.mouse.move(wbBox.x + 0.7 * wbBox.width, wbBox.y + 0.7 * wbBox.height);
await this.page.mouse.up();
- await helper.sleep(500);
- await this.page.screenshot({ path: 'screenshots/test-draw.png' });
+ await this.screenshot('test-draw.png', true);
const shapes1 = await this.getTestElements();
console.log('\nShapes before drawing box:');
diff --git a/bigbluebutton-html5/tests/puppeteer/page-status.js b/bigbluebutton-html5/tests/puppeteer/page-status.js
index 2b43519abc..c4d1593a7f 100644
--- a/bigbluebutton-html5/tests/puppeteer/page-status.js
+++ b/bigbluebutton-html5/tests/puppeteer/page-status.js
@@ -6,27 +6,28 @@ class StatusTestPage extends Page {
async test() {
await this.createBBBMeeting();
await this.joinWithoutAudio();
- await this.page.screenshot({ path: 'screenshots/test-status-0.png' });
+
+ await this.screenshot('test-status-0.png', true);
const status0 = await this.getTestElements();
- await this.page.click(e.firstUser);
- await this.page.click(e.setStatus);
- await this.page.click(e.applaud);
- await helper.sleep(100);
- await this.page.screenshot({ path: 'screenshots/test-status-1.png' });
+ await this.click(e.firstUser);
+ await this.click(e.setStatus, true);
+ await this.click(e.applaud, true);
+
+ await this.screenshot('test-status-1.png', true);
const status1 = await this.getTestElements();
- await this.page.click(e.firstUser);
- await this.page.click(e.setStatus);
- await this.page.click(e.away);
- await helper.sleep(100);
- await this.page.screenshot({ path: 'screenshots/test-status-2.png' });
+ await this.click(e.firstUser);
+ await this.click(e.setStatus, true);
+ await this.click(e.away, true);
+
+ await this.screenshot('test-status-2.png', true);
const status2 = await this.getTestElements();
- await this.page.click(e.firstUser);
- await this.page.click(e.clearStatus);
- await helper.sleep(100);
- await this.page.screenshot({ path: 'screenshots/test-status-3.png' });
+ await this.click(e.firstUser);
+ await this.click(e.clearStatus, true);
+
+ await this.screenshot('test-status-3.png', true);
const status3 = await this.getTestElements();
console.log('\nStatus at start of meeting:');
diff --git a/bigbluebutton-html5/tests/puppeteer/page-switch-slides.js b/bigbluebutton-html5/tests/puppeteer/page-switch-slides.js
index 3c76b408b6..ec7bdb1339 100644
--- a/bigbluebutton-html5/tests/puppeteer/page-switch-slides.js
+++ b/bigbluebutton-html5/tests/puppeteer/page-switch-slides.js
@@ -9,16 +9,18 @@ class SlideSwitchTestPage extends Page {
await this.page.waitFor(e.whiteboard);
await this.page.waitFor(e.presentationToolbarWrapper);
- await helper.sleep(500);
- await this.page.screenshot({ path: 'screenshots/test-switch-slides-0.png' });
+
+ await this.screenshot('test-switch-slides-0.png', true);
const svg0 = await this.getTestElements();
- await this.page.click(e.nextSlide);
- await helper.sleep(500);
- await this.page.screenshot({ path: 'screenshots/test-switch-slides-1.png' });
+
+ await this.click(e.nextSlide, true);
+
+ await this.screenshot('test-switch-slides-1.png', true);
const svg1 = await this.getTestElements();
- await this.page.click(e.prevSlide);
- await helper.sleep(500);
- await this.page.screenshot({ path: 'screenshots/test-switch-slides-2.png' });
+
+ await this.click(e.prevSlide, true);
+
+ await this.screenshot('test-switch-slides-2.png', true);
const svg2 = await this.getTestElements();
console.log('\nStarting slide:');
diff --git a/bigbluebutton-html5/tests/puppeteer/page-upload.js b/bigbluebutton-html5/tests/puppeteer/page-upload.js
index 5080ee47aa..3863278028 100644
--- a/bigbluebutton-html5/tests/puppeteer/page-upload.js
+++ b/bigbluebutton-html5/tests/puppeteer/page-upload.js
@@ -7,24 +7,22 @@ class UploadTestPage extends Page {
await this.createBBBMeeting();
await this.joinWithoutAudio();
- await this.page.waitFor(e.actions);
await this.page.waitFor(e.whiteboard);
await this.page.waitFor(e.skipSlide);
- await this.page.click(e.actions);
- await this.page.waitFor(e.uploadPresentation);
const slides0 = await this.getTestElements();
- await this.page.click(e.uploadPresentation);
+ await this.click(e.actions);
+ await this.click(e.uploadPresentation);
+
await this.page.waitFor(e.fileUpload);
const fileUpload = await this.page.$(e.fileUpload);
await fileUpload.uploadFile(`${__dirname}/upload-test.png`);
- await this.page.waitFor(e.start);
- await this.page.click(e.start);
+
+ await this.click(e.start);
await this.elementRemoved(e.start);
- await helper.sleep(1000);
- await this.page.screenshot({ path: 'screenshots/test-upload.png' });
+ await this.page.screenshot('test-upload.png', true);
const slides1 = await this.getTestElements();
console.log('\nSlides before presentation upload:');
diff --git a/bigbluebutton-html5/tests/puppeteer/page.js b/bigbluebutton-html5/tests/puppeteer/page.js
index 3bfea73f62..8f1fab5e86 100644
--- a/bigbluebutton-html5/tests/puppeteer/page.js
+++ b/bigbluebutton-html5/tests/puppeteer/page.js
@@ -44,33 +44,25 @@ class Page {
async joinBBBMeeting(meetingID) {
const joinURL = helper.getJoinURL(meetingID, params, true);
await this.goto(joinURL);
+ await this.page.waitForSelector(e.audioDialog, { timeout: 60000 });
}
// Joins a BigBlueButton as a listener
async joinAudioListenOnly() {
- await this.page.waitFor(e.listenButton);
- await this.page.click(e.listenButton);
- await this.elementRemoved(e.audioDialog);
+ await this.click(e.listenButton);
console.log('Joined meeting as listener');
}
// Joins a BigBlueButton meeting with a microphone
async joinAudioMicrophone() {
- await this.page.waitFor(e.microphoneButton);
- await this.page.click(e.microphoneButton);
- await this.page.waitFor(e.echoYes);
- await helper.sleep(500); // Echo test confirmation sometimes fails without this
- await this.page.click(e.echoYes);
- await this.elementRemoved(e.audioDialog);
+ await this.click(e.microphoneButton);
+ await this.click(e.echoYes, true);
console.log('Joined meeting with microphone');
}
// Joins a BigBlueButton meeting without audio
async joinWithoutAudio() {
- await this.page.waitFor(e.listenButton);
- await this.page.waitFor(e.closeAudio);
- await this.page.click(e.closeAudio);
- await this.elementRemoved(e.audioDialog);
+ await this.click(e.closeAudio, true);
console.log('Joined meeting without audio');
}
@@ -117,6 +109,23 @@ class Page {
await this.page.keyboard.press('ArrowUp');
}
}
+
+ async click(element, relief = false) {
+ if (relief) await helper.sleep(1000);
+ await this.page.waitForSelector(element, { timeout: 60000 });
+ await this.page.click(element);
+ }
+
+ async type(element, text, relief = false) {
+ if (relief) await helper.sleep(1000);
+ await this.page.waitForSelector(element, { timeout: 60000 });
+ await this.page.type(element, text);
+ }
+
+ async screenshot(path, relief = false) {
+ if (relief) await helper.sleep(1000);
+ await this.page.screenshot({ path: 'screenshots/' + path });
+ }
}
module.exports = exports = Page;