Added tolerance for test num < 4
This commit is contained in:
parent
ed4e2ea33c
commit
da4e992985
1 changed files with 17 additions and 5 deletions
|
|
@ -73,7 +73,7 @@ stages:
|
|||
tags: $(imageTag)
|
||||
arguments: '--no-cache --pull'
|
||||
|
||||
- script: |
|
||||
- bash: |
|
||||
branch_name=$(Build.SourceBranch) #TODO: Change back to $(System.PullRequest.SourceBranch)
|
||||
echo "Retrieved branch name: '$branch_name'"
|
||||
jira_card_number="${branch_name##*/}"
|
||||
|
|
@ -89,9 +89,17 @@ stages:
|
|||
-e CI=true \
|
||||
-e NODE_ENV=$(NODE_ENV) \
|
||||
$(dockerImageName):$(imageTag) \
|
||||
npx concurrently -k -n "server,playwright"\
|
||||
"sed -i \"s|^process\.env\.VUE_APP_CONSUMER_CF_DISTRO = .*|process\.env\.VUE_APP_CONSUMER_CF_DISTRO='https://digitalapi.test.safelite.io'|\" \"./vue.config.js\" && echo \"Updated config file to use TEST APIs\" && npm run serve -- --port=8080"\
|
||||
"npx wait-on http://localhost:8080 && npm run test:playwright -- --shard=$(shardNumber)/$(totalShards) --reporter=list,blob --grep \"@$jira_card_number\"")
|
||||
bash -c "num_tests=$(npx playwright test --list --grep \"@$jira_card_number\")
|
||||
num_tests=${num_tests#*Total: }
|
||||
num_tests=${num_tests%% test*}
|
||||
if [[ $num_tests -lt $(shardNumber) ]]; then
|
||||
echo 'There are fewer tests than shards. Skipping this shard.'
|
||||
else
|
||||
npx concurrently -k -n \"server,playwright\"
|
||||
\"sed -i \\\"s|^process\.env\.VUE_APP_CONSUMER_CF_DISTRO = .*|process\.env\.VUE_APP_CONSUMER_CF_DISTRO='https://digitalapi.test.safelite.io'|\\\" \\\"./vue.config.js\\\" && echo \\\"Updated config file to use TEST APIs\\\" && npm run serve -- --port=8080\"
|
||||
\"npx wait-on http://localhost:8080 && npm run test:playwright -- --shard=$(shardNumber)/$(totalShards) --reporter=list,blob --grep \\\"@$jira_card_number\\\"\"
|
||||
fi
|
||||
")
|
||||
|
||||
# Start container and stream logs
|
||||
echo "Starting tests for shard $(shardNumber)..."
|
||||
|
|
@ -103,7 +111,11 @@ stages:
|
|||
|
||||
# Copy test results from container
|
||||
echo "Copying test results..."
|
||||
docker cp $container_id:/app/blob-report/. $(System.DefaultWorkingDirectory)/blob-reports/shard-$(shardNumber)/
|
||||
if docker exec "$container_id" test -e "/app/blob-report"; then
|
||||
docker cp $container_id:/app/blob-report/. $(System.DefaultWorkingDirectory)/blob-reports/shard-$(shardNumber)/
|
||||
else
|
||||
echo "Test results file not found."
|
||||
fi
|
||||
|
||||
# Remove container
|
||||
echo "Cleaning up container..."
|
||||
|
|
|
|||
Loading…
Reference in a new issue