Merge pull request #15313 from antonbsa/test-fixes-v2.6

test: Fix v2.6 tests
This commit is contained in:
Anton Georgiev 2022-07-11 18:21:33 -04:00 committed by GitHub
commit 40a8034070
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 131 additions and 116 deletions

View File

@ -298,7 +298,7 @@ class InputStreamLiveSelector extends Component {
accessKey={shortcuts.togglemute}
$talking={talking || undefined}
animations={animations}
data-test="toggleMicrophoneButton"
data-test={muted ? 'unmuteMicButton' : 'muteMicButton'}
/>
);
}
@ -316,7 +316,7 @@ class InputStreamLiveSelector extends Component {
aria-label={intl.formatMessage(intlMessages.leaveAudio)}
label={intl.formatMessage(intlMessages.leaveAudio)}
accessKey={shortcuts.leaveaudio}
data-test="leaveAudio"
data-test='leaveListenOnly'
hideLabel
color="primary"
icon={isListenOnly ? 'listen' : 'volume_level_2'}
@ -372,6 +372,7 @@ class InputStreamLiveSelector extends Component {
icon: 'logout',
label: intl.formatMessage(intlMessages.leaveAudio),
key: 'leaveAudioOption',
dataTest: 'leaveAudio',
customStyles: Styled.DangerColor,
dividerTop: true,
onClick: () => handleLeaveAudio(),
@ -396,6 +397,7 @@ class InputStreamLiveSelector extends Component {
? this.renderListenOnlyButton()
: this.renderMuteToggleButton()}
<Styled.AudioDropdown
data-test='audioDropdownMenu'
emoji="device_list_selector"
label={intl.formatMessage(intlMessages.changeAudioDevice)}
hideLabel

View File

@ -480,7 +480,7 @@ class AudioModal extends Component {
if (this.skipAudioOptions()) {
return (
<Styled.Connecting role="alert">
<span data-test={!isEchoTest ? 'connecting' : 'connectingToEchoTest'}>
<span data-test={!isEchoTest ? 'establishingAudioLabel' : 'connectingToEchoTest'}>
{intl.formatMessage(intlMessages.connecting)}
</span>
<Styled.ConnectingAnimation animations={animations} />

View File

@ -293,7 +293,7 @@ class AudioSettings extends React.Component {
} = this.props;
return (
<Styled.FormWrapper>
<Styled.FormWrapper data-test="audioSettingsModal">
<Styled.Form>
<Styled.Row>
<Styled.AudioNote>
@ -313,6 +313,7 @@ class AudioSettings extends React.Component {
disabled={isConnecting}
/>
<Button
data-test="joinEchoTestButton"
size="md"
color="primary"
label={intl.formatMessage(intlMessages.retryLabel)}

View File

@ -69,6 +69,7 @@ const LocalEcho = ({
return (
<Styled.LocalEchoTestButton
data-test={hearing ? 'stopHearingButton' : 'testSpeakerButton'}
hearing={hearing}
label={intl.formatMessage(label)}
icon={icon}

View File

@ -944,7 +944,7 @@ class Presentation extends PureComponent {
<>
<Styled.PresentationContainer
role="region"
data-test="presentationContainer"
ref={(ref) => { this.refPresentationContainer = ref; }}
style={{
top: presentationBounds.top,
@ -961,7 +961,7 @@ class Presentation extends PureComponent {
}}
>
{this.renderPresentationMenu()}
<WhiteboardContainer
<WhiteboardContainer
whiteboardId={currentSlide?.id}
podId={podId}
slidePosition={slidePosition}

View File

@ -354,6 +354,7 @@ class PresentationToolbar extends PureComponent {
{
<Styled.PresentationZoomControls>
<Styled.WBAccessButton
data-test={multiUser ? 'turnMultiUsersWhiteboardOff' : 'turnMultiUsersWhiteboardOn'}
role="button"
aria-label={
multiUser

View File

@ -11,8 +11,9 @@ class Audio extends Page {
const { autoJoinAudioModal, listenOnlyCallTimeout } = this.settings;
if (!autoJoinAudioModal) await this.waitAndClick(e.joinAudio);
await this.waitAndClick(e.listenOnlyButton);
await this.wasRemoved(e.connecting);
await this.waitForSelector(e.leaveAudio, listenOnlyCallTimeout);
await this.wasRemoved(e.establishingAudioLabel);
await this.waitForSelector(e.leaveListenOnly, listenOnlyCallTimeout);
await this.waitAndClick(e.audioDropdownMenu);
await this.hasElement(e.leaveAudio);
}
@ -21,19 +22,20 @@ class Audio extends Page {
autoJoinAudioModal,
skipEchoTest,
skipEchoTestOnJoin,
listenOnlyCallTimeout,
} = this.settings;
if (!autoJoinAudioModal) await this.waitAndClick(e.joinAudio);
await this.waitAndClick(e.microphoneButton);
const shouldSkipEchoTest = skipEchoTest || skipEchoTestOnJoin;
if (!shouldSkipEchoTest) {
await this.waitForSelector(e.connectingToEchoTest);
await this.wasRemoved(e.connectingToEchoTest, ELEMENT_WAIT_LONGER_TIME);
await this.waitAndClick(e.echoYesButton, listenOnlyCallTimeout);
await this.waitForSelector(e.stopHearingButton);
await this.waitAndClick(e.joinEchoTestButton);
await this.waitForSelector(e.establishingAudioLabel);
await this.wasRemoved(e.establishingAudioLabel, ELEMENT_WAIT_LONGER_TIME);
}
await this.hasElement(e.isTalking);
await this.hasElement(e.toggleMicrophoneButton);
await this.hasElement(e.muteMicButton);
await this.waitAndClick(e.audioDropdownMenu);
await this.hasElement(e.leaveAudio);
}
}

View File

@ -23,7 +23,11 @@ class Join extends Create {
const breakoutUserPage = await this.userPage.getLastTargetPage(this.context);
await breakoutUserPage.bringToFront();
if (!shouldJoinAudio) await breakoutUserPage.closeAudioModal();
if (shouldJoinAudio) {
await this.userPage.waitForSelector(e.joinAudio);
} else {
await breakoutUserPage.closeAudioModal();
}
await breakoutUserPage.waitForSelector(e.presentationTitle);
return breakoutUserPage;
}
@ -33,15 +37,12 @@ class Join extends Create {
const { videoPreviewTimeout } = getSettings();
await breakoutPage.shareWebcam(true, videoPreviewTimeout);
await breakoutPage.hasElement(e.presentationPlaceholder);
await breakoutPage.waitForSelector(e.presentationTitle);
}
async joinAndShareScreen() {
const breakoutPage = await this.joinRoom();
await utilScreenShare.startScreenshare(breakoutPage);
await utilScreenShare.getScreenShareBreakoutContainer(breakoutPage);
}
async joinWithAudio() {

View File

@ -24,15 +24,22 @@ exports.userListButton = 'button[accesskey="U"]';
// Audio
exports.joinAudio = 'button[data-test="joinAudio"]';
exports.audioModal = 'div[data-test="audioModal"]';
exports.audioSettingsModal = 'div[data-test="audioSettingsModal"]';
exports.listenOnlyButton = 'button[data-test="listenOnlyBtn"]';
exports.connecting = 'span[data-test="connecting"]';
exports.leaveAudio = 'button[data-test="leaveAudio"]';
exports.testSpeakerButton = 'button[data-test="testSpeakerButton"]';
exports.stopHearingButton = 'button[data-test="stopHearingButton"]';
exports.joinEchoTestButton = 'button[data-test="joinEchoTestButton"]';
exports.establishingAudioLabel = 'span[data-test="establishingAudioLabel"]';
exports.leaveListenOnly = 'button[data-test="leaveListenOnly"]';
exports.leaveAudio = 'li[data-test="leaveAudio"]';
exports.audioDropdownMenu = 'button[data-test="audioDropdownMenu"]';
exports.microphoneButton = 'button[data-test="microphoneBtn"]';
exports.echoYesButton = 'button[data-test="echoYesBtn"]';
exports.connectingToEchoTest = 'span[data-test="connectingToEchoTest"]';
exports.isTalking = 'button[data-test="isTalking"]';
exports.talkingIndicator = 'div[data-test="talkingIndicator"]';
exports.toggleMicrophoneButton = 'button[data-test="toggleMicrophoneButton"]';
exports.unmuteMicButton = 'button[data-test="unmuteMicButton"]';
exports.muteMicButton = 'button[data-test="muteMicButton"]';
// Breakout
exports.createBreakoutRooms = 'li[data-test="createBreakoutRooms"]';
@ -79,8 +86,6 @@ exports.uniqueCharacterMessage = 'A';
exports.audioOptionsButtons = 'span[data-test="audioModalOptions"] > button';
exports.userListContent = 'div[data-test="userListContent"]';
exports.brandingAreaLogo = 'div[data-test="brandingArea"]';
exports.multiUsersWhiteboardOn = 'button[data-test="turnMultiUsersWhiteboardOn"]';
exports.multiUsersWhiteboardOff = 'button[data-test="turnMultiUsersWhiteboardOff"]';
exports.toolbarToolsList = 'div[data-test="toolbarToolsList"]';
exports.notificationBannerBar = 'div[data-test="notificationBannerBar"]';
exports.zoomInBtn = 'button[data-test="zoomInBtn"]';
@ -141,14 +146,13 @@ exports.pollQuestionArea = 'textarea[data-test="pollQuestionArea"]';
exports.userResponseBtn = 'button[data-test="userResponseBtn"]';
exports.pollAnswerOptionInput = 'input[data-test="pollAnswerOption"]';
exports.pollSubmitAnswer = 'button[data-test="submitAnswer"]';
exports.pollResults = 'g[data-test="pollResultAria"]';
exports.closePollingMenu = 'button[data-test="data-test="closePolling""]';
exports.addPollItem = 'button[data-test="addPollItem"]';
exports.deletePollOption = 'button[data-test="deletePollOption"]';
exports.cancelPollBtn = 'button[data-test="cancelPollLabel"]';
exports.pollYesNoAbstentionBtn = 'button[data-test="pollYesNoAbstentionBtn"]';
// Presentation
exports.currentSlideImg = 'img[id="slide-background-shape_image"]';
exports.uploadPresentationFileName = 'uploadTest.png';
exports.presentationPlaceholderLabel = 'There is no currently active presentation';
exports.startScreenSharing = 'button[data-test="startScreenShare"]';
@ -268,10 +272,17 @@ exports.dropdownWebcamButton = 'div[data-test="dropdownWebcamButton"]';
exports.webcamMirroredVideoPreview = 'video[data-test="mirroredVideoPreview"]';
// Whiteboard
exports.whiteboard = 'svg[data-test="whiteboard"]';
exports.toolsButton = 'button[data-test="toolsBtn"]';
exports.rectangle = 'button[data-test="rectangleTool"]';
exports.drawnRectangle = 'svg g[clip-path] > g:nth-child(2) rect[data-test="drawnRectangle"]';
exports.whiteboard = 'div[id="canvas"]';
exports.wbLayer = 'div[data-testid="layer"]';
exports.wbToolbar = 'div[id="TD-PrimaryTools"]';
exports.wbShapesButton = 'button[id="TD-PrimaryTools-Shapes"]';
exports.wbRectangleShape = 'span[id="TD-PrimaryTools-Shapes-rectangle"]';
exports.wbPencilShape = 'span[id="TD-PrimaryTools-Pencil"]';
exports.wbTypedText = 'div[data-shape="text"]';
exports.wbDrawnRectangle = 'div[data-shape="rectangle"]';
exports.wbDrawnLine = 'div[data-shape="draw"]';
exports.multiUsersWhiteboardOn = 'button[data-test="turnMultiUsersWhiteboardOn"]';
exports.multiUsersWhiteboardOff = 'button[data-test="turnMultiUsersWhiteboardOff"]';
exports.whiteboardViewBox = 'svg g[clip-path="url(#viewBox)"]';
exports.changeWhiteboardAccess = 'li[data-test="changeWhiteboardAccess"]';
exports.pencil = 'button[data-test="pencilTool"]';

View File

@ -61,13 +61,15 @@ class Page {
async joinMicrophone() {
await this.waitForSelector(e.audioModal);
await this.waitAndClick(e.microphoneButton);
await this.waitForSelector(e.connectingToEchoTest);
const { listenOnlyCallTimeout } = getSettings();
await this.waitAndClick(e.echoYesButton, listenOnlyCallTimeout);
await this.waitForSelector(e.stopHearingButton);
await this.waitAndClick(e.joinEchoTestButton);
await this.waitForSelector(e.establishingAudioLabel);
await this.wasRemoved(e.establishingAudioLabel, ELEMENT_WAIT_LONGER_TIME);
await this.waitForSelector(e.isTalking);
}
async leaveAudio() {
await this.waitAndClick(e.audioDropdownMenu);
await this.waitAndClick(e.leaveAudio);
await this.waitForSelector(e.joinAudio);
}

View File

@ -76,14 +76,13 @@ class CustomParameters extends MultiUsers {
}
async listenOnlyMode() {
await this.modPage.waitForSelector(e.audioModal);
await this.modPage.waitForSelector(e.connectingToEchoTest);
await this.modPage.wasRemoved(e.connecting);
await this.modPage.waitForSelector(e.echoYesButton);
await this.modPage.waitAndClick(e.closeModal);
await this.modPage.waitForSelector(e.audioSettingsModal);
await this.modPage.waitAndClick(e.joinEchoTestButton);
await this.modPage.waitForSelector(e.establishingAudioLabel);
await this.modPage.waitForSelector(e.isTalking);
await this.modPage.leaveAudio();
await this.modPage.waitAndClick(e.joinAudio);
const audioOptionsCount = await this.modPage.getSelectorCount(e.audioOptionsButtons);
await expect(audioOptionsCount).toBe(1);
await this.modPage.waitForSelector(e.audioSettingsModal);
}
async forceListenOnly() {
@ -94,20 +93,21 @@ class CustomParameters extends MultiUsers {
async skipCheck() {
await this.modPage.waitAndClick(e.microphoneButton);
await this.modPage.waitForSelector(e.connecting);
await this.modPage.wasRemoved(e.connecting, ELEMENT_WAIT_LONGER_TIME);
await this.modPage.wasRemoved(e.echoYesButton);
await this.modPage.waitForSelector(e.establishingAudioLabel);
await this.modPage.wasRemoved(e.establishingAudioLabel, ELEMENT_WAIT_LONGER_TIME);
await this.modPage.hasElement(e.smallToastMsg);
await this.modPage.hasElement(e.isTalking);
}
async skipCheckOnFirstJoin() {
await this.modPage.waitAndClick(e.microphoneButton);
await this.modPage.hasElement(e.connecting);
await this.modPage.hasElement(e.establishingAudioLabel);
await this.modPage.hasElement(e.smallToastMsg);
await this.modPage.hasElement(e.isTalking);
await this.modPage.leaveAudio();
await this.modPage.waitAndClick(e.joinAudio);
await this.modPage.waitAndClick(e.microphoneButton);
await this.modPage.hasElement(e.connectingToEchoTest);
await this.modPage.hasElement(e.audioSettingsModal);
}
async bannerText() {
@ -184,28 +184,28 @@ class CustomParameters extends MultiUsers {
async multiUserPenOnly() {
await this.modPage.waitAndClick(e.multiUsersWhiteboardOn);
await this.userPage.waitAndClick(e.toolsButton);
await this.userPage.waitAndClick(e.wbToolbar);
const resp = await this.userPage.page.evaluate((toolsElement) => {
return document.querySelectorAll(toolsElement)[0].parentElement.childElementCount === 1;
}, e.toolsButton);
}, e.wbToolbar);
await expect(resp).toBeTruthy();
}
async presenterTools() {
await this.modPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME);
await this.modPage.waitAndClick(e.toolsButton);
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.toolsButton, e.toolbarToolsList]);
}, [e.wbToolbar, e.toolbarToolsList]);
await expect(resp).toBeTruthy();
}
async multiUserTools() {
await this.modPage.waitAndClick(e.multiUsersWhiteboardOn);
await this.userPage.waitAndClick(e.toolsButton);
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.toolsButton, e.toolbarToolsList]);
}, [e.wbToolbar, e.toolbarToolsList]);
await expect(resp).toBeTruthy();
}

View File

@ -74,7 +74,7 @@ test.describe.parallel('CustomParameters', () => {
await customParam.autoJoin();
});
test('Listen Only Mode', async ({ browser, context, page }) => {
test('Disable Listen Only Mode', async ({ browser, context, page }) => {
const customParam = new CustomParameters(browser, context);
await customParam.initModPage(page, false, { customParameter: c.listenOnlyMode });
await customParam.listenOnlyMode();
@ -169,6 +169,7 @@ test.describe.parallel('CustomParameters', () => {
});
test.describe.parallel('Whiteboard', () => {
test.skip();
test('Multi Users Pen Only', async ({ browser, context, page }) => {
const customParam = new CustomParameters(browser, context);
await customParam.initModPage(page, true, { customParameter: c.multiUserPenOnly });

View File

@ -64,14 +64,9 @@ async function nextSlide(test) {
}
async function annotation(test) {
await test.waitAndClick(e.toolsButton);
await test.waitAndClick(e.pencil);
await test.waitAndClick(e.wbPencilShape);
await test.waitAndClick(e.whiteboard);
await test.page.waitForFunction(
(whiteboard) => document.querySelectorAll(`${whiteboard} > g > g`)[1].innerHTML !== '',
e.whiteboard,
{ timeout: ELEMENT_WAIT_TIME }
);
await test.waitForSelector(e.wbLineDraw);
}
function encodeCustomParams(param) {
@ -101,9 +96,9 @@ async function checkAccesskey(test, key) {
}
async function checkShortcutsArray(test, shortcut) {
for (const { key } of shortcut) {
for (const { key, param } of shortcut) {
const resp = await checkAccesskey(test, key);
await expect(resp).toBeTruthy();
await expect.soft(resp, `Shortcut to ${param} (key ${key}) failed`).toBeTruthy();
}
}

View File

@ -25,11 +25,12 @@ class Notifications extends MultiUsers {
await util.checkNotificationText(this.modPage, e.joinAudioToast);
await util.checkNotificationIcon(this.modPage, e.unmuteIcon);
await util.waitAndClearNotification(this.modPage);
await this.modPage.waitAndClick(e.audioDropdownMenu);
await this.modPage.waitAndClick(e.leaveAudio);
await util.waitAndClearNotification(this.modPage);
await this.modPage.waitAndClick(e.joinAudio);
await this.modPage.waitAndClick(e.listenOnlyButton);
await this.modPage.wasRemoved(e.connecting);
await this.modPage.wasRemoved(e.establishingAudioLabel);
await util.checkNotificationText(this.modPage, e.joinAudioToast);
await util.checkNotificationIcon(this.modPage, e.listenOnlyIcon);
}

View File

@ -28,7 +28,7 @@ class Polling extends MultiUsers {
}
async quickPoll() {
await this.modPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME);
await waitAndClearDefaultPresentationNotification(this.modPage);
await utilPresentation.uploadPresentation(this.modPage, e.questionSlideFileName);
await this.modPage.waitAndClick(e.quickPoll);
@ -54,7 +54,7 @@ class Polling extends MultiUsers {
await this.modPage.waitAndClick(e.publishPollingLabel);
await this.modPage.waitForSelector(e.restartPoll);
await this.modPage.hasElement(e.pollResults);
await this.modPage.hasElement(e.wbTypedText);
}
async stopPoll() {
@ -80,18 +80,18 @@ class Polling extends MultiUsers {
async pollResultsOnWhiteboard() {
await this.modPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME);
await util.startPoll(this.modPage, true);
await this.modPage.hasElement(e.pollResults);
await this.modPage.hasElement(e.wbTypedText);
}
async pollResultsInDifferentPresentation() {
await this.modPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME);
await waitAndClearDefaultPresentationNotification(this.modPage);
await util.startPoll(this.modPage);
await utilPresentation.uploadPresentation(this.modPage, e.questionSlideFileName);
await this.modPage.waitAndClick(e.publishPollingLabel);
// Check poll results
await this.modPage.hasElement(e.pollResults);
await this.modPage.hasElement(e.wbTypedText);
}
async manageResponseChoices() {

View File

@ -2,7 +2,7 @@ const { expect, default: test } = require('@playwright/test');
const { MultiUsers } = require('../user/multiusers');
const Page = require('../core/page');
const e = require('../core/elements');
const { checkSvgIndex, getSvgOuterHtml, uploadPresentation } = require('./util.js');
const { checkSvgIndex, getSlideOuterHtml, uploadPresentation } = require('./util.js');
const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants');
const { sleep } = require('../core/helpers');
const { getSettings } = require('../core/settings');
@ -15,19 +15,18 @@ class Presentation extends MultiUsers {
async skipSlide() {
await this.modPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME);
await this.modPage.waitForSelector(e.presentationToolbarWrapper);
await checkSvgIndex(this.modPage, '/svg/1');
await this.modPage.waitAndClick(e.nextSlide);
await this.modPage.waitForSelector(e.whiteboard);
await this.modPage.page.waitForTimeout(1000);
await sleep(1000);
await checkSvgIndex(this.modPage, '/svg/2');
await this.modPage.waitAndClick(e.prevSlide);
await this.modPage.waitForSelector(e.whiteboard);
await this.modPage.page.waitForTimeout(1000);
await sleep(1000);
await checkSvgIndex(this.modPage, '/svg/1');
}
@ -66,14 +65,14 @@ class Presentation extends MultiUsers {
await waitAndClearDefaultPresentationNotification(this.modPage);
await this.modPage.waitForSelector(e.skipSlide);
const modSlides0 = await this.modPage.page.evaluate(getSvgOuterHtml);
const userSlides0 = await this.userPage.page.evaluate(getSvgOuterHtml);
const modSlides0 = await getSlideOuterHtml(this.modPage);
const userSlides0 = await getSlideOuterHtml(this.userPage);
await expect(modSlides0).toEqual(userSlides0);
await uploadPresentation(this.modPage, e.uploadPresentationFileName);
const modSlides1 = await this.userPage.page.evaluate(async () => document.querySelector('svg g g g').outerHTML);
const userSlides1 = await this.modPage.page.evaluate(async () => document.querySelector('svg g g g').outerHTML);
const modSlides1 = await getSlideOuterHtml(this.modPage);
const userSlides1 = await getSlideOuterHtml(this.userPage);
await expect(modSlides1).toEqual(userSlides1);
await expect(modSlides0).not.toEqual(modSlides1);
@ -113,10 +112,10 @@ class Presentation extends MultiUsers {
await this.modPage.waitAndClick(e.removePresentation);
await this.modPage.waitAndClick(e.confirmManagePresentation);
await this.modPage.waitForSelector(e.presentationPlaceholder);
await this.modPage.hasText(e.presentationPlaceholder, e.presentationPlaceholderLabel);
await this.userPage.waitForSelector(e.presentationPlaceholder);
await this.userPage.hasText(e.presentationPlaceholder, e.presentationPlaceholderLabel);
await this.modPage.wasRemoved(e.whiteboard);
await this.modPage.hasElementDisabled(e.minimizePresentation);
await this.userPage.wasRemoved(e.whiteboard);
await this.userPage.hasElementDisabled(e.minimizePresentation);
}
async getFrame(page, frameSelector) {

View File

@ -27,7 +27,7 @@ test.describe.parallel('Presentation', () => {
await presentation.uploadPresentationTest();
});
test('Allow and disallow presentation download @ci', async ({ browser, context, page }, testInfo) => {
test.skip('Allow and disallow presentation download @ci', async ({ browser, context, page }, testInfo) => {
const presentation = new Presentation(browser, context);
await presentation.initPages(page);
await presentation.allowAndDisallowDownload(testInfo);

View File

@ -4,14 +4,16 @@ const e = require('../core/elements');
const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants');
async function checkSvgIndex(test, element) {
const check = await test.page.evaluate(([el]) => {
return document.querySelector('svg g g g').outerHTML.indexOf(el) !== -1;
}, [element]);
const check = await test.page.evaluate(([el, slideImg]) => {
return document.querySelector(slideImg).outerHTML.indexOf(el) !== -1;
}, [element, e.currentSlideImg]);
await expect(check).toBeTruthy();
}
function getSvgOuterHtml() {
return document.querySelector('svg g g g').outerHTML;
async function getSlideOuterHtml(testPage) {
return testPage.page.evaluate(([slideImg]) => {
return document.querySelector(slideImg).outerHTML;
}, [e.currentSlideImg]);
}
async function uploadPresentation(test, fileName, uploadTimeout = ELEMENT_WAIT_LONGER_TIME) {
@ -28,5 +30,5 @@ async function uploadPresentation(test, fileName, uploadTimeout = ELEMENT_WAIT_L
}
exports.checkSvgIndex = checkSvgIndex;
exports.getSvgOuterHtml = getSvgOuterHtml;
exports.getSlideOuterHtml = getSlideOuterHtml;
exports.uploadPresentation = uploadPresentation;

View File

@ -4,13 +4,7 @@ const { VIDEO_LOADING_WAIT_TIME } = require('../core/constants');
async function startScreenshare(test) {
await test.waitAndClick(e.startScreenSharing);
await test.waitForSelector(e.screenshareConnecting);
await test.waitForSelector(e.screenShareVideo, VIDEO_LOADING_WAIT_TIME);
}
async function getScreenShareBreakoutContainer(test) {
await test.waitForSelector(e.screenshareConnecting, VIDEO_LOADING_WAIT_TIME);
await test.hasElement(e.screenShareVideo, VIDEO_LOADING_WAIT_TIME);
}
exports.getScreenShareBreakoutContainer = getScreenShareBreakoutContainer;
exports.startScreenshare = startScreenshare;

View File

@ -1,10 +1,10 @@
const { test } = require('@playwright/test');
const { Language } = require('./language');
test.describe.parallel('Settings test suite', () => {
test(`Test locales`, async ({ browser, page }) => {
const language = new Language(browser, page);
await language.init(true, true);
await language.test();
});
test.describe.parallel('Settings', () => {
test(`Locales`, async ({ browser, page }) => {
const language = new Language(browser, page);
await language.init(true, true);
await language.test();
});
});

View File

@ -51,10 +51,11 @@ class LockViewers extends MultiUsers {
await openLockViewers(this.modPage);
await this.modPage.waitAndClickElement(e.lockShareMicrophone);
await this.modPage.waitAndClick(e.applyLockSettings);
await this.userPage.wasRemoved(e.toggleMicrophoneButton);
await this.userPage.wasRemoved(e.isTalking);
await this.userPage.waitForSelector(e.unmuteMicButton);
await this.userPage2.waitAndClick(e.joinAudio);
await this.userPage2.waitForSelector(e.connecting);
await this.userPage2.hasElement(e.leaveAudio, ELEMENT_WAIT_LONGER_TIME);
await this.userPage2.waitForSelector(e.establishingAudioLabel);
await this.userPage2.hasElement(e.leaveListenOnly, ELEMENT_WAIT_LONGER_TIME);
}
async lockSendPublicChatMessages() {
@ -86,7 +87,7 @@ class LockViewers extends MultiUsers {
await this.userPage.waitAndClick(e.sharedNotes);
await this.userPage.waitForSelector(e.hideNotesLabel);
const sharedNotesLocator = getNotesLocator(this.userPage);
await sharedNotesLocator.type(e.message);
await sharedNotesLocator.type(e.message, { timeout: ELEMENT_WAIT_TIME });
expect(sharedNotesLocator).toContainText(e.message, { timeout: ELEMENT_WAIT_TIME });
await openLockViewers(this.modPage);

View File

@ -78,10 +78,11 @@ class MultiUsers {
async makePresenter() {
await this.modPage.waitAndClick(e.userListItem);
await this.modPage.waitAndClick(e.makePresenter);
await this.modPage.wasRemoved(e.wbToolbar);
await this.userPage.hasElement(e.startScreenSharing);
await this.userPage.hasElement(e.presentationToolbarWrapper);
await this.userPage.hasElement(e.toolsButton);
await this.userPage.hasElement(e.wbToolbar);
await this.userPage.hasElement(e.actions);
const isPresenter = await checkIsPresenter(this.userPage);
expect(isPresenter).toBeTruthy();
@ -90,9 +91,10 @@ class MultiUsers {
async takePresenter() {
await this.modPage2.waitAndClick(e.currentUser);
await this.modPage2.waitAndClick(e.takePresenter);
await this.modPage.wasRemoved(e.wbToolbar);
await this.modPage2.hasElement(e.startScreenSharing);
await this.modPage2.hasElement(e.toolsButton);
await this.modPage2.hasElement(e.wbToolbar);
await this.modPage2.hasElement(e.presentationToolbarWrapper);
const isPresenter = await checkIsPresenter(this.modPage2);
expect(isPresenter).toBeTruthy();
@ -125,7 +127,7 @@ class MultiUsers {
test.fail(!raiseHandButton, 'Raise/lower hand button is disabled');
await waitAndClearDefaultPresentationNotification(this.modPage);
await waitAndClearDefaultPresentationNotification(this.userPage);
await this.initUserPage();
await this.userPage.waitAndClick(e.raiseHandBtn);
await sleep(1000);
await this.userPage.hasElement(e.lowerHandBtn);
@ -199,10 +201,10 @@ class MultiUsers {
await this.modPage.waitForSelector(e.whiteboard);
await this.modPage.waitAndClick(e.userListItem);
await this.modPage.waitAndClick(e.changeWhiteboardAccess);
await this.modPage.waitForSelector(e.multiWhiteboardTool);
const resp = await this.modPage.page.evaluate((multiWhiteboardTool) => {
return document.querySelector(multiWhiteboardTool).children[0].innerText === '1';
}, e.multiWhiteboardTool);
await this.modPage.waitForSelector(e.multiUsersWhiteboardOff);
const resp = await this.modPage.page.evaluate((multiUsersWbBtn) => {
return document.querySelector(multiUsersWbBtn).parentElement.children[1].innerText;
}, e.multiUsersWhiteboardOff);
await expect(resp).toBeTruthy();
}
}

View File

@ -11,7 +11,7 @@ test.describe.parallel('User', () => {
test.describe.parallel('Actions', () => {
test('Raise and lower Hand Toast', async ({ browser, context, page }) => {
const multiusers = new MultiUsers(browser, context);
await multiusers.initPages(page);
await multiusers.initModPage(page);
await multiusers.raiseAndLowerHand();
});

View File

@ -10,10 +10,10 @@ class Draw extends Page {
async test() {
await this.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME);
await this.waitAndClick(e.toolsButton);
await this.waitAndClick(e.rectangle);
await this.waitAndClick(e.wbShapesButton);
await this.waitAndClick(e.wbRectangleShape);
const shapes1 = await this.getTestElements();
const shapes1 = await this.getOuterHtmlDrawn();
const wb = await this.page.$(e.whiteboard);
const wbBox = await wb.boundingBox();
@ -22,15 +22,14 @@ class Draw extends Page {
await this.page.mouse.move(wbBox.x + 0.7 * wbBox.width, wbBox.y + 0.7 * wbBox.height);
await this.page.mouse.up();
await this.waitForSelector(e.drawnRectangle);
const shapes2 = await this.getTestElements();
await this.waitForSelector(e.wbDrawnRectangle);
const shapes2 = await this.getOuterHtmlDrawn();
await expect(shapes1).not.toEqual(shapes2);
}
async getTestElements() {
await this.waitForSelector(e.whiteboardViewBox);
return this.page.evaluate((selector) => document.querySelector(selector).children[1].outerHTML, e.whiteboardViewBox);
async getOuterHtmlDrawn() {
return this.page.evaluate((selector) => document.querySelector(selector).outerHTML, e.wbLayer);
}
}