Reconnectio n tests for chat and audio

This commit is contained in:
Maxim Khlobystov 2023-03-21 19:46:52 +00:00
parent efde3b832a
commit 7be61d1118
3 changed files with 85 additions and 0 deletions

View File

@ -0,0 +1,55 @@
const { expect } = require('@playwright/test');
const { MultiUsers } = require('../user/multiusers');
const e = require('../core/elements');
const { ELEMENT_WAIT_TIME } = require('../core/constants');
const { killConnection } = require('./util');
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
await expect(chatBoxLocator).toBeDisabled();
// reconnected -> chat enabled
await this.modPage.wasRemoved('//div[@data-test="notificationBannerBar" and contains(text(), "Connecting ...")]');
await expect(chatBoxLocator).toBeEnabled();
}
async mute() {
// 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();
// mute button is removed
await this.modPage.wasRemoved(e.muteMicButton);
// join audio appears disabled
const joinAudioLocator = this.modPage.getLocator(e.joinAudio);
await expect(joinAudioLocator).toBeDisabled();
// toast notification
await this.modPage.hasElement('//div[@data-test="toastSmallMsg"]/span[contains(text(), "You have left the audio conference")]');
// reconnected -> join audio button enabled
await this.modPage.wasRemoved('//div[@data-test="notificationBannerBar" and contains(text(), "Connecting ...")]');
await expect(joinAudioLocator).toBeEnabled();
}
}
exports.Reconnection = Reconnection;

View File

@ -0,0 +1,19 @@
const { test } = require('@playwright/test');
const e = require('../core/elements');
const notificationsUtil = require('../notifications/util');
const { expect } = require('@playwright/test');
const { Reconnection } = require('./reconnection');
test.describe.parallel('Reconnection', () => {
test('Chat', async ({ browser, context, page }) => {
const reconnection = new Reconnection(browser, context);
await reconnection.initModPage(page);
await reconnection.chat();
});
test('Audio', async ({ browser, context, page }) => {
const reconnection = new Reconnection(browser, context);
await reconnection.initModPage(page);
await reconnection.mute();
});
});

View File

@ -0,0 +1,11 @@
const util = require('node:util');
const exec = util.promisify(require('node:child_process').exec);
const parameters = require('../core/parameters.js');
const hostname = new URL(parameters.server).hostname;
async function killConnection() {
await exec('sudo ss -K dst ' + hostname + ' dport https');
}
exports.killConnection = killConnection;