2023-02-24 01:37:17 +08:00
|
|
|
const { MultiUsers } = require("../user/multiusers");
|
|
|
|
const e = require('../core/elements');
|
2023-06-08 10:16:50 +08:00
|
|
|
const { openPublicChat } = require('../chat/util');
|
2023-03-01 01:44:30 +08:00
|
|
|
const { expect } = require("@playwright/test");
|
|
|
|
const Page = require("../core/page");
|
2023-03-03 03:57:02 +08:00
|
|
|
const { sleep } = require("../core/helpers");
|
2024-02-23 21:09:31 +08:00
|
|
|
const { ELEMENT_WAIT_EXTRA_LONG_TIME, ELEMENT_WAIT_LONGER_TIME } = require("../core/constants");
|
2023-03-30 21:01:01 +08:00
|
|
|
const { openPoll, timeInSeconds, rowFilter } = require("./util");
|
2023-04-01 00:29:18 +08:00
|
|
|
const { checkTextContent } = require('../core/util');
|
2023-02-24 01:37:17 +08:00
|
|
|
|
|
|
|
class LearningDashboard extends MultiUsers {
|
|
|
|
constructor(browser, context) {
|
|
|
|
super(browser, context);
|
|
|
|
}
|
|
|
|
|
2024-03-07 04:11:17 +08:00
|
|
|
async getDashboardPage() {
|
2023-03-01 01:44:30 +08:00
|
|
|
await this.modPage.waitAndClick(e.manageUsers);
|
2023-02-24 01:37:17 +08:00
|
|
|
|
2023-03-01 01:44:30 +08:00
|
|
|
const [dashboardPage] = await Promise.all([
|
2024-03-07 04:11:17 +08:00
|
|
|
this.modPage.context.waitForEvent('page'),
|
2023-03-01 01:44:30 +08:00
|
|
|
this.modPage.waitAndClick(e.learningDashboard),
|
|
|
|
]);
|
2023-03-10 22:24:14 +08:00
|
|
|
|
2023-03-01 01:44:30 +08:00
|
|
|
await expect(dashboardPage).toHaveTitle(/Dashboard/);
|
2024-03-07 04:11:17 +08:00
|
|
|
this.dashboardPage = new Page(this.modPage.context, dashboardPage);
|
2023-03-01 01:44:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
async writeOnPublicChat() {
|
2023-06-08 10:16:50 +08:00
|
|
|
await openPublicChat(this.modPage);
|
2023-03-01 01:44:30 +08:00
|
|
|
await this.modPage.checkElementCount(e.chatUserMessageText, 0);
|
|
|
|
|
|
|
|
await this.modPage.type(e.chatBox, e.message);
|
|
|
|
await this.modPage.waitAndClick(e.sendButton);
|
|
|
|
await this.modPage.checkElementCount(e.chatUserMessageText, 1);
|
2023-03-10 05:09:02 +08:00
|
|
|
await this.dashboardPage.reloadPage();
|
2024-09-11 01:38:55 +08:00
|
|
|
await this.dashboardPage.hasText(e.messageLearningDashboard, '1', 'should display the correct amount of messages sent', ELEMENT_WAIT_EXTRA_LONG_TIME);
|
2023-02-24 01:37:17 +08:00
|
|
|
}
|
2023-03-01 01:44:30 +08:00
|
|
|
|
2023-03-09 04:34:54 +08:00
|
|
|
async userTimeOnMeeting() {
|
2023-03-03 03:57:02 +08:00
|
|
|
await this.modPage.waitAndClick(e.recordingIndicator);
|
|
|
|
await this.modPage.waitAndClick(e.confirmRecording);
|
|
|
|
await this.modPage.hasText(e.recordingIndicator, '00:0000:00');
|
|
|
|
|
2023-03-10 05:09:02 +08:00
|
|
|
const timeLocator = this.dashboardPage.getLocator(e.userOnlineTime);
|
|
|
|
const timeContent = await (timeLocator).textContent();
|
2023-03-10 22:24:14 +08:00
|
|
|
const time = timeInSeconds(timeContent);
|
2023-03-09 04:34:54 +08:00
|
|
|
await sleep(1000);
|
|
|
|
await this.dashboardPage.reloadPage();
|
2023-03-10 05:09:02 +08:00
|
|
|
const timeContentGreater = await (timeLocator).textContent();
|
2023-03-10 22:24:14 +08:00
|
|
|
const timeGreater = timeInSeconds(timeContentGreater);
|
2023-03-03 03:57:02 +08:00
|
|
|
|
2023-03-10 05:09:02 +08:00
|
|
|
await expect(timeGreater).toBeGreaterThan(time);
|
2023-03-03 03:57:02 +08:00
|
|
|
}
|
|
|
|
|
2023-03-09 04:34:54 +08:00
|
|
|
async polls() {
|
|
|
|
// True/False
|
|
|
|
await openPoll(this.modPage);
|
|
|
|
await this.modPage.type(e.pollQuestionArea, 'True/False?');
|
2023-03-03 03:57:02 +08:00
|
|
|
await this.modPage.waitAndClick(e.pollTrueFalse);
|
|
|
|
await this.modPage.waitAndClick(e.startPoll);
|
|
|
|
|
2023-03-09 04:34:54 +08:00
|
|
|
await this.userPage.waitAndClick(e.pollAnswerOptionBtn);
|
2024-04-04 02:56:38 +08:00
|
|
|
await this.modPage.hasText(e.userVoteLiveResult, 'True');
|
2023-03-09 04:34:54 +08:00
|
|
|
await this.modPage.waitAndClick(e.cancelPollBtn);
|
2023-03-03 03:57:02 +08:00
|
|
|
|
2023-03-09 04:34:54 +08:00
|
|
|
//ABCD
|
|
|
|
await this.modPage.getLocator(e.pollQuestionArea).fill(' ');
|
|
|
|
await this.modPage.type(e.pollQuestionArea, 'ABCD?');
|
2023-03-03 03:57:02 +08:00
|
|
|
await this.modPage.waitAndClick(e.pollLetterAlternatives);
|
|
|
|
await this.modPage.waitAndClick(e.startPoll);
|
2023-03-09 04:34:54 +08:00
|
|
|
await this.userPage.waitAndClick(e.pollAnswerOptionBtn);
|
2024-04-04 02:56:38 +08:00
|
|
|
await this.modPage.hasText(e.userVoteLiveResult, 'A');
|
2023-03-09 04:34:54 +08:00
|
|
|
await this.modPage.waitAndClick(e.cancelPollBtn);
|
2023-03-03 03:57:02 +08:00
|
|
|
|
2023-03-09 04:34:54 +08:00
|
|
|
//Yes/No/Abstention
|
|
|
|
await this.modPage.getLocator(e.pollQuestionArea).fill(' ');
|
|
|
|
await this.modPage.type(e.pollQuestionArea, 'Yes/No/Abstention?');
|
2023-03-03 03:57:02 +08:00
|
|
|
await this.modPage.waitAndClick(e.pollYesNoAbstentionBtn);
|
|
|
|
await this.modPage.waitAndClick(e.startPoll);
|
2023-03-09 04:34:54 +08:00
|
|
|
await this.userPage.waitAndClick(e.pollAnswerOptionBtn);
|
2024-04-04 02:56:38 +08:00
|
|
|
await this.modPage.hasText(e.userVoteLiveResult, 'Yes');
|
2023-03-09 04:34:54 +08:00
|
|
|
await this.modPage.waitAndClick(e.cancelPollBtn);
|
2023-03-03 03:57:02 +08:00
|
|
|
|
2023-03-09 04:34:54 +08:00
|
|
|
//User Response
|
|
|
|
await this.modPage.getLocator(e.pollQuestionArea).fill(' ');
|
|
|
|
await this.modPage.type(e.pollQuestionArea, 'User response?');
|
2023-03-03 03:57:02 +08:00
|
|
|
await this.modPage.waitAndClick(e.userResponseBtn);
|
|
|
|
await this.modPage.waitAndClick(e.startPoll);
|
2023-03-09 04:34:54 +08:00
|
|
|
await this.userPage.waitForSelector(e.pollingContainer);
|
|
|
|
await this.userPage.type(e.pollAnswerOptionInput, e.answerMessage);
|
|
|
|
await this.userPage.waitAndClick(e.pollSubmitAnswer);
|
2024-04-04 02:56:38 +08:00
|
|
|
await this.modPage.hasText(e.userVoteLiveResult, e.answerMessage);
|
2023-03-09 04:34:54 +08:00
|
|
|
await this.modPage.waitAndClick(e.cancelPollBtn);
|
2023-03-03 03:57:02 +08:00
|
|
|
|
2023-03-10 22:24:14 +08:00
|
|
|
//Checks
|
2023-03-10 05:09:02 +08:00
|
|
|
await this.dashboardPage.reloadPage();
|
2023-03-30 21:01:01 +08:00
|
|
|
const activityScore = await rowFilter(this.dashboardPage, 'tr', /Attendee/, e.userActivityScoreDashboard);
|
|
|
|
await expect(activityScore).toHaveText(/2/, { timeout: ELEMENT_WAIT_EXTRA_LONG_TIME });
|
2023-03-10 05:09:02 +08:00
|
|
|
await this.dashboardPage.waitAndClick(e.pollPanel);
|
2024-09-11 01:38:55 +08:00
|
|
|
await this.dashboardPage.hasText(e.pollTotal, '4', 'should display the correct amount of polls started in the session', ELEMENT_WAIT_EXTRA_LONG_TIME);
|
2023-03-10 22:24:14 +08:00
|
|
|
|
|
|
|
//True / False
|
|
|
|
await this.dashboardPage.hasText(e.pollTrueFalseQuestion, 'True/False?');
|
2023-03-09 04:34:54 +08:00
|
|
|
await this.dashboardPage.hasText(e.pollTrueFalseAnswer, 'True');
|
2023-03-06 21:46:31 +08:00
|
|
|
|
2023-03-09 04:34:54 +08:00
|
|
|
//ABCD
|
2023-03-10 22:24:14 +08:00
|
|
|
await this.dashboardPage.hasText(e.pollABCDQuestion, 'ABCD?');
|
2023-03-09 04:34:54 +08:00
|
|
|
await this.dashboardPage.hasText(e.pollABCDAnswer, 'A');
|
|
|
|
|
|
|
|
//Yes No
|
2023-03-10 22:24:14 +08:00
|
|
|
await this.dashboardPage.hasText(e.pollYesNoQuestion, 'Yes/No/Abstention?');
|
2023-03-09 04:34:54 +08:00
|
|
|
await this.dashboardPage.hasText(e.pollYesNoAnswer, 'Yes');
|
|
|
|
|
|
|
|
// User Response
|
2023-03-10 22:24:14 +08:00
|
|
|
await this.dashboardPage.hasText(e.pollUserResponseQuestion, 'User response?');
|
2023-03-09 04:34:54 +08:00
|
|
|
await this.dashboardPage.hasText(e.pollUserResponseAnswer, e.answerMessage);
|
2023-03-03 03:57:02 +08:00
|
|
|
}
|
2023-03-24 00:43:29 +08:00
|
|
|
|
|
|
|
async basicInfos() {
|
|
|
|
// Meeting Status check
|
2024-09-11 01:38:55 +08:00
|
|
|
await this.dashboardPage.hasText(e.meetingStatusActiveDashboard, 'Active', 'should display "Active" status', ELEMENT_WAIT_LONGER_TIME);
|
2023-03-24 00:43:29 +08:00
|
|
|
await this.dashboardPage.reloadPage();
|
|
|
|
|
|
|
|
// Meeting Time Duration check
|
|
|
|
const timeLocator = this.dashboardPage.getLocator(e.meetingDurationTimeDashboard);
|
|
|
|
const timeContent = await (timeLocator).textContent();
|
|
|
|
const array = timeContent.split(':').map(Number);
|
|
|
|
const firstTime = array[1] * 3600 + array[2] * 60 + array[3];
|
2023-08-23 04:25:50 +08:00
|
|
|
await sleep(10000);
|
2023-03-24 00:43:29 +08:00
|
|
|
await this.dashboardPage.reloadPage();
|
|
|
|
const timeContentGreater = await (timeLocator).textContent();
|
|
|
|
const arrayGreater = timeContentGreater.split(':').map(Number);
|
|
|
|
const secondTime = arrayGreater[1] * 3600 + arrayGreater[2] * 60 + arrayGreater[3];
|
2024-02-23 21:09:31 +08:00
|
|
|
|
2023-03-24 00:43:29 +08:00
|
|
|
await expect(secondTime).toBeGreaterThan(firstTime);
|
|
|
|
}
|
|
|
|
|
|
|
|
async overview() {
|
|
|
|
await this.modPage.waitAndClick(e.joinVideo);
|
|
|
|
await this.modPage.waitAndClick(e.startSharingWebcam);
|
2023-07-25 05:07:51 +08:00
|
|
|
await this.modPage.waitAndClick(e.reactionsButton);
|
2023-03-24 00:43:29 +08:00
|
|
|
await this.modPage.waitAndClick(e.raiseHandBtn);
|
2023-04-01 00:29:18 +08:00
|
|
|
|
|
|
|
await this.dashboardPage.reloadPage();
|
2023-03-24 00:43:29 +08:00
|
|
|
// User Name check
|
2023-04-01 00:29:18 +08:00
|
|
|
const userNameCheck = await rowFilter(this.dashboardPage, 'tr', /Moderator/, e.userNameDashboard);
|
|
|
|
await expect(userNameCheck).toHaveText(/Moderator/, { timeout: ELEMENT_WAIT_EXTRA_LONG_TIME });
|
2023-03-24 00:43:29 +08:00
|
|
|
// Webcam Time check
|
2023-03-30 21:01:01 +08:00
|
|
|
const webcamCheck = await rowFilter(this.dashboardPage, 'tr', /Moderator/, e.userWebcamTimeDashboard);
|
|
|
|
await expect(webcamCheck).toHaveText(/00/, { timeout: ELEMENT_WAIT_EXTRA_LONG_TIME });
|
2023-03-24 00:43:29 +08:00
|
|
|
// Raise Hand check
|
2023-03-30 21:01:01 +08:00
|
|
|
const raiseHandCheck = await rowFilter(this.dashboardPage, 'tr', /Moderator/, e.userRaiseHandDashboard);
|
|
|
|
await expect(raiseHandCheck).toHaveText(/1/, { timeout: ELEMENT_WAIT_EXTRA_LONG_TIME });
|
2023-03-24 00:43:29 +08:00
|
|
|
// Current Status check
|
2023-03-30 21:01:01 +08:00
|
|
|
const userStatusCheck = await rowFilter(this.dashboardPage, 'tr', /Moderator/, e.userStatusDashboard);
|
|
|
|
await expect(userStatusCheck).toHaveText(/Online/, { timeout: ELEMENT_WAIT_EXTRA_LONG_TIME });
|
2023-03-24 00:43:29 +08:00
|
|
|
}
|
2023-04-01 00:29:18 +08:00
|
|
|
|
|
|
|
async downloadSessionLearningDashboard(testInfo) {
|
2024-02-23 21:09:31 +08:00
|
|
|
await this.modPage.logoutFromMeeting();
|
2023-04-01 00:29:18 +08:00
|
|
|
await this.modPage.waitAndClick('button');
|
|
|
|
|
|
|
|
const downloadSessionLocator = this.dashboardPage.getLocator(e.downloadSessionLearningDashboard);
|
|
|
|
const dataCSV = await this.dashboardPage.handleDownload(downloadSessionLocator, testInfo);
|
|
|
|
|
|
|
|
const dataToCheck = [
|
|
|
|
'Moderator',
|
|
|
|
'Activity Score',
|
|
|
|
'Talk time',
|
|
|
|
'Webcam Time',
|
|
|
|
'Messages',
|
2024-08-27 21:46:14 +08:00
|
|
|
'Reactions',
|
2023-04-01 00:29:18 +08:00
|
|
|
'Poll Votes',
|
|
|
|
'Raise Hands',
|
|
|
|
'Left',
|
|
|
|
'Join',
|
|
|
|
'Duration',
|
|
|
|
]
|
|
|
|
|
|
|
|
await checkTextContent(dataCSV.content, dataToCheck);
|
|
|
|
}
|
2023-02-24 01:37:17 +08:00
|
|
|
}
|
|
|
|
|
2023-04-04 04:21:24 +08:00
|
|
|
exports.LearningDashboard = LearningDashboard;
|