From b923d4a2b4f4ca334068e90719564697a886efeb Mon Sep 17 00:00:00 2001 From: Peter Hedenskog Date: Wed, 10 May 2023 18:42:15 +0200 Subject: [PATCH] make it easier to use the API (#3839) --- bin/sitespeed.js | 10 ++++++++++ lib/cli/cli.js | 7 ------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/bin/sitespeed.js b/bin/sitespeed.js index 6f908f6cf..caafc25e1 100755 --- a/bin/sitespeed.js +++ b/bin/sitespeed.js @@ -30,6 +30,16 @@ async function api(options) { // a forever loop delete apiOptions.api.hostname; + if (apiOptions.mobile) { + apiOptions.api.testType = 'emulatedMobile'; + } else if (apiOptions.android) { + apiOptions.api.testType = 'android'; + } else if (apiOptions.safari && apiOptions.safari.ios) { + apiOptions.api.testType = 'ios'; + } else { + apiOptions.api.testType = 'desktop'; + } + /* // Add support for running multi tests if (options.multi) { diff --git a/lib/cli/cli.js b/lib/cli/cli.js index 522e72a6a..6cbc300b3 100644 --- a/lib/cli/cli.js +++ b/lib/cli/cli.js @@ -1822,13 +1822,6 @@ export async function parseCommandLine() { describe: 'The location of the worker that run the test.', group: 'API' }) - .option('api.testType', { - describe: - 'The test type you want to run. The location needs tp have the chosen test type.', - default: 'desktop', - choices: ['desktop', 'emulatedMobile', 'android', 'ios'], - group: 'API' - }) .option('api.silent', { describe: 'Set to true if you do not want to log anything from the communication',