From 0806cbf696e8497a305759a4e2f641265fc6499d Mon Sep 17 00:00:00 2001 From: Gabriel Porfirio Date: Thu, 1 Dec 2022 11:15:55 -0300 Subject: [PATCH] changed to call locators once --- .../playwright/presentation/presentation.js | 18 ++++++------------ .../playwright/presentation/util.js | 7 +++++++ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/bigbluebutton-tests/playwright/presentation/presentation.js b/bigbluebutton-tests/playwright/presentation/presentation.js index 81415a9820..9ac19a1395 100644 --- a/bigbluebutton-tests/playwright/presentation/presentation.js +++ b/bigbluebutton-tests/playwright/presentation/presentation.js @@ -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, getSlideOuterHtml, uploadSinglePresentation, uploadMultiplePresentations } = require('./util.js'); +const { checkSvgIndex, getSlideOuterHtml, uploadSinglePresentation, uploadMultiplePresentations, getCurrentPresentationHeight } = require('./util.js'); const { ELEMENT_WAIT_LONGER_TIME, ELEMENT_WAIT_EXTRA_LONG_TIME } = require('../core/constants'); const { sleep } = require('../core/helpers'); const { getSettings } = require('../core/settings'); @@ -202,22 +202,16 @@ class Presentation extends MultiUsers { } async presentationFullscreen() { - const element = await this.modPage.getLocator(e.presentationContainer); - const value = await element.evaluate((e) => { - return window.getComputedStyle(e).getPropertyValue("height") - }); - const height = parseInt(value); + const presentationLocator = await this.modPage.getLocator(e.presentationContainer); + const height = parseInt(await getCurrentPresentationHeight(presentationLocator)); await this.modPage.waitAndClick(e.whiteboardOptionsButton); await this.modPage.waitAndClick(e.presentationFullscreen); - const element1 = await this.modPage.getLocator(e.presentationContainer); - const value1 = await element1.evaluate((e) => { - return window.getComputedStyle(e).getPropertyValue("height") - }); - const height1 = parseInt(value1); + // Gets fullscreen mode height + const heightFullscreen = parseInt(await getCurrentPresentationHeight(presentationLocator)); - await expect(height1).toBeGreaterThan(height); + await expect(heightFullscreen).toBeGreaterThan(height); } async presentationSnapshot(testInfo) { diff --git a/bigbluebutton-tests/playwright/presentation/util.js b/bigbluebutton-tests/playwright/presentation/util.js index daaaf62f74..633a7c9853 100644 --- a/bigbluebutton-tests/playwright/presentation/util.js +++ b/bigbluebutton-tests/playwright/presentation/util.js @@ -16,6 +16,12 @@ async function getSlideOuterHtml(testPage) { }, [e.currentSlideImg]); } +async function getCurrentPresentationHeight(locator) { + return locator.evaluate((e) => { + return window.getComputedStyle(e).getPropertyValue("height"); + }); +} + async function uploadSinglePresentation(test, fileName, uploadTimeout = ELEMENT_WAIT_LONGER_TIME) { await test.waitAndClick(e.actions); await test.waitAndClick(e.managePresentations); @@ -46,3 +52,4 @@ exports.checkSvgIndex = checkSvgIndex; exports.getSlideOuterHtml = getSlideOuterHtml; exports.uploadSinglePresentation = uploadSinglePresentation; exports.uploadMultiplePresentations = uploadMultiplePresentations; +exports.getCurrentPresentationHeight = getCurrentPresentationHeight;