moved second function to util, added extra time to the polls checks
This commit is contained in:
parent
6042b300f0
commit
990ddb1f7c
@ -1,12 +1,11 @@
|
||||
const { MultiUsers } = require("../user/multiusers");
|
||||
const e = require('../core/elements');
|
||||
const util = require('../polling/util.js');
|
||||
const { openChat } = require('../chat/util');
|
||||
const { expect } = require("@playwright/test");
|
||||
const Page = require("../core/page");
|
||||
const { sleep } = require("../core/helpers");
|
||||
const { ELEMENT_WAIT_LONGER_TIME } = require("../core/constants");
|
||||
const { openPoll } = require("./util");
|
||||
const { ELEMENT_WAIT_EXTRA_LONG_TIME } = require("../core/constants");
|
||||
const { openPoll, timeInSeconds } = require("./util");
|
||||
|
||||
class LearningDashboard extends MultiUsers {
|
||||
constructor(browser, context) {
|
||||
@ -20,9 +19,8 @@ class LearningDashboard extends MultiUsers {
|
||||
context.waitForEvent('page'),
|
||||
this.modPage.waitAndClick(e.learningDashboard),
|
||||
]);
|
||||
|
||||
|
||||
await expect(dashboardPage).toHaveTitle(/Dashboard/);
|
||||
|
||||
this.dashboardPage = new Page(context, dashboardPage);
|
||||
}
|
||||
|
||||
@ -33,8 +31,8 @@ class LearningDashboard extends MultiUsers {
|
||||
await this.modPage.type(e.chatBox, e.message);
|
||||
await this.modPage.waitAndClick(e.sendButton);
|
||||
await this.modPage.checkElementCount(e.chatUserMessageText, 1);
|
||||
|
||||
await this.dashboardPage.hasText(e.messageLearningDashboard, '1', ELEMENT_WAIT_LONGER_TIME);
|
||||
await this.dashboardPage.reloadPage();
|
||||
await this.dashboardPage.hasText(e.messageLearningDashboard, '1', ELEMENT_WAIT_EXTRA_LONG_TIME);
|
||||
|
||||
}
|
||||
|
||||
@ -43,18 +41,15 @@ class LearningDashboard extends MultiUsers {
|
||||
await this.modPage.waitAndClick(e.confirmRecording);
|
||||
await this.modPage.hasText(e.recordingIndicator, '00:0000:00');
|
||||
|
||||
const timeTest = await (this.dashboardPage.getLocator(e.userOnlineTime)).textContent();
|
||||
|
||||
const [hours, minutes, seconds] = timeTest.split(':').map(Number);
|
||||
const timeInSeconds = hours * 3600 + minutes * 60 + seconds;
|
||||
const timeLocator = this.dashboardPage.getLocator(e.userOnlineTime);
|
||||
const timeContent = await (timeLocator).textContent();
|
||||
const time = await timeInSeconds(timeContent);
|
||||
await sleep(1000);
|
||||
await this.dashboardPage.reloadPage();
|
||||
const timeTestGreater = await (this.dashboardPage.getLocator(e.userOnlineTime)).textContent();
|
||||
|
||||
const [hoursGreater, minutesGreater, secondsGreater] = timeTestGreater.split(':').map(Number);
|
||||
const timeInSecondsGreater = hoursGreater * 3600 + minutesGreater * 60 + secondsGreater;
|
||||
const timeContentGreater = await (timeLocator).textContent();
|
||||
const timeGreater = await timeInSeconds(timeContentGreater);
|
||||
|
||||
await expect(timeInSecondsGreater).toBeGreaterThan(timeInSeconds);
|
||||
await expect(timeGreater).toBeGreaterThan(time);
|
||||
}
|
||||
|
||||
async polls() {
|
||||
@ -97,25 +92,32 @@ class LearningDashboard extends MultiUsers {
|
||||
await this.modPage.hasText(e.numberVotes, '1');
|
||||
await this.modPage.waitAndClick(e.cancelPollBtn);
|
||||
|
||||
//Checking Polls on Learning Dashboard
|
||||
await this.dashboardPage.waitAndClick(e.pollPanel);
|
||||
|
||||
//True / False
|
||||
await this.dashboardPage.hasText(e.pollTrueFalseQuestion, 'True/False?', ELEMENT_WAIT_LONGER_TIME);
|
||||
await this.dashboardPage.reloadPage();
|
||||
await this.dashboardPage.waitAndClick(e.pollPanel);
|
||||
await this.dashboardPage.hasText(e.pollTrueFalseQuestion, 'True/False?', ELEMENT_WAIT_EXTRA_LONG_TIME);
|
||||
await this.dashboardPage.hasText(e.pollTrueFalseAnswer, 'True');
|
||||
|
||||
//ABCD
|
||||
await this.dashboardPage.hasText(e.pollABCDQuestion, 'ABCD?', ELEMENT_WAIT_LONGER_TIME);
|
||||
await this.dashboardPage.reloadPage();
|
||||
await this.dashboardPage.waitAndClick(e.pollPanel);
|
||||
await this.dashboardPage.hasText(e.pollABCDQuestion, 'ABCD?', ELEMENT_WAIT_EXTRA_LONG_TIME);
|
||||
await this.dashboardPage.hasText(e.pollABCDAnswer, 'A');
|
||||
|
||||
//Yes No
|
||||
await this.dashboardPage.hasText(e.pollYesNoQuestion, 'Yes/No/Abstention?', ELEMENT_WAIT_LONGER_TIME);
|
||||
await this.dashboardPage.reloadPage();
|
||||
await this.dashboardPage.waitAndClick(e.pollPanel);
|
||||
await this.dashboardPage.hasText(e.pollYesNoQuestion, 'Yes/No/Abstention?', ELEMENT_WAIT_EXTRA_LONG_TIME);
|
||||
await this.dashboardPage.hasText(e.pollYesNoAnswer, 'Yes');
|
||||
|
||||
// User Response
|
||||
await this.dashboardPage.hasText(e.pollUserResponseQuestion, 'User response?', ELEMENT_WAIT_LONGER_TIME);
|
||||
await this.dashboardPage.reloadPage();
|
||||
await this.dashboardPage.waitAndClick(e.pollPanel);
|
||||
await this.dashboardPage.hasText(e.pollUserResponseQuestion, 'User response?', ELEMENT_WAIT_EXTRA_LONG_TIME);
|
||||
await this.dashboardPage.hasText(e.pollUserResponseAnswer, e.answerMessage);
|
||||
|
||||
await this.dashboardPage.reloadPage();
|
||||
await this.dashboardPage.waitAndClick(e.pollPanel);
|
||||
await this.dashboardPage.hasText(e.pollTotal, '4');
|
||||
}
|
||||
}
|
||||
|
@ -3,13 +3,10 @@ const { LearningDashboard } = require('./learningdashboard');
|
||||
const c = require('../customparameters/constants');
|
||||
|
||||
test.describe.serial('Learning Dashboard', async () => {
|
||||
|
||||
const learningDashboard = new LearningDashboard();
|
||||
test.beforeAll(async ({ browser }) => {
|
||||
|
||||
const context = await browser.newContext();
|
||||
const page = await context.newPage();
|
||||
|
||||
await learningDashboard.initModPage(page, true, { customParameter: c.recordMeeting });
|
||||
await learningDashboard.getDashboardPage(context);
|
||||
});
|
||||
|
@ -10,4 +10,10 @@ async function openPoll(testPage) {
|
||||
await testPage.waitAndClick(e.polling);
|
||||
}
|
||||
|
||||
exports.openPoll = openPoll;
|
||||
async function timeInSeconds(locator){
|
||||
const [hours, minutes, seconds] = locator.split(':').map(Number);
|
||||
return hours * 3600 + minutes * 60 + seconds;
|
||||
}
|
||||
|
||||
exports.openPoll = openPoll;
|
||||
exports.timeInSeconds = timeInSeconds;
|
Loading…
Reference in New Issue
Block a user