Skip to content

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

test(wdio): skip JaaS tests at capability level when JaaS is not configured

damenchoc09719dabff7
diff --git a/tests/wdio.conf.ts b/tests/wdio.conf.ts
index 095eef8aa4..9a5c67a4ba 100644
--- a/tests/wdio.conf.ts
+++ b/tests/wdio.conf.ts
@@ -68,9 +68,10 @@ const specs = [
* Analyzes test files at config construction time to determine browser requirements
* and generate capabilities with appropriate exclusions.
*/
-function generateCapabilitiesFromSpecs(): Record<string, any> {
+function generateCapabilitiesFromSpecs(): { capabilities: Record<string, any>; excludedSpecs: string[]; } {
const allSpecFiles: string[] = [];
const browsers = [ 'p1', 'p2', 'p3', 'p4', 'p5', 'p6' ];
+ const excludedSpecs: string[] = [];
for (const pattern of specs) {
const matches = glob.sync(pattern, { cwd: path.join(__dirname) });
@@ -98,6 +99,12 @@ function generateCapabilitiesFromSpecs(): Record<string, any> {
const props = testProperties[file];
const relativeFile = path.relative(__dirname, file);
+ // If a test requires JaaS but JaaS is not configured, exclude it at the top level so no worker is created.
+ if (props?.useJaas && !testsConfig.jaas.enabled) {
+ excludedSpecs.push(relativeFile);
+ continue;
+ }
+
// If a test doesn't use a particular browser, add it to exclusions for that browser
if (props?.usesBrowsers) {
browsers.forEach(browser => {
@@ -108,25 +115,28 @@ function generateCapabilitiesFromSpecs(): Record<string, any> {
}
}
- return Object.fromEntries(
- browsers.map(browser => [
- browser,
- {
- capabilities: {
- browserName: 'chrome',
- ...(browser === 'p1' && process.env.BROWSER_CHROME_BETA ? { browserVersion: 'beta' } : {}),
- 'goog:chromeOptions': {
- args: chromeArgs,
- prefs: chromePreferences
- },
- 'wdio:exclude': Array.from(browserExclusions[browser] || [])
+ return {
+ capabilities: Object.fromEntries(
+ browsers.map(browser => [
+ browser,
+ {
+ capabilities: {
+ browserName: 'chrome',
+ ...(browser === 'p1' && process.env.BROWSER_CHROME_BETA ? { browserVersion: 'beta' } : {}),
+ 'goog:chromeOptions': {
+ args: chromeArgs,
+ prefs: chromePreferences
+ },
+ 'wdio:exclude': Array.from(browserExclusions[browser] || [])
+ }
}
- }
- ])
- );
+ ])
+ ),
+ excludedSpecs
+ };
}
-const capabilities = generateCapabilitiesFromSpecs();
+const { capabilities, excludedSpecs } = generateCapabilitiesFromSpecs();
const TEST_RESULTS_DIR = 'test-results';
@@ -137,6 +147,7 @@ export const config: WebdriverIO.MultiremoteConfig = {
runner: 'local',
specs,
+ exclude: excludedSpecs,
maxInstances: parseInt(process.env.MAX_INSTANCES || '1', 10), // if changing check onWorkerStart logic
diff --git a/tests/wdio.firefox.conf.ts b/tests/wdio.firefox.conf.ts
index 3a079466d5..b7de4057ba 100644
--- a/tests/wdio.firefox.conf.ts
+++ b/tests/wdio.firefox.conf.ts
@@ -1,6 +1,6 @@
// wdio.firefox.conf.ts
// extends the main configuration file changing first participant to be Firefox
-import { merge } from 'lodash-es';
+import { mergeWith } from 'lodash-es';
import process from 'node:process';
// @ts-ignore
@@ -19,7 +19,7 @@ if (process.env.HEADLESS === 'true') {
ffArgs.push('--headless');
}
-const mergedConfig = merge(defaultConfig, {
+const mergedConfig = mergeWith(defaultConfig, {
exclude: [
'specs/iframe/*.spec.ts', // FF does not support uploading files (uploadFile)
@@ -50,7 +50,11 @@ const mergedConfig = merge(defaultConfig, {
}
}
}
-}, { clone: false });
+}, (objValue: any, srcValue: any) => {
+ if (Array.isArray(objValue)) {
+ return objValue.concat(srcValue);
+ }
+});
// Remove the chrome options from the first participant
// @ts-ignore