few improvements on the test

This commit is contained in:
Gabriel Porfirio 2023-10-25 17:29:52 -03:00
parent 7bcddfe631
commit e274cb595b
8 changed files with 25 additions and 23 deletions

View File

@ -277,7 +277,7 @@ class ActionsDropdown extends PureComponent {
: intl.formatMessage(intlMessages.activateTimerStopwatchLabel),
key: this.timerId,
onClick: () => this.handleTimerClick(),
dataTest: 'timer',
dataTest: 'timerStopWatchFeature',
});
}

View File

@ -248,7 +248,7 @@ class Timer extends Component {
color="secondary"
label={intl.formatMessage(intlMessages.reset)}
onClick={() => Service.resetTimer()}
data-test="reset"
data-test="resetTimerStopWatch"
/>
</Styled.TimerControls>
);

View File

@ -161,10 +161,10 @@ exports.virtualBackgrounds = 'div[data-test="virtualBackground"]';
exports.learningDashboard = 'li[data-test="learningDashboard"]';
// Timer
exports.timer = 'li[data-test="timer"]';
exports.timerStopwatchFeature = 'li[data-test="timerStopWatchFeature"]';
exports.timerCurrent = 'span[data-test="timerCurrent"]';
exports.startStopTimer = 'button[data-test="startStopTimer"]';
exports.resetTimer = 'button[data-test="reset"]';
exports.resetTimerStopwatch = 'button[data-test="resetTimerStopWatch"]';
exports.timerButton = 'button[data-test="timer"]';
exports.timerIndicator = 'div[data-test="timeIndicator"]';
exports.stopwatch = 'button[data-test="stopwatch"]';

View File

@ -4,13 +4,6 @@ const { DisabledFeatures } = require('./disabledFeatures');
const c = require('./constants');
const { encodeCustomParams, getAllShortcutParams, hexToRgb } = require('./util');
const { CreateParameters } = require('./createParameters');
const { Timer } = require('./timer');
test.only('Timer', async ({ browser, context, page })=> {
const timer = new Timer(browser, context);
await timer.initModPage(page, true);
await timer.timerTest();
})
test.describe.parallel('Create Parameters', () => {
test('Record Meeting', async ({ browser, context, page }) => {

View File

@ -102,13 +102,6 @@ async function checkShortcutsArray(test, shortcut) {
}
}
async function timeInSeconds(locator) {
const texto = await locator.innerText();
const [horas, minutos, segundos] = texto.split(':').map(Number);
const tempoEmSegundos = horas * 3600 + minutos * 60 + segundos;
return tempoEmSegundos;
}
exports.zoomIn = zoomIn;
exports.zoomOut = zoomOut;
exports.poll = poll;
@ -121,4 +114,3 @@ exports.encodeCustomParams = encodeCustomParams;
exports.getAllShortcutParams = getAllShortcutParams;
exports.checkAccesskey = checkAccesskey;
exports.checkShortcutsArray = checkShortcutsArray;
exports.timeInSeconds = timeInSeconds;

View File

@ -1,8 +1,9 @@
const { MultiUsers } = require('../user/multiusers');
const { MultiUsers } = require('./multiusers');
const e = require('../core/elements');
const { timeInSeconds } = require('./util');
const { expect } = require('@playwright/test');
const { sleep } = require('../core/helpers');
const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants');
class Timer extends MultiUsers {
constructor(browser, context) {
@ -11,7 +12,7 @@ class Timer extends MultiUsers {
async timerTest() {
await this.modPage.waitForSelector(e.whiteboard);
await this.modPage.waitAndClick(e.actions);
await this.modPage.waitAndClick(e.timer);
await this.modPage.waitAndClick(e.timerStopwatchFeature);
await this.modPage.waitForSelector(e.timerCurrent);
const timerCurrentLocator = await this.modPage.getLocator(e.timerCurrent);
const timerIndicatorLocator = await this.modPage.getLocator(e.timerIndicator);
@ -27,7 +28,8 @@ class Timer extends MultiUsers {
await expect(currentValueStopwatch).toBeGreaterThan(initialValeuStopWatch);
await expect(currentValueStopwatchIndicator).toBeGreaterThan(initialValeuStopWatchIndicator);
await this.modPage.waitAndClick(e.resetTimer);
await this.modPage.waitAndClick(e.startStopTimer);
await this.modPage.waitAndClick(e.resetTimerStopwatch);
await this.modPage.hasText(e.timerCurrent, /00:00:00/);
await this.modPage.hasText(e.timerIndicator, /00:00:00/);
@ -47,7 +49,7 @@ class Timer extends MultiUsers {
await expect(timerInitialValue).toBeGreaterThan(timerCurrentValue);
await this.modPage.waitAndClick(e.startStopTimer);
await this.modPage.waitAndClick(e.resetTimer);
await this.modPage.waitAndClick(e.resetTimerStopwatch);
await this.modPage.hasText(e.timerCurrent, /00:06:00/);
await this.modPage.hasText(e.timerIndicator, /00:06:00/);

View File

@ -4,6 +4,7 @@ const { MultiUsers } = require('./multiusers');
const { GuestPolicy } = require('./guestPolicy');
const { LockViewers } = require('./lockViewers');
const { MobileDevices } = require('./mobileDevices');
const { Timer } = require('./timer');
const motoG4 = devices['Moto G4'];
const iPhone11 = devices['iPhone 11'];
@ -299,3 +300,9 @@ test.describe.parallel('User', () => {
});
});
});
test('Timer', async ({ browser, context, page })=> {
const timer = new Timer(browser, context);
await timer.initModPage(page, true);
await timer.timerTest();
});

View File

@ -44,6 +44,13 @@ async function drawArrow(test) {
await test.page.mouse.up();
}
async function timeInSeconds(locator) {
const text = await locator.innerText();
const [hours, minutes, seconds] = text.split(':').map(Number);
const timeInSeconds = hours * 3600 + minutes * 60 + seconds;
return timeInSeconds;
}
exports.setStatus = setStatus;
exports.openLockViewers = openLockViewers;
exports.setGuestPolicyOption = setGuestPolicyOption;
@ -51,3 +58,4 @@ exports.checkAvatarIcon = checkAvatarIcon;
exports.checkIsPresenter = checkIsPresenter;
exports.checkMutedUsers = checkMutedUsers;
exports.drawArrow = drawArrow;
exports.timeInSeconds = timeInSeconds;