2016-10-04 20:39:20 -07:00
/**
* @license
2020-05-19 12:08:49 -07:00
* Copyright Google LLC All Rights Reserved.
2016-10-04 20:39:20 -07:00
*
* Use of this source code is governed by an MIT-style license that can be
2024-09-20 09:23:15 -06:00
* found in the LICENSE file at https://angular.dev/license
2016-10-04 20:39:20 -07:00
*/
// Unique place to configure the browsers which are used in the different CI jobs in Sauce Labs (SL)
2015-12-10 14:40:00 +01:00
// If the target is set to null, then the browser is not run anywhere during CI.
2016-10-04 20:39:20 -07:00
// If a category becomes empty (e.g. BS and required), then the corresponding job must be commented
2019-01-08 12:41:24 +01:00
// out in the CI configuration.
2021-11-25 20:07:49 +01:00
const config = {
2024-05-08 00:33:43 +02:00
'Android13' : { unitTest : { target : 'SL' , required : true } } ,
'Android14' : { unitTest : { target : 'SL' , required : true } } ,
2015-12-10 14:40:00 +01:00
} ;
2021-11-25 20:07:49 +01:00
/** Whether browsers should be remotely acquired in debug mode. */
const debugMode = false ;
2024-05-08 00:33:43 +02:00
// Karma-sauce-launcher isn't really maintained and doesn't support officially appium2
// Looking at the source code https://github.com/karma-runner/karma-sauce-launcher/blob/69dcb822a45d29e57297b0eda7af4123ae55aafd/src/process-config.ts#L60
// We can force the config to be recognized as W3C by setting a browserVersion property
const browserVersion = 'latest' ;
2022-05-08 14:38:17 -07:00
// Specific platform configuration can be found at:
// https://saucelabs.com/platform/platform-configurator
2021-11-25 20:07:49 +01:00
const customLaunchers = {
2024-05-08 00:33:43 +02:00
'SL_ANDROID13' : {
2020-02-06 15:50:14 -08:00
base : 'SauceLabs' ,
2021-11-25 20:07:49 +01:00
platformName : 'Android' ,
2024-05-08 00:33:43 +02:00
browserName : 'Chrome' ,
browserVersion ,
'appium:deviceName' : 'Google Pixel 5a GoogleAPI Emulator' ,
'appium:platformVersion' : '13.0' ,
'appium:automationName' : 'uiautomator2' ,
'sauce:options' : {
appiumVersion : '2.0.0' ,
extendedDebugging : debugMode ,
} ,
2020-02-06 15:50:14 -08:00
} ,
2024-05-08 00:33:43 +02:00
'SL_ANDROID14' : {
2020-02-06 15:50:14 -08:00
base : 'SauceLabs' ,
2021-11-25 20:07:49 +01:00
platformName : 'Android' ,
2024-05-08 00:33:43 +02:00
browserName : 'Chrome' ,
browserVersion ,
'appium:deviceName' : 'Google Pixel 6 Pro GoogleAPI Emulator' ,
'appium:platformVersion' : '14.0' ,
'appium:automationName' : 'uiautomator2' ,
'sauce:options' : {
appiumVersion : '2.0.0' ,
extendedDebugging : debugMode ,
} ,
2020-02-06 15:50:14 -08:00
} ,
2015-06-02 16:29:09 +02:00
} ;
2021-11-25 20:07:49 +01:00
const sauceAliases = {
2015-12-10 14:40:00 +01:00
'CI_REQUIRED' : buildConfiguration ( 'unitTest' , 'SL' , true ) ,
'CI_OPTIONAL' : buildConfiguration ( 'unitTest' , 'SL' , false ) ,
2015-06-02 16:29:09 +02:00
} ;
module . exports = {
2022-05-08 14:38:17 -07:00
customLaunchers : customLaunchers ,
sauceAliases : sauceAliases ,
2016-04-28 17:50:03 -07:00
} ;
2015-12-10 14:40:00 +01:00
function buildConfiguration ( type , target , required ) {
2021-11-25 20:07:49 +01:00
return Object . keys ( config )
2016-10-04 20:39:20 -07:00
. filter ( ( item ) => {
2021-11-25 20:07:49 +01:00
const conf = config [ item ] [ type ] ;
2016-10-04 20:39:20 -07:00
return conf . required === required && conf . target === target ;
} )
. map ( ( item ) => target + '_' + item . toUpperCase ( ) ) ;
2015-12-10 14:40:00 +01:00
}