From ac27e720f085e7576fd3aeb752f6040aa4e07320 Mon Sep 17 00:00:00 2001 From: Gabriel Porfirio Date: Mon, 7 Nov 2022 13:18:52 -0300 Subject: [PATCH 1/5] shared notes remaining tests --- .../playwright/core/elements.js | 4 + .../playwright/sharednotes/sharednotes.js | 134 ++++++++++++------ .../sharednotes/sharednotes.spec.js | 43 ++++-- .../playwright/sharednotes/util.js | 11 ++ 4 files changed, 138 insertions(+), 54 deletions(-) diff --git a/bigbluebutton-tests/playwright/core/elements.js b/bigbluebutton-tests/playwright/core/elements.js index a0a682966a..a4410072e1 100644 --- a/bigbluebutton-tests/playwright/core/elements.js +++ b/bigbluebutton-tests/playwright/core/elements.js @@ -138,6 +138,10 @@ exports.etherpadFrame = 'iframe[title="pad"]'; exports.etherpadOuter = 'iframe[title="Ether"]'; exports.etherpadInner = 'iframe[title="pad"]'; exports.etherpadEditable = 'body[id="innerdocbody"]'; +exports.sendNotesToWhiteboard = 'button[data-test="sendNotesToWhiteboard"]'; +exports.presentationUploadProgressToast = 'div[data-test="presentationUploadProgressToast"]'; +exports.sharedNotesViewingMode = 'iframe[data-test="sharedNotesViewingMode"]'; +exports.currentSlideText = 'span[id="currentSlideText"]'; // Notifications exports.smallToastMsg = 'div[data-test="toastSmallMsg"]'; diff --git a/bigbluebutton-tests/playwright/sharednotes/sharednotes.js b/bigbluebutton-tests/playwright/sharednotes/sharednotes.js index 7df2cdb76a..24a398c3dd 100644 --- a/bigbluebutton-tests/playwright/sharednotes/sharednotes.js +++ b/bigbluebutton-tests/playwright/sharednotes/sharednotes.js @@ -1,45 +1,47 @@ 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 } = require('./util'); +const { startSharedNotes, getNotesLocator, getShowMoreButtonLocator, getExportButtonLocator, getExportPlainTextLocator, getMoveToWhiteboardLocator, getSharedNotesUserWithoutPermission } = require('./util'); const { expect } = require('@playwright/test'); -const { ELEMENT_WAIT_TIME } = require('../core/constants'); +const { ELEMENT_WAIT_TIME, ELEMENT_WAIT_LONGER_TIME, ELEMENT_WAIT_EXTRA_LONG_TIME } = require('../core/constants'); const { sleep } = require('../core/helpers'); -class SharedNotes extends Page { - constructor(browser, page) { - super(browser, page); +class SharedNotes extends MultiUsers { + constructor(browser, context) { + super(browser, context); } async openSharedNotes() { const { sharedNotesEnabled } = getSettings(); test.fail(!sharedNotesEnabled, 'Shared notes is disabled'); - await startSharedNotes(this); + await startSharedNotes(this.modPage); + await startSharedNotes(this.userPage); } async editMessage(notesLocator) { - await this.down('Shift'); + await this.modPage.down('Shift'); let i = 7; while(i > 0) { - await this.press('ArrowLeft'); + await this.modPage.press('ArrowLeft'); i--; } - await this.up('Shift'); - await this.press('Backspace'); + await this.modPage.up('Shift'); + await this.modPage.press('Backspace'); i = 5; while(i > 0) { - await this.press('ArrowLeft'); + await this.modPage.press('ArrowLeft'); i--; } - await this.press('!'); + await this.modPage.press('!'); } async typeInSharedNotes() { const { sharedNotesEnabled } = getSettings(); test.fail(!sharedNotesEnabled, 'Shared notes is disabled'); - await startSharedNotes(this); - const notesLocator = getNotesLocator(this); + await startSharedNotes(this.modPage); + const notesLocator = getNotesLocator(this.modPage); await notesLocator.type(e.message); this.editMessage(notesLocator); const editedMessage = '!Hello'; @@ -49,42 +51,42 @@ class SharedNotes extends Page { async formatMessage(notesLocator) { // U for '!' - await this.down('Shift'); - await this.press('ArrowLeft'); - await this.up('Shift'); - await this.press('Control+U'); - await this.press('ArrowLeft'); + await this.modPage.down('Shift'); + await this.modPage.press('ArrowLeft'); + await this.modPage.up('Shift'); + await this.modPage.press('Control+U'); + await this.modPage.press('ArrowLeft'); // B for 'World' - await this.down('Shift'); + await this.modPage.down('Shift'); let i = 5; while(i > 0) { - await this.press('ArrowLeft'); + await this.modPage.press('ArrowLeft'); i--; } - await this.up('Shift'); - await this.press('Control+B'); - await this.press('ArrowLeft'); + await this.modPage.up('Shift'); + await this.modPage.press('Control+B'); + await this.modPage.press('ArrowLeft'); - await this.press('ArrowLeft'); + await this.modPage.press('ArrowLeft'); // I for 'Hello' - await this.down('Shift'); + await this.modPage.down('Shift'); i = 5; while(i > 0) { - await this.press('ArrowLeft'); + await this.modPage.press('ArrowLeft'); i--; } - await this.up('Shift'); - await this.press('Control+I'); - await this.press('ArrowLeft'); + await this.modPage.up('Shift'); + await this.modPage.press('Control+I'); + await this.modPage.press('ArrowLeft'); } async formatTextInSharedNotes() { const { sharedNotesEnabled } = getSettings(); test.fail(!sharedNotesEnabled, 'Shared notes is disabled'); - await startSharedNotes(this); - const notesLocator = getNotesLocator(this); + await startSharedNotes(this.modPage); + const notesLocator = getNotesLocator(this.modPage); await notesLocator.type(e.message); this.formatMessage(notesLocator); const html = await notesLocator.innerHTML(); @@ -99,24 +101,76 @@ class SharedNotes extends Page { await expect(html.includes(bText)).toBeTruthy(); } - async exportSharedNotes(testInfo) { + async exportSharedNotes(page) { const { sharedNotesEnabled } = getSettings(); test.fail(!sharedNotesEnabled, 'Shared notes is disabled'); - await startSharedNotes(this); - const notesLocator = getNotesLocator(this); + await startSharedNotes(this.modPage); + const notesLocator = getNotesLocator(this.modPage); await notesLocator.type(e.message); - const showMoreButtonLocator = getShowMoreButtonLocator(this); + const showMoreButtonLocator = getShowMoreButtonLocator(this.modPage); await showMoreButtonLocator.click(); - const exportButtonLocator = getExportButtonLocator(this); + const exportButtonLocator = getExportButtonLocator(this.modPage); await exportButtonLocator.click(); - const exportPlainTextLocator = getExportPlainTextLocator(this); - this.page.waitForEvent('download'); + const exportPlainTextLocator = getExportPlainTextLocator(this.modPage); + page.waitForEvent('download'); await exportPlainTextLocator.click(); await sleep(500); } + + async moveNotesToWhiteboard() { + const { sharedNotesEnabled } = getSettings(); + test.fail(!sharedNotesEnabled, 'Shared notes is disabled'); + await startSharedNotes(this.modPage); + const notesLocator = getNotesLocator(this.modPage); + await notesLocator.type('test'); + await sleep(1000); + + await this.modPage.waitAndClick(e.sendNotesToWhiteboard); + + await this.modPage.hasText(e.currentSlideText, /test/, 20000); + await this.userPage.hasText(e.currentSlideText, /test/); + } + + async editSharedNotesWithMoreThanOneUSer() { + const { sharedNotesEnabled } = getSettings(); + test.fail(!sharedNotesEnabled, 'Shared notes is disabled'); + await startSharedNotes(this.modPage); + const notesLocator = getNotesLocator(this.modPage); + await notesLocator.type(e.message); + + await startSharedNotes(this.userPage); + const notesLocatorUser = getNotesLocator(this.userPage); + await notesLocatorUser.press('Delete'); + 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 }); + } + + async seeNotesWithoutEditPermission() { + const { sharedNotesEnabled } = getSettings(); + test.fail(!sharedNotesEnabled, 'Shared notes is disabled'); + + await startSharedNotes(this.modPage); + const notesLocator = getNotesLocator(this.modPage); + notesLocator.type('Hello'); + + await startSharedNotes(this.userPage); + + await this.modPage.waitAndClick(e.manageUsers); + await this.modPage.waitAndClick(e.lockViewersButton); + 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); + + } } -exports.SharedNotes = SharedNotes; +exports.SharedNotes = SharedNotes; \ No newline at end of file diff --git a/bigbluebutton-tests/playwright/sharednotes/sharednotes.spec.js b/bigbluebutton-tests/playwright/sharednotes/sharednotes.spec.js index 5fb7eff51f..b0007ff31c 100644 --- a/bigbluebutton-tests/playwright/sharednotes/sharednotes.spec.js +++ b/bigbluebutton-tests/playwright/sharednotes/sharednotes.spec.js @@ -1,28 +1,43 @@ const { test } = require('@playwright/test'); -const { SharedNotes } = require('./sharednotes'); +const { SharedNotes, SharedNotesMultiUsers } = require('./sharednotes'); test.describe.parallel('Shared Notes', () => { - test('Open Shared notes @ci', async ({ browser, page }) => { - const sharedNotes = new SharedNotes(browser, page); - await sharedNotes.init(true, true); + test('Open Shared notes @ci', async ({ browser, page, context }) => { + const sharedNotes = new SharedNotes(browser, context); + await sharedNotes.initPages(page); await sharedNotes.openSharedNotes(); }); - test('Type in shared notes', async ({ browser, page }) => { + test('Type in shared notes', async ({ browser, page, context }) => { // https://docs.bigbluebutton.org/2.5/release-tests.html#using-shared-notes-panel - const sharedNotes = new SharedNotes(browser, page); - await sharedNotes.init(true, true); + const sharedNotes = new SharedNotes(browser, context); + await sharedNotes.initPages(page); await sharedNotes.typeInSharedNotes(); }); - test('Formate text in shared notes', async ({ browser, page }) => { + test('Formate text in shared notes', async ({ browser, page, context }) => { // https://docs.bigbluebutton.org/2.5/release-tests.html#using-shared-notes-formatting-tools - const sharedNotes = new SharedNotes(browser, page); - await sharedNotes.init(true, true); + const sharedNotes = new SharedNotes(browser, context); + await sharedNotes.initPages(page); await sharedNotes.formatTextInSharedNotes(); }); - test('Export shared notes', async ({ browser, page }, testInfo) => { + test('Export shared notes', async ({ browser, page, context }, testInfo) => { // https://docs.bigbluebutton.org/2.5/release-tests.html#exporting-shared-notes - const sharedNotes = new SharedNotes(browser, page); - await sharedNotes.init(true, true); - await sharedNotes.exportSharedNotes(testInfo); + const sharedNotes = new SharedNotes(browser, context); + await sharedNotes.initPages(page); + await sharedNotes.exportSharedNotes(page); + }); + test('Move notes to whiteboard', async ({ browser, page, context }) => { + const sharedNotes = new SharedNotes(browser, context); + await sharedNotes.initPages(page); + await sharedNotes.moveNotesToWhiteboard(); + }); + test('Multi users edit', async ({ browser, page, context }) => { + const sharedNotes = new SharedNotes(browser, context); + await sharedNotes.initPages(page); + await sharedNotes.editSharedNotesWithMoreThanOneUSer(); + }); + test('See notes without edit permission', async ({ browser, page, context }) => { + const sharedNotes = new SharedNotes(browser, context); + await sharedNotes.initPages(page); + await sharedNotes.seeNotesWithoutEditPermission(); }); }); diff --git a/bigbluebutton-tests/playwright/sharednotes/util.js b/bigbluebutton-tests/playwright/sharednotes/util.js index d80a2e5a44..219855f67e 100644 --- a/bigbluebutton-tests/playwright/sharednotes/util.js +++ b/bigbluebutton-tests/playwright/sharednotes/util.js @@ -27,8 +27,19 @@ function getExportPlainTextLocator(test) { return test.page.frameLocator(e.etherpadFrame).locator(e.exportPlainButton); } +function getMoveToWhiteboardLocator(test) { + return test.page.locator(e.sendNotesToWhiteboard); +} + +function getSharedNotesUserWithoutPermission(test) { + return test.page.frameLocator(e.sharedNotesViewingMode) + .locator('body'); +} + exports.startSharedNotes = startSharedNotes; exports.getNotesLocator = getNotesLocator; exports.getShowMoreButtonLocator = getShowMoreButtonLocator; exports.getExportButtonLocator = getExportButtonLocator; exports.getExportPlainTextLocator = getExportPlainTextLocator; +exports.getMoveToWhiteboardLocator = getMoveToWhiteboardLocator; +exports.getSharedNotesUserWithoutPermission = getSharedNotesUserWithoutPermission; \ No newline at end of file From bdbd6d0d691d534a07eb0144572545099b0642ea Mon Sep 17 00:00:00 2001 From: Gabriel Porfirio Date: Mon, 7 Nov 2022 13:47:43 -0300 Subject: [PATCH 2/5] data-test flags added --- .../imports/ui/components/notes/converter-button/component.jsx | 1 + .../imports/ui/components/pads/content/component.jsx | 1 + 2 files changed, 2 insertions(+) diff --git a/bigbluebutton-html5/imports/ui/components/notes/converter-button/component.jsx b/bigbluebutton-html5/imports/ui/components/notes/converter-button/component.jsx index 130c66d482..a2dd29d313 100644 --- a/bigbluebutton-html5/imports/ui/components/notes/converter-button/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/notes/converter-button/component.jsx @@ -36,6 +36,7 @@ const ConverterButtonComponent = ({ return Service.convertAndUpload()}} label={intl.formatMessage(intlMessages.convertAndUploadLabel)} icon="upload" + data-test="sendNotesToWhiteboard" /> ) : null)}; diff --git a/bigbluebutton-html5/imports/ui/components/pads/content/component.jsx b/bigbluebutton-html5/imports/ui/components/pads/content/component.jsx index accad76f6c..37e43a5c5a 100644 --- a/bigbluebutton-html5/imports/ui/components/pads/content/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/pads/content/component.jsx @@ -19,6 +19,7 @@ const PadContent = ({ ); From 35e5236683d786977ab943207906033b701fb231 Mon Sep 17 00:00:00 2001 From: Gabriel Porfirio Date: Wed, 16 Nov 2022 15:18:03 -0300 Subject: [PATCH 3/5] few improvements and pin notes test --- .../playwright/core/elements.js | 2 ++ .../playwright/sharednotes/sharednotes.js | 26 ++++++++++++++----- .../sharednotes/sharednotes.spec.js | 9 +++++-- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/bigbluebutton-tests/playwright/core/elements.js b/bigbluebutton-tests/playwright/core/elements.js index f53b79b8e9..5ed9f7eb24 100644 --- a/bigbluebutton-tests/playwright/core/elements.js +++ b/bigbluebutton-tests/playwright/core/elements.js @@ -361,6 +361,8 @@ exports.pencil = 'button[data-test="pencilTool"]'; exports.showMoreSharedNotesButton = 'span[class="show-more-icon-btn"]' exports.exportSharedNotesButton = 'button[aria-label="Import/Export from/to different file formats"]'; exports.exportPlainButton = 'span[id="exportplain"]'; +exports.pinNotes = 'li[data-test="pinNotes"]'; +exports.unpinNotes = 'button[data-test="unpinNotes"]'; // About modal exports.showAboutModalButton = 'li[data-test="aboutModal"]'; diff --git a/bigbluebutton-tests/playwright/sharednotes/sharednotes.js b/bigbluebutton-tests/playwright/sharednotes/sharednotes.js index 272877748c..40ef0eef74 100644 --- a/bigbluebutton-tests/playwright/sharednotes/sharednotes.js +++ b/bigbluebutton-tests/playwright/sharednotes/sharednotes.js @@ -88,7 +88,7 @@ class SharedNotes extends MultiUsers { await startSharedNotes(this.modPage); const notesLocator = getNotesLocator(this.modPage); await notesLocator.type(e.message); - this.formatMessage(notesLocator); + await this.formatMessage(notesLocator); const html = await notesLocator.innerHTML(); const uText = '!'; @@ -98,7 +98,7 @@ class SharedNotes extends MultiUsers { await expect(html.includes(bText)).toBeTruthy(); const iText = 'Hello' - await expect(html.includes(bText)).toBeTruthy(); + await expect(html.includes(iText)).toBeTruthy(); } async exportSharedNotes(page) { @@ -120,7 +120,7 @@ class SharedNotes extends MultiUsers { await sleep(500); } - async moveNotesToWhiteboard() { + async convertNotesToWhiteboard() { const { sharedNotesEnabled } = getSettings(); test.fail(!sharedNotesEnabled, 'Shared notes is disabled'); await startSharedNotes(this.modPage); @@ -158,7 +158,7 @@ class SharedNotes extends MultiUsers { await startSharedNotes(this.modPage); const notesLocator = getNotesLocator(this.modPage); - notesLocator.type('Hello'); + await notesLocator.type('Hello'); await startSharedNotes(this.userPage); @@ -169,8 +169,22 @@ class SharedNotes extends MultiUsers { const notesLocatorUser = getSharedNotesUserWithoutPermission(this.userPage); await expect(notesLocatorUser).toContainText(/Hello/, { timeout : 20000 }); - await this.userPage.wasRemoved(e.etherpadFrame); - + await this.userPage.wasRemoved(e.etherpadFrame); + } + + async pinNotesOntoWhiteboard() { + const { sharedNotesEnabled } = getSettings(); + test.fail(!sharedNotesEnabled, 'Shared notes is disabled'); + + await startSharedNotes(this.modPage); + // /await this.modPage.hasElement(e.sharedNotes); + await this.modPage.waitAndClick(e.notesOptions); + await this.modPage.waitAndClick(e.pinNotes); + await this.modPage.hasElement(e.unpinNotes); + const notesLocator = getNotesLocator(this.modPage); + await notesLocator.type('Hello'); + + await expect(notesLocator).toContainText(/Hello/, { timeout : 20000 }); } } diff --git a/bigbluebutton-tests/playwright/sharednotes/sharednotes.spec.js b/bigbluebutton-tests/playwright/sharednotes/sharednotes.spec.js index b0007ff31c..3a92ebc594 100644 --- a/bigbluebutton-tests/playwright/sharednotes/sharednotes.spec.js +++ b/bigbluebutton-tests/playwright/sharednotes/sharednotes.spec.js @@ -25,10 +25,10 @@ test.describe.parallel('Shared Notes', () => { await sharedNotes.initPages(page); await sharedNotes.exportSharedNotes(page); }); - test('Move notes to whiteboard', async ({ browser, page, context }) => { + test('Convert notes to whiteboard', async ({ browser, page, context }) => { const sharedNotes = new SharedNotes(browser, context); await sharedNotes.initPages(page); - await sharedNotes.moveNotesToWhiteboard(); + await sharedNotes.convertNotesToWhiteboard(); }); test('Multi users edit', async ({ browser, page, context }) => { const sharedNotes = new SharedNotes(browser, context); @@ -40,4 +40,9 @@ test.describe.parallel('Shared Notes', () => { await sharedNotes.initPages(page); await sharedNotes.seeNotesWithoutEditPermission(); }); + test('Pin notes onto whiteboard', async ({ browser, page, context }) => { + const sharedNotes = new SharedNotes(browser, context); + await sharedNotes.initModPage(page); + await sharedNotes.pinNotesOntoWhiteboard(); + }); }); From 60db3182c262992a7bcac31ae09df769a40aa21e Mon Sep 17 00:00:00 2001 From: Gabriel Porfirio Date: Fri, 18 Nov 2022 13:38:46 -0300 Subject: [PATCH 4/5] changes on pin notes test --- .../playwright/sharednotes/sharednotes.js | 4 ++-- .../playwright/sharednotes/sharednotes.spec.js | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/bigbluebutton-tests/playwright/sharednotes/sharednotes.js b/bigbluebutton-tests/playwright/sharednotes/sharednotes.js index 40ef0eef74..6edcaf7893 100644 --- a/bigbluebutton-tests/playwright/sharednotes/sharednotes.js +++ b/bigbluebutton-tests/playwright/sharednotes/sharednotes.js @@ -17,7 +17,6 @@ class SharedNotes extends MultiUsers { const { sharedNotesEnabled } = getSettings(); test.fail(!sharedNotesEnabled, 'Shared notes is disabled'); await startSharedNotes(this.modPage); - await startSharedNotes(this.userPage); } async editMessage(notesLocator) { @@ -177,14 +176,15 @@ class SharedNotes extends MultiUsers { test.fail(!sharedNotesEnabled, 'Shared notes is disabled'); await startSharedNotes(this.modPage); - // /await this.modPage.hasElement(e.sharedNotes); await this.modPage.waitAndClick(e.notesOptions); await this.modPage.waitAndClick(e.pinNotes); await this.modPage.hasElement(e.unpinNotes); const notesLocator = getNotesLocator(this.modPage); await notesLocator.type('Hello'); + const notesLocatorUser = getNotesLocator(this.modPage2); 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 3a92ebc594..8f25d13924 100644 --- a/bigbluebutton-tests/playwright/sharednotes/sharednotes.spec.js +++ b/bigbluebutton-tests/playwright/sharednotes/sharednotes.spec.js @@ -4,25 +4,25 @@ const { SharedNotes, SharedNotesMultiUsers } = require('./sharednotes'); test.describe.parallel('Shared Notes', () => { test('Open Shared notes @ci', async ({ browser, page, context }) => { const sharedNotes = new SharedNotes(browser, context); - await sharedNotes.initPages(page); + await sharedNotes.initModPage(page); await sharedNotes.openSharedNotes(); }); test('Type in shared notes', async ({ browser, page, context }) => { // https://docs.bigbluebutton.org/2.5/release-tests.html#using-shared-notes-panel const sharedNotes = new SharedNotes(browser, context); - await sharedNotes.initPages(page); + await sharedNotes.initModPage(page); await sharedNotes.typeInSharedNotes(); }); test('Formate text in shared notes', async ({ browser, page, context }) => { // https://docs.bigbluebutton.org/2.5/release-tests.html#using-shared-notes-formatting-tools const sharedNotes = new SharedNotes(browser, context); - await sharedNotes.initPages(page); + await sharedNotes.initModPage(page); await sharedNotes.formatTextInSharedNotes(); }); test('Export shared notes', async ({ browser, page, context }, testInfo) => { // https://docs.bigbluebutton.org/2.5/release-tests.html#exporting-shared-notes const sharedNotes = new SharedNotes(browser, context); - await sharedNotes.initPages(page); + await sharedNotes.initModPage(page); await sharedNotes.exportSharedNotes(page); }); test('Convert notes to whiteboard', async ({ browser, page, context }) => { @@ -43,6 +43,7 @@ test.describe.parallel('Shared Notes', () => { test('Pin notes onto whiteboard', async ({ browser, page, context }) => { const sharedNotes = new SharedNotes(browser, context); await sharedNotes.initModPage(page); + await sharedNotes.initModPage2(); await sharedNotes.pinNotesOntoWhiteboard(); }); }); From 0cb364214a93c0981fb30ae38525995f486c5c8b Mon Sep 17 00:00:00 2001 From: Gabriel Porfirio Date: Tue, 22 Nov 2022 10:44:28 -0300 Subject: [PATCH 5/5] added new function for two different browser instances --- bigbluebutton-tests/playwright/core/elements.js | 2 +- .../playwright/sharednotes/sharednotes.js | 3 ++- .../playwright/sharednotes/sharednotes.spec.js | 2 +- bigbluebutton-tests/playwright/user/multiusers.js | 13 +++++++++++++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/bigbluebutton-tests/playwright/core/elements.js b/bigbluebutton-tests/playwright/core/elements.js index 5ed9f7eb24..140fb3b257 100644 --- a/bigbluebutton-tests/playwright/core/elements.js +++ b/bigbluebutton-tests/playwright/core/elements.js @@ -154,7 +154,7 @@ exports.etherpadInner = 'iframe[title="pad"]'; exports.etherpadEditable = 'body[id="innerdocbody"]'; exports.sendNotesToWhiteboard = 'li[data-test="moveNotesToWhiteboard"]'; exports.presentationUploadProgressToast = 'div[data-test="presentationUploadProgressToast"]'; -exports.sharedNotesViewingMode = 'iframe[data-test="sharedNotesViewingMode"]'; +exports.sharedNotesViewingMode = 'iframe[title="shared notes viewing mode"]'; exports.currentSlideText = 'span[id="currentSlideText"]'; exports.notesOptions = 'button[data-test="notesOptionsMenu"]'; diff --git a/bigbluebutton-tests/playwright/sharednotes/sharednotes.js b/bigbluebutton-tests/playwright/sharednotes/sharednotes.js index 6edcaf7893..2c7d0912cf 100644 --- a/bigbluebutton-tests/playwright/sharednotes/sharednotes.js +++ b/bigbluebutton-tests/playwright/sharednotes/sharednotes.js @@ -179,9 +179,10 @@ class SharedNotes extends MultiUsers { await this.modPage.waitAndClick(e.notesOptions); await this.modPage.waitAndClick(e.pinNotes); await this.modPage.hasElement(e.unpinNotes); + const notesLocator = getNotesLocator(this.modPage); await notesLocator.type('Hello'); - const notesLocatorUser = getNotesLocator(this.modPage2); + const notesLocatorUser = getNotesLocator(this.userPage1); 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 8f25d13924..de01e07c1a 100644 --- a/bigbluebutton-tests/playwright/sharednotes/sharednotes.spec.js +++ b/bigbluebutton-tests/playwright/sharednotes/sharednotes.spec.js @@ -43,7 +43,7 @@ test.describe.parallel('Shared Notes', () => { test('Pin notes onto whiteboard', async ({ browser, page, context }) => { const sharedNotes = new SharedNotes(browser, context); await sharedNotes.initModPage(page); - await sharedNotes.initModPage2(); + await sharedNotes.initUserPage1(); await sharedNotes.pinNotesOntoWhiteboard(); }); }); diff --git a/bigbluebutton-tests/playwright/user/multiusers.js b/bigbluebutton-tests/playwright/user/multiusers.js index a681d89b80..a6ac0a04f5 100644 --- a/bigbluebutton-tests/playwright/user/multiusers.js +++ b/bigbluebutton-tests/playwright/user/multiusers.js @@ -1,4 +1,5 @@ const { expect, default: test } = require('@playwright/test'); +const playwright = require("playwright"); const Page = require('../core/page'); const e = require('../core/elements'); const { waitAndClearDefaultPresentationNotification } = require('../notifications/util'); @@ -56,6 +57,18 @@ class MultiUsers { await this.userPage.init(false, shouldCloseAudioModal, options); } + async initUserPage1(shouldCloseAudioModal = true, { fullName = 'Attendee', useModMeetingId = true, ...restOptions } = {}) { + const options = { + ...restOptions, + fullName, + meetingId: (useModMeetingId) ? this.modPage.meetingId : undefined, + }; + + const page = await (await playwright.chromium.launch()).newPage(); + this.userPage1 = new Page(this.browser, page); + await this.userPage1.init(false, shouldCloseAudioModal, options); + } + async initUserPage2(shouldCloseAudioModal = true, context = this.context, { fullName = 'Attendee2', useModMeetingId = true, ...restOptions } = {}) { const options = { ...restOptions,