2022-08-03 07:37:16 +08:00
|
|
|
const { expect } = require('@playwright/test');
|
|
|
|
const Page = require('../core/page');
|
|
|
|
const util = require('./util');
|
2022-08-18 11:34:32 +08:00
|
|
|
const { waitAndClearNotification, waitAndClearDefaultPresentationNotification } = require('../notifications/util');
|
2022-08-03 07:37:16 +08:00
|
|
|
const e = require('../core/elements');
|
|
|
|
const { connectMicrophone } = require('../audio/util');
|
|
|
|
const { sleep } = require('../core/helpers');
|
|
|
|
const { ELEMENT_WAIT_EXTRA_LONG_TIME } = require('../core/constants');
|
|
|
|
|
|
|
|
class RecordingNotifications extends Page {
|
|
|
|
constructor(browser, page) {
|
|
|
|
super(browser, page);
|
|
|
|
}
|
|
|
|
|
|
|
|
async notificationNoAudio() {
|
|
|
|
// when you don't join audio at all, there's notification about no active mic
|
2022-08-18 11:34:32 +08:00
|
|
|
await waitAndClearDefaultPresentationNotification(this);
|
2022-08-03 07:37:16 +08:00
|
|
|
await this.waitAndClick(e.recordingIndicator, ELEMENT_WAIT_EXTRA_LONG_TIME);
|
2024-07-31 06:49:02 +08:00
|
|
|
await this.hasElement(e.smallToastMsg, 'should appear a toast small message with the new message sent on the chat');
|
2022-08-03 07:37:16 +08:00
|
|
|
await util.checkNotificationText(this, e.noActiveMicrophoneToast);
|
|
|
|
}
|
|
|
|
|
|
|
|
async notificationListenOnly() {
|
|
|
|
// when you join listen only, there's notification about no active mic
|
2022-08-18 11:34:32 +08:00
|
|
|
await waitAndClearDefaultPresentationNotification(this);
|
|
|
|
await this.waitAndClick(e.joinAudio, ELEMENT_WAIT_EXTRA_LONG_TIME);
|
2022-08-03 07:37:16 +08:00
|
|
|
await this.waitAndClick(e.listenOnlyButton, ELEMENT_WAIT_EXTRA_LONG_TIME);
|
|
|
|
await waitAndClearNotification(this);
|
|
|
|
await this.waitAndClick(e.recordingIndicator);
|
2024-07-31 06:49:02 +08:00
|
|
|
await this.hasElement(e.smallToastMsg, 'should the small toast message be show');
|
2022-08-03 07:37:16 +08:00
|
|
|
await util.checkNotificationText(this, e.noActiveMicrophoneToast);
|
|
|
|
}
|
|
|
|
|
|
|
|
async noNotificationInAudio() {
|
|
|
|
// when you join audio with mic, there's no notification about no active mic
|
2022-08-18 11:34:32 +08:00
|
|
|
await waitAndClearDefaultPresentationNotification(this);
|
|
|
|
await this.waitAndClick(e.joinAudio, ELEMENT_WAIT_EXTRA_LONG_TIME);
|
2024-07-31 06:49:02 +08:00
|
|
|
await this.hasElement(e.audioModal, 'should the audio modal be displayed', ELEMENT_WAIT_EXTRA_LONG_TIME);
|
2022-08-03 07:37:16 +08:00
|
|
|
await connectMicrophone(this);
|
|
|
|
await waitAndClearNotification(this);
|
|
|
|
await this.waitAndClick(e.recordingIndicator);
|
2024-07-31 06:49:02 +08:00
|
|
|
await this.wasRemoved(e.smallToastMsg, 'should the small toast message disappear', ELEMENT_WAIT_EXTRA_LONG_TIME);
|
2022-08-03 07:37:16 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
async modalStartRecording() {
|
|
|
|
await this.waitAndClick(e.recordingIndicator, ELEMENT_WAIT_EXTRA_LONG_TIME);
|
2024-07-31 06:49:02 +08:00
|
|
|
await this.hasElement(e.noButton, 'should the button No appear');
|
|
|
|
await this.hasElement(e.yesButton, 'should the button Yes appear');
|
2022-08-03 07:37:16 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.RecordingNotifications = RecordingNotifications;
|