@testim/testim-cli 4.175.0 → 4.176.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +1 -1
- package/cli.js.map +2 -2
- package/npm-shrinkwrap.json +76 -88
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -405,7 +405,7 @@ Please make sure the CLI has stable access to the internet. ${Lc()?"(Internal: n
|
|
|
405
405
|
`).filter(w=>!t(w)&&!e(w)&&!s(w)&&!r(w)&&!i(w)&&!a(w)&&!o(w)&&!n(w)&&!c(w)&&!l(w)&&!d(w)&&!m(w)&&!u(w)&&!f(w)&&!h(w)).join(`
|
|
406
406
|
`))},mn=(s,e)=>{let t=e?`Please use ${e} instead.`:"";console.log(mT.default.yellow(`
|
|
407
407
|
WARNING: ${s} is deprecated. ${t}
|
|
408
|
-
`))},od=["clover","html","json-summary","json","lcov","lcovonly","teamcity","text-lcov","text-summary","text"],{env:rc,argv:cd,exit:id,cwd:At}=global.process,pT={development:{usw2:{servicesUrl:"https://services.dev.testim.io"},euc1:{servicesUrl:"https://services-eu.dev.testim.io"}},staging:{usw2:{servicesUrl:"https://services.staging.testim.io"},euc1:{servicesUrl:"https://services-eu.staging.testim.io"}},production:{usw2:{servicesUrl:"https://services.testim.io"},euc1:{servicesUrl:"https://services-eu.prod.testim.io"}}},JI=async s=>{let e=bs(s),t=await Qc(Xr.CACHE_FN_NAME);if(t&&t.region===e){zs(t.servicesUrl);return}let i=(pT[Hs]||pT.production)[e]||{servicesUrl:"https://services.testim.io"};rc.SERVICES_HOST||zs(i.servicesUrl)},XI=new Set(["trace","debug","info","warn","error","silent"]);Gc(cd,new Set(["run","connect","agent","tunneld","start","init","install-lazy-deps"]));ad.description("Testim.io CLI").option("-h --help","output usage information",hT).option("-o --options-file [options-file.json]","").option("-c --config-file [config-file.js]","").option("--test-data [test-data]","test data file name to include in the test run").option("--test-config [test-config]","test config name to override for all tests in current execution",Be,[]).option("--test-config-id [test-config-id]","test config ID to override for all tests in current execution",Be,[]).option("--params-file [params-file.json | params-file.js]","").option("--params [params-json-string]","").option("-t, --testId [test-id]","test ID to run",Be,[]).option("--test-id [test-id]","test ID to run",Be,[]).option("-l, --label [label]","labels to search test by",Be,[]).option("-n, --name [test-name]","test name to run",Be,[]).option("--project [project-id]","project ID").option("-r, --report-file [report junit xml path]","where to save junit xml results file").option("--urls","add step urls to the junit report").option("--override-report-file-classname [override-report-file-classname]","custom junit class name for the junit reporter").option("--reporters [names]","report types",zI).option("-h, --host [host-name]","host name or ip containing the selenium grid").option("-p, --port [host-port]","host port").option("-g, --grid [grid-name]","grid name").option("--path [grid-path]","grid path").option("--protocol [grid-protocol]","grid protocol http or https").option("--grid-username [grid-username]","grid http basic auth username").option("--grid-password [grid-password]","grid http basic auth password").option("-gi --grid-id [grid-id]","grid ID").option("-b, --browser [browser-type]","browser type (chrome/firefox)").option("-h, --headless [headless]","run in headless mode").option("-m, --mode [runner-mode]","use extension or selenium mode (extension/selenium/appium)").option("--branch [branch]","branch name",void 0).option("--base-url [base-url]","change base-url to a specified url for all tests in current execution").option("--token [token]","identification token to testim").option("--parallel [number-of-tests]","number of tests to run in parallel").option("--before-parallel [number-of-tests]","number of tests to run in parallel during the before phase of a test plan").option("--after-parallel [number-of-tests]","number of tests to run in parallel during the after phase of a test plan").option("--canary [canary-mode]","enable canary mode",!1).option("--test-plan [test-plan-name]","test plan to run",Be,[]).option("--test-plan-id [test-plan-id]","test plan to run",Be,[]).option("--suite [suite-name]","suite to run",Be,[]).option("--suite-id [suite-id]","suite ID to run",Be,[]).option("--rerun-failed-by-run-id [run-id]","allows re-running failed tests from a specific run ID").option("--disable-grid-check [boolean]","disable checking if selenium grid is available",!1).option("--disable-native-events [boolean]","pass nativeEvents=false capability to the selenium browser (in selenium mode)",!1).option("--disable-timeout-retry [boolean]","disable retry after test pass test timeout",!1).option("--ca-file [ca-file-location]","ca certificate file location").option("--proxy [proxy-url]","proxy url to all requests").option("--proxy-for-grid [proxy-for-grid]","used together with --proxy to also router grid traffic through a proxy").option("--result-label [result-label]","result label",Be,[]).option("-oen --override-execution-name [execution-name]","override the default execution name","").option("--retries [max_num_of_retries]","number of retries on test failure, defaults to 0 (no retries)",Number,0).option("--set-retention [retention-in-days]","set the number of days for results retention").option("--user [user-id]","user ID for local Testim-CLI").option("--user-access-key [user-access-key]","EXPERIMENTAL").option("--pass-zero-tests","don't fail the run if no tests were found").option("--device-name [device-name]","The device name to use, iPhone 12, Nexus 5X, SM-G900P etc....").option("--device-udid [device-udid]","Unique Device Identifier").option("--custom-tag [custom-tag]","tag grid result with custom tag").option("-slb --skip-load-balancer","skipping automatic allocation (AppiumLB) for mobile runs on mobile gird that support it",!1).option("--no-lock-device","skipping locking device internal use for TDC grid").option("--os-version [os-version]","The operating system version number").option("--app-id [app-id]","The application id from app library on Testim Editor App").option("--appium-log-level [appium-log-level]","Level of logging verbosity").option("--set-no-reset [set-no-reset]","set noReset appium capability, by default set to false",!1).option("-fr --full-reset [full-reset]","set fullReset appium capability to true to reinstall application on session start and session end").option("--duration [duration]","The duration of the test run in minutes",Number).option("-str --suppress-tms-reporting [suppress-tms-reporting]","disable test management reporting",!1).option("-tsr --tms-suppress-reporting [tms-suppress-reporting]","disable test management reporting",!1).option("-tid --tms-run-id [tms-run-id]","update existing result in test management","").option("-tff --tms-field-file [tms-field-file.json]","pass field file location to add custom result field to the tms result report","").option("--disable-file-cache","disable internal CLI file caching").option("--clear-file-cache","clear internal CLI file cache").option("--file-cache-location [directory]"," internal CLI file caching location").option("--test-start-timeout [test-start-timeout]","The time to wait for a test to start after getting a browser session",Number,Number(rc.TESTIM_TEST_START_TIMEOUT)||2*60*1e3).option("--timeout [test-timeout]","Test run timeout in milliseconds",Number).option("--browser-timeout [open-browser-timeout]","Get browser from grid timeout in milliseconds",Number).option("--new-browser-wait-timeout [max-wait-to-browser]","Maximum get browser wait in minutes",Number).option("--get-browser-timeout [get-browser-timeout]","Timeout for a single attempt to get browser from the grid configured in the project's plan",Number).option("--get-browser-retries [get-browser-retries]","Number of attempts to get browser from the grid configured in the project's plan",Number).option("--get-session-timeout [get-session-timeout]",'Timeout for "/session" request to the selenium server',Number,(0,nd.default)("90s")).option("--get-session-retries [get-session-retries]",'Retries for "/session" request to the selenium server',Number,3).option("--driver-request-timeout [driver-request-timeout]","Timeout for any WebDriver request to the grid server",Number,(0,nd.default)("90s")).option("--driver-request-retries [driver-request-retries]","Retries for any WebDriver request to the grid server",Number,3).option("--local-tma-url [local-tma-url]","use a local TMA instance for appium session").option("--use-local-chrome-driver [use-local-chrome-driver]","use a local ChromeDriver instance instead of a selenium grid").option("--chrome-binary-location [chrome-binary-location]","Chrome binary location").option("--use-chrome-launcher","use a local Chrome installation without selenium").option("-mnh --mock-network-har","use the HAR file configured in the Testim editor to mock network traffic").option("-mnp --mock-network-pattern [local file location path]","use a JSON rule file to mock network traffic (Rule file schema: https://help.testim.io/page/mocking-network-traffic)").option("-omf --override-mapping-file [local file location path]","pass map file location to override mock network (see schema: https://help.testim.io/page/mocking-network-traffic)").option("-dmn --disable-mock-network","Disable mock mode for the entire CLI run").option("--run-quarantined-tests","Run quarantine tests").option("--collect-code-coverage","collect code coverage for all js files under base url").option("--code-coverage-url-filter [url pattern]","collect code coverage for all js files matching url filter (url including asterisk)").option("--code-coverage-report-path [path]","where to save coverage report (default ./coverage)").option("--code-coverage-source-map-path [path]","path of source code").option("--code-coverage-reporter [reporter]",`set code coverage reporter (default html and text), options: ${od.join("/")}`,Be,[]).option("--code-coverage-include [pattern]","set selecting files for coverage (default src/**)",Be,[]).option("--sauce-user [sauce-lab-user]","user to connect to sauce labs").option("--sauce-key [sauce-lab-key]","key to use when connecting to sauce labs").option("--sauce-options [sauce-options]","DEPRECATED: use --custom-capabilities-name or --custom-capabilities-file instead. JSON file of browser and os options for sauce").option("--browserstack-user [browserstack-user]","user to connect to browserStack").option("--browserstack-key [browserstack-key]","key to use when connecting to browserStack").option("--browserstack-options [browserstack-options]","DEPRECATED: use --custom-capabilities-name or --custom-capabilities-file instead. JSON file of browser and os options for browserStack").option("--perfecto-token [perfecto-token]","security token to use when connecting to perfecto").option("--perfecto-options [perfecto-options]","DEPRECATED: use --custom-capabilities-name or --custom-capabilities-file instead. JSON file of browser and os options for perfecto").option("--experitest-token [experitest-token]","security token to use when connecting to experitest").option("--testobject-key [testobject-key]","api key to use when connecting to testobject").option("--testobject-options [testobject-options]","json file of options for testobject").option("--sealights-lab-id [sealights-lab-id]","SeaLight Lab ID").option("--sealights-build-session-id [sealights-build-session-id]","SeaLight Session Build ID").option("--sealights-test-stage [sealights-test-stage]","SeaLight Test Stage Name").option("--ext [extension src path]","use extension from path (default it '/..')").option("--extension-path [path to extension archived file]","override the used extension").option("--install-custom-extension [chrome extension zipped file url or local path]","chrome extension to be installed in the browser").option("--player-path [path to player file]").option("--player-require-path [path to unminified player - development only]").option("--inspect [port]","Opens node inspector at given port",Number).option("--tunneld","run a tunnel daemon only").option("--tunnel [tunnel]","enable tunnel").option("--tunnel-routes [routes]","tunnel routes for cloudflare tunnels").option("--tunnel-port [tunnel-port]","tunnel port address").option("--tunnel-host-header [tunnel-host-header]","tunnel host header").option("--tunnel-region [tunnel-region]","ngrok tunnel region").option("--tunnel-diagnostics","collect ngrok tunnel diagnostics").option("--tunnel-use-http-address [tunnel-use-http-address]","use http:// address instead of https://",!1).option("--external-lambdatest-tunnel-id [tunnel-id]","use existing lambdatest tunnel ID").option("--external-lambdatest-use-wss","use wss instead of ssh for LT",!1).option("--external-lambdatest-disable-automation-tunneling","don't tunnel Testim calls in LT tunnel",!0).option("--external-lambdatest-mitm","Turn on LT Man in the middle",!1).option("--external-lambdatest-NTLM-tunnel-username [tunnel-NTLM-username]","Tunnel NTLM username").option("--external-lambdatest-NTLM-tunnel-password [tunnel-NTLM-password]","Tunnel NTLM password").option("--w3c-capabilities [enable-w3c-caps-mode]","enable/disable w3c capabilities format (default enable)",JSON.parse,!0).option("--old-capabilities [enable-old-caps-mode]","enable/disable old capabilities format (default enable)",JSON.parse,!0).option("--disable-sockets","Disable CLI sockets",!1).option("--executionId [execution-id]","","").option("--remoteRunId [remote-run-id]","","").option("--schedulerId [scheduler-id]","","").option("--source [source]","","cli").option("--resultId [result-id]","","").option("--connect, --agent [enable-agent-mode]","enable Testim CLI agent mode",!1).option("--start [enable-start]","Connect to testim and open the editor in a standalone browser",!1).option("--download-browser","when used with the start option, downloads a fixed version to run Testim editor in",!1).option("--agent-port [agent-port]","set agent port",Number,42543).option("--agent-bind [agent-host-bind]","set agent host bind","127.0.0.1").option("--chrome-extra-prefs [chrome-extra-prefs]","add extra chrome preferences","").option("--chrome-extra-args [chrome-extra-args]","add extra chrome arguments separated by ','","").option("--chrome-block-location [chrome-block-location]","block chrome geolocation",!1).option("--chrome-user-data-dir [chrome-user-data-dir]","use custom chrome user date dir",!1).option("--disable-cookies-same-site-none-requires-secure [disable-same-site-none-requires-secure]","Disable cookies without SameSite must be secure",!1).option("--selenium-caps-file [selenium-caps-file.json]","DEPRECATED: use --custom-capabilities-name or --custom-capabilities-file instead. JSON file to merge into Testim selenium desired capabilities").option("--version [version]","print the current version of the Testim CLI and exit",!1).option("--monitor-performance","collect test playback performance data").option("--high-speed","DEPRECATED: use --turbo-mode instead").option("--turbo-mode","run in turbo mode (providing that tests are configured with browsers that use extension mode [chrome, edge chromium])").option("--lightweight-mode [settings]","run lightweight mode").option("--create-prefeched-data [location]","prefetch data into local cache file").option("--use-prefeched-data [location]","use prefetched data from local cache file, and force using only cached data").option("--save-rca-locally [path]","save root cause analysis assets locally").option("--exit-code-ignore-failing-tests","return exit code of zero when tests fail. non zero exit code will mean a real error occurred").option("--intersect-with-label [label]","Out of the execution's test list, run only those tests that have the specified label",Be,[]).option("--label-intersection-operand [operand]",'Run only tests that match either all the labels with the "AND" operand, or at least one of the labels with the "OR" operand',qI("--label-intersection-operand")).option("--intersect-with-suite [suiteName]","Out of the execution's test list, run only those tests that are included in the specified suite (by suite name)",Be,[]).option("--intersect-with-suite-id [suiteId]","Out of the execution's test list, run only those tests that are included in the specified suite (by suite ID)",Be,[]).option("--apply-intersections-to-before-and-after-sections [boolean]","For a test plan's before/after tests, run tests that intersect with specified intersection flags",void 0).option("--install-lazy-deps [install-lazy-deps]","Install all lazy dependencies from package.json",!1).option("--bypass-node-version-check [bypass-node-version-check]","Allow running with incompatible Node.js versions",!1).option("--print-grids","Print available grids and exit",!1).option("--print-final-caps","Print the final calculated capabilities",!1).option("--headless-extension-download-path [headless-extension-download-path]","Path to download headless extension","").option("--custom-capabilities-name <name>","name of pre-created custom capabilities item").option("--custom-capabilities-file <path>","path to a JSON file with capabilities settings").parse(cd);p=ad.opts(),YI=()=>{p.grid||p.gridId||(p.host||(p.host="ondemand.saucelabs.com"),p.port||(p.port=80))},QI=()=>{p.grid||p.gridId||(p.host||(p.host="hub-cloud.browserstack.com"),p.port||(p.port=80))},dT=s=>{var r;if(!O.flags.secrets.isEnabled({projectId:p.project}))return;let t=tc.readFileSync(s);(r=Qp)!=null&&r.containsSecrets(t.toString())&&Qp.injectProxySecretsStoreToGlobal()},ZI=async()=>{var S,b,v,T,A,_,B,G;p.inspect&&require("node:inspector").open(p.inspect);let s={},e={},t=[],r={},i;if(!cd.slice(2).length)throw hT(),new Hr;if(p.version){let E="Testim CLI Version: ";rc.npm_package_version&&(console.log(E,rc.npm_package_version),id(0));let k=at();k&&(console.log(E,k),id(0)),console.log("Could not find version, please check the package.json manually"),id(0)}if(p.installLazyDeps)return{installLazyDepsMode:!0};p.disableFileCache&&Bm(),p.clearFileCache&&ss();let n=p.fileCacheLocation||p.usePrefechedData||p.createPrefechedData;if(n){let E=_e.resolve(n);Fm(E)}if(p.usePrefechedData&&jm(),p.playerRequirePath){let E=_e.resolve(p.playerRequirePath);console.log("Using Local Clickim for Player Require Path =",E);let k=_e.join(E,"tsconfig.node.json"),j=require("ts-node").register({project:k,ignore:[/node_modules/,new RegExp(`^${Ct.escapeRegExp(_e.relative(At(),__dirname))}`)],transpileOnly:!0});require("tsconfig-paths").register({paths:j.config.options.paths,baseUrl:j.config.options.baseUrl}),(Se(),Xe(cr)).options.playerPath=E;let K=require("node:module"),q=K.prototype.require;K.prototype.require=function(ge){return ge==="rox-alias"?q.call(this,"rox-node"):ge==="canvas"?{}:q.apply(this,arguments)}}if(p.caFile&&(global.caFileContent=tc.readFileSync(p.caFile)),p.proxy&&(global.proxyUri=p.proxy,global.SuperagentProxy=require("superagent-proxy"),global.ProxyAgent=require("proxy-agent").ProxyAgent,global.HttpsProxyAgent=require("https-proxy-agent").HttpsProxyAgent),p.proxyForGrid&&!p.proxy)throw new x("missing --proxy option");if(rT(p))return sT(p);try{let E={};p.configFile?(dT(p.configFile),E=require(_e.join(At(),p.configFile)).config):p.optionsFile&&(E=require(_e.join(At(),p.optionsFile))),E&&typeof E.then=="function"&&(E=await E),Object.keys(E).forEach(k=>{let D=HI(k);p[D]=KI(p[D],E[k])})}catch(E){throw E.message=`Unable to read options file: ${E.message}`,E}if(p.tunneld)return{tunnel:!0,tunnelPort:p.tunnelPort,tunnelRoutes:p.tunnelRoutes,tunnelRoutesOutput:p.tunnelRoutesOutput,tunnelHostHeader:p.tunnelHostHeader,tunnelRegion:p.tunnelRegion,tunnelDiagnostics:p.tunnelDiagnostics,tunnelUseHttpAddress:p.tunnelUseHttpAddress,tunnelOnlyMode:!0,token:p.token,project:p.project};let o=((S=p.testConfig)==null?void 0:S.length)||((b=p.testConfigId)==null?void 0:b.length),a=((v=p.testPlan)==null?void 0:v.length)||((T=p.testPlanId)==null?void 0:T.length),c=((A=p.suite)==null?void 0:A.length)||((_=p.suiteId)==null?void 0:_.length);if(p.customCapabilitiesFile&&p.customCapabilitiesName)throw new x("You can either use --custom-capabilities-name or --custom-capabilities-file");if((p.customCapabilitiesFile||p.customCapabilitiesName)&&(p.browserstackOptions||p.sauceOptions||p.seleniumCapsFile||p.perfectoOptions))throw new x("Custom capabilities parameters can't be used together with --browserstack-options, --sauce-options, --selenium-caps-file or --perfecto-options parameters");if(p.customCapabilitiesFile)try{i=require(_e.join(At(),p.customCapabilitiesFile)),Do(i)}catch(E){throw E instanceof x?E:new x(`Failed to parse custom capabilities file: ${E.message}`)}if(p.seleniumCapsFile){mn("--selenium-caps-file","--custom-capabilities-name or --custom-capabilities-file");try{r=require(_e.join(At(),p.seleniumCapsFile))}catch(E){throw new x(`Failed to parse selenium caps file file error: ${E.message}`)}}if((B=p.reporters)!=null&&B.includes("junit")&&!p.reportFile&&console.log("Warning: please define --report-file option for JUnit reporter"),!p.tunnel&&p.externalLambdatestTunnelId)throw new x("missing --tunnel parameter");if(!p.tunnel&&p.externalLambdatestUseWss)throw new x("missing --tunnel parameter");if(!p.tunnel&&[p.tunnelPort,p.tunnelHostHeader,p.tunnelRegion,p.tunnelDiagnostics].some(Boolean))throw new x("missing --tunnel parameter");if(p.chromeExtraPrefs)try{e=require(_e.join(At(),p.chromeExtraPrefs))}catch(E){throw new x(`Failed to read/open chrome extra prefs file error: ${E.message}`)}if(p.chromeExtraArgs){let E=p.chromeExtraArgs.split(",");for(let k of E){let[D]=k.split("=");uT.includes(D)||p.useLocalChromeDriver||p.useChromeLauncher?(t.push(k),D==="proxy-server"&&t.push("proxy-bypass-list=*.testim.io;*.coralogix.com;*.rollout.io")):console.warn(`Ignoring an unsupported chrome arg (${D}), allowed values: ${JSON.stringify(uT)}`)}}if(p.paramsFile)try{p.paramsFile.endsWith("js")&&dT(p.paramsFile),s={...s,...require(_e.join(At(),p.paramsFile))}}catch(E){throw new x(`Failed to read/open params file error: ${E.message}`)}if(p.params)try{s={...s,...JSON.parse(p.params)}}catch(E){throw new x(`Failed to parse params string error: ${E.message}`)}if(p.sauceUser&&!p.sauceKey||!p.sauceUser&&p.sauceKey)throw new x("missing --sauce-user <sauce-user> or --sauce-key <sauce-key>");if(p.sauceUser&&p.sauceKey&&(YI(),p.saucelabs={},p.saucelabs.username=p.sauceUser,p.saucelabs.accessKey=p.sauceKey),p.sauceOptions){mn("--sauce-options","--custom-capabilities-name or --custom-capabilities-file");try{let E=require(_e.join(At(),p.sauceOptions)),k=E.platformName&&["ios","android"].includes(E.platformName.toLowerCase());if(E.browserName){let j=E.browserName.toLowerCase();switch(j){case"microsoftedge":p.browser="edge";break;default:p.browser=j}}p.browser==="edge"&&parseFloat(E.version)>=79&&(p.browser="edge-chromium");let D=parseFloat(E.version)<50&&!["dev","beta"].includes(E.version);if(!k&&p.browser==="chrome"&&D)throw new x("The minimum chrome supported version is 50.0");p.saucelabs={...p.saucelabs,...E}}catch(E){throw new x(`Failed to parse saucelabs options file error: ${E.message}`)}}if(p.browserstackUser&&!p.browserstackKey||!p.browserstackUser&&p.browserstackKey)throw new x("missing --browserstack-user <browserstack-user> or --browserstack-key <browserstack-key>");if(p.browserstackUser&&p.browserstackKey&&(QI(),p.browserstack={},p.browserstack["browserstack.user"]=p.browserstackUser,p.browserstack["browserstack.key"]=p.browserstackKey),p.browserstackOptions){mn("--browserstack-options","--custom-capabilities-name or --custom-capabilities-file");try{let E=require(_e.join(At(),p.browserstackOptions)),k=E.platform&&["mac","android"].includes(E.platform.toLowerCase());if(E.browserName&&(p.browser=E.browserName.toLowerCase()),p.browser==="edge"&&parseFloat(E.browser_version)>=79&&(p.browser="edge-chromium"),!k&&parseFloat(E.browser_version)<50&&p.browser==="chrome")throw new x("The minimum chrome supported version is 50.0");p.browserstack={...p.browserstack,...E}}catch(E){throw new x(`Failed to parse browserstack options file error: ${E.message}`)}}if(p.perfecto={},p.perfectoToken&&(p.perfecto.securityToken=p.perfectoToken),p.perfectoOptions){mn("--perfecto-options","--custom-capabilities-name or --custom-capabilities-file");try{let E=require(_e.join(At(),p.perfectoOptions)),k={location:"US East",securityToken:p.perfectoToken};p.perfecto={...k,...E}}catch(E){throw new x(`Failed to parse perfecto options file error: ${E.message}`)}}if(p.testobjectSauce={},p.testobjectKey&&(p.testobjectSauce.testobjectApiKey=p.testobjectKey),p.testobjectOptions)try{let E=require(_e.join(At(),p.testobjectOptions)),k={testobjectApiKey:p.testobjectKey};p.testobjectSauce={...k,...E}}catch(E){throw new x(`Failed to parse test object options file error: ${E.message}`)}let l={seaLights:{buildSessionId:p.sealightsBuildSessionId,labId:p.sealightsLabId,testStage:p.sealightsTestStage}};if(p.testOptimization=l,!p.project){let k=await(await Promise.resolve().then(()=>(ec(),sd))).getProjectId();if(k)p.project=k;else throw new x("missing project-id info, either --login to provide new credentials or use --project <project-id>")}JI(p.project),O.flags.forceTurboModeIfNeeded.isEnabled({projectId:p.project})&&(p.turboMode=!0),p.testConfig&&(p.testConfig=[p.testConfig].flat()),p.testConfigId&&(p.testConfigId=[p.testConfigId].flat()),p.retries=!p.retries||typeof p.retries=="boolean"?1:Number(p.retries)+1,p.browserTimeout=!p.browserTimeout||typeof p.browserTimeout=="boolean"?60*1e3:p.browserTimeout,p.newBrowserWaitTimeout=!p.newBrowserWaitTimeout||typeof p.newBrowserWaitTimeout=="boolean"?10*60*1e3:p.newBrowserWaitTimeout*60*1e3,p.getBrowserTimeout||(p.getBrowserTimeout=p.browserTimeout),p.getBrowserRetries||(p.getBrowserRetries=Math.round(p.newBrowserWaitTimeout/p.browserTimeout)),p.getSessionTimeout=Math.max(p.browserTimeout,p.getSessionTimeout),p.driverRequestTimeout=Math.max(p.browserTimeout,p.driverRequestTimeout);let m=Boolean(p.timeout);if(p.timeout=!p.timeout||typeof p.timeout=="boolean"?10*60*1e3:p.timeout,p.beforeParallel=!p.beforeParallel||typeof p.beforeParallel=="boolean"?1:Number(p.beforeParallel),p.parallel=!p.parallel||typeof p.parallel=="boolean"?1:Number(p.parallel),p.afterParallel=!p.afterParallel||typeof p.afterParallel=="boolean"?1:Number(p.afterParallel),p.tunnelPort=!p.tunnelPort||typeof p.tunnelPort=="boolean"?"80":p.tunnelPort,p.port&&=Number(p.port),!p.token){let k=await(await Promise.resolve().then(()=>(ec(),sd))).getToken();if(k)p.token=k;else throw new x("missing Testim Access Token, either --login to provide new credentials or use --token <testim-access-token>, contact info@testim.io if you need a new one.")}let u=E=>E<=0||!Number.isInteger(E);if(u(p.retries))throw new x("test failure retry count could not be a negative number or string, --retries <max_num_of_retries>");if(p.retries>21)throw new x("Max number of retries exceeded. Number cannot be greater than 20, --retries <max_num_of_retries>");if(u(p.browserTimeout))throw new x("get browser timeout could not be a negative number, --browser-timeout <get-browser-timeout>");if(u(p.newBrowserWaitTimeout))throw new x("max new browser wait timeout could not be a negative number, --new-browser-wait-timeout <max-wait-to-browser>");if(u(p.timeout))throw new x("test run timeout could not be a negative number, --timeout <run-timeout>");if(u(p.beforeParallel))throw new x("before-parallel could not be a negative number or not number, --before-parallel <number-of-tests>");if(u(p.parallel))throw new x("parallel could not be a negative number or not number, --parallel <number-of-tests>");if(u(p.afterParallel))throw new x("after-parallel could not be a negative number or not number, --after-parallel <number-of-tests>");if(p.mode&&![J.EXTENSION,J.SELENIUM,J.APPIUM].includes(p.mode))throw new x(`runner mode <${p.mode}> is not supported`);if(p.browser&&![...Fr,...Ki].includes(p.browser))throw new x(`browser ${p.browser} is not supported`);if(p.mode!==J.SELENIUM&&p.disableNativeEvents)throw new x("--disable-native-events is only applicable in selenium mode");if(p.appiumLogLevel||(p.appiumLogLevel="silent"),!XI.has(p.appiumLogLevel))throw new x(`runner appium-log-level <${p.appiumLogLevel}> is not supported`);if(p.testPlan&&p.testPlan.length===0&&p.testPlanId&&p.testPlanId.length===0){if(typeof p.host!="string"&&typeof p.grid!="string"&&typeof p.gridId!="string"&&!p.localTmaUrl&&!p.useLocalChromeDriver&&!p.useChromeLauncher&&!p.createPrefechedData&&!p.printGrids)throw new x("missing remote grid address parameter, specify --host <host-name-or-ip> or --grid <grid-name> or --grid-id <grid-id>")}else if(p.testId.length||p.label.length||p.name.length||o||p.browser||c||p.localTmaUrl||p.useLocalChromeDriver||p.useChromeLauncher)throw new x("cannot set --testId, --label, --name, --browser, --test-config, --test-config-id, --local-tma-url, --use-local-chrome-driver --use-chrome-launcher or --suite with --test-plan option");if(!a&&(p.beforeParallel!==1||p.afterParallel!==1))throw new x("cannot set --before-parallel or --after-parallel without --test-plan option");if([p.host,p.grid,p.gridId].filter(Boolean).length>1)throw new x("please define exactly one of --grid or --grid-id or --host");if((G=p.host)!=null&&G.includes("/")&&(/^(f|ht)tps?:\/\//i.test(p.host)||(p.host=`http://${p.host}`),p.host=fT.parse(p.host).hostname),p.resultLabel.length){p.resultLabel=p.resultLabel.map(k=>k.trim()).filter(Boolean);let E=p.resultLabel.filter(k=>k.length>=250).filter(Boolean);if(p.branch==="auto-detect"&&p.resultLabel.includes("auto-detect-branch")&&vr()&&p.resultLabel.unshift(vr()),E.length)throw new x("A result label cannot exceed 250 characters")}let h=ko(p);if(!p.w3cCapabilities&&!p.oldCapabilities)throw new x("cannot set --w3c-capabilities and --old-capabilities options as false");if(p.protocol||=p.port===443?"https":"http",!["http","https"].includes(p.protocol))throw new x("invalid --protocol value, allow --protocol http or https");if(p.rerunFailedByRunId&&p.branch)throw new x("It is not possible to use --branch with --rerun-failed-by-run-id. Tests will automatically run on the same branch that was used in the original run");if(p.rerunFailedByRunId&&(c||p.name.length||p.testId.length||p.label.length||a))throw new x("Re-running failed tests is not possible when suite (--suite), label (--label), plan (--test-plan), or other test flags (--test) are provided. Please remove these flags and try again");if(p.setRetention&&!Ct.inRange(Ct.parseInt(p.setRetention),1,11))throw new x("Please provide the number of days that the test results will be retained for (--set-retention must be a whole number between 1 to 10)");p.setRetention&&=Number(p.setRetention);let g="is no longer supported, please use --override-mapping-file";if(p.mockNetworkHar)throw new x(`--mock-network-har ${g}`);if(p.mockNetworkPattern)throw new x(`--mock-network-pattern ${g}`);if(p.disableMockNetwork&&p.overrideMappingFile)throw new x("You can either use --disable-mock-network or --override-mapping-file");if(!p.collectCodeCoverage&&p.codeCoverageSourceMapPath)throw new x("cannot set --code-coverage-source-map-path without passing --collect-code-coverage");if(!p.collectCodeCoverage&&p.codeCoverageReporter.length)throw new x("cannot set --code-coverage-reporter without passing --collect-code-coverage");if(!p.collectCodeCoverage&&p.codeCoverageInclude.length)throw new x("cannot set --code-coverage-include without passing --collect-code-coverage");if(p.collectCodeCoverage&&p.codeCoverageReporter&&Ct.difference(p.codeCoverageReporter,od).length){let E=Ct.difference(p.codeCoverageReporter,od);throw new x(`invalid --code-coverage-reporter parameters ${E.join("/")}`)}p.codeCoverageReporter=p.codeCoverageReporter.length===0?["html","text"]:p.codeCoverageReporter,p.codeCoverageInclude=p.codeCoverageInclude.length===0?["src/**"]:p.codeCoverageInclude;let y={mockNetworkHar:"--mock-network-har",mockNetworkPattern:"--mock-network-pattern",overrideMappingFile:"--override-mapping-file",codeCoverageUrlFilter:"--code-coverage-url-filter",collectCodeCoverage:"--collect-code-coverage",disableMockNetwork:"--disable-mock-network",useChromeLauncher:"--use-chrome-launcher"},w=Object.keys(y).filter(E=>Boolean(p[E]));if([J.APPIUM,J.SELENIUM].includes(p.mode)&&w.length){let E=w.length>1?"are":"is";throw new x(`${w.map(k=>y[k]).join(" and ")} ${E} only applicable in extension mode`)}if((p.useChromeLauncher||p.useLocalChromeDriver)&&(p.browser="chrome"),p.tmsFieldFile)try{let E=tc.readFileSync(p.tmsFieldFile);p.tmsCustomFields=JSON.parse(E)}catch(E){throw new x(`failed to parse field file error: ${E.message}`)}if(p.applyIntersectionsToBeforeAndAfterSections&&!p.intersectWithLabel&&!p.intersectWithSuite&&!p.intersectWithSuiteId)throw new x("--apply-intersections-to-before-and-after-sections flag must be combined with at least one of the available --intersect-with flags");if(p.labelIntersectionOperand===!0)throw new x("The --label-intersection-operand flag requires a value. Please provide a value after the flag.");if(p.labelIntersectionOperand&&!Object.values(ti).includes(p.labelIntersectionOperand))throw new x(`The --label-intersection-operand flag must be one of the following values: ${Object.values(ti).join(", ")}`);if(p.labelIntersectionOperand&&Ct.isEmpty(p.intersectWithLabel))throw new x("The --label-intersection-operand flag must be used together with the --intersect-with-label flag.");if(p.highSpeed&&(mn("--high-speed","--turbo-mode"),p.turboMode=!0),p.skipLoadBalancer&&!p.deviceUdid)throw new x("It is not possible to skip load balancer without specifying deviceUdid");if(p.deviceUdid&&(p.deviceName||p.osVersion))throw new x("It is not possible to use --osVersion or --deviceName with --device-udid. device-udid is unique and cannot be combined with another flag");if(p.setNoReset&&p.fullReset)throw new x("It is not possible to set both --set-no-reset and --full-reset capabilities to true at the same time!");if(p.lightweightMode)try{let E={general:!0,disableLabs:!0,disableFeatureFlags:!0,disableAssets:!0,disablePixelValidation:!0,disableResults:!0,disableStepDelay:!0,disableRemoteStep:!0,assumePreloadedSharedSteps:!0,disableVisibilityCheck:!1,disableLocators:!1,bypassSetup:!1,disableAutoImprove:!0,disableQuotaBlocking:!0,onlyTestIdsNoSuite:!0,uploadAssetsAndResultsOnFailure:!0,preloadTests:!0,disableProjectDefaults:!0,type:"lightweight"},k=typeof p.lightweightMode=="string"?JSON.parse(p.lightweightMode):{};p.lightweightMode={...E,...k}}catch(E){throw new x(`failed to parse lightweightMode settings error: ${E.message}`)}else p.turboMode&&![J.APPIUM,J.SELENIUM].includes(p.mode)?p.lightweightMode={general:!0,disableLabs:!1,disableFeatureFlags:!1,disableAssets:!0,disablePixelValidation:!1,disableResults:!0,disableStepDelay:!0,disableRemoteStep:!1,assumePreloadedSharedSteps:!1,disableVisibilityCheck:!1,disableLocators:!1,bypassSetup:!1,disableQuotaBlocking:!1,disableAutoImprove:!1,onlyTestIdsNoSuite:!1,uploadAssetsAndResultsOnFailure:!0,preloadTests:!1,disableProjectDefaults:!1,type:"turboMode"}:p.turboMode&&[J.APPIUM,J.SELENIUM].includes(p.mode)&&console.warn(`
|
|
408
|
+
`))},od=["clover","html","json-summary","json","lcov","lcovonly","teamcity","text-lcov","text-summary","text"],{env:rc,argv:cd,exit:id,cwd:At}=global.process,pT={development:{usw2:{servicesUrl:"https://services.dev.testim.io"},euc1:{servicesUrl:"https://services.dev.eu.testim.io"}},staging:{usw2:{servicesUrl:"https://services.staging.testim.io"},euc1:{servicesUrl:"https://services.staging.eu.testim.io"}},production:{usw2:{servicesUrl:"https://services.testim.io"},euc1:{servicesUrl:"https://services.eu.testim.io"}}},JI=async s=>{let e=bs(s),t=await Qc(Xr.CACHE_FN_NAME);if(t&&t.region===e){zs(t.servicesUrl);return}let i=(pT[Hs]||pT.production)[e]||{servicesUrl:"https://services.testim.io"};rc.SERVICES_HOST||zs(i.servicesUrl)},XI=new Set(["trace","debug","info","warn","error","silent"]);Gc(cd,new Set(["run","connect","agent","tunneld","start","init","install-lazy-deps"]));ad.description("Testim.io CLI").option("-h --help","output usage information",hT).option("-o --options-file [options-file.json]","").option("-c --config-file [config-file.js]","").option("--test-data [test-data]","test data file name to include in the test run").option("--test-config [test-config]","test config name to override for all tests in current execution",Be,[]).option("--test-config-id [test-config-id]","test config ID to override for all tests in current execution",Be,[]).option("--params-file [params-file.json | params-file.js]","").option("--params [params-json-string]","").option("-t, --testId [test-id]","test ID to run",Be,[]).option("--test-id [test-id]","test ID to run",Be,[]).option("-l, --label [label]","labels to search test by",Be,[]).option("-n, --name [test-name]","test name to run",Be,[]).option("--project [project-id]","project ID").option("-r, --report-file [report junit xml path]","where to save junit xml results file").option("--urls","add step urls to the junit report").option("--override-report-file-classname [override-report-file-classname]","custom junit class name for the junit reporter").option("--reporters [names]","report types",zI).option("-h, --host [host-name]","host name or ip containing the selenium grid").option("-p, --port [host-port]","host port").option("-g, --grid [grid-name]","grid name").option("--path [grid-path]","grid path").option("--protocol [grid-protocol]","grid protocol http or https").option("--grid-username [grid-username]","grid http basic auth username").option("--grid-password [grid-password]","grid http basic auth password").option("-gi --grid-id [grid-id]","grid ID").option("-b, --browser [browser-type]","browser type (chrome/firefox)").option("-h, --headless [headless]","run in headless mode").option("-m, --mode [runner-mode]","use extension or selenium mode (extension/selenium/appium)").option("--branch [branch]","branch name",void 0).option("--base-url [base-url]","change base-url to a specified url for all tests in current execution").option("--token [token]","identification token to testim").option("--parallel [number-of-tests]","number of tests to run in parallel").option("--before-parallel [number-of-tests]","number of tests to run in parallel during the before phase of a test plan").option("--after-parallel [number-of-tests]","number of tests to run in parallel during the after phase of a test plan").option("--canary [canary-mode]","enable canary mode",!1).option("--test-plan [test-plan-name]","test plan to run",Be,[]).option("--test-plan-id [test-plan-id]","test plan to run",Be,[]).option("--suite [suite-name]","suite to run",Be,[]).option("--suite-id [suite-id]","suite ID to run",Be,[]).option("--rerun-failed-by-run-id [run-id]","allows re-running failed tests from a specific run ID").option("--disable-grid-check [boolean]","disable checking if selenium grid is available",!1).option("--disable-native-events [boolean]","pass nativeEvents=false capability to the selenium browser (in selenium mode)",!1).option("--disable-timeout-retry [boolean]","disable retry after test pass test timeout",!1).option("--ca-file [ca-file-location]","ca certificate file location").option("--proxy [proxy-url]","proxy url to all requests").option("--proxy-for-grid [proxy-for-grid]","used together with --proxy to also router grid traffic through a proxy").option("--result-label [result-label]","result label",Be,[]).option("-oen --override-execution-name [execution-name]","override the default execution name","").option("--retries [max_num_of_retries]","number of retries on test failure, defaults to 0 (no retries)",Number,0).option("--set-retention [retention-in-days]","set the number of days for results retention").option("--user [user-id]","user ID for local Testim-CLI").option("--user-access-key [user-access-key]","EXPERIMENTAL").option("--pass-zero-tests","don't fail the run if no tests were found").option("--device-name [device-name]","The device name to use, iPhone 12, Nexus 5X, SM-G900P etc....").option("--device-udid [device-udid]","Unique Device Identifier").option("--custom-tag [custom-tag]","tag grid result with custom tag").option("-slb --skip-load-balancer","skipping automatic allocation (AppiumLB) for mobile runs on mobile gird that support it",!1).option("--no-lock-device","skipping locking device internal use for TDC grid").option("--os-version [os-version]","The operating system version number").option("--app-id [app-id]","The application id from app library on Testim Editor App").option("--appium-log-level [appium-log-level]","Level of logging verbosity").option("--set-no-reset [set-no-reset]","set noReset appium capability, by default set to false",!1).option("-fr --full-reset [full-reset]","set fullReset appium capability to true to reinstall application on session start and session end").option("--duration [duration]","The duration of the test run in minutes",Number).option("-str --suppress-tms-reporting [suppress-tms-reporting]","disable test management reporting",!1).option("-tsr --tms-suppress-reporting [tms-suppress-reporting]","disable test management reporting",!1).option("-tid --tms-run-id [tms-run-id]","update existing result in test management","").option("-tff --tms-field-file [tms-field-file.json]","pass field file location to add custom result field to the tms result report","").option("--disable-file-cache","disable internal CLI file caching").option("--clear-file-cache","clear internal CLI file cache").option("--file-cache-location [directory]"," internal CLI file caching location").option("--test-start-timeout [test-start-timeout]","The time to wait for a test to start after getting a browser session",Number,Number(rc.TESTIM_TEST_START_TIMEOUT)||2*60*1e3).option("--timeout [test-timeout]","Test run timeout in milliseconds",Number).option("--browser-timeout [open-browser-timeout]","Get browser from grid timeout in milliseconds",Number).option("--new-browser-wait-timeout [max-wait-to-browser]","Maximum get browser wait in minutes",Number).option("--get-browser-timeout [get-browser-timeout]","Timeout for a single attempt to get browser from the grid configured in the project's plan",Number).option("--get-browser-retries [get-browser-retries]","Number of attempts to get browser from the grid configured in the project's plan",Number).option("--get-session-timeout [get-session-timeout]",'Timeout for "/session" request to the selenium server',Number,(0,nd.default)("90s")).option("--get-session-retries [get-session-retries]",'Retries for "/session" request to the selenium server',Number,3).option("--driver-request-timeout [driver-request-timeout]","Timeout for any WebDriver request to the grid server",Number,(0,nd.default)("90s")).option("--driver-request-retries [driver-request-retries]","Retries for any WebDriver request to the grid server",Number,3).option("--local-tma-url [local-tma-url]","use a local TMA instance for appium session").option("--use-local-chrome-driver [use-local-chrome-driver]","use a local ChromeDriver instance instead of a selenium grid").option("--chrome-binary-location [chrome-binary-location]","Chrome binary location").option("--use-chrome-launcher","use a local Chrome installation without selenium").option("-mnh --mock-network-har","use the HAR file configured in the Testim editor to mock network traffic").option("-mnp --mock-network-pattern [local file location path]","use a JSON rule file to mock network traffic (Rule file schema: https://help.testim.io/page/mocking-network-traffic)").option("-omf --override-mapping-file [local file location path]","pass map file location to override mock network (see schema: https://help.testim.io/page/mocking-network-traffic)").option("-dmn --disable-mock-network","Disable mock mode for the entire CLI run").option("--run-quarantined-tests","Run quarantine tests").option("--collect-code-coverage","collect code coverage for all js files under base url").option("--code-coverage-url-filter [url pattern]","collect code coverage for all js files matching url filter (url including asterisk)").option("--code-coverage-report-path [path]","where to save coverage report (default ./coverage)").option("--code-coverage-source-map-path [path]","path of source code").option("--code-coverage-reporter [reporter]",`set code coverage reporter (default html and text), options: ${od.join("/")}`,Be,[]).option("--code-coverage-include [pattern]","set selecting files for coverage (default src/**)",Be,[]).option("--sauce-user [sauce-lab-user]","user to connect to sauce labs").option("--sauce-key [sauce-lab-key]","key to use when connecting to sauce labs").option("--sauce-options [sauce-options]","DEPRECATED: use --custom-capabilities-name or --custom-capabilities-file instead. JSON file of browser and os options for sauce").option("--browserstack-user [browserstack-user]","user to connect to browserStack").option("--browserstack-key [browserstack-key]","key to use when connecting to browserStack").option("--browserstack-options [browserstack-options]","DEPRECATED: use --custom-capabilities-name or --custom-capabilities-file instead. JSON file of browser and os options for browserStack").option("--perfecto-token [perfecto-token]","security token to use when connecting to perfecto").option("--perfecto-options [perfecto-options]","DEPRECATED: use --custom-capabilities-name or --custom-capabilities-file instead. JSON file of browser and os options for perfecto").option("--experitest-token [experitest-token]","security token to use when connecting to experitest").option("--testobject-key [testobject-key]","api key to use when connecting to testobject").option("--testobject-options [testobject-options]","json file of options for testobject").option("--sealights-lab-id [sealights-lab-id]","SeaLight Lab ID").option("--sealights-build-session-id [sealights-build-session-id]","SeaLight Session Build ID").option("--sealights-test-stage [sealights-test-stage]","SeaLight Test Stage Name").option("--ext [extension src path]","use extension from path (default it '/..')").option("--extension-path [path to extension archived file]","override the used extension").option("--install-custom-extension [chrome extension zipped file url or local path]","chrome extension to be installed in the browser").option("--player-path [path to player file]").option("--player-require-path [path to unminified player - development only]").option("--inspect [port]","Opens node inspector at given port",Number).option("--tunneld","run a tunnel daemon only").option("--tunnel [tunnel]","enable tunnel").option("--tunnel-routes [routes]","tunnel routes for cloudflare tunnels").option("--tunnel-port [tunnel-port]","tunnel port address").option("--tunnel-host-header [tunnel-host-header]","tunnel host header").option("--tunnel-region [tunnel-region]","ngrok tunnel region").option("--tunnel-diagnostics","collect ngrok tunnel diagnostics").option("--tunnel-use-http-address [tunnel-use-http-address]","use http:// address instead of https://",!1).option("--external-lambdatest-tunnel-id [tunnel-id]","use existing lambdatest tunnel ID").option("--external-lambdatest-use-wss","use wss instead of ssh for LT",!1).option("--external-lambdatest-disable-automation-tunneling","don't tunnel Testim calls in LT tunnel",!0).option("--external-lambdatest-mitm","Turn on LT Man in the middle",!1).option("--external-lambdatest-NTLM-tunnel-username [tunnel-NTLM-username]","Tunnel NTLM username").option("--external-lambdatest-NTLM-tunnel-password [tunnel-NTLM-password]","Tunnel NTLM password").option("--w3c-capabilities [enable-w3c-caps-mode]","enable/disable w3c capabilities format (default enable)",JSON.parse,!0).option("--old-capabilities [enable-old-caps-mode]","enable/disable old capabilities format (default enable)",JSON.parse,!0).option("--disable-sockets","Disable CLI sockets",!1).option("--executionId [execution-id]","","").option("--remoteRunId [remote-run-id]","","").option("--schedulerId [scheduler-id]","","").option("--source [source]","","cli").option("--resultId [result-id]","","").option("--connect, --agent [enable-agent-mode]","enable Testim CLI agent mode",!1).option("--start [enable-start]","Connect to testim and open the editor in a standalone browser",!1).option("--download-browser","when used with the start option, downloads a fixed version to run Testim editor in",!1).option("--agent-port [agent-port]","set agent port",Number,42543).option("--agent-bind [agent-host-bind]","set agent host bind","127.0.0.1").option("--chrome-extra-prefs [chrome-extra-prefs]","add extra chrome preferences","").option("--chrome-extra-args [chrome-extra-args]","add extra chrome arguments separated by ','","").option("--chrome-block-location [chrome-block-location]","block chrome geolocation",!1).option("--chrome-user-data-dir [chrome-user-data-dir]","use custom chrome user date dir",!1).option("--disable-cookies-same-site-none-requires-secure [disable-same-site-none-requires-secure]","Disable cookies without SameSite must be secure",!1).option("--selenium-caps-file [selenium-caps-file.json]","DEPRECATED: use --custom-capabilities-name or --custom-capabilities-file instead. JSON file to merge into Testim selenium desired capabilities").option("--version [version]","print the current version of the Testim CLI and exit",!1).option("--monitor-performance","collect test playback performance data").option("--high-speed","DEPRECATED: use --turbo-mode instead").option("--turbo-mode","run in turbo mode (providing that tests are configured with browsers that use extension mode [chrome, edge chromium])").option("--lightweight-mode [settings]","run lightweight mode").option("--create-prefeched-data [location]","prefetch data into local cache file").option("--use-prefeched-data [location]","use prefetched data from local cache file, and force using only cached data").option("--save-rca-locally [path]","save root cause analysis assets locally").option("--exit-code-ignore-failing-tests","return exit code of zero when tests fail. non zero exit code will mean a real error occurred").option("--intersect-with-label [label]","Out of the execution's test list, run only those tests that have the specified label",Be,[]).option("--label-intersection-operand [operand]",'Run only tests that match either all the labels with the "AND" operand, or at least one of the labels with the "OR" operand',qI("--label-intersection-operand")).option("--intersect-with-suite [suiteName]","Out of the execution's test list, run only those tests that are included in the specified suite (by suite name)",Be,[]).option("--intersect-with-suite-id [suiteId]","Out of the execution's test list, run only those tests that are included in the specified suite (by suite ID)",Be,[]).option("--apply-intersections-to-before-and-after-sections [boolean]","For a test plan's before/after tests, run tests that intersect with specified intersection flags",void 0).option("--install-lazy-deps [install-lazy-deps]","Install all lazy dependencies from package.json",!1).option("--bypass-node-version-check [bypass-node-version-check]","Allow running with incompatible Node.js versions",!1).option("--print-grids","Print available grids and exit",!1).option("--print-final-caps","Print the final calculated capabilities",!1).option("--headless-extension-download-path [headless-extension-download-path]","Path to download headless extension","").option("--custom-capabilities-name <name>","name of pre-created custom capabilities item").option("--custom-capabilities-file <path>","path to a JSON file with capabilities settings").parse(cd);p=ad.opts(),YI=()=>{p.grid||p.gridId||(p.host||(p.host="ondemand.saucelabs.com"),p.port||(p.port=80))},QI=()=>{p.grid||p.gridId||(p.host||(p.host="hub-cloud.browserstack.com"),p.port||(p.port=80))},dT=s=>{var r;if(!O.flags.secrets.isEnabled({projectId:p.project}))return;let t=tc.readFileSync(s);(r=Qp)!=null&&r.containsSecrets(t.toString())&&Qp.injectProxySecretsStoreToGlobal()},ZI=async()=>{var S,b,v,T,A,_,B,G;p.inspect&&require("node:inspector").open(p.inspect);let s={},e={},t=[],r={},i;if(!cd.slice(2).length)throw hT(),new Hr;if(p.version){let E="Testim CLI Version: ";rc.npm_package_version&&(console.log(E,rc.npm_package_version),id(0));let k=at();k&&(console.log(E,k),id(0)),console.log("Could not find version, please check the package.json manually"),id(0)}if(p.installLazyDeps)return{installLazyDepsMode:!0};p.disableFileCache&&Bm(),p.clearFileCache&&ss();let n=p.fileCacheLocation||p.usePrefechedData||p.createPrefechedData;if(n){let E=_e.resolve(n);Fm(E)}if(p.usePrefechedData&&jm(),p.playerRequirePath){let E=_e.resolve(p.playerRequirePath);console.log("Using Local Clickim for Player Require Path =",E);let k=_e.join(E,"tsconfig.node.json"),j=require("ts-node").register({project:k,ignore:[/node_modules/,new RegExp(`^${Ct.escapeRegExp(_e.relative(At(),__dirname))}`)],transpileOnly:!0});require("tsconfig-paths").register({paths:j.config.options.paths,baseUrl:j.config.options.baseUrl}),(Se(),Xe(cr)).options.playerPath=E;let K=require("node:module"),q=K.prototype.require;K.prototype.require=function(ge){return ge==="rox-alias"?q.call(this,"rox-node"):ge==="canvas"?{}:q.apply(this,arguments)}}if(p.caFile&&(global.caFileContent=tc.readFileSync(p.caFile)),p.proxy&&(global.proxyUri=p.proxy,global.SuperagentProxy=require("superagent-proxy"),global.ProxyAgent=require("proxy-agent").ProxyAgent,global.HttpsProxyAgent=require("https-proxy-agent").HttpsProxyAgent),p.proxyForGrid&&!p.proxy)throw new x("missing --proxy option");if(rT(p))return sT(p);try{let E={};p.configFile?(dT(p.configFile),E=require(_e.join(At(),p.configFile)).config):p.optionsFile&&(E=require(_e.join(At(),p.optionsFile))),E&&typeof E.then=="function"&&(E=await E),Object.keys(E).forEach(k=>{let D=HI(k);p[D]=KI(p[D],E[k])})}catch(E){throw E.message=`Unable to read options file: ${E.message}`,E}if(p.tunneld)return{tunnel:!0,tunnelPort:p.tunnelPort,tunnelRoutes:p.tunnelRoutes,tunnelRoutesOutput:p.tunnelRoutesOutput,tunnelHostHeader:p.tunnelHostHeader,tunnelRegion:p.tunnelRegion,tunnelDiagnostics:p.tunnelDiagnostics,tunnelUseHttpAddress:p.tunnelUseHttpAddress,tunnelOnlyMode:!0,token:p.token,project:p.project};let o=((S=p.testConfig)==null?void 0:S.length)||((b=p.testConfigId)==null?void 0:b.length),a=((v=p.testPlan)==null?void 0:v.length)||((T=p.testPlanId)==null?void 0:T.length),c=((A=p.suite)==null?void 0:A.length)||((_=p.suiteId)==null?void 0:_.length);if(p.customCapabilitiesFile&&p.customCapabilitiesName)throw new x("You can either use --custom-capabilities-name or --custom-capabilities-file");if((p.customCapabilitiesFile||p.customCapabilitiesName)&&(p.browserstackOptions||p.sauceOptions||p.seleniumCapsFile||p.perfectoOptions))throw new x("Custom capabilities parameters can't be used together with --browserstack-options, --sauce-options, --selenium-caps-file or --perfecto-options parameters");if(p.customCapabilitiesFile)try{i=require(_e.join(At(),p.customCapabilitiesFile)),Do(i)}catch(E){throw E instanceof x?E:new x(`Failed to parse custom capabilities file: ${E.message}`)}if(p.seleniumCapsFile){mn("--selenium-caps-file","--custom-capabilities-name or --custom-capabilities-file");try{r=require(_e.join(At(),p.seleniumCapsFile))}catch(E){throw new x(`Failed to parse selenium caps file file error: ${E.message}`)}}if((B=p.reporters)!=null&&B.includes("junit")&&!p.reportFile&&console.log("Warning: please define --report-file option for JUnit reporter"),!p.tunnel&&p.externalLambdatestTunnelId)throw new x("missing --tunnel parameter");if(!p.tunnel&&p.externalLambdatestUseWss)throw new x("missing --tunnel parameter");if(!p.tunnel&&[p.tunnelPort,p.tunnelHostHeader,p.tunnelRegion,p.tunnelDiagnostics].some(Boolean))throw new x("missing --tunnel parameter");if(p.chromeExtraPrefs)try{e=require(_e.join(At(),p.chromeExtraPrefs))}catch(E){throw new x(`Failed to read/open chrome extra prefs file error: ${E.message}`)}if(p.chromeExtraArgs){let E=p.chromeExtraArgs.split(",");for(let k of E){let[D]=k.split("=");uT.includes(D)||p.useLocalChromeDriver||p.useChromeLauncher?(t.push(k),D==="proxy-server"&&t.push("proxy-bypass-list=*.testim.io;*.coralogix.com;*.rollout.io")):console.warn(`Ignoring an unsupported chrome arg (${D}), allowed values: ${JSON.stringify(uT)}`)}}if(p.paramsFile)try{p.paramsFile.endsWith("js")&&dT(p.paramsFile),s={...s,...require(_e.join(At(),p.paramsFile))}}catch(E){throw new x(`Failed to read/open params file error: ${E.message}`)}if(p.params)try{s={...s,...JSON.parse(p.params)}}catch(E){throw new x(`Failed to parse params string error: ${E.message}`)}if(p.sauceUser&&!p.sauceKey||!p.sauceUser&&p.sauceKey)throw new x("missing --sauce-user <sauce-user> or --sauce-key <sauce-key>");if(p.sauceUser&&p.sauceKey&&(YI(),p.saucelabs={},p.saucelabs.username=p.sauceUser,p.saucelabs.accessKey=p.sauceKey),p.sauceOptions){mn("--sauce-options","--custom-capabilities-name or --custom-capabilities-file");try{let E=require(_e.join(At(),p.sauceOptions)),k=E.platformName&&["ios","android"].includes(E.platformName.toLowerCase());if(E.browserName){let j=E.browserName.toLowerCase();switch(j){case"microsoftedge":p.browser="edge";break;default:p.browser=j}}p.browser==="edge"&&parseFloat(E.version)>=79&&(p.browser="edge-chromium");let D=parseFloat(E.version)<50&&!["dev","beta"].includes(E.version);if(!k&&p.browser==="chrome"&&D)throw new x("The minimum chrome supported version is 50.0");p.saucelabs={...p.saucelabs,...E}}catch(E){throw new x(`Failed to parse saucelabs options file error: ${E.message}`)}}if(p.browserstackUser&&!p.browserstackKey||!p.browserstackUser&&p.browserstackKey)throw new x("missing --browserstack-user <browserstack-user> or --browserstack-key <browserstack-key>");if(p.browserstackUser&&p.browserstackKey&&(QI(),p.browserstack={},p.browserstack["browserstack.user"]=p.browserstackUser,p.browserstack["browserstack.key"]=p.browserstackKey),p.browserstackOptions){mn("--browserstack-options","--custom-capabilities-name or --custom-capabilities-file");try{let E=require(_e.join(At(),p.browserstackOptions)),k=E.platform&&["mac","android"].includes(E.platform.toLowerCase());if(E.browserName&&(p.browser=E.browserName.toLowerCase()),p.browser==="edge"&&parseFloat(E.browser_version)>=79&&(p.browser="edge-chromium"),!k&&parseFloat(E.browser_version)<50&&p.browser==="chrome")throw new x("The minimum chrome supported version is 50.0");p.browserstack={...p.browserstack,...E}}catch(E){throw new x(`Failed to parse browserstack options file error: ${E.message}`)}}if(p.perfecto={},p.perfectoToken&&(p.perfecto.securityToken=p.perfectoToken),p.perfectoOptions){mn("--perfecto-options","--custom-capabilities-name or --custom-capabilities-file");try{let E=require(_e.join(At(),p.perfectoOptions)),k={location:"US East",securityToken:p.perfectoToken};p.perfecto={...k,...E}}catch(E){throw new x(`Failed to parse perfecto options file error: ${E.message}`)}}if(p.testobjectSauce={},p.testobjectKey&&(p.testobjectSauce.testobjectApiKey=p.testobjectKey),p.testobjectOptions)try{let E=require(_e.join(At(),p.testobjectOptions)),k={testobjectApiKey:p.testobjectKey};p.testobjectSauce={...k,...E}}catch(E){throw new x(`Failed to parse test object options file error: ${E.message}`)}let l={seaLights:{buildSessionId:p.sealightsBuildSessionId,labId:p.sealightsLabId,testStage:p.sealightsTestStage}};if(p.testOptimization=l,!p.project){let k=await(await Promise.resolve().then(()=>(ec(),sd))).getProjectId();if(k)p.project=k;else throw new x("missing project-id info, either --login to provide new credentials or use --project <project-id>")}JI(p.project),O.flags.forceTurboModeIfNeeded.isEnabled({projectId:p.project})&&(p.turboMode=!0),p.testConfig&&(p.testConfig=[p.testConfig].flat()),p.testConfigId&&(p.testConfigId=[p.testConfigId].flat()),p.retries=!p.retries||typeof p.retries=="boolean"?1:Number(p.retries)+1,p.browserTimeout=!p.browserTimeout||typeof p.browserTimeout=="boolean"?60*1e3:p.browserTimeout,p.newBrowserWaitTimeout=!p.newBrowserWaitTimeout||typeof p.newBrowserWaitTimeout=="boolean"?10*60*1e3:p.newBrowserWaitTimeout*60*1e3,p.getBrowserTimeout||(p.getBrowserTimeout=p.browserTimeout),p.getBrowserRetries||(p.getBrowserRetries=Math.round(p.newBrowserWaitTimeout/p.browserTimeout)),p.getSessionTimeout=Math.max(p.browserTimeout,p.getSessionTimeout),p.driverRequestTimeout=Math.max(p.browserTimeout,p.driverRequestTimeout);let m=Boolean(p.timeout);if(p.timeout=!p.timeout||typeof p.timeout=="boolean"?10*60*1e3:p.timeout,p.beforeParallel=!p.beforeParallel||typeof p.beforeParallel=="boolean"?1:Number(p.beforeParallel),p.parallel=!p.parallel||typeof p.parallel=="boolean"?1:Number(p.parallel),p.afterParallel=!p.afterParallel||typeof p.afterParallel=="boolean"?1:Number(p.afterParallel),p.tunnelPort=!p.tunnelPort||typeof p.tunnelPort=="boolean"?"80":p.tunnelPort,p.port&&=Number(p.port),!p.token){let k=await(await Promise.resolve().then(()=>(ec(),sd))).getToken();if(k)p.token=k;else throw new x("missing Testim Access Token, either --login to provide new credentials or use --token <testim-access-token>, contact info@testim.io if you need a new one.")}let u=E=>E<=0||!Number.isInteger(E);if(u(p.retries))throw new x("test failure retry count could not be a negative number or string, --retries <max_num_of_retries>");if(p.retries>21)throw new x("Max number of retries exceeded. Number cannot be greater than 20, --retries <max_num_of_retries>");if(u(p.browserTimeout))throw new x("get browser timeout could not be a negative number, --browser-timeout <get-browser-timeout>");if(u(p.newBrowserWaitTimeout))throw new x("max new browser wait timeout could not be a negative number, --new-browser-wait-timeout <max-wait-to-browser>");if(u(p.timeout))throw new x("test run timeout could not be a negative number, --timeout <run-timeout>");if(u(p.beforeParallel))throw new x("before-parallel could not be a negative number or not number, --before-parallel <number-of-tests>");if(u(p.parallel))throw new x("parallel could not be a negative number or not number, --parallel <number-of-tests>");if(u(p.afterParallel))throw new x("after-parallel could not be a negative number or not number, --after-parallel <number-of-tests>");if(p.mode&&![J.EXTENSION,J.SELENIUM,J.APPIUM].includes(p.mode))throw new x(`runner mode <${p.mode}> is not supported`);if(p.browser&&![...Fr,...Ki].includes(p.browser))throw new x(`browser ${p.browser} is not supported`);if(p.mode!==J.SELENIUM&&p.disableNativeEvents)throw new x("--disable-native-events is only applicable in selenium mode");if(p.appiumLogLevel||(p.appiumLogLevel="silent"),!XI.has(p.appiumLogLevel))throw new x(`runner appium-log-level <${p.appiumLogLevel}> is not supported`);if(p.testPlan&&p.testPlan.length===0&&p.testPlanId&&p.testPlanId.length===0){if(typeof p.host!="string"&&typeof p.grid!="string"&&typeof p.gridId!="string"&&!p.localTmaUrl&&!p.useLocalChromeDriver&&!p.useChromeLauncher&&!p.createPrefechedData&&!p.printGrids)throw new x("missing remote grid address parameter, specify --host <host-name-or-ip> or --grid <grid-name> or --grid-id <grid-id>")}else if(p.testId.length||p.label.length||p.name.length||o||p.browser||c||p.localTmaUrl||p.useLocalChromeDriver||p.useChromeLauncher)throw new x("cannot set --testId, --label, --name, --browser, --test-config, --test-config-id, --local-tma-url, --use-local-chrome-driver --use-chrome-launcher or --suite with --test-plan option");if(!a&&(p.beforeParallel!==1||p.afterParallel!==1))throw new x("cannot set --before-parallel or --after-parallel without --test-plan option");if([p.host,p.grid,p.gridId].filter(Boolean).length>1)throw new x("please define exactly one of --grid or --grid-id or --host");if((G=p.host)!=null&&G.includes("/")&&(/^(f|ht)tps?:\/\//i.test(p.host)||(p.host=`http://${p.host}`),p.host=fT.parse(p.host).hostname),p.resultLabel.length){p.resultLabel=p.resultLabel.map(k=>k.trim()).filter(Boolean);let E=p.resultLabel.filter(k=>k.length>=250).filter(Boolean);if(p.branch==="auto-detect"&&p.resultLabel.includes("auto-detect-branch")&&vr()&&p.resultLabel.unshift(vr()),E.length)throw new x("A result label cannot exceed 250 characters")}let h=ko(p);if(!p.w3cCapabilities&&!p.oldCapabilities)throw new x("cannot set --w3c-capabilities and --old-capabilities options as false");if(p.protocol||=p.port===443?"https":"http",!["http","https"].includes(p.protocol))throw new x("invalid --protocol value, allow --protocol http or https");if(p.rerunFailedByRunId&&p.branch)throw new x("It is not possible to use --branch with --rerun-failed-by-run-id. Tests will automatically run on the same branch that was used in the original run");if(p.rerunFailedByRunId&&(c||p.name.length||p.testId.length||p.label.length||a))throw new x("Re-running failed tests is not possible when suite (--suite), label (--label), plan (--test-plan), or other test flags (--test) are provided. Please remove these flags and try again");if(p.setRetention&&!Ct.inRange(Ct.parseInt(p.setRetention),1,11))throw new x("Please provide the number of days that the test results will be retained for (--set-retention must be a whole number between 1 to 10)");p.setRetention&&=Number(p.setRetention);let g="is no longer supported, please use --override-mapping-file";if(p.mockNetworkHar)throw new x(`--mock-network-har ${g}`);if(p.mockNetworkPattern)throw new x(`--mock-network-pattern ${g}`);if(p.disableMockNetwork&&p.overrideMappingFile)throw new x("You can either use --disable-mock-network or --override-mapping-file");if(!p.collectCodeCoverage&&p.codeCoverageSourceMapPath)throw new x("cannot set --code-coverage-source-map-path without passing --collect-code-coverage");if(!p.collectCodeCoverage&&p.codeCoverageReporter.length)throw new x("cannot set --code-coverage-reporter without passing --collect-code-coverage");if(!p.collectCodeCoverage&&p.codeCoverageInclude.length)throw new x("cannot set --code-coverage-include without passing --collect-code-coverage");if(p.collectCodeCoverage&&p.codeCoverageReporter&&Ct.difference(p.codeCoverageReporter,od).length){let E=Ct.difference(p.codeCoverageReporter,od);throw new x(`invalid --code-coverage-reporter parameters ${E.join("/")}`)}p.codeCoverageReporter=p.codeCoverageReporter.length===0?["html","text"]:p.codeCoverageReporter,p.codeCoverageInclude=p.codeCoverageInclude.length===0?["src/**"]:p.codeCoverageInclude;let y={mockNetworkHar:"--mock-network-har",mockNetworkPattern:"--mock-network-pattern",overrideMappingFile:"--override-mapping-file",codeCoverageUrlFilter:"--code-coverage-url-filter",collectCodeCoverage:"--collect-code-coverage",disableMockNetwork:"--disable-mock-network",useChromeLauncher:"--use-chrome-launcher"},w=Object.keys(y).filter(E=>Boolean(p[E]));if([J.APPIUM,J.SELENIUM].includes(p.mode)&&w.length){let E=w.length>1?"are":"is";throw new x(`${w.map(k=>y[k]).join(" and ")} ${E} only applicable in extension mode`)}if((p.useChromeLauncher||p.useLocalChromeDriver)&&(p.browser="chrome"),p.tmsFieldFile)try{let E=tc.readFileSync(p.tmsFieldFile);p.tmsCustomFields=JSON.parse(E)}catch(E){throw new x(`failed to parse field file error: ${E.message}`)}if(p.applyIntersectionsToBeforeAndAfterSections&&!p.intersectWithLabel&&!p.intersectWithSuite&&!p.intersectWithSuiteId)throw new x("--apply-intersections-to-before-and-after-sections flag must be combined with at least one of the available --intersect-with flags");if(p.labelIntersectionOperand===!0)throw new x("The --label-intersection-operand flag requires a value. Please provide a value after the flag.");if(p.labelIntersectionOperand&&!Object.values(ti).includes(p.labelIntersectionOperand))throw new x(`The --label-intersection-operand flag must be one of the following values: ${Object.values(ti).join(", ")}`);if(p.labelIntersectionOperand&&Ct.isEmpty(p.intersectWithLabel))throw new x("The --label-intersection-operand flag must be used together with the --intersect-with-label flag.");if(p.highSpeed&&(mn("--high-speed","--turbo-mode"),p.turboMode=!0),p.skipLoadBalancer&&!p.deviceUdid)throw new x("It is not possible to skip load balancer without specifying deviceUdid");if(p.deviceUdid&&(p.deviceName||p.osVersion))throw new x("It is not possible to use --osVersion or --deviceName with --device-udid. device-udid is unique and cannot be combined with another flag");if(p.setNoReset&&p.fullReset)throw new x("It is not possible to set both --set-no-reset and --full-reset capabilities to true at the same time!");if(p.lightweightMode)try{let E={general:!0,disableLabs:!0,disableFeatureFlags:!0,disableAssets:!0,disablePixelValidation:!0,disableResults:!0,disableStepDelay:!0,disableRemoteStep:!0,assumePreloadedSharedSteps:!0,disableVisibilityCheck:!1,disableLocators:!1,bypassSetup:!1,disableAutoImprove:!0,disableQuotaBlocking:!0,onlyTestIdsNoSuite:!0,uploadAssetsAndResultsOnFailure:!0,preloadTests:!0,disableProjectDefaults:!0,type:"lightweight"},k=typeof p.lightweightMode=="string"?JSON.parse(p.lightweightMode):{};p.lightweightMode={...E,...k}}catch(E){throw new x(`failed to parse lightweightMode settings error: ${E.message}`)}else p.turboMode&&![J.APPIUM,J.SELENIUM].includes(p.mode)?p.lightweightMode={general:!0,disableLabs:!1,disableFeatureFlags:!1,disableAssets:!0,disablePixelValidation:!1,disableResults:!0,disableStepDelay:!0,disableRemoteStep:!1,assumePreloadedSharedSteps:!1,disableVisibilityCheck:!1,disableLocators:!1,bypassSetup:!1,disableQuotaBlocking:!1,disableAutoImprove:!1,onlyTestIdsNoSuite:!1,uploadAssetsAndResultsOnFailure:!0,preloadTests:!1,disableProjectDefaults:!1,type:"turboMode"}:p.turboMode&&[J.APPIUM,J.SELENIUM].includes(p.mode)&&console.warn(`
|
|
409
409
|
When running the CLI in Selenium mode, the Turbo Mode option is ignored, as they are not compatible concurrently`);if(typeof p.baseUrl=="boolean")throw new x("base url cannot be used as a flag, and must contain a string value");return{testId:[p.testId].flat(),name:[p.name].flat(),label:[p.label].flat(),suites:[p.suite].flat(),suiteIds:[p.suiteId].flat(),testPlan:[p.testPlan].flat(),testPlanIds:[p.testPlanId].flat(),reportFile:p.reportFile,urls:p.urls,reportFileClassname:p.overrideReportFileClassname,reporters:p.reporters,project:p.project,host:p.host,headless:p.headless,localTmaUrl:p.localTmaUrl,useLocalChromeDriver:p.useLocalChromeDriver,chromeBinaryLocation:p.chromeBinaryLocation,useChromeLauncher:p.useChromeLauncher,port:p.port,grid:p.grid,gridId:p.gridId,disableNativeEvents:p.disableNativeEvents,saucelabs:p.saucelabs,browserstack:p.browserstack,baseUrl:p.baseUrl,branch:(p.branch==="auto-detect"?vr():p.branch)||"master",autoDetect:p.branch==="auto-detect",token:p.token,userAccessKey:p.userAccessKey,userParamsData:s,mode:p.mode,browser:p.browser,beforeParallel:p.beforeParallel,parallel:p.parallel,afterParallel:p.afterParallel,canary:p.canary,rerunFailedByRunId:p.rerunFailedByRunId,disableGridCheck:p.disableGridCheck,disableTimeoutRetry:p.disableTimeoutRetry,resultLabels:p.resultLabel,path:p.path,protocol:p.protocol,perfecto:p.perfecto,experitestToken:p.experitestToken,testobjectSauce:p.testobjectSauce,testOptimization:p.testOptimization,gridUsername:p.gridUsername,gridPassword:p.gridPassword,overrideExecutionName:p.overrideExecutionName,tmsSuppressReporting:Boolean(p.suppressTmsReporting)||Boolean(p.tmsSuppressReporting),tmsRunId:p.tmsRunId,tmsCustomFields:p.tmsCustomFields,proxyForGrid:p.proxyForGrid,retentionDays:p.setRetention,passZeroTests:Boolean(p.passZeroTests),runQuarantinedTests:Boolean(p.runQuarantinedTests),deviceName:p.deviceName,deviceUdid:p.deviceUdid,customTag:p.customTag,osVersion:p.osVersion,duration:p.duration,skipLoadBalancer:p.skipLoadBalancer,lockDevice:p.lockDevice,appId:p.appId,appiumLogLevel:p.appiumLogLevel,setNoReset:p.setNoReset,fullReset:p.fullReset,ext:p.ext,extensionPath:p.extensionPath,extensionLocation:[p.extensionPath].filter(Boolean),playerLocation:p.playerPath||h,playerPath:p.playerPath,playerRequirePath:p.playerRequirePath,tunnel:p.tunnel,tunnelPort:p.tunnelPort,tunnelRoutes:p.tunnelRoutes,tunnelRoutesOutput:p.tunnelRoutesOutput,tunnelHostHeader:p.tunnelHostHeader,tunnelRegion:p.tunnelRegion,tunnelDiagnostics:p.tunnelDiagnostics,tunnelUseHttpAddress:p.tunnelUseHttpAddress,externalLambdatestTunnelId:p.externalLambdatestTunnelId,externalLambdatestNTLMTunnelUsername:p.externalLambdatestNTLMTunnelUsername,externalLambdatestNTLMTunnelPassword:p.externalLambdatestNTLMTunnelPassword,externalLambdatestUseWss:p.externalLambdatestUseWss||!1,externalLambdatestDisableAutomationTunneling:Boolean(p.externalLambdatestDisableAutomationTunneling),externalLambdatestMitm:Boolean(p.externalLambdatestMitm),beforeTest:p.beforeTest,afterTest:p.afterTest,beforeSuite:p.beforeSuite,afterSuite:p.afterSuite,timeout:p.timeout,timeoutWasGiven:m,browserTimeout:p.browserTimeout,newBrowserWaitTimeout:p.newBrowserWaitTimeout,getBrowserTimeout:p.getBrowserTimeout,getBrowserRetries:p.getBrowserRetries,getSessionTimeout:p.getSessionTimeout,getSessionRetries:p.getSessionRetries,driverRequestTimeout:p.driverRequestTimeout,driverRequestRetries:p.driverRequestRetries,testStartTimeout:p.testStartTimeout,testConfigNames:p.testConfig,testConfigIds:p.testConfigId,overrideMappingFile:p.overrideMappingFile,disableMockNetwork:p.disableMockNetwork,codeCoverageUrlFilter:p.codeCoverageUrlFilter,collectCodeCoverage:p.collectCodeCoverage,codeCoverageReportPath:p.codeCoverageReportPath,codeCoverageSourceMapPath:p.codeCoverageSourceMapPath,codeCoverageReporter:p.codeCoverageReporter,codeCoverageInclude:p.codeCoverageInclude,executionId:p.executionId,remoteRunId:p.remoteRunId,schedulerId:p.schedulerId,source:p.source,resultId:p.resultId,installCustomExtension:p.installCustomExtension,w3cCapabilities:p.w3cCapabilities,oldCapabilities:p.oldCapabilities,chromeBlockLocation:p.chromeBlockLocation,chromeUserDataDir:p.chromeUserDataDir,retries:p.retries,chromeExtraPrefs:e,chromeExtraArgs:t,disableCookiesSameSiteNoneRequiresSecure:p.disableCookiesSameSiteNoneRequiresSecure,seleniumCapsFileContent:r,shouldMonitorPerformance:p.monitorPerformance,user:p.user,lightweightMode:p.lightweightMode,createPrefechedData:p.createPrefechedData,saveRCALocally:p.saveRcaLocally,exitCodeIgnoreFailingTests:p.exitCodeIgnoreFailingTests,disableSockets:p.disableSockets,intersections:{labels:p.intersectWithLabel.length?[p.intersectWithLabel].flat():void 0,suiteNames:p.intersectWithSuite.length?[p.intersectWithSuite].flat():void 0,suiteIds:p.intersectWithSuiteId.length?[p.intersectWithSuiteId].flat():void 0,applyIntersectionsToBeforeAndAfterSections:p.applyIntersectionsToBeforeAndAfterSections,labelIntersectionOperand:p.labelIntersectionOperand},testDataFileName:p.testData,downloadBrowser:p.downloadBrowser,slotService:"mongo",printGrids:p.printGrids,printFinalCaps:p.printFinalCaps,customCapabilities:i,customCapabilitiesName:p.customCapabilitiesName}}});var ld,eR,Bs,TT,wT,ud,vT,ST=I(()=>{"use strict";F();Y();W();hs();ld=C("testimNgrok"),eR=".whitelisted-ngrok.testim.io",Bs="",wT=async(s,e={})=>{if(!e.ngrokToken)throw new x("tunnel feature is not enabled, please contact support - info@testim.io.");let t;e.isNgrokWhitelisted&&(t=`${ie()}-${s.projectData.projectId}${eR}`);let r={proto:"http",addr:s.tunnelPort||80,authtoken:e.ngrokToken,hostname:t};s.tunnelHostHeader&&(r.host_header=s.tunnelHostHeader),s.tunnelRegion&&(r.region=s.tunnelRegion);let n=await(await Ue("ngrok")).connect(r);s.tunnelUseHttpAddress&&n.startsWith("https://")?(ld.info("replace https to http"),Bs=n.replace("https://","http://")):Bs=n,s.tunnelDiagnostics&&ud(),s.baseUrl=Bs},ud=async(s=!0)=>{try{let t=(await Ue("ngrok")).getApi(),{tunnels:r}=await t.listTunnels(),i=r.find(n=>n.public_url===Bs);console.log("ngrok stats",i),ld.info("ngrok stats",{tunnel:i})}catch(e){ld.error("error collecting ngrok stats",{err:e})}s&&(TT=setTimeout(()=>ud(),1e4))},vT=async s=>{if(!Bs)return;clearTimeout(TT),s.tunnelDiagnostics&&await ud(!1),await(await Ue("ngrok")).disconnect(Bs)}});var mr,dd,ET,rR,sR,pd,sc,nc,ic,iR,IT,RT,xT=I(()=>{"use strict";mr=R(require("os")),dd=R(require("fs")),ET=R(require("child_process"));F();ye();rR="https://github.com/cloudflare/cloudflared/releases/download/2024.1.5/",sR={win32ia32:{path:"cloudflared-windows-386.exe"},win32x64:{path:"cloudflared-windows-amd64.exe"},darwinx64:{path:"cloudflared-darwin-amd64.tgz",extract:!0},linuxia32:{path:"cloudflared-linux-386"},linuxx64:{path:"cloudflared-linux-amd64"}},pd=mr.tmpdir(),sc=`${pd}/cloudflared`,nc=null,ic=null,iR=async()=>{if(await Te(sc))return;let e=sR[mr.platform()+mr.arch()];if(!e)throw new Error(`tunnel on ${mr.platform()+mr.arch()} platform is not supported.`);let t=e.extract?pd+e.path:sc;await Ze(`${rR}/${e.path}`,t),e.extract&&await je(t,pd),await dd.promises.chmod(sc,"755")},IT=async s=>{let e=s.baseUrl||`http://localhost:${s.tunnelPort||80}`,t="tunnelRoutes"in s&&s.tunnelRoutes||[e],[r]=await Promise.all([jp(s.company.companyId,t),iR()]);nc=r._id,ic=ET.spawn(sc,["tunnel","--no-autoupdate","run","--token",r.token],{stdio:"inherit"}),await $p(s.company.companyId,nc),"tunnelRoutesOutput"in s&&s.tunnelRoutesOutput&&await dd.promises.writeFile(s.tunnelRoutesOutput,JSON.stringify(r.routesMapping,null,2)),s.baseUrl=`${s.tunnelUseHttpAddress?"http":"https"}://${r.routesMapping[e]}`},RT=async s=>{let e=[];return nc&&e.push(Wp(s.company.companyId,nc)),ic&&e.push(new Promise((t,r)=>{ic.on("close",i=>{i&&r(new Error(`tunnel process exited with code ${i}`)),t()}),ic.kill()})),await Promise.all(e)}});var md={};z(md,{connect:()=>ac,disconnect:()=>cc,serveTunneling:()=>aR});var oc,AT,CT,oR,ac,cc,aR,fd=I(()=>{"use strict";ST();Oi();xT();dt();oc=R(require("ora"));W();ae();Lo();AT=C("tunnel"),CT=s=>{var e;return[N.TESTIM_LAMBDATEST,N.HYBRID].includes((e=s.gridData)==null?void 0:e.type)&&s.gridData.tunnel==="lambdatest"},oR=s=>{var e;return s.tunnelRoutes||((e=s.gridData)==null?void 0:e.type)===N.HYBRID&&s.gridData.tunnel==="cloudflare"},ac=async s=>{if(!s.tunnel)return;let e=xr(),t;try{CT(s)?(t=(0,oc.default)("Starting testim lambdatest tunnel...").start(),await oe.connectTunnel(s)):oR(s)?(t=(0,oc.default)("Starting testim cloudflare tunnel...").start(),await IT(s)):(t=(0,oc.default)("Starting testim ngrok tunnel...").start(),await wT(s,e)),t.succeed()}catch(r){let i="Failed to start tunnel. Please contact support@testim.io";throw r.isInvalidCredsForLT&&(i="Could not connect to LambdaTest. Check your credentials and then try again."),AT.error("Failed to open tunnel",{err:r}),t==null||t.fail(i),new Error(r.isInvalidCredsForLT?`${i}
|
|
410
410
|
${r.stdoutResult}`:i)}},cc=async s=>{if(s.tunnel)try{CT(s)?await oe.disconnectTunnel(s):"tunnelRoutes"in s?await RT(s):await vT(s)}catch(e){let t="catch error - failed to close tunnel";throw AT.error(t,{err:e}),new Error(t)}},aR=async(s,e=new Promise(()=>{}))=>(await ac(s),fs(()=>cc(s)),await e)});var _T={};z(_T,{init:()=>_R,run:()=>CR});async function lR(s){let e=s.project,t=await Up(e);if(t!=null&&t.isExecutionBlocked)throw console.error("You have reached the limit of runs for the billing month, please upgrade your plan at https://www.testim.io/upgrade-contact-us?source=cli"),cs(s.authData.uid,"execution-quota-surpassed",{projectId:e}),new Ks}function pR(s,e){var n,o,a,c,l,d,m,u,f,h,g,y,w;let t=$n(e.activePlan),r=s.parallel;if(t==="free"&&r>kT)throw new x(`The free plan allows only ${kT} parallel runs, please upgrade your plan at https://www.testim.io/upgrade-contact-us?source=cli. Run aborted`);if(e.followL2CPlan){let S=(n=s.projectData)!=null&&n.type?uR[s.projectData.type]:void 0,b=(o=e.activePlan)!=null&&o.premiumFeatures.parallelism&&S?(a=e.activePlan)==null?void 0:a.premiumFeatures.parallelism[S]:0;b&&r>b&&(console.warn(`It looks like your command used more parallel processing than your plan supports (${r} vs. ${b}).
|
|
411
411
|
We'll use the maximum of ${b} for now. To use more, you can adjust your command or upgrade your plan.`),s.parallel=b);let v=(l=(c=e.activePlan)==null?void 0:c.premiumFeatures)==null?void 0:l.tunnel;if(s.tunnel&&!v)throw new x("Tunnel is not allowed for your current plan, please upgrade your plan at https://www.testim.io/upgrade-contact-us?source=cli. Run aborted");let T=(m=(d=e.activePlan)==null?void 0:d.premiumFeatures)==null?void 0:m.runInTurboMode;s.lightweightMode&&!T&&(console.warn(`
|