2022-03-21 14:23:50 +01:00
|
|
|
import { Capabilities } from 'selenium-webdriver';
|
2022-10-17 11:42:04 +02:00
|
|
|
import * as chrome from 'selenium-webdriver/chrome';
|
|
|
|
import { LAUNCH_MODE } from './config';
|
2022-03-21 14:23:50 +01:00
|
|
|
|
|
|
|
interface BrowserConfig {
|
|
|
|
appUrl: string;
|
|
|
|
seleniumAddress: string;
|
|
|
|
browserCapabilities: Capabilities;
|
|
|
|
browserOptions: chrome.Options;
|
|
|
|
browserName: string;
|
|
|
|
}
|
|
|
|
|
2024-07-02 19:19:05 +02:00
|
|
|
const chromeArguments = [
|
|
|
|
'--window-size=1300,1000',
|
2025-05-21 11:55:44 +02:00
|
|
|
// '--headless',
|
2024-07-02 19:19:05 +02:00
|
|
|
'--use-fake-ui-for-media-stream',
|
|
|
|
'--use-fake-device-for-media-stream',
|
2025-05-21 13:24:08 +02:00
|
|
|
'--use-file-for-fake-audio-capture=e2e/assets/audio_test.wav'
|
2024-07-02 19:19:05 +02:00
|
|
|
];
|
2022-10-27 17:51:51 +02:00
|
|
|
const chromeArgumentsCI = [
|
2024-07-02 19:19:05 +02:00
|
|
|
'--window-size=1300,1000',
|
2022-06-02 17:05:41 +02:00
|
|
|
'--headless',
|
2022-10-17 11:42:04 +02:00
|
|
|
'--no-sandbox',
|
|
|
|
'--disable-gpu',
|
2022-10-27 17:51:51 +02:00
|
|
|
'--disable-popup-blocking',
|
|
|
|
'--no-first-run',
|
|
|
|
'--no-default-browser-check',
|
2022-03-21 14:23:50 +01:00
|
|
|
'--disable-dev-shm-usage',
|
2022-10-27 17:51:51 +02:00
|
|
|
'--disable-background-networking',
|
|
|
|
'--disable-default-apps',
|
2022-03-21 14:23:50 +01:00
|
|
|
'--use-fake-ui-for-media-stream',
|
2025-05-21 13:13:56 +02:00
|
|
|
'--use-fake-device-for-media-stream',
|
2025-05-21 13:24:08 +02:00
|
|
|
'--use-file-for-fake-audio-capture=e2e/assets/audio_test.wav'
|
2022-03-21 14:23:50 +01:00
|
|
|
];
|
2024-07-02 19:19:05 +02:00
|
|
|
const chromeArgumentsWithoutMediaDevices = ['--headless', '--window-size=1300,900', '--deny-permission-prompts'];
|
2022-10-27 17:51:51 +02:00
|
|
|
const chromeArgumentsWithoutMediaDevicesCI = [
|
2024-07-02 19:19:05 +02:00
|
|
|
'--window-size=1300,900',
|
2022-10-27 17:51:51 +02:00
|
|
|
'--headless',
|
|
|
|
'--no-sandbox',
|
|
|
|
'--disable-gpu',
|
|
|
|
'--disable-popup-blocking',
|
|
|
|
'--no-first-run',
|
|
|
|
'--no-default-browser-check',
|
|
|
|
'--disable-dev-shm-usage',
|
|
|
|
'--disable-background-networking',
|
|
|
|
'--disable-default-apps',
|
|
|
|
'--deny-permission-prompts'
|
|
|
|
];
|
2022-03-21 14:23:50 +01:00
|
|
|
|
|
|
|
export const WebComponentConfig: BrowserConfig = {
|
|
|
|
appUrl: 'http://localhost:8080/',
|
2024-07-30 15:48:13 +02:00
|
|
|
seleniumAddress: LAUNCH_MODE === 'CI' ? 'http://localhost:4444/wd/hub' : '',
|
2022-03-21 14:23:50 +01:00
|
|
|
browserName: 'chrome',
|
|
|
|
browserCapabilities: Capabilities.chrome().set('acceptInsecureCerts', true),
|
2022-11-16 11:35:07 +01:00
|
|
|
browserOptions: new chrome.Options().addArguments(...(LAUNCH_MODE === 'CI' ? chromeArgumentsCI : chromeArguments))
|
2022-03-21 14:23:50 +01:00
|
|
|
};
|
|
|
|
|
2025-05-20 12:38:20 +02:00
|
|
|
export const TestAppConfig: BrowserConfig = {
|
|
|
|
appUrl: 'http://localhost:4200/#/call?staticVideos=false',
|
|
|
|
seleniumAddress: LAUNCH_MODE === 'CI' ? 'http://localhost:4444/wd/hub' : '',
|
|
|
|
browserName: 'chrome',
|
|
|
|
browserCapabilities: Capabilities.chrome().set('acceptInsecureCerts', true),
|
|
|
|
browserOptions: new chrome.Options().addArguments(...(LAUNCH_MODE === 'CI' ? chromeArgumentsCI : chromeArguments))
|
|
|
|
};
|
|
|
|
|
2024-07-29 13:20:07 +02:00
|
|
|
export const NestedConfig: BrowserConfig = {
|
2022-06-02 13:32:14 +02:00
|
|
|
appUrl: 'http://localhost:4200/#/testing',
|
2024-07-29 13:27:43 +02:00
|
|
|
seleniumAddress: LAUNCH_MODE === 'CI' ? 'http://localhost:4444/wd/hub' : '',
|
2022-03-21 14:23:50 +01:00
|
|
|
browserName: 'Chrome',
|
|
|
|
browserCapabilities: Capabilities.chrome().set('acceptInsecureCerts', true),
|
|
|
|
browserOptions: new chrome.Options().addArguments(...(LAUNCH_MODE === 'CI' ? chromeArgumentsCI : chromeArguments))
|
|
|
|
};
|
2022-10-27 17:51:51 +02:00
|
|
|
|
|
|
|
export function getBrowserOptionsWithoutDevices() {
|
2024-04-18 17:40:37 +02:00
|
|
|
if (LAUNCH_MODE === 'CI') {
|
2022-10-27 17:51:51 +02:00
|
|
|
return new chrome.Options().addArguments(...chromeArgumentsWithoutMediaDevicesCI);
|
|
|
|
} else {
|
|
|
|
return new chrome.Options().addArguments(...chromeArgumentsWithoutMediaDevices);
|
|
|
|
}
|
|
|
|
}
|