Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(tests): drop @wdio/globals value imports, use multiRemoteBrowser

damencho6f4e15cad2f8
diff --git a/tests/helpers/Participant.ts b/tests/helpers/Participant.ts
index abfbd84dc1..a9eb56a07e 100644
--- a/tests/helpers/Participant.ts
+++ b/tests/helpers/Participant.ts
@@ -1,6 +1,5 @@
/* global APP $ */
-import { multiremotebrowser } from '@wdio/globals';
import assert from 'assert';
import { Key } from 'webdriverio';
@@ -176,7 +175,7 @@ export class Participant {
* The driver it uses.
*/
get driver() {
- return multiremotebrowser.getInstance(this._name);
+ return multiRemoteBrowser.getInstance(this._name);
}
/**
diff --git a/tests/helpers/TestProperties.ts b/tests/helpers/TestProperties.ts
index ed5059eb3c..80a5d8d704 100644
--- a/tests/helpers/TestProperties.ts
+++ b/tests/helpers/TestProperties.ts
@@ -70,9 +70,18 @@ export function loadTestFiles(files: string[]): void {
testGlobals.forEach(fn => {
originalTestFunctions[fn] = (global as any)[fn];
- (global as any)[fn] = () => {
+ const stub: any = () => {
// do nothing
};
+
+ // helpers/matchers.ts calls expect.extend({...}) at module load to
+ // register a custom matcher; without a stub for .extend the require()
+ // below would throw and we'd skip the spec's setTestProperties calls.
+ if (fn === 'expect') {
+ stub.extend = () => { /* no-op */ };
+ }
+
+ (global as any)[fn] = stub;
});
try {
diff --git a/tests/helpers/matchers.ts b/tests/helpers/matchers.ts
index f2eff8facd..c7a1843259 100644
--- a/tests/helpers/matchers.ts
+++ b/tests/helpers/matchers.ts
@@ -1,5 +1,3 @@
-import { expect } from '@wdio/globals';
-
expect.extend({
toPartiallyMatch(received: string, other: string, receivedLabel = 'received', otherLabel = 'other') {
const pass = received.includes(other) || other.includes(received);
diff --git a/tests/specs/iframe/chat.spec.ts b/tests/specs/iframe/chat.spec.ts
index 0affc2e1c6..135a01c128 100644
--- a/tests/specs/iframe/chat.spec.ts
+++ b/tests/specs/iframe/chat.spec.ts
@@ -1,5 +1,3 @@
-import { expect } from '@wdio/globals';
-
import type { Participant } from '../../helpers/Participant';
import { setTestProperties } from '../../helpers/TestProperties';
import { config as testsConfig } from '../../helpers/TestsConfig';
diff --git a/tests/specs/iframe/util.ts b/tests/specs/iframe/util.ts
index 5eac5ca72a..4024eb65dc 100644
--- a/tests/specs/iframe/util.ts
+++ b/tests/specs/iframe/util.ts
@@ -1,5 +1,3 @@
-import { expect } from '@wdio/globals';
-
import type { Participant } from '../../helpers/Participant';
import { expectations } from '../../helpers/expectations';
diff --git a/tests/specs/jaas/chat.spec.ts b/tests/specs/jaas/chat.spec.ts
index 72d23befe4..78ef87dde7 100644
--- a/tests/specs/jaas/chat.spec.ts
+++ b/tests/specs/jaas/chat.spec.ts
@@ -1,5 +1,3 @@
-import { expect } from '@wdio/globals';
-
import type { Participant } from '../../helpers/Participant';
import { setTestProperties } from '../../helpers/TestProperties';
import { config as testsConfig } from '../../helpers/TestsConfig';
diff --git a/tests/specs/jaas/dial/dialin.spec.ts b/tests/specs/jaas/dial/dialin.spec.ts
index ad3e0e41aa..7242372507 100644
--- a/tests/specs/jaas/dial/dialin.spec.ts
+++ b/tests/specs/jaas/dial/dialin.spec.ts
@@ -1,5 +1,3 @@
-import { expect } from '@wdio/globals';
-
import '../../../helpers/matchers';
import type { Participant } from '../../../helpers/Participant';
import { setTestProperties } from '../../../helpers/TestProperties';
diff --git a/tests/specs/jaas/fileSharing.spec.ts b/tests/specs/jaas/fileSharing.spec.ts
index 9ef2faeff3..b6c881c8fe 100644
--- a/tests/specs/jaas/fileSharing.spec.ts
+++ b/tests/specs/jaas/fileSharing.spec.ts
@@ -1,5 +1,3 @@
-import { expect } from '@wdio/globals';
-
import type { Participant } from '../../helpers/Participant';
import { setTestProperties } from '../../helpers/TestProperties';
import { expectations } from '../../helpers/expectations';
diff --git a/tests/specs/jaas/presence.spec.ts b/tests/specs/jaas/presence.spec.ts
index a4914b8cc3..f8ba3c67e0 100644
--- a/tests/specs/jaas/presence.spec.ts
+++ b/tests/specs/jaas/presence.spec.ts
@@ -1,5 +1,3 @@
-import { expect } from '@wdio/globals';
-
import { Participant } from '../../helpers/Participant';
import { setTestProperties } from '../../helpers/TestProperties';
import { config as testsConfig } from '../../helpers/TestsConfig';
diff --git a/tests/specs/jaas/recording.spec.ts b/tests/specs/jaas/recording.spec.ts
index 72b22a73b8..3a9558d55f 100644
--- a/tests/specs/jaas/recording.spec.ts
+++ b/tests/specs/jaas/recording.spec.ts
@@ -1,5 +1,3 @@
-import { expect } from '@wdio/globals';
-
import '../../helpers/matchers';
import { Participant } from '../../helpers/Participant';
import { setTestProperties } from '../../helpers/TestProperties';
diff --git a/tests/specs/jaas/transcriptions.spec.ts b/tests/specs/jaas/transcriptions.spec.ts
index 9723a6d3b9..74b0cdd770 100644
--- a/tests/specs/jaas/transcriptions.spec.ts
+++ b/tests/specs/jaas/transcriptions.spec.ts
@@ -1,5 +1,3 @@
-import { expect } from '@wdio/globals';
-
import '../../helpers/matchers';
import type { Participant } from '../../helpers/Participant';
import { setTestProperties } from '../../helpers/TestProperties';
diff --git a/tests/specs/jaas/visitors/visitorsLive.spec.ts b/tests/specs/jaas/visitors/visitorsLive.spec.ts
index f03797ae40..11a1da7506 100644
--- a/tests/specs/jaas/visitors/visitorsLive.spec.ts
+++ b/tests/specs/jaas/visitors/visitorsLive.spec.ts
@@ -1,5 +1,3 @@
-import { expect } from '@wdio/globals';
-
import { Participant } from '../../../helpers/Participant';
import { setTestProperties } from '../../../helpers/TestProperties';
import { expectations } from '../../../helpers/expectations';
diff --git a/tests/specs/misc/connectivity.spec.ts b/tests/specs/misc/connectivity.spec.ts
index 9518e0c949..16a4e3b04a 100644
--- a/tests/specs/misc/connectivity.spec.ts
+++ b/tests/specs/misc/connectivity.spec.ts
@@ -1,5 +1,3 @@
-import { expect } from '@wdio/globals';
-
import '../../helpers/matchers';
import type { Participant } from '../../helpers/Participant';
import { setTestProperties } from '../../helpers/TestProperties';
diff --git a/tests/specs/moderation/grantModerator.spec.ts b/tests/specs/moderation/grantModerator.spec.ts
index 9d99a78c9d..bfc26e2cbd 100644
--- a/tests/specs/moderation/grantModerator.spec.ts
+++ b/tests/specs/moderation/grantModerator.spec.ts
@@ -1,5 +1,3 @@
-import { expect } from '@wdio/globals';
-
import { Participant } from '../../helpers/Participant';
import { setTestProperties } from '../../helpers/TestProperties';
import { expectations } from '../../helpers/expectations';
diff --git a/tests/specs/moderation/lobby.spec.ts b/tests/specs/moderation/lobby.spec.ts
index 93f13a81cf..8246a719c6 100644
--- a/tests/specs/moderation/lobby.spec.ts
+++ b/tests/specs/moderation/lobby.spec.ts
@@ -1,5 +1,3 @@
-import { expect } from '@wdio/globals';
-
import '../../helpers/matchers';
import { P1, P3, Participant } from '../../helpers/Participant';
import { setTestProperties } from '../../helpers/TestProperties';
diff --git a/tests/wdio.conf.ts b/tests/wdio.conf.ts
index a0bf40797f..804d9b049c 100644
--- a/tests/wdio.conf.ts
+++ b/tests/wdio.conf.ts
@@ -1,5 +1,4 @@
import AllureReporter from '@wdio/allure-reporter';
-import { multiremotebrowser } from '@wdio/globals';
import { Buffer } from 'buffer';
import fs from 'fs';
import { glob } from 'glob';
@@ -295,7 +294,7 @@ export const config: WebdriverIO.MultiremoteConfig = {
.replace(/\//g, '-');
const testProperties = await getTestProperties(testFilePath);
- console.log(`Running test: ${testName} via worker: ${cid} browser instances:${multiremotebrowser.instances.length}`);
+ console.log(`Running test: ${testName} via worker: ${cid} browser instances:${multiRemoteBrowser.instances.length}`);
const globalAny: any = global;
@@ -310,8 +309,8 @@ export const config: WebdriverIO.MultiremoteConfig = {
return;
}
- await Promise.all(multiremotebrowser.instances.map(async (instance: string) => {
- const bInstance = multiremotebrowser.getInstance(instance);
+ await Promise.all(multiRemoteBrowser.instances.map(async (instance: string) => {
+ const bInstance = multiRemoteBrowser.getInstance(instance);
// @ts-ignore
initLogger(bInstance, `${instance}-${cid}-${testName}`, TEST_RESULTS_DIR);
@@ -404,8 +403,8 @@ export const config: WebdriverIO.MultiremoteConfig = {
* @param {Object} suite - Suite details.
*/
beforeSuite(suite) {
- multiremotebrowser.instances.forEach((instance: string) => {
- logInfo(multiremotebrowser.getInstance(instance),
+ multiRemoteBrowser.instances.forEach((instance: string) => {
+ logInfo(multiRemoteBrowser.getInstance(instance),
`---=== Begin ${suite.file.substring(suite.file.lastIndexOf('/') + 1)} ===---`);
});
},
@@ -449,8 +448,8 @@ export const config: WebdriverIO.MultiremoteConfig = {
return;
}
- multiremotebrowser.instances.forEach((instance: string) => {
- logInfo(multiremotebrowser.getInstance(instance), `---=== Start test ${test.title} ===---`);
+ multiRemoteBrowser.instances.forEach((instance: string) => {
+ logInfo(multiRemoteBrowser.getInstance(instance), `---=== Start test ${test.title} ===---`);
});
},
@@ -463,8 +462,8 @@ export const config: WebdriverIO.MultiremoteConfig = {
* @returns {Promise<void>}
*/
async afterTest(test, context, { error }) {
- multiremotebrowser.instances.forEach((instance: string) =>
- logInfo(multiremotebrowser.getInstance(instance), `---=== End test ${test.title} ===---`));
+ multiRemoteBrowser.instances.forEach((instance: string) =>
+ logInfo(multiRemoteBrowser.getInstance(instance), `---=== End test ${test.title} ===---`));
if (error) {
@@ -472,7 +471,7 @@ export const config: WebdriverIO.MultiremoteConfig = {
ctx.skipSuiteTests = `Test "${test.title}" has failed.`;
// make sure all browsers are at the main app in iframe (if used), so we collect debug info
- await Promise.all(multiremotebrowser.instances.map(async (instance: string) => {
+ await Promise.all(multiRemoteBrowser.instances.map(async (instance: string) => {
// @ts-ignore
await ctx[instance]?.switchToIFrame();
}));
@@ -480,8 +479,8 @@ export const config: WebdriverIO.MultiremoteConfig = {
const allProcessing: Promise<any>[] = [];
const attachments: { content: string | Buffer; filename: string; type: string; }[] = [];
- multiremotebrowser.instances.forEach((instance: string) => {
- const bInstance = multiremotebrowser.getInstance(instance);
+ multiRemoteBrowser.instances.forEach((instance: string) => {
+ const bInstance = multiRemoteBrowser.getInstance(instance);
allProcessing.push(bInstance.takeScreenshot().then(shot => {
attachments.push({
@@ -538,8 +537,8 @@ export const config: WebdriverIO.MultiremoteConfig = {
* @returns {Promise<void>}
*/
afterSuite(suite) {
- multiremotebrowser.instances.forEach((instance: string) => {
- logInfo(multiremotebrowser.getInstance(instance),
+ multiRemoteBrowser.instances.forEach((instance: string) => {
+ logInfo(multiRemoteBrowser.getInstance(instance),
`---=== End ${suite.file.substring(suite.file.lastIndexOf('/') + 1)} ===---`);
});
},