From 5d731ac9636d1786d0b10386bc9919c2d1934425 Mon Sep 17 00:00:00 2001 From: Anton B Date: Tue, 14 Feb 2023 10:59:46 -0300 Subject: [PATCH] test: fix and update tests --- bigbluebutton-tests/playwright/api/api.js | 76 ++++++++--------- .../playwright/api/api.spec.js | 2 - .../playwright/api/breakout.js | 82 ++++++++++--------- .../playwright/breakout/breakout.spec.js | 2 +- .../playwright/breakout/create.js | 6 +- .../playwright/breakout/join.js | 21 ++--- .../playwright/chat/chat.spec.js | 8 +- .../playwright/core/elements.js | 24 ++++-- .../playwright/core/helpers.js | 37 ++++----- bigbluebutton-tests/playwright/core/page.js | 49 ++++++----- .../playwright/notifications/util.js | 3 +- .../playwright/polling/poll.js | 13 +-- .../playwright/presentation/presentation.js | 16 ++-- .../presentation/presentation.spec.js | 11 ++- .../playwright/presentation/util.js | 5 +- .../playwright/sharednotes/sharednotes.js | 38 ++++----- .../sharednotes/sharednotes.spec.js | 2 +- .../playwright/sharednotes/util.js | 3 +- .../playwright/user/mobileDevices.js | 2 +- .../playwright/user/user.spec.js | 10 +-- .../playwright/virtualizedlist/virtualize.js | 2 +- .../virtualizedlist/virtualizedlist.spec.js | 2 +- .../playwright/whiteboard/draw.js | 3 +- .../playwright/whiteboard/drawEllipse.js | 4 +- .../playwright/whiteboard/drawLine.js | 4 +- .../playwright/whiteboard/drawPencil.js | 4 +- .../playwright/whiteboard/drawRectangle.js | 4 +- .../playwright/whiteboard/drawStickyNote.js | 8 +- .../playwright/whiteboard/drawText.js | 4 +- .../playwright/whiteboard/drawTriangle.js | 4 +- .../playwright/whiteboard/whiteboard.spec.js | 7 +- 31 files changed, 229 insertions(+), 227 deletions(-) diff --git a/bigbluebutton-tests/playwright/api/api.js b/bigbluebutton-tests/playwright/api/api.js index a55cbbd03f..7c006c106a 100644 --- a/bigbluebutton-tests/playwright/api/api.js +++ b/bigbluebutton-tests/playwright/api/api.js @@ -1,22 +1,18 @@ -// const util = require('node:util'); - const { expect } = require("@playwright/test"); const Page = require('../core/page'); const parameters = require('../core/parameters'); const { apiCall, createMeeting } = require('../core/helpers'); -const e = require('../core/elements'); function getMeetings() { return apiCall('getMeetings', {}); } function getMeetingInfo(meetingID) { - return apiCall('getMeetingInfo', {meetingID: meetingID}); + return apiCall('getMeetingInfo', { meetingID: meetingID }); } class API { - constructor(browser, context, page) { this.modPage = new Page(browser, page); this.browser = browser; @@ -46,22 +42,25 @@ class API { * should ensure that the API will report hasJoinedVoice? */ - const expectedUsers = [expect.objectContaining({fullName: ['Moderator'], - role: ['MODERATOR'], - isPresenter: ['true'], - }), - expect.objectContaining({fullName: ['Attendee'], - role: ['VIEWER'], - isPresenter: ['false'], - }) - ]; - const expectedMeeting = {meetingName : [meetingId], - running : ['true'], - participantCount : ['2'], - moderatorCount : ['1'], - isBreakout: ['false'], - attendees: [{ attendee: expect.arrayContaining(expectedUsers) }] - }; + const expectedUsers = [expect.objectContaining({ + fullName: ['Moderator'], + role: ['MODERATOR'], + isPresenter: ['true'], + }), + expect.objectContaining({ + fullName: ['Attendee'], + role: ['VIEWER'], + isPresenter: ['false'], + }) + ]; + const expectedMeeting = { + meetingName: [meetingId], + running: ['true'], + participantCount: ['2'], + moderatorCount: ['1'], + isBreakout: ['false'], + attendees: [{ attendee: expect.arrayContaining(expectedUsers) }] + }; /* check that this meeting is in the server's list of all meetings */ const response = await getMeetings(); @@ -90,22 +89,25 @@ class API { * should ensure that the API will report hasJoinedVoice? */ - const expectedUsers = [expect.objectContaining({fullName: ['Moderator'], - role: ['MODERATOR'], - isPresenter: ['true'], - }), - expect.objectContaining({fullName: ['Attendee'], - role: ['VIEWER'], - isPresenter: ['false'], - }) - ]; - const expectedMeeting = {meetingName : [meetingId], - running : ['true'], - participantCount : ['2'], - moderatorCount : ['1'], - isBreakout: ['false'], - attendees: [{ attendee: expect.arrayContaining(expectedUsers) }] - }; + const expectedUsers = [expect.objectContaining({ + fullName: ['Moderator'], + role: ['MODERATOR'], + isPresenter: ['true'], + }), + expect.objectContaining({ + fullName: ['Attendee'], + role: ['VIEWER'], + isPresenter: ['false'], + }) + ]; + const expectedMeeting = { + meetingName: [meetingId], + running: ['true'], + participantCount: ['2'], + moderatorCount: ['1'], + isBreakout: ['false'], + attendees: [{ attendee: expect.arrayContaining(expectedUsers) }] + }; /* check that we can retrieve this meeting by its meetingId */ const response2 = await getMeetingInfo(meetingId); diff --git a/bigbluebutton-tests/playwright/api/api.spec.js b/bigbluebutton-tests/playwright/api/api.spec.js index f36112e348..f8b05e252f 100644 --- a/bigbluebutton-tests/playwright/api/api.spec.js +++ b/bigbluebutton-tests/playwright/api/api.spec.js @@ -3,7 +3,6 @@ const { API } = require('./api.js'); const { APIBreakout } = require('./breakout.js'); test.describe.parallel('API', () => { - test('getMeetings', async ({ browser, context, page }) => { const api = new API(browser, context, page); await api.testGetMeetings(); @@ -38,5 +37,4 @@ test.describe.parallel('API', () => { await api.joinRoom(); await api.testBreakoutMeetingInfoOneJoin(); }); - }); diff --git a/bigbluebutton-tests/playwright/api/breakout.js b/bigbluebutton-tests/playwright/api/breakout.js index 5b7deb7b02..6cb80b8ee4 100644 --- a/bigbluebutton-tests/playwright/api/breakout.js +++ b/bigbluebutton-tests/playwright/api/breakout.js @@ -5,11 +5,10 @@ const parameters = require('../core/parameters'); const { apiCall, createMeetingPromise } = require('../core/helpers'); function getMeetingInfo(meetingID) { - return apiCall('getMeetingInfo', {meetingID: meetingID}); + return apiCall('getMeetingInfo', { meetingID: meetingID }); } class APIBreakout extends Join { - constructor(browser, context) { super(browser, context); } @@ -17,21 +16,21 @@ class APIBreakout extends Join { // Attempt to use API to create a breakout room without a parent async testBreakoutWithoutParent() { const response = await createMeetingPromise(parameters, `isBreakout=true&sequence=1`) - .catch(error => error); + .catch(error => error); expect(response.response.status).toEqual(500); } // Attempt to use API to create a break room without a sequence number async testBreakoutWithoutSequenceNumber() { const response = await createMeetingPromise(parameters, `isBreakout=true&parentMeetingID=${this.modPage.meetingId}`) - .catch(error => error); + .catch(error => error); expect(response.response.status).toEqual(500); } // Attempt to use API to create a break room with a non-existent parent meeting async testBreakoutWithNonexistentParent() { const response = await createMeetingPromise(parameters, `isBreakout=true&parentMeetingID=0000000&sequence=1`) - .catch(error => error); + .catch(error => error); expect(response.response.status).toEqual(500); } @@ -49,16 +48,17 @@ class APIBreakout extends Join { for (const breakoutRoom of response1.response.breakoutRooms[0].breakout) { const response2 = await getMeetingInfo(breakoutRoom); - const expectedMeeting = {meetingID : [breakoutRoom], - isBreakout: ['true'], - running: ['false'], - participantCount: ['0'], - hasUserJoined: ['false'], - attendees: ['\n'], /* no attendees; the newline is an artifact of xml2js */ - freeJoin: ['false'], - sequence: [ expect.stringMatching('[12]') ], - parentMeetingID: response1.response.internalMeetingID, - }; + const expectedMeeting = { + meetingID: [breakoutRoom], + isBreakout: ['true'], + running: ['false'], + participantCount: ['0'], + hasUserJoined: ['false'], + attendees: ['\n'], /* no attendees; the newline is an artifact of xml2js */ + freeJoin: ['false'], + sequence: [expect.stringMatching('[12]')], + parentMeetingID: response1.response.internalMeetingID, + }; expect(response2.response.returncode).toEqual(['SUCCESS']); expect(response2.response).toMatchObject(expectedMeeting); @@ -85,33 +85,36 @@ class APIBreakout extends Join { // Attendee, a VIEWER in the parent meeting, becomes a MODERATOR (and presenter) in the breakout room - const expectedUser = expect.objectContaining({fullName: ['Attendee'], - role: ['MODERATOR'], - isPresenter: ['true'], - }); + const expectedUser = expect.objectContaining({ + fullName: ['Attendee'], + role: ['MODERATOR'], + isPresenter: ['true'], + }); - const expectedMeeting1 = {isBreakout: ['true'], - running: ['true'], - participantCount: ['1'], - hasUserJoined: ['true'], - attendees: [{ attendee: [ expectedUser ] }], - freeJoin: ['false'], - sequence: [ '1' ], - parentMeetingID: response1.response.internalMeetingID, - }; + const expectedMeeting1 = { + isBreakout: ['true'], + running: ['true'], + participantCount: ['1'], + hasUserJoined: ['true'], + attendees: [{ attendee: [expectedUser] }], + freeJoin: ['false'], + sequence: ['1'], + parentMeetingID: response1.response.internalMeetingID, + }; - const expectedMeeting2 = {isBreakout: ['true'], - running: ['false'], - participantCount: ['0'], - hasUserJoined: ['false'], - attendees: ['\n'], /* no attendees; the newline is an artifact of xml2js */ - freeJoin: ['false'], - sequence: [ '2' ], - parentMeetingID: response1.response.internalMeetingID, - }; + const expectedMeeting2 = { + isBreakout: ['true'], + running: ['false'], + participantCount: ['0'], + hasUserJoined: ['false'], + attendees: ['\n'], /* no attendees; the newline is an artifact of xml2js */ + freeJoin: ['false'], + sequence: ['2'], + parentMeetingID: response1.response.internalMeetingID, + }; - const expectedResponse1 = {response: expect.objectContaining(expectedMeeting1)}; - const expectedResponse2 = {response: expect.objectContaining(expectedMeeting2)}; + const expectedResponse1 = { response: expect.objectContaining(expectedMeeting1) }; + const expectedResponse2 = { response: expect.objectContaining(expectedMeeting2) }; // Note that this is an array of two responses from two API calls, // not a single API call response containing two breakout rooms @@ -119,7 +122,6 @@ class APIBreakout extends Join { const response2array = await Promise.all(breakoutRooms.map(getMeetingInfo)); expect(response2array).toEqual(expect.arrayContaining([expectedResponse1, expectedResponse2])); } - } exports.APIBreakout = APIBreakout; diff --git a/bigbluebutton-tests/playwright/breakout/breakout.spec.js b/bigbluebutton-tests/playwright/breakout/breakout.spec.js index 1db42e73ba..bb3b4cf0ac 100644 --- a/bigbluebutton-tests/playwright/breakout/breakout.spec.js +++ b/bigbluebutton-tests/playwright/breakout/breakout.spec.js @@ -129,7 +129,7 @@ test.describe.parallel('Breakout', () => { // temporarily skipped until the following issue gets resolved: // https://github.com/bigbluebutton/bigbluebutton/issues/16368 - test.skip('Export breakout room whiteboard annotations', async ({ browser, context, page }) => { + test('Export breakout room whiteboard annotations', async ({ browser, context, page }) => { const join = new Join(browser, context); await join.initPages(page); await join.create(false, true); // capture breakout whiteboard diff --git a/bigbluebutton-tests/playwright/breakout/create.js b/bigbluebutton-tests/playwright/breakout/create.js index e3fb8378ec..6e2dd92ea6 100644 --- a/bigbluebutton-tests/playwright/breakout/create.js +++ b/bigbluebutton-tests/playwright/breakout/create.js @@ -8,7 +8,7 @@ class Create extends MultiUsers { super(browser, context); } - // Create Breakoutrooms + // Create BreakoutRooms async create(captureNotes = false, captureWhiteboard = false) { await this.modPage.waitAndClick(e.manageUsers); await this.modPage.waitAndClick(e.createBreakoutRooms); @@ -16,8 +16,8 @@ class Create extends MultiUsers { //Randomly assignment await this.modPage.waitAndClick(e.randomlyAssign); - if(captureNotes) await this.modPage.page.check(e.captureBreakoutSharedNotes); - if(captureWhiteboard) await this.modPage.page.check(e.captureBreakoutWhiteboard); + if (captureNotes) await this.modPage.page.check(e.captureBreakoutSharedNotes); + if (captureWhiteboard) await this.modPage.page.check(e.captureBreakoutWhiteboard); await this.modPage.waitAndClick(e.modalConfirmButton, ELEMENT_WAIT_LONGER_TIME); await this.userPage.hasElement(e.modalConfirmButton); diff --git a/bigbluebutton-tests/playwright/breakout/join.js b/bigbluebutton-tests/playwright/breakout/join.js index 94006c8f78..88255be179 100644 --- a/bigbluebutton-tests/playwright/breakout/join.js +++ b/bigbluebutton-tests/playwright/breakout/join.js @@ -136,8 +136,7 @@ class Join extends Create { await this.modPage.waitAndClick(e.modalConfirmButton); await this.userPage.waitForSelector(e.modalConfirmButton); - await breakoutUserPage.hasElement(e.errorScreenMessage); - await breakoutUserPage.hasText(e.errorScreenMessage, e.error403removedLabel); + await breakoutUserPage.page.isClosed(); await this.userPage.waitAndClick(e.modalConfirmButton); await this.modPage.hasText(e.userNameBreakoutRoom2, /Attendee/); @@ -161,15 +160,14 @@ class Join extends Create { await this.modPage.waitAndClick(e.endAllBreakouts); await this.modPage.hasElement(e.presentationUploadProgressToast); - await this.modPage.page.waitForSelector(e.presentationUploadProgressToast, { state: 'detached' }); + await this.modPage.waitForSelectorDetached(e.presentationUploadProgressToast, ELEMENT_WAIT_LONGER_TIME); await this.modPage.waitAndClick(e.closeModal); // closing the audio modal await this.modPage.waitAndClick(e.actions); await this.modPage.checkElementCount(e.actionsItem, 9); await this.modPage.getLocatorByIndex(e.actionsItem, 1).click(); - const wb = await this.modPage.page.$(e.whiteboard); - const wbBox = await wb.boundingBox(); + const wbBox = await this.modPage.getElementBoundingBox(e.whiteboard); const clipObj = { x: wbBox.x, y: wbBox.y, @@ -208,20 +206,19 @@ class Join extends Create { await this.modPage.waitAndClick(e.endAllBreakouts); await this.modPage.waitForSelector(e.presentationUploadProgressToast, ELEMENT_WAIT_LONGER_TIME); - await this.modPage.page.waitForSelector(e.presentationUploadProgressToast, { state: 'detached' }); + await this.modPage.waitForSelectorDetached(e.presentationUploadProgressToast, ELEMENT_WAIT_LONGER_TIME); await this.modPage.waitAndClick(e.closeModal); // closing the audio modal await this.modPage.waitAndClick(e.actions); await this.modPage.checkElementCount(e.actionsItem, 9); await this.modPage.getLocatorByIndex(e.actionsItem, 1).click(); - const wbMod = await this.modPage.page.$(e.whiteboard); - const wbBoxMod = await wbMod.boundingBox(); + const wbBox = await this.modPage.getElementBoundingBox(e.whiteboard); const clipObj = { - x: wbBoxMod.x, - y: wbBoxMod.y, - width: wbBoxMod.width, - height: wbBoxMod.height, + x: wbBox.x, + y: wbBox.y, + width: wbBox.width, + height: wbBox.height, }; await expect(this.modPage.page).toHaveScreenshot('capture-breakout-whiteboard.png', { maxDiffPixels: 1000, diff --git a/bigbluebutton-tests/playwright/chat/chat.spec.js b/bigbluebutton-tests/playwright/chat/chat.spec.js index 4af93e35e0..8509594f5e 100644 --- a/bigbluebutton-tests/playwright/chat/chat.spec.js +++ b/bigbluebutton-tests/playwright/chat/chat.spec.js @@ -25,7 +25,7 @@ test.describe.parallel('Chat', () => { }); test('Copy chat', async ({ browser, context, page }, testInfo) => { - test.fixme(testInfo.project.use.headless, 'Only works in headed mode'); + test.skip(testInfo.project.use.headless, 'Only works in headed mode'); const chat = new Chat(browser, page); await chat.init(true, true); await chat.copyChat(context); @@ -78,7 +78,7 @@ test.describe.parallel('Chat', () => { }); test('Copy chat with emoji', async ({ browser, context, page }, testInfo) => { - test.fixme(testInfo.project.use.headless, 'Only works in headed mode'); + test.skip(testInfo.project.use.headless, 'Only works in headed mode'); const emoji = new Chat(browser, page); await emoji.init(true, true); await emoji.emojiCopyChat(context); @@ -103,7 +103,7 @@ test.describe.parallel('Chat', () => { }); test('Copy chat with auto converted emoji', async ({ browser, context, page }, testInfo) => { - test.fixme(testInfo.project.use.headless, 'Only works in headed mode'); + test.skip(testInfo.project.use.headless, 'Only works in headed mode'); const emoji = new Chat(browser, page); await emoji.init(true, true); await emoji.autoConvertEmojiCopyChat(context); @@ -121,4 +121,4 @@ test.describe.parallel('Chat', () => { await emoji.autoConvertEmojiSendPrivateChat(); }); }); -}); \ No newline at end of file +}); diff --git a/bigbluebutton-tests/playwright/core/elements.js b/bigbluebutton-tests/playwright/core/elements.js index 0d639b6aa2..ef7216abf4 100644 --- a/bigbluebutton-tests/playwright/core/elements.js +++ b/bigbluebutton-tests/playwright/core/elements.js @@ -164,7 +164,8 @@ exports.notesOptions = 'button[data-test="notesOptionsMenu"]'; // Notifications exports.smallToastMsg = 'div[data-test="toastSmallMsg"]'; -exports.currentPresentationToast = 'div[data-test="toastSmallMsg"] > div'; +const currentPresentationToast = 'div[data-test="currentPresentationToast"]'; +exports.currentPresentationToast = currentPresentationToast exports.notificationsTab = 'span[id="notificationTab"]'; exports.chatPopupAlertsBtn = 'input[data-test="chatPopupAlertsBtn"]'; exports.hasUnreadMessages = 'button[data-test="hasUnreadMessages"]'; @@ -202,7 +203,10 @@ exports.restartPoll = 'button[data-test="restartPoll"]'; exports.hidePollDesc = 'button[data-test="hidePollDesc"]'; exports.pollingContainer = 'div[data-test="pollingContainer"]'; exports.pollLetterAlternatives = 'button[data-test="pollLetterAlternatives"]'; -exports.pollOptionItem = 'input[data-test="pollOptionItem"]'; +const pollOptionItem = 'input[data-test="pollOptionItem"]'; +exports.pollOptionItem1 = `${pollOptionItem}>>nth=0`; +exports.pollOptionItem2 = `${pollOptionItem}>>nth=1`; +exports.pollOptionItem = pollOptionItem; exports.anonymousPoll = 'input[data-test="anonymousPollBtn"]'; const pollAnswerOptionBtn = 'button[data-test="publishPollingLabel"]'; exports.publishPollingLabel = pollAnswerOptionBtn; @@ -220,11 +224,10 @@ exports.pollYesNoAbstentionBtn = 'button[data-test="pollYesNoAbstentionBtn"]'; exports.noPresentation = 'h4[data-test="noPresentation"]'; exports.autoOptioningPollBtn = 'input[data-test="autoOptioningPollBtn"]'; exports.currentPollQuestion = 'span[data-test="currentPollQuestion"]'; -exports.allowMultiple = 'div[data-test="allowMultiple"] > div > input[type="checkbox"]'; -exports.pollOptionItem1 = 'input[data-test="pollOptionItem"]>>nth=0'; -exports.pollOptionItem2 = 'input[data-test="pollOptionItem"]>>nth=1'; -exports.pollAnswerDescTest1 = 'div[data-test="optionsAnswers"]>>nth=0'; -exports.pollAnswerDescTest2 = 'div[data-test="optionsAnswers"]>>nth=1'; +exports.allowMultiple = 'div[data-test="allowMultiple"] input[type="checkbox"]'; +const pollAnswerOptionDesc = 'button[data-test="pollAnswerOption"]'; +exports.firstPollAnswerDescOption = `${pollAnswerOptionDesc}>>nth=0`; +exports.secondPollAnswerDescOption = `${pollAnswerOptionDesc}>>nth=1`; exports.submitAnswersMultiple = 'button[data-test="submitAnswersMultiple"]'; exports.numberVotes = 'div[data-test="numberVotes"]'; exports.answer1 = 'div[data-test="numberOfVotes"]>>nth=0'; @@ -232,8 +235,10 @@ exports.answer2 = 'div[data-test="numberOfVotes"]>>nth=1'; exports.errorNoValueInput = 'div[data-test="errorNoValueInput"]'; exports.smartSlides1 = 'smartSlidesPresentation.pdf'; exports.responsePollQuestion = 'div[data-test="pollQuestion"]'; -exports.firstPollAnswerOptionBtn = `${pollAnswerOptionBtn}>>nth=0`; -exports.checkboxInput = `${pollAnswerOptionBtn} > div`; +const pollAnswersOption = 'div[data-test="optionsAnswers"]'; +exports.firstPollAnswerOptionBtn = `${pollAnswersOption}>>nth=0`; +exports.secondPollAnswerOptionBtn = `${pollAnswersOption}>>nth=1`; +exports.firstCheckboxInput = `${pollAnswersOption}`; // Presentation exports.currentSlideImg = 'img[id="slide-background-shape_image"]'; exports.uploadPresentationFileName = 'uploadTest.png'; @@ -396,6 +401,7 @@ exports.wbPencilShape = 'button[id="TD-PrimaryTools-Pencil"]'; exports.wbStickyNoteShape = 'button[id="TD-PrimaryTools-Pencil2"]'; exports.wbTextShape = 'button[id="TD-PrimaryTools-Text"]'; exports.wbTypedText = 'div[data-shape="text"]'; +exports.wbTypedStickyNote = 'div[data-shape="sticky"]'; exports.wbDrawnRectangle = 'div[data-shape="rectangle"]'; exports.wbDrawnLine = 'div[data-shape="draw"]'; exports.multiUsersWhiteboardOn = 'button[data-test="turnMultiUsersWhiteboardOn"]'; diff --git a/bigbluebutton-tests/playwright/core/helpers.js b/bigbluebutton-tests/playwright/core/helpers.js index 2436a032f1..eb3443dc8b 100644 --- a/bigbluebutton-tests/playwright/core/helpers.js +++ b/bigbluebutton-tests/playwright/core/helpers.js @@ -1,11 +1,9 @@ require('dotenv').config(); const sha1 = require('sha1'); const axios = require('axios'); -const { test } = require('@playwright/test'); +const { test, expect } = require('@playwright/test'); const xml2js = require('xml2js'); -const { expect } = require("@playwright/test"); - const parameters = require('./parameters'); function getRandomInt(min, max) { @@ -16,8 +14,8 @@ function getRandomInt(min, max) { function apiCallUrl(name, callParams) { const query = new URLSearchParams(callParams).toString(); - const apicall = `${name}${query}${parameters.secret}`; - const checksum = sha1(apicall); + const apiCall = `${name}${query}${parameters.secret}`; + const checksum = sha1(apiCall); const url = `${parameters.server}/${name}?${query}&checksum=${checksum}`; return url; } @@ -27,22 +25,21 @@ function apiCall(name, callParams) { return axios.get(url, { adapter: 'http' }).then(response => xml2js.parseStringPromise(response.data)); } -function createMeetingUrl(params, customParameter) { - const meetingID = `random-${getRandomInt(1000000, 10000000).toString()}`; +function createMeetingUrl(params, customParameter, customMeetingId) { + const meetingID = (customMeetingId) ? customMeetingId : `random-${getRandomInt(1000000, 10000000).toString()}`; const mp = params.moderatorPW; const ap = params.attendeePW; - const query = customParameter !== undefined ? `name=${meetingID}&meetingID=${meetingID}&attendeePW=${ap}&moderatorPW=${mp}` - + `&allowStartStopRecording=true&${customParameter}&autoStartRecording=false&welcome=${params.welcome}` - : `name=${meetingID}&meetingID=${meetingID}&attendeePW=${ap}&moderatorPW=${mp}` + const baseQuery = `name=${meetingID}&meetingID=${meetingID}&attendeePW=${ap}&moderatorPW=${mp}` + `&allowStartStopRecording=true&autoStartRecording=false&welcome=${params.welcome}`; - const apicall = `create${query}${params.secret}`; - const checksum = sha1(apicall); + const query = customParameter !== undefined ? `${baseQuery}&${customParameter}` : baseQuery; + const apiCall = `create${query}${params.secret}`; + const checksum = sha1(apiCall); const url = `${params.server}/create?${query}&checksum=${checksum}`; return url; } -function createMeetingPromise(params, customParameter) { - const url = createMeetingUrl(params, customParameter); +function createMeetingPromise(params, customParameter, customMeetingId) { + const url = createMeetingUrl(params, customParameter, customMeetingId); return axios.get(url, { adapter: 'http' }); } @@ -50,16 +47,16 @@ async function createMeeting(params, customParameter) { const promise = createMeetingPromise(params, customParameter); const response = await promise; expect(response.status).toEqual(200); - const xmlresponse = await xml2js.parseStringPromise(response.data); - return xmlresponse.response.meetingID[0]; + const xmlResponse = await xml2js.parseStringPromise(response.data); + return xmlResponse.response.meetingID[0]; } function getJoinURL(meetingID, params, moderator, customParameter) { const pw = moderator ? params.moderatorPW : params.attendeePW; - const query = customParameter !== undefined ? `fullName=${params.fullName}&meetingID=${meetingID}&password=${pw}&${customParameter}` - : `fullName=${params.fullName}&meetingID=${meetingID}&password=${pw}`; - const apicall = `join${query}${params.secret}`; - const checksum = sha1(apicall); + const baseQuery = `fullName=${params.fullName}&meetingID=${meetingID}&password=${pw}`; + const query = customParameter !== undefined ? `${baseQuery}&${customParameter}` : baseQuery; + const apiCall = `join${query}${params.secret}`; + const checksum = sha1(apiCall); return `${params.server}/join?${query}&checksum=${checksum}`; } diff --git a/bigbluebutton-tests/playwright/core/page.js b/bigbluebutton-tests/playwright/core/page.js index c62c943d3a..aef6ad38b2 100644 --- a/bigbluebutton-tests/playwright/core/page.js +++ b/bigbluebutton-tests/playwright/core/page.js @@ -24,26 +24,26 @@ function formatWithCss(CONSOLE_options, ...args) { // See https://console.spec.whatwg.org/ sections 2.2.1 and 2.3.4 let split_arg0 = args[0].split("%"); - for (let i=1, j=1; i opt.trim().toLowerCase()); const CONSOLE_options = { - colorize: CONSOLE_strings.includes('color') || CONSOLE_strings.includes('colour'), - drop_references: CONSOLE_strings.includes('norefs'), - drop_timestamps: CONSOLE_strings.includes('nots'), - line_label: CONSOLE_strings.includes('label') ? this.username + " " : undefined, - noClientLogger: CONSOLE_strings.includes('nocl') || CONSOLE_strings.includes('noclientlogger'), + colorize: CONSOLE_strings.includes('color') || CONSOLE_strings.includes('colour'), + drop_references: CONSOLE_strings.includes('norefs'), + drop_timestamps: CONSOLE_strings.includes('nots'), + line_label: CONSOLE_strings.includes('label') ? this.username + " " : undefined, + noClientLogger: CONSOLE_strings.includes('nocl') || CONSOLE_strings.includes('noclientlogger'), }; this.page.on('console', async (msg) => console.log(await console_format(msg, CONSOLE_options))); } - this.meetingId = (meetingId) ? meetingId : await helpers.createMeeting(parameters, customParameter); + this.meetingId = (meetingId) ? meetingId : await helpers.createMeeting(parameters, customParameter, customMeetingId); const joinUrl = helpers.getJoinURL(this.meetingId, this.initParameters, isModerator, customParameter); const response = await this.page.goto(joinUrl); await expect(response.ok()).toBeTruthy(); @@ -143,7 +143,7 @@ class Page { } } - async handleNewTab(selector, context){ + async handleNewTab(selector, context) { const [newPage] = await Promise.all([ context.waitForEvent('page'), this.waitAndClick(selector), @@ -201,7 +201,7 @@ class Page { } async getCopiedText(context) { - await context.grantPermissions(['clipboard-write', 'clipboard-read'], { origin: process.env.BBB_URL}); + await context.grantPermissions(['clipboard-write', 'clipboard-read'], { origin: process.env.BBB_URL }); return this.page.evaluate(async () => navigator.clipboard.readText()); } @@ -214,6 +214,15 @@ class Page { await this.page.waitForSelector(selector, { timeout }); } + async waitForSelectorDetached(selector, timeout = ELEMENT_WAIT_TIME) { + await this.page.waitForSelector(selector, { state: 'detached', timeout }); + } + + async getElementBoundingBox(selector) { + const element = await this.page.$(selector); + return element.boundingBox(); + } + async waitUntilHaveCountSelector(selector, count, timeout = ELEMENT_WAIT_TIME) { await this.page.waitForFunction( checkElementLengthEqualTo, @@ -295,7 +304,7 @@ class Page { async up(key) { await this.page.keyboard.up(key); } - + async mouseDoubleClick(x, y) { await this.page.mouse.dblclick(x, y); } @@ -310,7 +319,7 @@ class Page { } async hasValue(selector, value) { - const locator = await this.page.locator(selector); + const locator = await this.page.locator(selector); await expect(locator).toHaveValue(value); } diff --git a/bigbluebutton-tests/playwright/notifications/util.js b/bigbluebutton-tests/playwright/notifications/util.js index f666dab593..1168708692 100644 --- a/bigbluebutton-tests/playwright/notifications/util.js +++ b/bigbluebutton-tests/playwright/notifications/util.js @@ -57,7 +57,8 @@ async function waitAndClearDefaultPresentationNotification(testPage) { await testPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME); const hasCurrentPresentationToast = await testPage.checkElement(e.currentPresentationToast); if (hasCurrentPresentationToast) { - await waitAndClearNotification(testPage); + await testPage.waitAndClick(e.currentPresentationToast, ELEMENT_WAIT_LONGER_TIME); + await testPage.wasRemoved(e.currentPresentationToast); } } diff --git a/bigbluebutton-tests/playwright/polling/poll.js b/bigbluebutton-tests/playwright/polling/poll.js index 652555833f..85bdb74362 100644 --- a/bigbluebutton-tests/playwright/polling/poll.js +++ b/bigbluebutton-tests/playwright/polling/poll.js @@ -6,7 +6,6 @@ const utilPresentation = require('../presentation/util'); const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants'); const { getSettings } = require('../core/settings'); const { waitAndClearDefaultPresentationNotification } = require('../notifications/util'); -const { sleep } = require('../core/helpers'); class Polling extends MultiUsers { constructor(browser, context) { @@ -196,8 +195,8 @@ class Polling extends MultiUsers { await this.modPage.waitAndClick(e.startPoll); await this.modPage.hasText(e.currentPollQuestion, /Test/); - await this.userPage.waitAndClick(e.pollAnswerDescTest1); - await this.userPage.waitAndClick(e.pollAnswerDescTest2); + await this.userPage.waitAndClick(e.firstPollAnswerOptionBtn); + await this.userPage.waitAndClick(e.secondPollAnswerOptionBtn); await this.userPage.waitAndClickElement(e.submitAnswersMultiple); await this.modPage.hasText(e.answer1, '1'); @@ -205,8 +204,10 @@ class Polling extends MultiUsers { } async smartSlidesQuestions() { + await this.modPage.hasElement(e.whiteboard, ELEMENT_WAIT_LONGER_TIME); + await waitAndClearDefaultPresentationNotification(this.modPage); await utilPresentation.uploadSinglePresentation(this.modPage, e.smartSlides1, ELEMENT_WAIT_LONGER_TIME); - await this.userPage.hasElement(e.presentationTitle); + await this.userPage.hasElement(e.currentUser); await this.modPage.waitAndClick(e.quickPoll); await this.userPage.hasElement(e.responsePollQuestion); @@ -218,7 +219,7 @@ class Polling extends MultiUsers { await this.modPage.waitAndClick(e.publishPollingLabel); await this.modPage.waitAndClick(e.nextSlide); await this.modPage.waitAndClick(e.quickPoll); - await this.userPage.waitAndClick(e.checkboxInput); + await this.userPage.waitAndClick(e.firstCheckboxInput); await this.userPage.waitAndClick(e.submitAnswersMultiple); await this.modPage.hasText(e.answer1, '1'); @@ -226,7 +227,7 @@ class Polling extends MultiUsers { await this.modPage.waitAndClick(e.publishPollingLabel); await this.modPage.waitAndClick(e.nextSlide); await this.modPage.waitAndClick(e.quickPoll); - await this.userPage.waitAndClick(e.pollAnswerDescTest1); + await this.userPage.waitAndClick(e.firstPollAnswerDescOption); await this.modPage.hasText(e.answer1, '1'); await this.modPage.hasElementDisabled(e.nextSlide); diff --git a/bigbluebutton-tests/playwright/presentation/presentation.js b/bigbluebutton-tests/playwright/presentation/presentation.js index 89336f3d0f..4a15658720 100644 --- a/bigbluebutton-tests/playwright/presentation/presentation.js +++ b/bigbluebutton-tests/playwright/presentation/presentation.js @@ -34,7 +34,7 @@ class Presentation extends MultiUsers { async hideAndRestorePresentation() { const { presentationHidden } = getSettings(); if (!presentationHidden) { - await this.modPage.waitForSelector(e.whiteboard); + await this.modPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME); await this.modPage.waitAndClick(e.minimizePresentation); } await this.modPage.wasRemoved(e.presentationContainer); @@ -69,6 +69,7 @@ class Presentation extends MultiUsers { const userSlides0 = await getSlideOuterHtml(this.userPage); await expect(modSlides0).toEqual(userSlides0); + await waitAndClearDefaultPresentationNotification(this.modPage); await uploadSinglePresentation(this.modPage, e.uploadPresentationFileName); const modSlides1 = await getSlideOuterHtml(this.modPage); @@ -80,7 +81,7 @@ class Presentation extends MultiUsers { } async uploadMultiplePresentationsTest() { - await this.modPage.waitForSelector(e.skipSlide); + await this.modPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME); const modSlides0 = await getSlideOuterHtml(this.modPage); const userSlides0 = await getSlideOuterHtml(this.userPage); @@ -91,19 +92,17 @@ class Presentation extends MultiUsers { const modSlides1 = await getSlideOuterHtml(this.modPage); const userSlides1 = await getSlideOuterHtml(this.userPage); await expect(modSlides1).toEqual(userSlides1); - await expect(modSlides0).not.toEqual(modSlides1); await expect(userSlides0).not.toEqual(userSlides1); } async fitToWidthTest() { await this.modPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME); - await this.modPage.waitForSelector(e.skipSlide); await this.modPage.waitAndClick(e.userListToggleBtn); await uploadSinglePresentation(this.modPage, e.uploadPresentationFileName); - const width1 = (await this.modPage.page.locator(e.whiteboard).boundingBox()).width; + const width1 = (await this.modPage.getElementBoundingBox(e.whiteboard)).width; await this.modPage.waitAndClick(e.fitToWidthButton); - const width2 = (await this.modPage.page.locator(e.whiteboard).boundingBox()).width; + const width2 = (await this.modPage.getElementBoundingBox(e.whiteboard)).width; await expect(Number(width2) > Number(width1)).toBeTruthy(); } @@ -115,7 +114,8 @@ class Presentation extends MultiUsers { await this.modPage.waitAndClick(e.actions); await this.modPage.waitAndClick(e.managePresentations); await this.modPage.waitAndClick(e.exportPresentationToPublicChat); - await this.modPage.hasElement(e.downloadPresentationToast); + await this.userPage.hasElement(e.smallToastMsg); + await this.userPage.hasElement(e.toastDownload); await this.userPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME); await this.userPage.hasElement(e.downloadPresentation, ELEMENT_WAIT_EXTRA_LONG_TIME); await this.userPage.handleDownload(e.downloadPresentation, testInfo); @@ -203,6 +203,7 @@ class Presentation extends MultiUsers { } async presentationFullscreen() { + await this.modPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME); const presentationLocator = await this.modPage.getLocator(e.presentationContainer); const height = parseInt(await getCurrentPresentationHeight(presentationLocator)); @@ -216,6 +217,7 @@ class Presentation extends MultiUsers { } async presentationSnapshot(testInfo) { + await this.modPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME); await this.modPage.waitAndClick(e.whiteboardOptionsButton); await this.modPage.handleDownload(e.presentationSnapshot, testInfo); } diff --git a/bigbluebutton-tests/playwright/presentation/presentation.spec.js b/bigbluebutton-tests/playwright/presentation/presentation.spec.js index b40a5ace31..7a37975ded 100644 --- a/bigbluebutton-tests/playwright/presentation/presentation.spec.js +++ b/bigbluebutton-tests/playwright/presentation/presentation.spec.js @@ -1,6 +1,9 @@ const { test } = require('@playwright/test'); +const { encodeCustomParams } = require('../customparameters/util'); const { Presentation } = require('./presentation'); +const customStyleAvoidUploadingNotifications = encodeCustomParams(`userdata-bbb_custom_style=.presentationUploaderToast{display: none;}`); + test.describe.parallel('Presentation', () => { // https://docs.bigbluebutton.org/2.6/release-tests.html#navigation-automated test('Skip slide @ci', async ({ browser, context, page }) => { @@ -26,7 +29,8 @@ test.describe.parallel('Presentation', () => { // https://docs.bigbluebutton.org/2.6/release-tests.html#fit-to-width-option test('Presentation fit to width', async ({ browser, context, page }) => { const presentation = new Presentation(browser, context); - await presentation.initPages(page); + await presentation.initModPage(page, true, { customParameter: customStyleAvoidUploadingNotifications }); + await presentation.initUserPage(true, context); await presentation.fitToWidthTest(); }); @@ -45,7 +49,7 @@ test.describe.parallel('Presentation', () => { test.describe.parallel('Manage', () => { // https://docs.bigbluebutton.org/2.6/release-tests.html#uploading-a-presentation-automated test('Upload single presentation @ci', async ({ browser, context, page }) => { - test.fixme(true, 'Different behaviors in the development and production environment'); + // test.fixme(true, 'Different behaviors in the development and production environment'); const presentation = new Presentation(browser, context); await presentation.initPages(page, true); await presentation.uploadSinglePresentationTest(); @@ -79,7 +83,8 @@ test.describe.parallel('Presentation', () => { test('Remove previous presentation from previous presenter', async ({ browser, context, page }) => { const presentation = new Presentation(browser, context); - await presentation.initPages(page); + await presentation.initModPage(page, true, { customParameter: customStyleAvoidUploadingNotifications }); + await presentation.initUserPage(true, context); await presentation.removePreviousPresentationFromPreviousPresenter(); }); }); diff --git a/bigbluebutton-tests/playwright/presentation/util.js b/bigbluebutton-tests/playwright/presentation/util.js index 633a7c9853..6ddcd28935 100644 --- a/bigbluebutton-tests/playwright/presentation/util.js +++ b/bigbluebutton-tests/playwright/presentation/util.js @@ -31,8 +31,7 @@ async function uploadSinglePresentation(test, fileName, uploadTimeout = ELEMENT_ await test.hasText('body', e.statingUploadPresentationToast); await test.waitAndClick(e.confirmManagePresentation); - await test.hasText(e.presentationStatusInfo, e.convertingPresentationFileToast, uploadTimeout); - await test.hasText(e.smallToastMsg, e.presentationUploadedToast, uploadTimeout); + await test.hasElement(e.currentPresentationToast, uploadTimeout); } async function uploadMultiplePresentations(test, fileNames, uploadTimeout = ELEMENT_WAIT_LONGER_TIME) { @@ -40,7 +39,7 @@ async function uploadMultiplePresentations(test, fileNames, uploadTimeout = ELEM await test.waitAndClick(e.managePresentations); await test.waitForSelector(e.fileUpload); - await test.page.setInputFiles(e.fileUpload, fileNames.map(function(fileName) { return path.join(__dirname, `../core/media/${fileName}`); })); + await test.page.setInputFiles(e.fileUpload, fileNames.map(function (fileName) { return path.join(__dirname, `../core/media/${fileName}`); })); await test.hasText('body', e.statingUploadPresentationToast); await test.waitAndClick(e.confirmManagePresentation); diff --git a/bigbluebutton-tests/playwright/sharednotes/sharednotes.js b/bigbluebutton-tests/playwright/sharednotes/sharednotes.js index 2c7d0912cf..42309ce837 100644 --- a/bigbluebutton-tests/playwright/sharednotes/sharednotes.js +++ b/bigbluebutton-tests/playwright/sharednotes/sharednotes.js @@ -1,11 +1,10 @@ const { default: test } = require('@playwright/test'); -const Page = require('../core/page'); const { MultiUsers } = require('../user/multiusers'); const { getSettings } = require('../core/settings'); const e = require('../core/elements'); -const { startSharedNotes, getNotesLocator, getShowMoreButtonLocator, getExportButtonLocator, getExportPlainTextLocator, getMoveToWhiteboardLocator, getSharedNotesUserWithoutPermission } = require('./util'); +const { startSharedNotes, getNotesLocator, getShowMoreButtonLocator, getExportButtonLocator, getExportPlainTextLocator, getSharedNotesUserWithoutPermission } = require('./util'); const { expect } = require('@playwright/test'); -const { ELEMENT_WAIT_TIME, ELEMENT_WAIT_LONGER_TIME, ELEMENT_WAIT_EXTRA_LONG_TIME } = require('../core/constants'); +const { ELEMENT_WAIT_TIME } = require('../core/constants'); const { sleep } = require('../core/helpers'); class SharedNotes extends MultiUsers { @@ -17,19 +16,21 @@ class SharedNotes extends MultiUsers { const { sharedNotesEnabled } = getSettings(); test.fail(!sharedNotesEnabled, 'Shared notes is disabled'); await startSharedNotes(this.modPage); + const sharedNotesContent = await getNotesLocator(this.modPage); + await expect(sharedNotesContent).toBeEditable({ timeout: ELEMENT_WAIT_TIME }); } - async editMessage(notesLocator) { + async editMessage() { await this.modPage.down('Shift'); let i = 7; - while(i > 0) { + while (i > 0) { await this.modPage.press('ArrowLeft'); i--; } await this.modPage.up('Shift'); await this.modPage.press('Backspace'); i = 5; - while(i > 0) { + while (i > 0) { await this.modPage.press('ArrowLeft'); i--; } @@ -42,13 +43,12 @@ class SharedNotes extends MultiUsers { await startSharedNotes(this.modPage); const notesLocator = getNotesLocator(this.modPage); await notesLocator.type(e.message); - this.editMessage(notesLocator); + await this.editMessage(notesLocator); const editedMessage = '!Hello'; - await expect(notesLocator).toContainText(editedMessage, { timeout : ELEMENT_WAIT_TIME }); + await expect(notesLocator).toContainText(editedMessage, { timeout: ELEMENT_WAIT_TIME }); } - async formatMessage(notesLocator) { - + async formatMessage() { // U for '!' await this.modPage.down('Shift'); await this.modPage.press('ArrowLeft'); @@ -59,7 +59,7 @@ class SharedNotes extends MultiUsers { // B for 'World' await this.modPage.down('Shift'); let i = 5; - while(i > 0) { + while (i > 0) { await this.modPage.press('ArrowLeft'); i--; } @@ -72,7 +72,7 @@ class SharedNotes extends MultiUsers { // I for 'Hello' await this.modPage.down('Shift'); i = 5; - while(i > 0) { + while (i > 0) { await this.modPage.press('ArrowLeft'); i--; } @@ -129,7 +129,7 @@ class SharedNotes extends MultiUsers { await this.modPage.waitAndClick(e.notesOptions); await this.modPage.waitAndClick(e.sendNotesToWhiteboard); - + await this.modPage.hasText(e.currentSlideText, /test/, 20000); await this.userPage.hasText(e.currentSlideText, /test/); } @@ -147,8 +147,8 @@ class SharedNotes extends MultiUsers { await notesLocatorUser.type('J'); const editedMessage = 'Jello World!'; - await expect(notesLocator).toContainText(editedMessage, { timeout : ELEMENT_WAIT_TIME }); - await expect(notesLocatorUser).toContainText(editedMessage, { timeout : ELEMENT_WAIT_TIME }); + await expect(notesLocator).toContainText(editedMessage, { timeout: ELEMENT_WAIT_TIME }); + await expect(notesLocatorUser).toContainText(editedMessage, { timeout: ELEMENT_WAIT_TIME }); } async seeNotesWithoutEditPermission() { @@ -166,9 +166,9 @@ class SharedNotes extends MultiUsers { await this.modPage.waitAndClickElement(e.lockEditSharedNotes); await this.modPage.waitAndClick(e.applyLockSettings); - const notesLocatorUser = getSharedNotesUserWithoutPermission(this.userPage); - await expect(notesLocatorUser).toContainText(/Hello/, { timeout : 20000 }); - await this.userPage.wasRemoved(e.etherpadFrame); + const notesLocatorUser = getSharedNotesUserWithoutPermission(this.userPage); + await expect(notesLocatorUser).toContainText(/Hello/, { timeout: 20000 }); + await this.userPage.wasRemoved(e.etherpadFrame); } async pinNotesOntoWhiteboard() { @@ -184,7 +184,7 @@ class SharedNotes extends MultiUsers { await notesLocator.type('Hello'); const notesLocatorUser = getNotesLocator(this.userPage1); - await expect(notesLocator).toContainText(/Hello/, { timeout : 20000 }); + await expect(notesLocator).toContainText(/Hello/, { timeout: 20000 }); await expect(notesLocatorUser).toContainText(/Hello/); } } diff --git a/bigbluebutton-tests/playwright/sharednotes/sharednotes.spec.js b/bigbluebutton-tests/playwright/sharednotes/sharednotes.spec.js index de01e07c1a..bd2a199a2d 100644 --- a/bigbluebutton-tests/playwright/sharednotes/sharednotes.spec.js +++ b/bigbluebutton-tests/playwright/sharednotes/sharednotes.spec.js @@ -1,5 +1,5 @@ const { test } = require('@playwright/test'); -const { SharedNotes, SharedNotesMultiUsers } = require('./sharednotes'); +const { SharedNotes } = require('./sharednotes'); test.describe.parallel('Shared Notes', () => { test('Open Shared notes @ci', async ({ browser, page, context }) => { diff --git a/bigbluebutton-tests/playwright/sharednotes/util.js b/bigbluebutton-tests/playwright/sharednotes/util.js index 219855f67e..5f4fd749d8 100644 --- a/bigbluebutton-tests/playwright/sharednotes/util.js +++ b/bigbluebutton-tests/playwright/sharednotes/util.js @@ -1,11 +1,10 @@ const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants'); const e = require('../core/elements'); -const { expect } = require('@playwright/test'); async function startSharedNotes(test) { await test.waitAndClick(e.sharedNotes); await test.waitForSelector(e.hideNotesLabel, ELEMENT_WAIT_LONGER_TIME); - await test.hasElement(e.etherpadFrame); + await test.hasElement(e.etherpadFrame, ELEMENT_WAIT_LONGER_TIME); } function getNotesLocator(test) { diff --git a/bigbluebutton-tests/playwright/user/mobileDevices.js b/bigbluebutton-tests/playwright/user/mobileDevices.js index 011234e1ba..0d034acf8b 100644 --- a/bigbluebutton-tests/playwright/user/mobileDevices.js +++ b/bigbluebutton-tests/playwright/user/mobileDevices.js @@ -21,7 +21,7 @@ class MobileDevices extends MultiUsers { await this.userPage.wasRemoved(e.whiteboard); } - async userlistNotAppearOnMobile() { + async userListNotAppearOnMobile() { await this.modPage.wasRemoved(e.userListItem); await this.userPage.wasRemoved(e.userListItem); } diff --git a/bigbluebutton-tests/playwright/user/user.spec.js b/bigbluebutton-tests/playwright/user/user.spec.js index ab6204811d..d00cfe04fa 100644 --- a/bigbluebutton-tests/playwright/user/user.spec.js +++ b/bigbluebutton-tests/playwright/user/user.spec.js @@ -82,7 +82,7 @@ test.describe.parallel('User', () => { test('Remove user and prevent rejoining', async ({ browser, context, page }) => { const multiusers = new MultiUsers(browser, context); await multiusers.initModPage(page, true); - await multiusers.initModPage2(true, context, { customParameter: 'userID=Moderator2'}); + await multiusers.initModPage2(true, context, { customParameter: 'userID=Moderator2' }); await multiusers.removeUserAndPreventRejoining(context); }); }); @@ -262,7 +262,7 @@ test.describe.parallel('User', () => { await mobileDevices.mobileTagName(); }); - test('Whiteboard should not be accessible when chat panel or userlist are active on mobile devices', async ({ browser }) => { + test('Whiteboard should not be accessible when chat panel or user list are active on mobile devices', async ({ browser }) => { test.fixme(); const iphoneContext = await browser.newContext({ ...iPhone11 }); const motoContext = await browser.newContext({ ...motoG4 }); @@ -273,17 +273,17 @@ test.describe.parallel('User', () => { await mobileDevices.whiteboardNotAppearOnMobile(); }); - test('Userslist should not appear when Chat Panel or Whiteboard are active on mobile devices', async ({ browser }) => { + test('User List should not appear when Chat Panel or Whiteboard are active on mobile devices', async ({ browser }) => { const iphoneContext = await browser.newContext({ ...iPhone11 }); const motoContext = await browser.newContext({ ...motoG4 }); const modPage = await iphoneContext.newPage(); const mobileDevices = new MobileDevices(browser, iphoneContext); await mobileDevices.initModPage(modPage); await mobileDevices.initUserPage(true, motoContext); - await mobileDevices.userlistNotAppearOnMobile(); + await mobileDevices.userListNotAppearOnMobile(); }); - test('Chat Panel should not appear when Userlist or Whiteboard are active on mobile devices', async ({ browser }) => { + test('Chat Panel should not appear when UserList or Whiteboard are active on mobile devices', async ({ browser }) => { const iphoneContext = await browser.newContext({ ...iPhone11 }); const motoContext = await browser.newContext({ ...motoG4 }); const modPage = await iphoneContext.newPage(); diff --git a/bigbluebutton-tests/playwright/virtualizedlist/virtualize.js b/bigbluebutton-tests/playwright/virtualizedlist/virtualize.js index e6f34c9bb4..e779d007ac 100644 --- a/bigbluebutton-tests/playwright/virtualizedlist/virtualize.js +++ b/bigbluebutton-tests/playwright/virtualizedlist/virtualize.js @@ -13,7 +13,7 @@ class VirtualizeList { // Join BigBlueButton meeting async init() { await this.page1.init(true, true, { fullName: 'BroadCaster1' }); - await this.page1.waitForSelector(e.firstUser); + await this.page1.waitForSelector(e.currentUser); for (let i = 1; i <= parseInt(USER_LIST_VLIST_BOTS_LISTENING); i++) { const newPage = await this.browser.newPage(); const viewerPage = new Page(this.browser, newPage); diff --git a/bigbluebutton-tests/playwright/virtualizedlist/virtualizedlist.spec.js b/bigbluebutton-tests/playwright/virtualizedlist/virtualizedlist.spec.js index 9fdba2e40e..084e51ad40 100644 --- a/bigbluebutton-tests/playwright/virtualizedlist/virtualizedlist.spec.js +++ b/bigbluebutton-tests/playwright/virtualizedlist/virtualizedlist.spec.js @@ -2,7 +2,7 @@ const { test } = require('@playwright/test'); const { VirtualizeList } = require('./virtualize'); test.describe.parallel('Virtualize list', () => { - test.fixme('Virtualized Users List', async ({ browser, page }) => { + test('Virtualized Users List', async ({ browser, page }) => { test.setTimeout(0); const virtualizeList = new VirtualizeList(browser, page); await virtualizeList.init(); diff --git a/bigbluebutton-tests/playwright/whiteboard/draw.js b/bigbluebutton-tests/playwright/whiteboard/draw.js index 2167f8f45e..0496383f83 100644 --- a/bigbluebutton-tests/playwright/whiteboard/draw.js +++ b/bigbluebutton-tests/playwright/whiteboard/draw.js @@ -15,8 +15,7 @@ class Draw extends Page { const shapes1 = await this.getOuterHtmlDrawn(); - const wb = await this.page.$(e.whiteboard); - const wbBox = await wb.boundingBox(); + const wbBox = await this.getElementBoundingBox(e.whiteboard); await this.page.mouse.move(wbBox.x + 0.3 * wbBox.width, wbBox.y + 0.3 * wbBox.height); await this.page.mouse.down(); await this.page.mouse.move(wbBox.x + 0.7 * wbBox.width, wbBox.y + 0.7 * wbBox.height); diff --git a/bigbluebutton-tests/playwright/whiteboard/drawEllipse.js b/bigbluebutton-tests/playwright/whiteboard/drawEllipse.js index 3c4e5969d4..75d6e4323d 100644 --- a/bigbluebutton-tests/playwright/whiteboard/drawEllipse.js +++ b/bigbluebutton-tests/playwright/whiteboard/drawEllipse.js @@ -1,5 +1,4 @@ const { expect } = require('@playwright/test'); -const Page = require('../core/page'); const e = require('../core/elements'); const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants'); const { MultiUsers } = require('../user/multiusers'); @@ -14,8 +13,7 @@ class DrawEllipse extends MultiUsers { await this.modPage.waitAndClick(e.wbShapesButton); await this.modPage.waitAndClick(e.wbEllipseShape); - const wb = await this.modPage.page.$(e.whiteboard); - const wbBox = await wb.boundingBox(); + const wbBox = await this.modPage.getElementBoundingBox(e.whiteboard); await this.modPage.page.mouse.move(wbBox.x + 0.3 * wbBox.width, wbBox.y + 0.3 * wbBox.height); await this.modPage.page.mouse.down(); await this.modPage.page.mouse.move(wbBox.x + 0.7 * wbBox.width, wbBox.y + 0.7 * wbBox.height); diff --git a/bigbluebutton-tests/playwright/whiteboard/drawLine.js b/bigbluebutton-tests/playwright/whiteboard/drawLine.js index d403b0f414..0bf9f3193f 100644 --- a/bigbluebutton-tests/playwright/whiteboard/drawLine.js +++ b/bigbluebutton-tests/playwright/whiteboard/drawLine.js @@ -1,5 +1,4 @@ const { expect } = require('@playwright/test'); -const Page = require('../core/page'); const e = require('../core/elements'); const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants'); const { MultiUsers } = require('../user/multiusers'); @@ -14,8 +13,7 @@ class DrawLine extends MultiUsers { await this.modPage.waitAndClick(e.wbShapesButton); await this.modPage.waitAndClick(e.wbLineShape); - const wb = await this.modPage.page.$(e.whiteboard); - const wbBox = await wb.boundingBox(); + const wbBox = await this.modPage.getElementBoundingBox(e.whiteboard); await this.modPage.page.mouse.move(wbBox.x + 0.3 * wbBox.width, wbBox.y + 0.3 * wbBox.height); await this.modPage.page.mouse.down(); await this.modPage.page.mouse.move(wbBox.x + 0.7 * wbBox.width, wbBox.y + 0.7 * wbBox.height); diff --git a/bigbluebutton-tests/playwright/whiteboard/drawPencil.js b/bigbluebutton-tests/playwright/whiteboard/drawPencil.js index 704c427100..c4c7d1537b 100644 --- a/bigbluebutton-tests/playwright/whiteboard/drawPencil.js +++ b/bigbluebutton-tests/playwright/whiteboard/drawPencil.js @@ -1,5 +1,4 @@ const { expect } = require('@playwright/test'); -const Page = require('../core/page'); const e = require('../core/elements'); const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants'); const { MultiUsers } = require('../user/multiusers'); @@ -13,8 +12,7 @@ class DrawPencil extends MultiUsers { await this.modPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME); await this.modPage.waitAndClick(e.wbPencilShape); - const wb = await this.modPage.page.$(e.whiteboard); - const wbBox = await wb.boundingBox(); + const wbBox = await this.modPage.getElementBoundingBox(e.whiteboard); const moveOptions = { steps: 50 }; // to slow down await this.modPage.page.mouse.move(wbBox.x + 0.2 * wbBox.width, wbBox.y + 0.2 * wbBox.height); await this.modPage.page.mouse.down(); diff --git a/bigbluebutton-tests/playwright/whiteboard/drawRectangle.js b/bigbluebutton-tests/playwright/whiteboard/drawRectangle.js index b5772ced44..9dccc89c6e 100644 --- a/bigbluebutton-tests/playwright/whiteboard/drawRectangle.js +++ b/bigbluebutton-tests/playwright/whiteboard/drawRectangle.js @@ -1,5 +1,4 @@ const { expect } = require('@playwright/test'); -const Page = require('../core/page'); const e = require('../core/elements'); const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants'); const { MultiUsers } = require('../user/multiusers'); @@ -14,8 +13,7 @@ class DrawRectangle extends MultiUsers { await this.modPage.waitAndClick(e.wbShapesButton); await this.modPage.waitAndClick(e.wbRectangleShape); - const wb = await this.modPage.page.$(e.whiteboard); - const wbBox = await wb.boundingBox(); + const wbBox = await this.modPage.getElementBoundingBox(e.whiteboard); await this.modPage.page.mouse.move(wbBox.x + 0.3 * wbBox.width, wbBox.y + 0.3 * wbBox.height); await this.modPage.page.mouse.down(); await this.modPage.page.mouse.move(wbBox.x + 0.7 * wbBox.width, wbBox.y + 0.7 * wbBox.height); diff --git a/bigbluebutton-tests/playwright/whiteboard/drawStickyNote.js b/bigbluebutton-tests/playwright/whiteboard/drawStickyNote.js index c4ecac8b4a..2ce70e4034 100644 --- a/bigbluebutton-tests/playwright/whiteboard/drawStickyNote.js +++ b/bigbluebutton-tests/playwright/whiteboard/drawStickyNote.js @@ -1,5 +1,4 @@ const { expect } = require('@playwright/test'); -const Page = require('../core/page'); const e = require('../core/elements'); const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants'); const { MultiUsers } = require('../user/multiusers'); @@ -13,8 +12,7 @@ class DrawStickyNote extends MultiUsers { await this.modPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME); await this.modPage.waitAndClick(e.wbStickyNoteShape); - const wb = await this.modPage.page.$(e.whiteboard); - const wbBox = await wb.boundingBox(); + const wbBox = await this.modPage.getElementBoundingBox(e.whiteboard); await this.modPage.page.mouse.click(wbBox.x + 0.3 * wbBox.width, wbBox.y + 0.3 * wbBox.height); await this.modPage.press('A'); @@ -23,8 +21,8 @@ class DrawStickyNote extends MultiUsers { await this.modPage.press('B'); await this.modPage.page.mouse.click(wbBox.x + 0.6 * wbBox.width, wbBox.y + 0.6 * wbBox.height); - await this.modPage.hasText(e.wbTypedText, 'AB'); - await this.modPage2.hasText(e.wbTypedText, 'AB'); + await this.modPage.hasText(e.wbTypedStickyNote, 'AB'); + await this.modPage2.hasText(e.wbTypedStickyNote, 'AB'); const clipObj = { x: wbBox.x, diff --git a/bigbluebutton-tests/playwright/whiteboard/drawText.js b/bigbluebutton-tests/playwright/whiteboard/drawText.js index 9016954ca5..5f842f9ad6 100644 --- a/bigbluebutton-tests/playwright/whiteboard/drawText.js +++ b/bigbluebutton-tests/playwright/whiteboard/drawText.js @@ -1,5 +1,4 @@ const { expect } = require('@playwright/test'); -const Page = require('../core/page'); const e = require('../core/elements'); const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants'); const { MultiUsers } = require('../user/multiusers'); @@ -13,8 +12,7 @@ class DrawText extends MultiUsers { await this.modPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME); await this.modPage.waitAndClick(e.wbTextShape); - const wb = await this.modPage.page.$(e.whiteboard); - const wbBox = await wb.boundingBox(); + const wbBox = await this.modPage.getElementBoundingBox(e.whiteboard); await this.modPage.page.mouse.click(wbBox.x + 0.3 * wbBox.width, wbBox.y + 0.3 * wbBox.height); await this.modPage.press('A'); diff --git a/bigbluebutton-tests/playwright/whiteboard/drawTriangle.js b/bigbluebutton-tests/playwright/whiteboard/drawTriangle.js index cff4d4ffcd..f0135230e6 100644 --- a/bigbluebutton-tests/playwright/whiteboard/drawTriangle.js +++ b/bigbluebutton-tests/playwright/whiteboard/drawTriangle.js @@ -1,5 +1,4 @@ const { expect } = require('@playwright/test'); -const Page = require('../core/page'); const e = require('../core/elements'); const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants'); const { MultiUsers } = require('../user/multiusers'); @@ -14,8 +13,7 @@ class DrawTriangle extends MultiUsers { await this.modPage.waitAndClick(e.wbShapesButton); await this.modPage.waitAndClick(e.wbTriangleShape); - const wb = await this.modPage.page.$(e.whiteboard); - const wbBox = await wb.boundingBox(); + const wbBox = await this.modPage.getElementBoundingBox(e.whiteboard); await this.modPage.page.mouse.move(wbBox.x + 0.3 * wbBox.width, wbBox.y + 0.3 * wbBox.height); await this.modPage.page.mouse.down(); await this.modPage.page.mouse.move(wbBox.x + 0.7 * wbBox.width, wbBox.y + 0.7 * wbBox.height); diff --git a/bigbluebutton-tests/playwright/whiteboard/whiteboard.spec.js b/bigbluebutton-tests/playwright/whiteboard/whiteboard.spec.js index 1cfe84a4f3..785dc4985e 100644 --- a/bigbluebutton-tests/playwright/whiteboard/whiteboard.spec.js +++ b/bigbluebutton-tests/playwright/whiteboard/whiteboard.spec.js @@ -8,7 +8,6 @@ const { DrawPencil } = require('./drawPencil'); const { DrawText } = require('./drawText'); const { DrawStickyNote } = require('./drawStickyNote'); const { MultiUsers } = require('../user/multiusers'); -const { CUSTOM_MEETING_ID } = require('../core/constants'); const { encodeCustomParams } = require('../customparameters/util'); test.describe.parallel('Whiteboard @ci', () => { @@ -61,21 +60,21 @@ test.describe.parallel('Drawing - visual regression', () => { test('Draw with pencil', async ({ browser, context, page }) => { const drawPencil = new DrawPencil(browser, context); - await drawPencil.initModPage(page, true, { customMeetingId : 'draw_pencil_meeting', customParameter: encodeCustomParams(`userdata-bbb_custom_style=.presentationUploaderToast{display: none;}.currentPresentationToast{display:none;}`) }); + await drawPencil.initModPage(page, true, { customMeetingId: 'draw_pencil_meeting', customParameter: encodeCustomParams(`userdata-bbb_custom_style=.presentationUploaderToast{display: none;}.currentPresentationToast{display:none;}`) }); await drawPencil.initModPage2(true, context, { customParameter: encodeCustomParams(`userdata-bbb_custom_style=.presentationUploaderToast{display: none;}.currentPresentationToast{display:none;}`) }); await drawPencil.test(); }); test('Type text', async ({ browser, context, page }) => { const drawText = new DrawText(browser, context); - await drawText.initModPage(page, true, { customMeetingId : 'draw_text_meeting', customParameter: encodeCustomParams(`userdata-bbb_custom_style=.presentationUploaderToast{display: none;}.currentPresentationToast{display:none;}`) }); + await drawText.initModPage(page, true, { customMeetingId: 'draw_text_meeting', customParameter: encodeCustomParams(`userdata-bbb_custom_style=.presentationUploaderToast{display: none;}.currentPresentationToast{display:none;}`) }); await drawText.initModPage2(true, context, { customParameter: encodeCustomParams(`userdata-bbb_custom_style=.presentationUploaderToast{display: none;}.currentPresentationToast{display:none;}`) }); await drawText.test(); }); test('Create sticky note', async ({ browser, context, page }) => { const drawStickyNote = new DrawStickyNote(browser, context); - await drawStickyNote.initModPage(page, true, { customMeetingId : 'draw_sticky_meeting', customParameter: encodeCustomParams(`userdata-bbb_custom_style=.presentationUploaderToast{display: none;}.currentPresentationToast{display:none;}`) }); + await drawStickyNote.initModPage(page, true, { customMeetingId: 'draw_sticky_meeting', customParameter: encodeCustomParams(`userdata-bbb_custom_style=.presentationUploaderToast{display: none;}.currentPresentationToast{display:none;}`) }); await drawStickyNote.initModPage2(true, context, { customParameter: encodeCustomParams(`userdata-bbb_custom_style=.presentationUploaderToast{display: none;}.currentPresentationToast{display:none;}`) }); await drawStickyNote.test(); });