diff --git a/API Tests/BGApp/Auth/Login.yml b/API Tests/BGApp/Auth/Login.yml index 6f58080..f52223f 100644 --- a/API Tests/BGApp/Auth/Login.yml +++ b/API Tests/BGApp/Auth/Login.yml @@ -5,7 +5,7 @@ info: http: method: POST - url: http://localhost:3000/api/auth/login + url: "{{BASE_URL}}/api/auth/login" headers: - name: Content-Type value: application/json @@ -18,6 +18,16 @@ http: } auth: inherit +runtime: + scripts: + - type: after-response + code: |- + function onResponse(res) { + console.log(res.getHeader('set-cookie')); + bru.setEnvVar("REFRESH_COOKIE", res.getHeader('set-cookie')); + } + onResponse(res); + settings: encodeUrl: true timeout: 0 diff --git a/API Tests/BGApp/Auth/Token.yml b/API Tests/BGApp/Auth/Token.yml index 5e0fb37..71983e9 100644 --- a/API Tests/BGApp/Auth/Token.yml +++ b/API Tests/BGApp/Auth/Token.yml @@ -5,12 +5,22 @@ info: http: method: GET - url: http://localhost:3000/api/auth/token + url: "{{BASE_URL}}/api/auth/token" headers: - name: Cookie - value: refresh=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1IjoiMSIsInIiOiIxIiwiaWF0IjoxNzcxNTk3NjQ2LCJleHAiOjE3NzQxODk2NDZ9.07ViS5Nie3Bi2OgnlHyybDNZ9bdXPRRiqO-RFLhjoKo; Path=/; Max-Age=2592000; Secure; HttpOnly; SameSite=Lax + value: "{{REFRESH_COOKIE}}" auth: inherit +runtime: + scripts: + - type: after-response + code: |- + function onResponse(res) { + let data = res.getBody(); + bru.setEnvVar("BEARER_TOKEN", data.token); + } + onResponse(res); + settings: encodeUrl: true timeout: 0 diff --git a/API Tests/BGApp/Collections/Add game.yml b/API Tests/BGApp/Collections/Add game.yml new file mode 100644 index 0000000..d8586a2 --- /dev/null +++ b/API Tests/BGApp/Collections/Add game.yml @@ -0,0 +1,28 @@ +info: + name: Add game + type: http + seq: 6 + +http: + method: POST + url: "{{BASE_URL}}/api/collection/{{CollectionID}}/add" + body: + type: json + data: |- + { + "gameId": "{{GameID}}" + } + auth: inherit + +runtime: + variables: + - name: CollectionID + value: "" + - name: GameID + value: "" + +settings: + encodeUrl: true + timeout: 0 + followRedirects: true + maxRedirects: 5 diff --git a/API Tests/BGApp/Collections/Create.yml b/API Tests/BGApp/Collections/Create.yml index 4b6ad67..5ce5b0e 100644 --- a/API Tests/BGApp/Collections/Create.yml +++ b/API Tests/BGApp/Collections/Create.yml @@ -5,15 +5,20 @@ info: http: method: POST - url: http://localhost:3000/api/collection + url: "{{BASE_URL}}/api/collection" body: type: json data: |- { - "name": "Invited player2" + "name": "{{Name}}" } auth: inherit +runtime: + variables: + - name: Name + value: "" + settings: encodeUrl: true timeout: 0 diff --git a/API Tests/BGApp/Collections/Delete.yml b/API Tests/BGApp/Collections/Delete.yml index 0dac8f7..22745b5 100644 --- a/API Tests/BGApp/Collections/Delete.yml +++ b/API Tests/BGApp/Collections/Delete.yml @@ -5,13 +5,14 @@ info: http: method: DELETE - url: http://localhost:3000/api/collection/:id - params: - - name: id - value: bmOe - type: path + url: "{{BASE_URL}}/api/collection/{{CollectionID}}" auth: inherit +runtime: + variables: + - name: CollectionID + value: "" + settings: encodeUrl: true timeout: 0 diff --git a/API Tests/BGApp/Collections/Get.yml b/API Tests/BGApp/Collections/Get.yml index bacde05..4065842 100644 --- a/API Tests/BGApp/Collections/Get.yml +++ b/API Tests/BGApp/Collections/Get.yml @@ -5,13 +5,18 @@ info: http: method: GET - url: http://localhost:3000/api/collection/:id + url: "{{BASE_URL}}/api/collection/{{CollectionID}}" params: - - name: id - value: ejRe - type: path + - name: "" + value: "" + type: query auth: inherit +runtime: + variables: + - name: CollectionID + value: "" + settings: encodeUrl: true timeout: 0 diff --git a/API Tests/BGApp/Collections/List.yml b/API Tests/BGApp/Collections/List.yml index 554f35c..24acd0a 100644 --- a/API Tests/BGApp/Collections/List.yml +++ b/API Tests/BGApp/Collections/List.yml @@ -5,9 +5,16 @@ info: http: method: GET - url: http://localhost:3000/api/collection/list + url: "{{BASE_URL}}/api/collection/list/{{PageSize}}/{{Page}}" auth: inherit +runtime: + variables: + - name: PageSize + value: "1" + - name: Page + value: "0" + settings: encodeUrl: true timeout: 0 diff --git a/API Tests/BGApp/Collections/Remove game.yml b/API Tests/BGApp/Collections/Remove game.yml new file mode 100644 index 0000000..f29a246 --- /dev/null +++ b/API Tests/BGApp/Collections/Remove game.yml @@ -0,0 +1,28 @@ +info: + name: Remove game + type: http + seq: 7 + +http: + method: POST + url: "{{BASE_URL}}/api/collection/{{CollectionID}}/remove" + body: + type: json + data: |- + { + "gameId": "{{GameID}}" + } + auth: inherit + +runtime: + variables: + - name: CollectionID + value: "" + - name: GameID + value: "" + +settings: + encodeUrl: true + timeout: 0 + followRedirects: true + maxRedirects: 5 diff --git a/API Tests/BGApp/Collections/Update.yml b/API Tests/BGApp/Collections/Update.yml index dbb4fe0..dc2ba1e 100644 --- a/API Tests/BGApp/Collections/Update.yml +++ b/API Tests/BGApp/Collections/Update.yml @@ -5,21 +5,22 @@ info: http: method: PATCH - url: http://localhost:3000/api/collection/:id - params: - - name: id - value: bmOe - type: path + url: "{{BASE_URL}}/api/collection/{{CollectionID}}" body: type: json data: |- { - "name": "Test Player", - "isRatingLocked": true, - "canBeMultiple": false + "name": "{{Name}}" } auth: inherit +runtime: + variables: + - name: CollectionID + value: "" + - name: Name + value: "" + settings: encodeUrl: true timeout: 0 diff --git a/API Tests/BGApp/Game/Create.yml b/API Tests/BGApp/Game/Create.yml index 10fa52b..a5dd099 100644 --- a/API Tests/BGApp/Game/Create.yml +++ b/API Tests/BGApp/Game/Create.yml @@ -5,15 +5,20 @@ info: http: method: POST - url: http://localhost:3000/api/game + url: "{{BASE_URL}}/api/game" body: type: json data: |- { - "name": "Test Game3" + "name": "{{Name}}" } auth: inherit +runtime: + variables: + - name: Name + value: "" + settings: encodeUrl: true timeout: 0 diff --git a/API Tests/BGApp/Game/Delete.yml b/API Tests/BGApp/Game/Delete.yml index ef5bd45..a6333bc 100644 --- a/API Tests/BGApp/Game/Delete.yml +++ b/API Tests/BGApp/Game/Delete.yml @@ -5,13 +5,14 @@ info: http: method: DELETE - url: http://localhost:3000/api/game/:id - params: - - name: id - value: bk5e - type: path + url: "{{BASE_URL}}/api/game/{{GameID}}" auth: inherit +runtime: + variables: + - name: GameID + value: "" + settings: encodeUrl: true timeout: 0 diff --git a/API Tests/BGApp/Game/Get.yml b/API Tests/BGApp/Game/Get.yml index e49cbae..31fd3fb 100644 --- a/API Tests/BGApp/Game/Get.yml +++ b/API Tests/BGApp/Game/Get.yml @@ -5,13 +5,14 @@ info: http: method: GET - url: http://localhost:3000/api/game/:id - params: - - name: id - value: bk5e - type: path + url: "{{BASE_URL}}/api/game/{{GameID}}" auth: inherit +runtime: + variables: + - name: GameID + value: "" + settings: encodeUrl: true timeout: 0 diff --git a/API Tests/BGApp/Game/Search.yml b/API Tests/BGApp/Game/Search.yml index 0562d2c..8a6ac87 100644 --- a/API Tests/BGApp/Game/Search.yml +++ b/API Tests/BGApp/Game/Search.yml @@ -5,13 +5,18 @@ info: http: method: GET - url: http://localhost:3000/api/game/search/:query - params: - - name: query - value: game - type: path + url: "{{BASE_URL}}/api/game/search/{{Query}}/{{PageSize}}/{{Page}}" auth: inherit +runtime: + variables: + - name: Query + value: test + - name: PageSize + value: "2" + - name: Page + value: "2" + settings: encodeUrl: true timeout: 0 diff --git a/API Tests/BGApp/Game/Update.yml b/API Tests/BGApp/Game/Update.yml index 4dc561d..00ae16b 100644 --- a/API Tests/BGApp/Game/Update.yml +++ b/API Tests/BGApp/Game/Update.yml @@ -5,19 +5,22 @@ info: http: method: PATCH - url: http://localhost:3000/api/game/:id - params: - - name: id - value: el5a - type: path + url: "{{BASE_URL}}/api/game/{{GameID}}" body: type: json data: |- { - "name":"Updated game" + "name":"{{Name}}" } auth: inherit +runtime: + variables: + - name: GameID + value: "" + - name: Name + value: "" + settings: encodeUrl: true timeout: 0 diff --git a/API Tests/BGApp/Invites/Accept.yml b/API Tests/BGApp/Invites/Accept.yml index 7abe457..512d8c8 100644 --- a/API Tests/BGApp/Invites/Accept.yml +++ b/API Tests/BGApp/Invites/Accept.yml @@ -5,16 +5,23 @@ info: http: method: POST - url: http://localhost:3000/api/invite/accept + url: "{{BASE_URL}}/api/invite/accept" body: type: json data: |- { - "inviteCode": "3ST6N8", - "password": "test123" + "inviteCode": "{{InviteCode}}", + "password": "{{Password}} } auth: inherit +runtime: + variables: + - name: InviteCode + value: "" + - name: Password + value: "" + settings: encodeUrl: true timeout: 0 diff --git a/API Tests/BGApp/Invites/Create.yml b/API Tests/BGApp/Invites/Create.yml index 77bb58e..d000b29 100644 --- a/API Tests/BGApp/Invites/Create.yml +++ b/API Tests/BGApp/Invites/Create.yml @@ -5,16 +5,23 @@ info: http: method: POST - url: http://localhost:3000/api/invite + url: "{{BASE_URL}}/api/invite" body: type: json data: |- { - "email": "james+test2@dardry.com", - "playerId": "boja" + "email": "{{Email}}", + "playerId": "{{PlayerID}}" } auth: inherit +runtime: + variables: + - name: Email + value: "" + - name: PlayerID + value: "" + settings: encodeUrl: true timeout: 0 diff --git a/API Tests/BGApp/Invites/folder.yml b/API Tests/BGApp/Invites/folder.yml index 0dc9714..80b4290 100644 --- a/API Tests/BGApp/Invites/folder.yml +++ b/API Tests/BGApp/Invites/folder.yml @@ -1,7 +1,7 @@ info: name: Invites type: folder - seq: 5 + seq: 1 request: auth: inherit diff --git a/API Tests/BGApp/Players/Create.yml b/API Tests/BGApp/Players/Create.yml index 3732172..8b62b00 100644 --- a/API Tests/BGApp/Players/Create.yml +++ b/API Tests/BGApp/Players/Create.yml @@ -5,15 +5,20 @@ info: http: method: POST - url: http://localhost:3000/api/player + url: "{{BASE_URL}}/api/player" body: type: json data: |- { - "name": "Invited player2" + "name": "{{Name}}" } auth: inherit +runtime: + variables: + - name: Name + value: Test + settings: encodeUrl: true timeout: 0 diff --git a/API Tests/BGApp/Players/Delete.yml b/API Tests/BGApp/Players/Delete.yml index 1917b55..adf2df8 100644 --- a/API Tests/BGApp/Players/Delete.yml +++ b/API Tests/BGApp/Players/Delete.yml @@ -5,13 +5,14 @@ info: http: method: DELETE - url: http://localhost:3000/api/player/:id - params: - - name: id - value: bmOe - type: path + url: "{{BASE_URL}}/api/player/{{PlayerID}}" auth: inherit +runtime: + variables: + - name: PlayerID + value: "" + settings: encodeUrl: true timeout: 0 diff --git a/API Tests/BGApp/Players/Get.yml b/API Tests/BGApp/Players/Get.yml index 0c85407..2d4e90d 100644 --- a/API Tests/BGApp/Players/Get.yml +++ b/API Tests/BGApp/Players/Get.yml @@ -5,13 +5,14 @@ info: http: method: GET - url: http://localhost:3000/api/player/:id - params: - - name: id - value: ejRe - type: path + url: "{{BASE_URL}}/api/player/{{PlayerID}}" auth: inherit +runtime: + variables: + - name: PlayerID + value: "" + settings: encodeUrl: true timeout: 0 diff --git a/API Tests/BGApp/Players/List.yml b/API Tests/BGApp/Players/List.yml index 8aead3c..9cc53f8 100644 --- a/API Tests/BGApp/Players/List.yml +++ b/API Tests/BGApp/Players/List.yml @@ -5,7 +5,7 @@ info: http: method: GET - url: http://localhost:3000/api/player/list + url: "{{BASE_URL}}/api/player/list" auth: inherit settings: diff --git a/API Tests/BGApp/Players/Update.yml b/API Tests/BGApp/Players/Update.yml index 3ab9c8a..5ce7747 100644 --- a/API Tests/BGApp/Players/Update.yml +++ b/API Tests/BGApp/Players/Update.yml @@ -5,21 +5,24 @@ info: http: method: PATCH - url: http://localhost:3000/api/player/:id - params: - - name: id - value: bmOe - type: path + url: "{{BASE_URL}}/api/player/{{PlayerID}}" body: type: json data: |- { - "name": "Test Player", - "isRatingLocked": true, + "name": "{{Name}}", + "isRatingLocked": false, "canBeMultiple": false } auth: inherit +runtime: + variables: + - name: Name + value: Foo + - name: PlayerID + value: "" + settings: encodeUrl: true timeout: 0 diff --git a/API Tests/BGApp/User/Create.yml b/API Tests/BGApp/User/Create.yml index 82205cf..83fa399 100644 --- a/API Tests/BGApp/User/Create.yml +++ b/API Tests/BGApp/User/Create.yml @@ -5,17 +5,26 @@ info: http: method: POST - url: http://localhost:3000/api/user + url: "{{BASE_URL}}/api/user" body: type: json data: |- { - "email": "Test User", - "password": "Test123", - "playerId": "enRe" + "email": "{{Email}}", + "password": "{{Password}}", + "playerId": "{{PlayerID}}" } auth: inherit +runtime: + variables: + - name: Email + value: "" + - name: Password + value: "" + - name: PlayerID + value: "" + settings: encodeUrl: true timeout: 0 diff --git a/API Tests/BGApp/User/Delete.yml b/API Tests/BGApp/User/Delete.yml index 1e1de19..5ed3239 100644 --- a/API Tests/BGApp/User/Delete.yml +++ b/API Tests/BGApp/User/Delete.yml @@ -5,13 +5,14 @@ info: http: method: DELETE - url: http://localhost:3000/api/user/:id - params: - - name: id - value: "" - type: path + url: "{{BASE_URL}}/api/user/{{UserID}}" auth: inherit +runtime: + variables: + - name: UserID + value: "" + settings: encodeUrl: true timeout: 0 diff --git a/API Tests/BGApp/User/Get.yml b/API Tests/BGApp/User/Get.yml index 13808de..770c2ba 100644 --- a/API Tests/BGApp/User/Get.yml +++ b/API Tests/BGApp/User/Get.yml @@ -5,13 +5,14 @@ info: http: method: GET - url: http://localhost:3000/api/user/:id - params: - - name: id - value: ejRe - type: path + url: "{{BASE_URL}}/api/user/{{UserID}}" auth: inherit +runtime: + variables: + - name: UserID + value: "" + settings: encodeUrl: true timeout: 0 diff --git a/API Tests/BGApp/User/Update.yml b/API Tests/BGApp/User/Update.yml index 772c6b9..0b4a30e 100644 --- a/API Tests/BGApp/User/Update.yml +++ b/API Tests/BGApp/User/Update.yml @@ -5,20 +5,28 @@ info: http: method: PATCH - url: http://localhost:3000/api/user/:id - params: - - name: id - value: "" - type: path + url: "{{BASE_URL}}/api/user/{{UserID}}" body: type: json data: |- { - "isActive": true, - "isAdmin": false + "isActive": {{IsActive}}, + "isAdmin": {{IsAdmin}}, + "email": "{{Email}}" } auth: inherit +runtime: + variables: + - name: UserID + value: "" + - name: IsActive + value: "" + - name: IsAdmin + value: "" + - name: Email + value: "" + settings: encodeUrl: true timeout: 0 diff --git a/API Tests/BGApp/environments/BGApp.yml b/API Tests/BGApp/environments/BGApp.yml new file mode 100644 index 0000000..770c2f0 --- /dev/null +++ b/API Tests/BGApp/environments/BGApp.yml @@ -0,0 +1,8 @@ +name: BGApp +variables: + - name: BEARER_TOKEN + value: "" + - name: REFRESH_COOKIE + value: "" + - name: BASE_URL + value: http://localhost:3000 diff --git a/API Tests/BGApp/opencollection.yml b/API Tests/BGApp/opencollection.yml index 7b744d0..acfa2b7 100644 --- a/API Tests/BGApp/opencollection.yml +++ b/API Tests/BGApp/opencollection.yml @@ -17,7 +17,7 @@ config: request: auth: type: bearer - token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJNUFJLTFIiLCJjbGFpbXMiOlsiQURNSU4iLCJVU0VSU19DUkVBVEUiLCJVU0VSU19TRUxGX1JFQUQiLCJVU0VSU19TRUxGX1VQREFURSIsIlVTRVJTX1NFTEZfREVMRVRFIiwiVVNFUlNfT1RIRVJfUkVBRCIsIlVTRVJTX09USEVSX1VQREFURSJdLCJpYXQiOjE3NzE2ODcxNzAsImV4cCI6MTgwMzIyMzE3MH0.inf1q3LTMuTkzLI-lEezYduPCpidJDaqsWZNNIY_doE + token: "{{BEARER_TOKEN}}" actions: - type: set-variable phase: after-response