mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2025-12-30 03:12:29 +00:00
feat(tests): Handle checking for grid by updating merged config.
This commit is contained in:
@@ -17,8 +17,6 @@ const allure = require('allure-commandline');
|
||||
// we need it to be able to reuse jitsi-meet code in tests
|
||||
require.extensions['.web.ts'] = require.extensions['.ts'];
|
||||
|
||||
const usingGrid = Boolean(new URL(import.meta.url).searchParams.get('grid'));
|
||||
|
||||
const chromeArgs = [
|
||||
'--allow-insecure-localhost',
|
||||
'--use-fake-ui-for-media-stream',
|
||||
@@ -35,8 +33,7 @@ const chromeArgs = [
|
||||
// Avoids - "You are checking for animations on an inactive tab, animations do not run for inactive tabs"
|
||||
// when executing waitForStable()
|
||||
'--disable-renderer-backgrounding',
|
||||
`--use-file-for-fake-audio-capture=${
|
||||
usingGrid ? process.env.REMOTE_RESOURCE_PATH : 'tests/resources'}/fakeAudioStream.wav`
|
||||
'--use-file-for-fake-audio-capture=tests/resources/fakeAudioStream.wav'
|
||||
];
|
||||
|
||||
if (process.env.RESOLVER_RULES) {
|
||||
|
||||
@@ -4,15 +4,37 @@ import { merge } from 'lodash-es';
|
||||
import { URL } from 'url';
|
||||
|
||||
// @ts-ignore
|
||||
import { config as defaultConfig } from './wdio.conf.ts?grid=true';
|
||||
import { config as defaultConfig } from './wdio.conf.ts';
|
||||
|
||||
const gridUrl = new URL(process.env.GRID_HOST_URL as string);
|
||||
const protocol = gridUrl.protocol.replace(':', '');
|
||||
|
||||
export const config = merge(defaultConfig, {
|
||||
const mergedConfig = merge(defaultConfig, {
|
||||
protocol,
|
||||
hostname: gridUrl.hostname,
|
||||
port: gridUrl.port ? parseInt(gridUrl.port, 10) // Convert port to number
|
||||
: protocol === 'http' ? 80 : 443,
|
||||
path: gridUrl.pathname
|
||||
}, { clone: false });
|
||||
|
||||
mergedConfig.capabilities.participant1.capabilities['goog:chromeOptions'].args
|
||||
= updateRemoteResource(mergedConfig.capabilities.participant1.capabilities['goog:chromeOptions'].args);
|
||||
mergedConfig.capabilities.participant2.capabilities['goog:chromeOptions'].args
|
||||
= updateRemoteResource(mergedConfig.capabilities.participant2.capabilities['goog:chromeOptions'].args);
|
||||
mergedConfig.capabilities.participant3.capabilities['goog:chromeOptions'].args
|
||||
= updateRemoteResource(mergedConfig.capabilities.participant3.capabilities['goog:chromeOptions'].args);
|
||||
mergedConfig.capabilities.participant4.capabilities['goog:chromeOptions'].args
|
||||
= updateRemoteResource(mergedConfig.capabilities.participant4.capabilities['goog:chromeOptions'].args);
|
||||
|
||||
export const config = mergedConfig;
|
||||
|
||||
/**
|
||||
* Updates the array of arguments for the Chrome browser to use a remote resource for fake audio capture.
|
||||
* @param arr
|
||||
*/
|
||||
function updateRemoteResource(arr: string[]): string[] {
|
||||
// eslint-disable-next-line no-confusing-arrow
|
||||
return arr.map((item: string) => item.startsWith('--use-file-for-fake-audio-capture=')
|
||||
? `--use-file-for-fake-audio-capture=${process.env.REMOTE_RESOURCE_PATH}/fakeAudioStream.wav` : item
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user