mcdcorp / opentest

Open source test automation tool for web applications, mobile apps and APIs
https://getopentest.org
MIT License
447 stars 107 forks source link

Specify actorTags and session label when creating sessions by command line #513

Closed TripleG closed 2 years ago

TripleG commented 2 years ago

Hi,

Could you please consider of adding the possibility to specify actorTags and session label when creating a session from the command line?

Right now if I want to specify these options, I am forced to use the WebAPI, but when I use the WebAPI I lose the feature of command line's --wait which is very useful when using Jenkins. The only workaround I am thinking of is to keep polling the session status using the WebAPI until it is finished, which is not very efficient and unnecessarily complicates the process.

The point is to make command line and WebAPI have the same possibilities regarding creating a session, so they can be used interchangeably

adrianth commented 2 years ago

The --actorTags CLI option is something I was looking to add for some time now but kept getting postponed since nobody needed it (or at least nobody was asking for this). It's not a big effort so I think I should be able to add it before the end of next week.

TripleG commented 2 years ago

Thank you! Are you planning to include --sessionLabel option as well?

Btw, when should we expect the new 1.3 release?

adrianth commented 2 years ago

OpenTest version 1.3.4 was just published with the beta tag. The new version adds support for two new CLI options: --actor-tags and --session-label. Please let me know if it works as intended and sorry it took a bit longer than expected.

Usage example:

opentest session create -t Template1 --session-label "My custom label" --actor-tags tag1,tag2

You can install the new version with npm i opentest@beta -g. If you can confirm this works as intended I should be able to promote this to "latest" pretty soon.

TripleG commented 2 years ago

Hi @adrianth ,

I am having issues with the --wait option on version 1.3.4. When I try to use it, this error is thrown

C:\test_automation\opentest-server\server>opentest session create -t "_regression_us" --session-label "_regression_us[us-dev, windows, chrome]" --actor-tags "windows-chrome" --wait 30000 
C:\Users\georgig\AppData\Roaming\npm\node_modules\opentest\node_modules\yargs\yargs.js:1100
      else throw err
           ^

ReferenceError: reqOptions is not defined
    at Object.createSessionFromTemplateAndWait (C:\Users\georgig\AppData\Roaming\npm\node_modules\opentest\session.js:110:3)
    at Object.handler (C:\Users\georgig\AppData\Roaming\npm\node_modules\opentest\opentest.js:152:29)
    at Object.runCommand (C:\Users\georgig\AppData\Roaming\npm\node_modules\opentest\node_modules\yargs\lib\command.js:235:44)
    at Object.parseArgs [as _parseArgs] (C:\Users\georgig\AppData\Roaming\npm\node_modules\opentest\node_modules\yargs\yargs.js:1013:30)
    at Object.runCommand (C:\Users\georgig\AppData\Roaming\npm\node_modules\opentest\node_modules\yargs\lib\command.js:195:96)
    at Object.parseArgs [as _parseArgs] (C:\Users\georgig\AppData\Roaming\npm\node_modules\opentest\node_modules\yargs\yargs.js:1013:30)
    at Object.parse (C:\Users\georgig\AppData\Roaming\npm\node_modules\opentest\node_modules\yargs\yargs.js:542:25)
    at Object.<anonymous> (C:\Users\georgig\AppData\Roaming\npm\node_modules\opentest\opentest.js:222:6)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
adrianth commented 2 years ago

This was a bug that slipped into the 1.3.4 build, sorry for that. I have just published version 1.3.6 with the fix. Please run the npm i opentest@beta -g command again to get the new build.

TripleG commented 2 years ago

Version 1.3.6 seems fine, thank you!

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.