generated from axonivy-market/market-product
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update new workflow and postman collection
- Loading branch information
1 parent
f14645c
commit 9be17d6
Showing
2 changed files
with
170 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Api testing | ||
|
||
on: | ||
push: | ||
schedule: | ||
- cron: '21 21 * * *' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
uses: axonivy-market/github-workflows/.github/workflows/dev.yml@feature/MARP-1412-Implement-a-common-workflow-for-api-testing | ||
with: | ||
postman_collection_location: ./open-weather-connector-test/src_test/resources/open-weather.postman_collection.json | ||
secrets: | ||
postman_env_content: ${{ secrets.postman_env_content }} |
155 changes: 155 additions & 0 deletions
155
open-weather-connector-test/src_test/resources/open-weather.postman_collection.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
{ | ||
"info": { | ||
"_postman_id": "b9dbdb78-789d-408c-b9ab-70082b18f31e", | ||
"name": "open-weather-api-collection", | ||
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", | ||
"_exporter_id": "20987298" | ||
}, | ||
"item": [ | ||
{ | ||
"name": "Get weather data without token", | ||
"event": [ | ||
{ | ||
"listen": "test", | ||
"script": { | ||
"exec": [ | ||
"pm.test(\"Status code is 401\", function () {", | ||
" pm.response.to.have.status(401);", | ||
"});", | ||
"", | ||
"pm.test(\"Response message indicates invalid API key\", function () {", | ||
" pm.expect(pm.response.json().message).to.include(\"Invalid API key\");", | ||
"});", | ||
"" | ||
], | ||
"type": "text/javascript", | ||
"packages": {} | ||
} | ||
} | ||
], | ||
"request": { | ||
"method": "GET", | ||
"header": [], | ||
"url": { | ||
"raw": "{{weatherUrl}}?q=London&units=metric", | ||
"host": [ | ||
"{{weatherUrl}}" | ||
], | ||
"query": [ | ||
{ | ||
"key": "q", | ||
"value": "London" | ||
}, | ||
{ | ||
"key": "", | ||
"value": "", | ||
"disabled": true | ||
}, | ||
{ | ||
"key": "units", | ||
"value": "metric" | ||
} | ||
] | ||
} | ||
}, | ||
"response": [] | ||
}, | ||
{ | ||
"name": "Get weather data by lat and lon", | ||
"event": [ | ||
{ | ||
"listen": "test", | ||
"script": { | ||
"exec": [ | ||
"pm.test(\"Status code is 200\", function () {", | ||
" pm.response.to.have.status(200);", | ||
"});", | ||
"", | ||
"pm.test(\"Location name should be Ho Chi Minh City\", function () {", | ||
" var responseJSON = pm.response.json();", | ||
" pm.expect(responseJSON.name).to.equal(\"Ho Chi Minh City\");", | ||
"});", | ||
"", | ||
"pm.test(\"Location country should be based in Viet Nam\", function () {", | ||
" var responseJSON = pm.response.json();", | ||
" pm.expect(responseJSON.sys.country).to.equal('VN');", | ||
"});", | ||
"" | ||
], | ||
"type": "text/javascript", | ||
"packages": {} | ||
} | ||
} | ||
], | ||
"request": { | ||
"method": "GET", | ||
"header": [], | ||
"url": { | ||
"raw": "{{weatherUrl}}?lat={{hcm-lat}}&lon={{hcm-lon}}&appid={{token}}", | ||
"host": [ | ||
"{{weatherUrl}}" | ||
], | ||
"query": [ | ||
{ | ||
"key": "lat", | ||
"value": "{{hcm-lat}}" | ||
}, | ||
{ | ||
"key": "lon", | ||
"value": "{{hcm-lon}}" | ||
}, | ||
{ | ||
"key": "appid", | ||
"value": "{{token}}" | ||
} | ||
] | ||
} | ||
}, | ||
"response": [] | ||
}, | ||
{ | ||
"name": "Get weather data by lat and lon Copy", | ||
"event": [ | ||
{ | ||
"listen": "test", | ||
"script": { | ||
"exec": [ | ||
"pm.test(\"Check if there is 1 record with name 'Chelsea'\", function () {", | ||
" var jsonData = pm.response.json();", | ||
" pm.expect(jsonData.some(item => item.name === 'Chelsea')).to.be.true;", | ||
"});", | ||
"" | ||
], | ||
"type": "text/javascript", | ||
"packages": {} | ||
} | ||
} | ||
], | ||
"request": { | ||
"method": "GET", | ||
"header": [], | ||
"url": { | ||
"raw": "{{geoUrl}}?q=London&limit=5&appId={{token}}", | ||
"host": [ | ||
"{{geoUrl}}" | ||
], | ||
"query": [ | ||
{ | ||
"key": "q", | ||
"value": "London" | ||
}, | ||
{ | ||
"key": "limit", | ||
"value": "5" | ||
}, | ||
{ | ||
"key": "appId", | ||
"value": "{{token}}" | ||
} | ||
] | ||
} | ||
}, | ||
"response": [] | ||
} | ||
] | ||
} |