From 29b12b908747f783bdca32f3ba45e2081732b5e2 Mon Sep 17 00:00:00 2001 From: Anton Barboza Date: Wed, 12 Jun 2024 16:06:19 -0300 Subject: [PATCH] test: fix and enable whiteboard parameter tests on CI --- .../playwright/core/elements.js | 2 +- .../playwright/parameters/constants.js | 4 ++-- .../playwright/parameters/customparameters.js | 24 +++++++------------ .../playwright/parameters/parameters.spec.js | 7 +++--- 4 files changed, 15 insertions(+), 22 deletions(-) diff --git a/bigbluebutton-tests/playwright/core/elements.js b/bigbluebutton-tests/playwright/core/elements.js index 11348c5fa8..f83ef59ea0 100644 --- a/bigbluebutton-tests/playwright/core/elements.js +++ b/bigbluebutton-tests/playwright/core/elements.js @@ -451,7 +451,7 @@ exports.webcamMirroredVideoPreview = 'video[data-test="mirroredVideoPreview"]'; // Whiteboard exports.whiteboard = 'div[data-testid="canvas"]'; exports.wbLayer = 'div[data-testid="layer"]'; -exports.wbToolbar = 'div[class="tlui-toolbar__tools"]'; +exports.wbToolbar = 'div[class^="tlui-toolbar__tools tlui-toolbar__tools__mobile"]'; exports.wbShapesButton = 'button[data-testid="tools.more"]'; exports.wbRectangleShape = 'button[data-testid="tools.rectangle"]'; exports.wbEllipseShape = 'button[data-testid="tools.more.ellipse"]'; diff --git a/bigbluebutton-tests/playwright/parameters/constants.js b/bigbluebutton-tests/playwright/parameters/constants.js index 1004cead70..7a599f2c27 100644 --- a/bigbluebutton-tests/playwright/parameters/constants.js +++ b/bigbluebutton-tests/playwright/parameters/constants.js @@ -35,8 +35,8 @@ exports.logo = 'logo=https://bigbluebutton.org/wp-content/uploads/2021/01/BigBlu exports.enableVideo = 'userdata-bbb_enable_video=false'; exports.autoShareWebcam = 'userdata-bbb_auto_share_webcam=true'; exports.multiUserPenOnly = 'userdata-bbb_multi_user_pen_only=true'; -exports.presenterTools = 'userdata-bbb_presenter_tools=["pencil","hand"]'; -exports.multiUserTools = 'userdata-bbb_multi_user_tools=["pencil","hand"]'; +exports.presenterTools = 'userdata-bbb_presenter_tools=["select","draw", "arrow"]'; +exports.multiUserTools = 'userdata-bbb_multi_user_tools=["arrow","text"]'; const cssCode = `${e.presentationTitle}{display: none;}`; exports.customStyle = `userdata-bbb_custom_style=${cssCode}`; exports.customStyleUrl = 'userdata-bbb_custom_style_url=https://develop.bigbluebutton.org/css-test-file.css'; diff --git a/bigbluebutton-tests/playwright/parameters/customparameters.js b/bigbluebutton-tests/playwright/parameters/customparameters.js index 7e641eac03..dae363a286 100644 --- a/bigbluebutton-tests/playwright/parameters/customparameters.js +++ b/bigbluebutton-tests/playwright/parameters/customparameters.js @@ -180,29 +180,23 @@ class CustomParameters extends MultiUsers { async multiUserPenOnly() { await this.modPage.waitAndClick(e.multiUsersWhiteboardOn); - await this.userPage.waitAndClick(e.wbToolbar); - const resp = await this.userPage.page.evaluate((toolsElement) => { - return document.querySelectorAll(toolsElement)[0].parentElement.childElementCount === 1; - }, e.wbToolbar); - expect(resp).toBeTruthy(); + await this.userPage.hasElement(e.wbToolbar); + const toolsCount = await this.userPage.getSelectorCount(`${e.wbToolbar} button:visible`); + await expect(toolsCount, 'should display only 1 tool (pen)').toBe(1); } async presenterTools() { await this.modPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME); - await this.modPage.waitAndClick(e.wbToolbar); - const resp = await this.modPage.page.evaluate(([toolsElement, toolbarListSelector]) => { - return document.querySelectorAll(toolsElement)[0].parentElement.querySelector(toolbarListSelector).childElementCount === 2; - }, [e.wbToolbar, e.toolbarToolsList]); - expect(resp).toBeTruthy(); + await this.modPage.hasElement(e.wbToolbar); + const toolsCount = await this.modPage.getSelectorCount(`${e.wbToolbar} button:visible`); + await expect(toolsCount, 'should display only the 3 elements passed in the parameter (select, draw and arrow)').toBe(3); } async multiUserTools() { await this.modPage.waitAndClick(e.multiUsersWhiteboardOn); - await this.userPage.waitAndClick(e.wbToolbar); - const resp = await this.userPage.page.evaluate(([toolsElement, toolbarListSelector]) => { - return document.querySelectorAll(toolsElement)[0].parentElement.querySelector(toolbarListSelector).childElementCount === 2; - }, [e.wbToolbar, e.toolbarToolsList]); - expect(resp).toBeTruthy(); + await this.userPage.hasElement(e.wbToolbar); + const toolsCount = await this.userPage.getSelectorCount(`${e.wbToolbar} button:visible`); + await expect(toolsCount, 'should display only the 2 elements passed in the parameter (arrow and text)').toBe(2); } async autoShareWebcam() { diff --git a/bigbluebutton-tests/playwright/parameters/parameters.spec.js b/bigbluebutton-tests/playwright/parameters/parameters.spec.js index e4f2b7aac1..f8d74ef514 100644 --- a/bigbluebutton-tests/playwright/parameters/parameters.spec.js +++ b/bigbluebutton-tests/playwright/parameters/parameters.spec.js @@ -512,12 +512,11 @@ test.describe.parallel('Custom Parameters', () => { }); }); - test.describe.parallel('Whiteboard', () => { - test.skip(); + test.describe.parallel('Whiteboard @ci', () => { test('Multi Users Pen Only', async ({ browser, context, page }) => { const customParam = new CustomParameters(browser, context); - await customParam.initModPage(page, true, { joinParameter: c.multiUserPenOnly }); - await customParam.initUserPage(true, context, { useModMeetingId: true, createParameter: c.multiUserPenOnly }); + await customParam.initModPage(page, true); + await customParam.initUserPage(true, context, { useModMeetingId: true, joinParameter: c.multiUserPenOnly }); await customParam.multiUserPenOnly(); });