Skip to content

Commit

Permalink
test(@dpc-sdp/ripple-ui-maps): update maps test
Browse files Browse the repository at this point in the history
  • Loading branch information
dylankelly committed Dec 6, 2023
1 parent df2559e commit 60e63b1
Show file tree
Hide file tree
Showing 19 changed files with 615 additions and 81 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Feature: Custom Collection
Scenario: Custom collection
Given the "/api/tide/elasticsearch/sdp_data_pipelines_scl/_search" network request is stubbed with fixture "/landingpage/custom-collection/response" and status 200 as alias "cslReq"
Given I visit the page "/custom-collection"
Then the landing page component "TideCustomCollection" should exist
Then the landing page component "TideDataDrivenMap" should exist
And the custom collection component should have a search input bar
And the custom collection component results count should read "Displaying 1-10 of 282 results"
And the "cslReq" network request should be made to the elasticsearch endpoint
Expand All @@ -22,15 +22,15 @@ Feature: Custom Collection
Scenario: Error
Given the "/api/tide/elasticsearch/sdp_data_pipelines_scl/_search" network request is stubbed with fixture "/landingpage/custom-collection/response" and status 400 as alias "cslReq"
Given I visit the page "/custom-collection"
Then the landing page component "TideCustomCollection" should exist
Then the landing page component "TideDataDrivenMap" should exist
And the custom collection component should display the error "Sorry! Something went wrong. Please try again later."

@mockserver
Scenario: No results
Given the "/api/tide/elasticsearch/sdp_data_pipelines_scl/_search" network request is stubbed with fixture "/landingpage/custom-collection/response-no-items" and status 200 as alias "cslReq"
Given I visit the page "/custom-collection"
Then the landing page component "TideCustomCollection" should exist
And the custom collection component should display the error "Sorry! We couldn't find any matches for ''."
Then the landing page component "TideDataDrivenMap" should exist
And the custom collection component should display the error "Sorry! We couldn't find any matches."



21 changes: 21 additions & 0 deletions examples/nuxt-app/test/features/data-table/table-filters.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Feature: Custom Collection

As an editor I want to be able to add a view of results in a search index to a landing page with filters

Background:
Given the page endpoint for path "/" returns fixture "/map-table/ise/page" with status 200
Given the site endpoint returns fixture "/site/reference" with status 200
And the search autocomplete request is stubbed with "/search-listing/suggestions/none" fixture
Given I am using a "macbook-16" device

@mockserver
Scenario: On load
Given the "/api/tide/elasticsearch/sdp_data_pipelines_ise/_search" network request is stubbed with fixture "/map-table/ise/response" and status 200 as alias "cslReq"
Given the "/api/tide/elasticsearch/sdp_data_pipelines_ise/_search" aggregation request is stubbed with fixture "/map-table/ise/aggregations" and status 200 as alias "aggReq"
Given I visit the page "/"
Then the landing page component "TideDataDrivenMap" should exist
And the custom collection component should have a search input bar
And the custom collection component results count should read "Displaying 1-10 of 8269 results"
And the "cslReq" network request should be made to the elasticsearch endpoint
And the "aggReq" network request should be made to the elasticsearch endpoint
And the search listing layout should be "table"
32 changes: 25 additions & 7 deletions examples/nuxt-app/test/features/maps/vsba.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,31 @@ Feature: School buildings map
Given the site endpoint returns fixture "/site/vsba" with status 200
And the search autocomplete request is stubbed with "/search-listing/suggestions/none" fixture
Given I am using a "macbook-16" device
Given the "/api/tide/elasticsearch/elasticsearch_index_develop_node/_search" network request is stubbed with fixture "/landingpage/maps/vsba/response" and status 200 as alias "searchReq"
Given the "/api/tide/elasticsearch/elasticsearch_index_develop_node/_search" aggregation request is stubbed with fixture "/landingpage/maps/vsba/aggregations" and status 200 as alias "aggReq"
Given I visit the page "/map"

@mockserver
Scenario: On load
Given the "/api/tide/elasticsearch/elasticsearch_index_develop_node/_search" network request is stubbed with fixture "/landingpage/maps/vsba/response" and status 200 as alias "searchReq"
Given I visit the page "/map"
Then the landing page component "TideCustomCollection" should exist
And the custom collection component should have a search input bar
And the custom collection component results count should read "Displaying 1-10 of 2105 results"
And the "searchReq" network request should be made to the elasticsearch endpoint
And the search listing layout should be "table"
Then the landing page component "TideDataDrivenMap" should exist
Then the custom collection component should have a search input bar
And the ripple map component should be visible
And the data map component tabs should exist
And the data map tabs should be labelled:
| Map |
| List |

@mockserver
Scenario: Search for postcode
Then the ripple map component should be visible
When I enter the term "3012" into the location search input
Then the location search results should contain "West Footscray"
When I click the location search term "West Footscray"


