Skip to content

Commit 2c6c487

Browse files
authored
Merge pull request #5 from Testlio/introduce-test-args
Added testArgs parameter support. Small refactoring.
2 parents 3b7ae50 + 1be9859 commit 2c6c487

File tree

6 files changed

+33
-13
lines changed

6 files changed

+33
-13
lines changed

.circleci/test-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ workflows:
2929
- copy-sample-configs:
3030
filters: *filters
3131
- testlio/schedule-run:
32-
dryRun: true
32+
dry-run: true
3333
filters: *filters
3434
requires:
3535
- copy-sample-configs

sample-config/test-config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"deviceTestType": "SELENIUM_NODE",
66
"type": "BROWSER",
77
"executionConfiguration": {
8-
"videoCapture": true
8+
"videoCapture": true,
9+
"testArgs": "--spec tests/login-test.ts"
910
}
1011
},
1112
"devices": {},

src/commands/create-run.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,25 @@ parameters:
1616
default: "./project-config.json"
1717
description: |
1818
Specify path to the project config JSON file. Default is "./project-config.json".
19-
dryRun:
20-
description: when true it runs configuration validations without creating run
19+
test-args:
20+
type: string
21+
default: ""
22+
description: |
23+
Pass custom arguments to the test script in order to trigger a particular set of tests.
24+
This value will be passed as an environment variable to the test script and can be used as
25+
command-line arguments for test execution command. Example: "--spec tests/login-test.ts".
26+
dry-run:
2127
type: boolean
2228
default: false
29+
description: |
30+
When true it runs configuration validations without creating run.
2331
steps:
2432
- run:
2533
name: Scheduling automated run
2634
environment:
27-
DRY_RUN: << parameters.dryRun >>
35+
DRY_RUN: << parameters.dry-run >>
2836
RUN_API_TOKEN_ENV_NAME: << parameters.token >>
2937
TEST_CONFIG_PATH: << parameters.test-config >>
3038
PROJECT_CONFIG_PATH: << parameters.project-config >>
39+
TEST_ARGS: << parameters.test-args >>
3140
command: << include(scripts/create-run.sh) >>

src/examples/schedule-run.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ usage:
1212
token: "TESTLIO_RUN_API_TOKEN"
1313
test-config: "./functional-tests-folder/test-config.json"
1414
project-config: "./functional-tests-folder/project-config.json"
15+
test-args: "--spec tests/login-test.ts"

src/jobs/schedule-run.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,18 @@ parameters:
2525
default: "./project-config.json"
2626
description: |
2727
Specify path to the project config JSON file. Default is "./project-config.json".
28-
dryRun:
29-
description: when true it runs configuration validations without creating run
28+
test-args:
29+
type: string
30+
default: ""
31+
description: |
32+
Pass custom arguments to the test script in order to trigger a particular set of tests.
33+
This value will be passed as an environment variable to the test script and can be used as
34+
command-line arguments for test execution command. Example: "--spec tests/login-test.ts".
35+
dry-run:
3036
type: boolean
3137
default: false
38+
description: |
39+
When true it runs configuration validations without creating run.
3240
steps:
3341
- when:
3442
condition: << parameters.attach-workspace >>
@@ -41,7 +49,8 @@ steps:
4149
- checkout
4250
- install
4351
- create-run:
44-
dryRun: << parameters.dryRun >>
52+
dry-run: << parameters.dry-run >>
4553
token: << parameters.token >>
4654
test-config: << parameters.test-config >>
4755
project-config: << parameters.project-config >>
56+
test-args: << parameters.test-args >>

src/scripts/create-run.sh

100644100755
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ set -o xtrace
99

1010
export RUN_API_TOKEN=${!RUN_API_TOKEN_ENV_NAME}
1111

12-
if [ "$DRY_RUN" -eq 1 ] ; then
13-
testlio create-run --dryRun --projectConfig "${PROJECT_CONFIG_PATH}" --testConfig "${TEST_CONFIG_PATH}"
14-
else
15-
testlio create-run --projectConfig "${PROJECT_CONFIG_PATH}" --testConfig "${TEST_CONFIG_PATH}"
16-
fi
12+
OPTIONAL_ARGS=()
13+
[ "$DRY_RUN" -eq 1 ] && OPTIONAL_ARGS+=("--dryRun")
14+
[ -n "$TEST_ARGS" ] && OPTIONAL_ARGS+=("--testArgs='${TEST_ARGS}'")
15+
16+
testlio create-run --projectConfig "${PROJECT_CONFIG_PATH}" --testConfig "${TEST_CONFIG_PATH}" "${OPTIONAL_ARGS[@]}"

0 commit comments

Comments
 (0)