bigbluebutton-Github/bigbluebutton-tests/playwright/reconnection/reconnection.js

54 lines
1.6 KiB
JavaScript
Raw Normal View History

2023-03-22 03:46:52 +08:00
const { expect } = require('@playwright/test');
const { MultiUsers } = require('../user/multiusers');
const e = require('../core/elements');
const { killConnection } = require('./util');
const { runScript } = require('../core/util');
const { ELEMENT_WAIT_TIME } = require('../core/constants');
2023-03-22 03:46:52 +08:00
class Reconnection extends MultiUsers {
constructor(browser, context) {
super(browser, context);
}
async chat() {
// chat enabled
await this.modPage.waitForSelector(e.chatBox);
const chatBoxLocator = this.modPage.getLocator(e.chatBox);
await expect(chatBoxLocator).toBeEnabled();
killConnection();
// chat disabled and notification bar displayed
await Promise.all([
expect(chatBoxLocator).toBeDisabled({ timeout: ELEMENT_WAIT_TIME }),
this.modPage.hasElement(e.reconnectingBar),
]);
2023-03-22 03:46:52 +08:00
// reconnected -> chat enabled
await expect(chatBoxLocator).toBeEnabled();
await this.modPage.wasRemoved(e.notificationBannerBar);
2023-03-22 03:46:52 +08:00
}
async microphone() {
2023-03-22 03:46:52 +08:00
// join audio
await this.modPage.waitAndClick(e.joinAudio);
await this.modPage.joinMicrophone();
// mute is available
const muteMicButtonLocator = this.modPage.getLocator(e.muteMicButton);
await expect(muteMicButtonLocator).toBeEnabled();
killConnection();
await this.modPage.hasElement(e.reconnectingBar);
2023-03-22 03:46:52 +08:00
// reconnected
await this.modPage.wasRemoved(e.notificationBannerBar);
2023-03-22 03:46:52 +08:00
// audio connection should keep connected
await this.modPage.hasElement(e.muteMicButton);
await this.modPage.hasElement(e.isTalking);
}
2023-03-22 03:46:52 +08:00
}
exports.Reconnection = Reconnection;