Merge pull request #19747 from antonbsa/global-test-hook
test: Add global test hook
This commit is contained in:
commit
c91108c2a5
@ -93,7 +93,7 @@ class LeaveMeetingButton extends PureComponent {
|
||||
this.menuItems.push(
|
||||
{
|
||||
key: 'list-item-logout',
|
||||
dataTest: 'logoutButton',
|
||||
dataTest: 'directLogoutButton',
|
||||
icon: 'logout',
|
||||
label: intl.formatMessage(intlMessages.leaveSessionLabel),
|
||||
description: intl.formatMessage(intlMessages.leaveSessionDesc),
|
||||
|
@ -359,7 +359,7 @@ class OptionsDropdown extends PureComponent {
|
||||
if (allowLogoutSetting) {
|
||||
bottomItems.push({
|
||||
key: 'list-item-logout',
|
||||
dataTest: 'logout',
|
||||
dataTest: 'optionsLogoutButton',
|
||||
icon: 'logout',
|
||||
label: intl.formatMessage(intlMessages.leaveSessionLabel),
|
||||
description: intl.formatMessage(intlMessages.leaveSessionDesc),
|
||||
|
@ -2,5 +2,4 @@
|
||||
BBB_URL="" # https://DOMAIN_NAME/bigbluebutton/api
|
||||
BBB_SECRET=""
|
||||
|
||||
DEBUG_MODE="" # (true / false|empty) Enable or disable debug features
|
||||
TIMEOUT_MULTIPLIER=1 # (number / empty) Apply a multiplier on default timeouts - depending the server strength (not recommended to use greater values than 3)
|
||||
|
@ -1,4 +1,4 @@
|
||||
const { test } = require('@playwright/test');
|
||||
const { test } = require('../fixtures');
|
||||
const { API } = require('./api.js');
|
||||
const { APIBreakout } = require('./breakout.js');
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
const { test } = require('@playwright/test');
|
||||
const { test } = require('../fixtures');
|
||||
const { fullyParallel } = require('../playwright.config');
|
||||
const { Audio } = require('./audio');
|
||||
const { initializePages } = require('../core/helpers');
|
||||
|
@ -1,4 +1,4 @@
|
||||
const { test } = require('@playwright/test');
|
||||
const { test } = require('../fixtures');
|
||||
const { Create } = require('./create');
|
||||
const { Join } = require('./join');
|
||||
|
||||
|
@ -66,7 +66,7 @@ class Chat extends MultiUsers {
|
||||
await this.modPage.hasText(e.chatUserMessageText, 'The public chat history was cleared by a moderator');
|
||||
}
|
||||
|
||||
async copyChat(context) {
|
||||
async copyChat() {
|
||||
const { publicChatOptionsEnabled } = getSettings();
|
||||
|
||||
await openPublicChat(this.modPage);
|
||||
@ -85,7 +85,7 @@ class Chat extends MultiUsers {
|
||||
await this.modPage.waitForSelector(e.chatUserMessageText);
|
||||
await this.modPage.waitAndClick(e.chatCopy);
|
||||
// enable access to browser context clipboard
|
||||
const copiedText = await this.modPage.getCopiedText(context);
|
||||
const copiedText = await this.modPage.getCopiedText(this.modPage.context);
|
||||
const check = copiedText.includes(`${p.fullName}: ${e.message}`);
|
||||
await expect(check).toBeTruthy();
|
||||
}
|
||||
|
@ -1,16 +1,14 @@
|
||||
const { test } = require('@playwright/test');
|
||||
const { test } = require('../fixtures');
|
||||
const { fullyParallel } = require('../playwright.config');
|
||||
const { linkIssue, initializePages } = require('../core/helpers');
|
||||
const { Chat } = require('./chat');
|
||||
|
||||
test.describe('Chat', () => {
|
||||
const chat = new Chat();
|
||||
let context;
|
||||
|
||||
test.describe.configure({ mode: fullyParallel ? 'parallel' : 'serial' });
|
||||
test[fullyParallel ? 'beforeEach' : 'beforeAll'](async ({ browser }) => {
|
||||
const { context: innerContext } = await initializePages(chat, browser, { isMultiUser: true });
|
||||
context = innerContext;
|
||||
await initializePages(chat, browser, { isMultiUser: true });
|
||||
});
|
||||
|
||||
// https://docs.bigbluebutton.org/2.6/release-tests.html#public-message-automated
|
||||
@ -28,7 +26,7 @@ test.describe('Chat', () => {
|
||||
});
|
||||
|
||||
test.skip('Copy chat', async () => {
|
||||
await chat.copyChat(context);
|
||||
await chat.copyChat();
|
||||
});
|
||||
|
||||
test('Save chat @ci', async ({}, testInfo) => {
|
||||
@ -78,7 +76,7 @@ test.describe('Chat', () => {
|
||||
await chat.autoConvertEmojiCopyChat();
|
||||
});
|
||||
|
||||
test('Auto convert emoji save chat', async ({ context }, testInfo) => {
|
||||
test('Auto convert emoji save chat', async ({}, testInfo) => {
|
||||
await chat.autoConvertEmojiSaveChat(testInfo);
|
||||
});
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
const { test, devices } = require('@playwright/test');
|
||||
const { test } = require('../fixtures');
|
||||
const { ScreenShare, MultiUserScreenShare } = require('../screenshare/screenshare');
|
||||
const { sleep, checkRootPermission } = require('../core/helpers');
|
||||
const { checkRootPermission } = require('../core/helpers');
|
||||
const e = require('../core/elements');
|
||||
const { getCurrentTCPSessions, killTCPSessions } = require('./util');
|
||||
const notificationsUtil = require('../notifications/util');
|
||||
const deepEqual = require('deep-equal');
|
||||
|
||||
test.describe.parallel('Connection failure', () => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const { test } = require('@playwright/test');
|
||||
const { test } = require('../fixtures');
|
||||
const { ConnectionStatus } = require('./connectionStatus');
|
||||
|
||||
test.describe.parallel('Connection Status', () => {
|
||||
|
@ -17,7 +17,8 @@ exports.lowerHandBtn = 'div[data-test="lowerHandBtn"]';
|
||||
exports.raiseHandRejection = 'button[data-test="raiseHandRejection"]';
|
||||
exports.meetingEndedModal = 'div[data-test="meetingEndedModal"]';
|
||||
exports.leaveMeetingDropdown = 'button[data-test="leaveMeetingDropdown"]';
|
||||
exports.logoutBtn = 'li[data-test="logoutButton"]';
|
||||
exports.directLogoutButton = 'li[data-test="directLogoutButton"]';
|
||||
exports.optionsLogoutButton = 'li[data-test="optionsLogoutButton"]';
|
||||
exports.rating = 'div[data-test="rating"]';
|
||||
exports.errorScreenMessage = 'h1[data-test="errorScreenMessage"]';
|
||||
exports.errorMessageLabel = 'span[id="error-message"]';
|
||||
|
@ -168,10 +168,6 @@ async function initializePages(testInstance, browser, initOptions) {
|
||||
const page = await context.newPage();
|
||||
await testInstance.initModPage(page, true, { createParameter, joinParameter });
|
||||
if (isMultiUser) await testInstance.initUserPage(true, context, { createParameter, joinParameter });
|
||||
|
||||
return {
|
||||
context,
|
||||
};
|
||||
}
|
||||
|
||||
exports.getRandomInt = getRandomInt;
|
||||
|
@ -1,7 +1,6 @@
|
||||
require('dotenv').config();
|
||||
const { expect, default: test } = require('@playwright/test');
|
||||
const { readFileSync } = require('fs');
|
||||
|
||||
const parameters = require('./parameters');
|
||||
const helpers = require('./helpers');
|
||||
const e = require('./elements');
|
||||
@ -15,6 +14,9 @@ class Page {
|
||||
this.browser = browser;
|
||||
this.page = page;
|
||||
this.initParameters = Object.assign({}, parameters);
|
||||
try {
|
||||
this.context = page.context();
|
||||
} catch { } // page doesn't have context - likely an iframe
|
||||
}
|
||||
|
||||
async bringToFront() {
|
||||
@ -95,10 +97,11 @@ class Page {
|
||||
|
||||
if (directLeaveButton) {
|
||||
await this.waitAndClick(e.leaveMeetingDropdown);
|
||||
await this.waitAndClick(e.directLogoutButton);
|
||||
} else {
|
||||
await this.waitAndClick(e.optionsButton);
|
||||
await this.waitAndClick(e.optionsLogoutButton);
|
||||
}
|
||||
await this.waitAndClick(e.logoutBtn);
|
||||
}
|
||||
|
||||
async shareWebcam(shouldConfirmSharing = true, videoPreviewTimeout = ELEMENT_WAIT_TIME) {
|
||||
|
15
bigbluebutton-tests/playwright/fixtures.js
Normal file
15
bigbluebutton-tests/playwright/fixtures.js
Normal file
@ -0,0 +1,15 @@
|
||||
const base = require('@playwright/test');
|
||||
const { fullyParallel } = require('./playwright.config');
|
||||
|
||||
exports.test = base.test.extend({
|
||||
sharedEachTestHook: [ async ({ browser }, use) => {
|
||||
// before test
|
||||
await use();
|
||||
// after test
|
||||
if (fullyParallel) {
|
||||
while (browser.contexts().length > 0) {
|
||||
await browser.contexts()[0].close();
|
||||
}
|
||||
}
|
||||
}, { scope: 'test', auto: true }],
|
||||
});
|
@ -1,4 +1,4 @@
|
||||
const { test } = require('@playwright/test');
|
||||
const { test } = require('../fixtures');
|
||||
const { fullyParallel } = require('../playwright.config');
|
||||
const { encodeCustomParams } = require('../parameters/util');
|
||||
const { PARAMETER_HIDE_PRESENTATION_TOAST } = require('../core/constants');
|
||||
@ -12,7 +12,7 @@ test.describe("Layout management", () => {
|
||||
|
||||
test.describe.configure({ mode: fullyParallel ? 'parallel' : 'serial' });
|
||||
test[fullyParallel ? 'beforeEach' : 'beforeAll'](async ({ browser }) => {
|
||||
await initializePages(layouts, browser, true, { isMultiUser: true, createParameter: hidePresentationToast });
|
||||
await initializePages(layouts, browser, { isMultiUser: true, createParameter: hidePresentationToast });
|
||||
await layouts.modPage.shareWebcam();
|
||||
await layouts.userPage.shareWebcam();
|
||||
});
|
||||
|
@ -13,16 +13,16 @@ class LearningDashboard extends MultiUsers {
|
||||
super(browser, context);
|
||||
}
|
||||
|
||||
async getDashboardPage(context) {
|
||||
async getDashboardPage() {
|
||||
await this.modPage.waitAndClick(e.manageUsers);
|
||||
|
||||
const [dashboardPage] = await Promise.all([
|
||||
context.waitForEvent('page'),
|
||||
this.modPage.context.waitForEvent('page'),
|
||||
this.modPage.waitAndClick(e.learningDashboard),
|
||||
]);
|
||||
|
||||
await expect(dashboardPage).toHaveTitle(/Dashboard/);
|
||||
this.dashboardPage = new Page(context, dashboardPage);
|
||||
this.dashboardPage = new Page(this.modPage.context, dashboardPage);
|
||||
}
|
||||
|
||||
async writeOnPublicChat() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const { test } = require('@playwright/test');
|
||||
const { test } = require('../fixtures');
|
||||
const { fullyParallel } = require('../playwright.config');
|
||||
const { LearningDashboard } = require('./learningdashboard');
|
||||
const c = require('../parameters/constants');
|
||||
@ -9,8 +9,8 @@ test.describe('Learning Dashboard', async () => {
|
||||
|
||||
test.describe.configure({ mode: fullyParallel ? 'parallel' : 'serial' });
|
||||
test[fullyParallel ? 'beforeEach' : 'beforeAll'](async ({ browser }) => {
|
||||
const { context } = await initializePages(learningDashboard, browser, { createParameter: c.recordMeeting });
|
||||
await learningDashboard.getDashboardPage(context);
|
||||
await initializePages(learningDashboard, browser, { createParameter: c.recordMeeting });
|
||||
await learningDashboard.getDashboardPage();
|
||||
});
|
||||
|
||||
test('Check message', async() => {
|
||||
@ -21,8 +21,8 @@ test.describe('Learning Dashboard', async () => {
|
||||
await learningDashboard.userTimeOnMeeting();
|
||||
});
|
||||
|
||||
test('Polls @ci', async ({ context }) => {
|
||||
await learningDashboard.initUserPage(true, context, { isRecording: true });
|
||||
test('Polls @ci', async () => {
|
||||
await learningDashboard.initUserPage(true, learningDashboard.modPage.context, { isRecording: true });
|
||||
await learningDashboard.polls();
|
||||
});
|
||||
|
||||
@ -34,7 +34,7 @@ test.describe('Learning Dashboard', async () => {
|
||||
await learningDashboard.overview();
|
||||
});
|
||||
|
||||
test('Download Session Learning Dashboard @ci', async ({ context }, testInfo) => {
|
||||
test('Download Session Learning Dashboard @ci', async ({}, testInfo) => {
|
||||
await learningDashboard.downloadSessionLearningDashboard(testInfo);
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
const { test } = require('@playwright/test');
|
||||
const { test } = require('../fixtures');
|
||||
const { Notifications } = require('./notifications');
|
||||
const { ChatNotifications } = require('./chatNotifications');
|
||||
const { PresenterNotifications } = require('./presenterNotifications');
|
||||
|
@ -16,9 +16,9 @@ class Options extends MultiUsers {
|
||||
await this.modPage.waitAndClick(e.closeModal);
|
||||
}
|
||||
|
||||
async openHelp(context) {
|
||||
async openHelp() {
|
||||
await this.modPage.waitAndClick(e.optionsButton);
|
||||
const newPage = await this.modPage.handleNewTab(e.helpButton, context);
|
||||
const newPage = await this.modPage.handleNewTab(e.helpButton, this.modPage.context);
|
||||
await expect(newPage).toHaveTitle(/Tutorials/);
|
||||
await newPage.close();
|
||||
await this.modPage.hasElement(e.whiteboard);
|
||||
|
@ -1,16 +1,14 @@
|
||||
const { test } = require('@playwright/test');
|
||||
const { test } = require('../fixtures');
|
||||
const { fullyParallel } = require('../playwright.config');
|
||||
const { Options } = require('./options');
|
||||
const { initializePages } = require('../core/helpers');
|
||||
|
||||
test.describe('Options', () => {
|
||||
const options = new Options();
|
||||
let context;
|
||||
|
||||
test.describe.configure({ mode: fullyParallel ? 'parallel' : 'serial' });
|
||||
test[fullyParallel ? 'beforeEach' : 'beforeAll'](async ({ browser }) => {
|
||||
const { context: innerContext } = await initializePages(options, browser);
|
||||
context = innerContext;
|
||||
await initializePages(options, browser);
|
||||
});
|
||||
|
||||
test('Open about modal', async () => {
|
||||
@ -18,7 +16,7 @@ test.describe('Options', () => {
|
||||
});
|
||||
|
||||
test('Open Help Button', async () => {
|
||||
await options.openHelp(context);
|
||||
await options.openHelp();
|
||||
});
|
||||
|
||||
test('Locales test', async () => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const { test } = require('@playwright/test');
|
||||
const { test } = require('../fixtures');
|
||||
const { CustomParameters } = require('./customparameters');
|
||||
const { DisabledFeatures } = require('./disabledFeatures');
|
||||
const c = require('./constants');
|
||||
|
@ -3,7 +3,6 @@ const { chromiumConfig, firefoxConfig, webkitConfig } = require('./core/browsers
|
||||
const { ELEMENT_WAIT_TIME } = require('./core/constants');
|
||||
|
||||
const CI = process.env.CI === 'true';
|
||||
const DEBUG_MODE = process.env.DEBUG_MODE === 'true';
|
||||
|
||||
const config = {
|
||||
workers: CI ? 1 : 2,
|
||||
@ -16,9 +15,7 @@ const config = {
|
||||
fullyParallel: CI,
|
||||
use: {
|
||||
headless: true,
|
||||
trace: DEBUG_MODE ? 'on'
|
||||
: CI ? 'retain-on-failure'
|
||||
: 'off',
|
||||
trace: 'on',
|
||||
screenshot: 'on',
|
||||
video: 'on',
|
||||
},
|
||||
|
@ -1,4 +1,4 @@
|
||||
const { test } = require('@playwright/test');
|
||||
const { test } = require('../fixtures');
|
||||
const { fullyParallel } = require('../playwright.config');
|
||||
const { Polling } = require('./poll');
|
||||
const { initializePages } = require('../core/helpers');
|
||||
|
@ -1,4 +1,4 @@
|
||||
const { test } = require('@playwright/test');
|
||||
const { test } = require('../fixtures');
|
||||
const { encodeCustomParams } = require('../parameters/util');
|
||||
const { Presentation } = require('./presentation');
|
||||
const { linkIssue } = require('../core/helpers');
|
||||
|
@ -1,4 +1,4 @@
|
||||
const { test } = require('@playwright/test');
|
||||
const { test } = require('../fixtures');
|
||||
const { Reconnection } = require('./reconnection');
|
||||
const { checkRootPermission } = require('../core/helpers');
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
const { test, devices } = require('@playwright/test');
|
||||
const { test } = require('../fixtures');
|
||||
const { devices } = require('@playwright/test');
|
||||
const { ScreenShare } = require('./screenshare');
|
||||
|
||||
test.describe.parallel('Screenshare', () => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const { test } = require('@playwright/test');
|
||||
const { test } = require('../fixtures');
|
||||
const { SharedNotes } = require('./sharednotes');
|
||||
const { initializePages } = require('../core/helpers');
|
||||
const { fullyParallel } = require('../playwright.config');
|
||||
|
@ -1,4 +1,4 @@
|
||||
const { test } = require('@playwright/test');
|
||||
const { test } = require('../fixtures');
|
||||
const { Stress } = require('./stress.js');
|
||||
|
||||
test.describe.parallel('Stress', () => {
|
||||
|
@ -1,4 +1,5 @@
|
||||
const { test, devices } = require('@playwright/test');
|
||||
const { devices } = require('@playwright/test');
|
||||
const { test } = require('../fixtures');
|
||||
const { Status } = require('./status');
|
||||
const { MultiUsers } = require('./multiusers');
|
||||
const { GuestPolicy } = require('./guestPolicy');
|
||||
|
@ -1,4 +1,4 @@
|
||||
const { test } = require('@playwright/test');
|
||||
const { test } = require('../fixtures');
|
||||
const { VirtualizeList } = require('./virtualize');
|
||||
|
||||
test.describe.parallel('Virtualize list', () => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const { test } = require('@playwright/test');
|
||||
const { test } = require('../fixtures');
|
||||
const { MultiUsers } = require('../user/multiusers');
|
||||
const { Webcam } = require('./webcam');
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
const { test } = require('@playwright/test');
|
||||
const { test } = require('../fixtures');
|
||||
const { Draw } = require('./draw');
|
||||
const { DrawRectangle } = require('./drawRectangle');
|
||||
const { DrawEllipse } = require('./drawEllipse');
|
||||
|
Loading…
Reference in New Issue
Block a user