Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Clean up parameter documentation and code #167

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 42 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ A full Paramedic run will:
1. Skip if no Appium tests were found <!-- 7-427 -->
1. Prepare App in AppiumRunner <!-- 7-433 -->
1. Remove server address from app
2. Reconfigure app (modify preferences + CSP, add plugin) <!-- 367, 375, 385 -- >
2. Reconfigure app (modify preferences + CSP, add plugin) <!-- 367, 375, 385 -->
3. Build app
1. (sauce) Package and Upload the App to Sauce Labs <!-- 7-436 -->
1. Run tests via AppiumRunner <!-- 7-442 -->
Expand Down Expand Up @@ -175,7 +175,7 @@ cordova-paramedic --config conf/pr/android-7.0 --plugin ./

## Command Line Interface

### What to build and test
### What and how to build and test

#### `--platform` (required)

Expand Down Expand Up @@ -217,6 +217,10 @@ A path to Cordova CLI. Useful when you're testing against locally installed Cord
cordova-paramedic --platform android --plugin cordova-plugin-device --cli ./cordova-cli/bin/cordova
```

#### `--action` (optional)

TODO

#### `--justbuild` (optional)

Just builds the project, without running the tests.
Expand All @@ -225,6 +229,22 @@ Just builds the project, without running the tests.
cordova-paramedic --platform ios --plugin cordova-plugin-inappbrowser --justbuild
```

#### `--skipMainTests` (optional)

TODO

#### `--skipAppiumTests` (optional)

TODO

#### `--args` (optional)

Add additional parameters to the `cordova build` and `cordova run` commands.

```
cordova-paramedic --platform ios --plugin cordova-plugin-contacts --args=--buildFlag='-UseModernBuildSystem=0'
```

### Emulator/Device to use for tests

#### `--target` (optional)
Expand Down Expand Up @@ -312,14 +332,6 @@ iOS only parameter. The path to the sample TCC DB file, with permissions, to be
cordova-paramedic --platform ios --plugin cordova-plugin-contacts --tccDbPath tcc.db
```

#### `--args` (optional)

Add additional parameters to the `cordova build` and `cordova run` commands.

```
cordova-paramedic --platform ios --plugin cordova-plugin-contacts --args=--buildFlag='-UseModernBuildSystem=0'
```

### Sauce Labs

#### `--shouldUseSauce` (optional)
Expand Down Expand Up @@ -358,6 +370,26 @@ Appium version to use when running on Sauce Labs. For example, "1.5.3".
cordova-paramedic --platform ios --plugin cordova-plugin-contacts --shouldUseSauce --sauceUser ***** --sauceKey ***** --sauceDeviceName 'iPad Simulator" --saucePlatformVersion 9.1 --appiumVersion 1.5.2
```

#### `--sauceTunnelId`(optional)

Tunnel identifier to use. Only usable if you have Sauce Connect up

TODO

### Others

#### `--ci` (optional)

Skip tests that require user interaction

TODO

#### `--fileTransferServer` (optional)

(cordova-plugin-file-transfer only) A server address tests should connect to

TODO

## Configuration file

Configuration file is used when no parameters are passed to `cordova-paramedic` call or explicitly specified via `--config` parameter:
Expand Down
35 changes: 24 additions & 11 deletions lib/ParamedicConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,33 +279,46 @@ class ParamedicConfig {

ParamedicConfig.parseFromArguments = function (argv) {
return new ParamedicConfig({
// What and how to build and test
platform: argv.platform,
action: argv.justbuild || argv.justBuild ? 'build' : 'run',
args: '',
plugins: Array.isArray(argv.plugin) ? argv.plugin : [argv.plugin],
useTunnel: !!argv.useTunnel,
verbose: !!argv.verbose,
cli: argv.cli,
action: argv.justbuild || argv.justBuild ? 'build' : 'run', // TODO argv.action
skipMainTests: argv.skipMainTests,
skipAppiumTests: argv.skipAppium,
args: '',

// Emulator/Device to use for tests
target: argv.target,

// Test Result Server
useTunnel: !!argv.useTunnel,
externalServerUrl: argv.externalServerUrl,
startPort: argv.startport || argv.port,
endPort: argv.endport || argv.port,
externalServerUrl: argv.externalServerUrl,

// Test configuration
// timeout?
outputDir: argv.outputDir ? argv.outputDir : null,
cleanUpAfterRun: !!argv.cleanUpAfterRun,
logMins: argv.logMins ? argv.logMins : null,
tccDb: argv.tccDbPath ? argv.tccDb : null,
cleanUpAfterRun: !!argv.cleanUpAfterRun,

// Sauce Labs
shouldUseSauce: !!argv.shouldUseSauce || false,
buildName: argv.buildName,
sauceUser: argv.sauceUser,
sauceKey: argv.sauceKey,
buildName: argv.buildName,
sauceDeviceName: argv.sauceDeviceName && argv.sauceDeviceName.toString(),
saucePlatformVersion: argv.saucePlatformVersion && argv.saucePlatformVersion.toString(),
sauceAppiumVersion: argv.sauceAppiumVersion && argv.sauceAppiumVersion.toString(),
sauceTunnelId: argv.sauceTunnelId,
skipAppiumTests: argv.skipAppium,
skipMainTests: argv.skipMainTests,

// Others
ci: argv.ci,
target: argv.target,
fileTransferServer: argv.fileTransferServer,
cli: argv.cli
fileTransferServer: argv.fileTransferServer

});
};

Expand Down
Loading