@mockserver
Scenario: Switch to list view
When I click the tab labelled "List"
Then the search listing layout should be "table"
And the custom collection component results count should read "Displaying 1-5 of 2106 results"

Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
},
{
"uuid": "55555555-5555-5555-5555-555555555555",
"component": "TideCustomCollection",
"component": "TideDataDrivenMap",
"id": "123",
"title": "Cameras save lives",
"props": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
"camera_type": "Fixed Camera",
"certificate": "https://content.vic.gov.au/sites/default/files/2023-04/A56_Surrey_Hills_intersection-of-mont-albert-road-and-union-road_camera_cert_310323.pdf",
"site_type": "Intersection",
"reason": "Demonstrated accident risk",
"reason": "Someone complained",
"how_cameras_work": "https://www.vic.gov.au/camera-accuracy",
"latitude": "-37.8204019",
"longitude": "145.0981877",
Expand All @@ -180,7 +180,7 @@
"camera_type": "Fixed Camera",
"certificate": "https://content.vic.gov.au/sites/default/files/2023-05/A59_Echuca-intersection-of-Ogilvie-Ave-and-High-St-camera-cert_090523.pdf",
"site_type": "Intersection",
"reason": "Demonstrated accident risk",
"reason": "Someone complained",
"how_cameras_work": "https://www.vic.gov.au/camera-accuracy",
"latitude": "-36.140432",
"longitude": "144.750963",
Expand Down Expand Up @@ -255,7 +255,7 @@
"camera_type": "Fixed Camera",
"certificate": "https://content.vic.gov.au/sites/default/files/2023-03/B12_Bayswater_North_intersection-of-canterbury-road-and-bayswater-road_camera_cert.pdf",
"site_type": "Intersection",
"reason": "Demonstrated accident risk",
"reason": "Marginal seat",
"how_cameras_work": "https://www.vic.gov.au/camera-accuracy",
"latitude": "-37.832238",
"longitude": "145.269109",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 2129,
"relation": "eq"
},
"max_score": null,
"hits": []
},
"aggregations": {
"category": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "Early childhood",
"doc_count": 274
},
{
"key": "New school",
"doc_count": 87
},
{
"key": "Non-government grant",
"doc_count": 198
},
{
"key": "Planning",
"doc_count": 13
},
{
"key": "School upgrade",
"doc_count": 991
},
{
"key": "Tech school",
"doc_count": 10
}
]
}
}
}
79 changes: 63 additions & 16 deletions examples/nuxt-app/test/fixtures/landingpage/maps/vsba/page.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,32 +177,66 @@
"searchListingConfig": {
"searchProvider": "elasticsearch",
"index": "elasticsearch_index_develop_node",
"resultsPerPage": 10,
"resultsPerPage": 5,
"displayMapTab": true,
"labels": {
"submit": "Search",
"placeholder": "Enter school name"
"placeholder": "Search by postcode or suburb"
}
},
"queryConfig": {
"multi_match": {
"query": "{{query}}",
"fields": ["title"]
"fields": ["field_postcode", "field_suburb"]
}
},
"mapConfig": {
"props": {
"popup": {
"title": {
"objKey": "title[0]"
"objKey": "_source.title[0]"
},
"content": {
"objKey": "field_landing_page_summary[0]"
"component": "VSBAMapPopupContent"
}
},
"pinIconFn": "vsbaPinIcons",
"latObjPath": "_source.field_latitude[0]",
"lngObjPath": "_source.field_longitude[0]",
"titleObjPath": "title[0]"
"titleObjPath": "title[0]",
"vectorLayerComponent": "VSBAProjectAreaLayer",
"legendItems": [
{
"text": "New schools",
"icon": "icon-pin",
"iconColour": "#8A2A2B"
},
{
"text": "School upgrades",
"icon": "icon-pin",
"iconColour": "#E35205"
},
{
"text": "Planning projects",
"icon": "icon-pin",
"iconColour": "#FF9E1B"
},
{
"text": "Early childhood projects",
"icon": "icon-pin",
"iconColour": "#87189D"
},
{
"text": "Tech schools",
"icon": "icon-pin",
"iconColour": "#00B2A9"
},
{
"text": "Non-government grants",
"icon": "icon-pin",
"iconColour": "#71C5E8"
}
]
}
},
"userFilters": [
Expand All @@ -220,29 +254,42 @@
"props": {
"id": "category",
"label": "Filter by",
"placeholder": "Select school type",
"type": "RplFormDropdown",
"multiple": false,
"multiple": true,
"options": []
}
}
],
"globalFilters": [],
"globalFilters": [
{
"terms": {
"type": ["project_infrastructure"]
}
},
{
"terms": {
"field_node_site": [622]
}
}
],
"locationQueryConfig": {
"component": "TideSearchAddressLookup",
"dslTransformFunction": "schoolBuildings",
"mapResultsMappingFn": "schoolBuildings"
},
"resultsConfig": {
"layout": {
"component": "TideSearchResultsTable",
"props": {
"columns": [
{
"label": "Title",
"objectKey": "title"
},
{
"label": "Postcode",
"objectKey": "field_postcode"
"label": "School name",
"component": "TideSearchListingTableLink"
},
{
"label": "Type",
"objectKey": "field_mappintype_value"
"label": "Suburb",
"objectKey": "field_suburb"
}
]
}
Expand Down
50 changes: 50 additions & 0 deletions examples/nuxt-app/test/fixtures/map-table/ise/aggregations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 2129,
"relation": "eq"
},
"max_score": null,
"hits": []
},
"aggregations": {
"category": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "Early childhood",
"doc_count": 274
},
{
"key": "New school",
"doc_count": 87
},
{
"key": "Non-government grant",
"doc_count": 198
},
{
"key": "Planning",
"doc_count": 13
},
{
"key": "School upgrade",
"doc_count": 991
},
{
"key": "Tech school",
"doc_count": 10
}
]
}
}
}
Loading

0 comments on commit 60e63b1

Please sign in to comment.