|
| 1 | +@sapi3 |
| 2 | +Feature: Test the Search API v3 pagination and sorting |
| 3 | + |
| 4 | + Background: |
| 5 | + Given I am using the Search API v3 base URL |
| 6 | + And I am using a x-client-id header for client "test_client_sapi3_only" |
| 7 | + And I send and accept "application/json" |
| 8 | + |
| 9 | + Scenario: Default itemsPerPage should be 30 |
| 10 | + When I send a GET request to "/offers" |
| 11 | + Then the response status should be "200" |
| 12 | + And the JSON response at "itemsPerPage" should be 30 |
| 13 | + |
| 14 | + Scenario: Custom limit is accepted |
| 15 | + When I send a GET request to "/offers" with parameters: |
| 16 | + | limit | 50 | |
| 17 | + Then the response status should be "200" |
| 18 | + And the JSON response at "itemsPerPage" should be 50 |
| 19 | + |
| 20 | + Scenario: Limit above 2000 returns error |
| 21 | + When I send a GET request to "/offers" with parameters: |
| 22 | + | limit | 3000 | |
| 23 | + Then the response status should be "404" |
| 24 | + And the JSON response should be: |
| 25 | + """ |
| 26 | + { |
| 27 | + "title": "Not Found", |
| 28 | + "type": "https:\/\/api.publiq.be\/probs\/url\/not-found", |
| 29 | + "status": 404, |
| 30 | + "detail": "The \"limit\" parameter should be between 0 and 2000" |
| 31 | + } |
| 32 | + """ |
| 33 | + |
| 34 | + Scenario: Different start is possible |
| 35 | + When I send a GET request to "/offers" with parameters: |
| 36 | + | start | 10 | |
| 37 | + Then the response status should be "200" |
| 38 | + |
| 39 | + Scenario: Start above 10000 returns error |
| 40 | + When I send a GET request to "/offers" with parameters: |
| 41 | + | start | 1000000 | |
| 42 | + Then the response status should be "404" |
| 43 | + And the JSON response should be: |
| 44 | + """ |
| 45 | + { |
| 46 | + "title": "Not Found", |
| 47 | + "type": "https:\/\/api.publiq.be\/probs\/url\/not-found", |
| 48 | + "status": 404, |
| 49 | + "detail": "The \"start\" parameter should be between 0 and 10000" |
| 50 | + } |
| 51 | + """ |
| 52 | + |
| 53 | + Scenario: Sort by availableTo ascending |
| 54 | + When I send a GET request to "/offers" with parameters: |
| 55 | + | sort[availableTo] | asc | |
| 56 | + Then the response status should be "200" |
| 57 | + |
| 58 | + Scenario: Sort by availableTo descending |
| 59 | + When I send a GET request to "/offers" with parameters: |
| 60 | + | sort[availableTo] | desc | |
| 61 | + Then the response status should be "200" |
| 62 | + |
| 63 | + Scenario: Sort by completeness ascending |
| 64 | + When I send a GET request to "/offers" with parameters: |
| 65 | + | sort[completeness] | asc | |
| 66 | + Then the response status should be "200" |
| 67 | + |
| 68 | + Scenario: Sort by created ascending |
| 69 | + When I send a GET request to "/offers" with parameters: |
| 70 | + | sort[created] | asc | |
| 71 | + Then the response status should be "200" |
| 72 | + |
| 73 | + Scenario: Sort by distance ascending |
| 74 | + When I send a GET request to "/offers" with parameters: |
| 75 | + | coordinates | 50.8511740,4.3386740 | |
| 76 | + | distance | 10km | |
| 77 | + | sort[distance] | asc | |
| 78 | + Then the response status should be "200" |
| 79 | + |
| 80 | + Scenario: Sort by modified ascending |
| 81 | + When I send a GET request to "/offers" with parameters: |
| 82 | + | sort[modified] | asc | |
| 83 | + Then the response status should be "200" |
| 84 | + |
| 85 | + Scenario: Sort by modified descending |
| 86 | + When I send a GET request to "/offers" with parameters: |
| 87 | + | sort[modified] | desc | |
| 88 | + Then the response status should be "200" |
| 89 | + |
| 90 | + Scenario: Sort by score ascending |
| 91 | + When I send a GET request to "/offers" with parameters: |
| 92 | + | sort[score] | asc | |
| 93 | + Then the response status should be "200" |
| 94 | + |
| 95 | + Scenario: Sort by score descending |
| 96 | + When I send a GET request to "/offers" with parameters: |
| 97 | + | sort[score] | desc | |
| 98 | + Then the response status should be "200" |
0 commit comments