Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
Signed-off-by: Yang Chiu <[email protected]>
  • Loading branch information
yangchiu committed Aug 19, 2024
1 parent 8e998f6 commit f8757d3
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/qase-sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,20 @@ jobs:
str="${str[@]^}" # capitalize every word
fi
# check if the test suite already exists
echo "check if ${str} exists"
res=$(curl --request GET --url "https://api.qase.io/v1/suite/LH" --data-urlencode "search=${str}" --header "Token: ${token}" --header "accept: application/json")
res=$(curl -s --request GET --url "https://api.qase.io/v1/suite/LH" --data-urlencode "search=${str}" --header "Token: ${token}" --header "accept: application/json")
echo "check if ${str} exists: ${res}"
# if not, create new test suite
if [[ $(echo "$res" | jq .result.count) == "0" ]]; then
echo "create new test suite ${str} with parent id ${parent_suite_id}"
curl --request POST \
curl --request POST -s \
--url https://api.qase.io/v1/suite/LH \
--header "Token: ${token}" \
--header "accept: application/json" \
--header "content-type: application/json" \
--data "{ \"title\": \"${str}\", \"parent_id\": \"${parent_suite_id}\" }"
fi
# get parent suite id
res=$(curl --request GET --url "https://api.qase.io/v1/suite/LH" --data-urlencode "search=${str}" --header "Token: ${token}" --header "accept: application/json")
res=$(curl -s --request GET --url "https://api.qase.io/v1/suite/LH" --data-urlencode "search=${str}" --header "Token: ${token}" --header "accept: application/json")
parent_suite_id=$(echo "$res" | jq .result.entities[0].id)
done
done
Expand All @@ -84,6 +84,7 @@ jobs:
token: ${{ secrets.QASE_TOKEN }}
test_cases: ${{ env.test_cases }}
run: |
set -ex
test_cases=(${test_cases})
cd docs/content/manual/
for file_path in "${test_cases[@]}"; do
Expand All @@ -93,11 +94,11 @@ jobs:
description=$(sed -z 's/\n/\\n/g' ${file_path} | sed 's/ \\/ \\\\/g')
echo "description = ${description}"
res=$(curl --request GET --url "https://api.qase.io/v1/case/LH" --data-urlencode "search=${title}" --header "Token: ${token}" --header "accept: application/json")
res=$(curl -s --request GET --url "https://api.qase.io/v1/case/LH" --data-urlencode "search=${title}" --header "Token: ${token}" --header "accept: application/json")
if [[ "$(echo $res | jq .result.count) == "1" ]]; then
# update existing test case
test_case_id=$(echo $res | jq .result.entities[0].id)
curl --request PATCH \
curl --request PATCH -s \
--url "https://api.qase.io/v1/case/LH/${test_case_id}" \
--header "Token: ${token}" \
--header "accept: application/json" \
Expand All @@ -110,10 +111,10 @@ jobs:
if [[ "${parent_suite_name}" == "manual" ]]; then:
parent_suite_id=""
else
res=$(curl --request GET --url "https://api.qase.io/v1/suite/LH" --data-urlencode "search=${str}" --header "Token: ${token}" --header "accept: application/json")
res=$(curl -s --request GET --url "https://api.qase.io/v1/suite/LH" --data-urlencode "search=${str}" --header "Token: ${token}" --header "accept: application/json")
parent_suite_id=$(echo "$res" | jq .result.entities[0].id)
fi
curl --request POST \
curl --request POST -s \
--url https://api.qase.io/v1/case/LH/ \
--header "Token: ${token}" \
--header "accept: application/json" \
Expand Down

0 comments on commit f8757d3

Please sign in to comment.