Skip to content

Commit

Permalink
Merge pull request #708 from dpc-sdp/feature/search-listing-table-layout
Browse files Browse the repository at this point in the history
Feature/search listing table layout
  • Loading branch information
dylankelly authored Jul 13, 2023
2 parents f927859 + 81a9c67 commit b5d57d7
Show file tree
Hide file tree
Showing 32 changed files with 2,073 additions and 45 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Feature: Search listing - Aggregations

As a user I can see lists of values filter values, sourced from either drupal Taxonomies or Elastic Aggregations

Background:
Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" with status 200
And the search autocomplete request is stubbed with "/search-listing/suggestions/none" fixture
And I am using a "macbook-16" device

@mockserver
Example: Aggregations and Taxonomies
Given the endpoint "/api/tide/page" with query "?path=/aggregations&site=8888" returns fixture "/search-listing/aggregations/page" with status 200
And the search network request is stubbed with fixture "/search-listing/aggregations/response" and status 200
And the current date is "Fri, 02 Feb 2050 03:04:05 GMT"

When I visit the page "/aggregations"
Then the search listing page should have 2 results
And the search network request should be called with the "/search-listing/aggregations/request" fixture

When I click the search listing dropdown field labelled "Elastic aggregation test"
# First item is hardcoded, the rest come from ES aggregation
Then the selected dropdown field should have the items:
| Hard coded |
| Business |
| Government |
| Individual |
| Not-for-profit groups |
# Close the dropdown
When I click the search listing dropdown field labelled "Elastic aggregation test"

When I click the search listing dropdown field labelled "Taxonomy test"
# These come from Tide page API response (taxonomies)
Then the selected dropdown field should have the items:
| Arts |
| Business |
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Feature: Searching listing - Errors

Background:
Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" with status 200
And the search autocomplete request is stubbed with "/search-listing/suggestions/none" fixture
And I am using a "macbook-16" device

@mockserver
Expand Down
14 changes: 14 additions & 0 deletions examples/nuxt-app/test/features/search-listing/grants.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Feature: Grants collection

Background:
Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" with status 200
And the search autocomplete request is stubbed with "/search-listing/suggestions/none" fixture
And I am using a "macbook-16" device

@mockserver
Expand All @@ -19,3 +20,16 @@ Feature: Grants collection
| title | url | updated | content | audience | amount | status |
| THIS IS A TEST | /site-8888/tc-9b-grant-page-closed | Updated: 2023-05-09T15:00:46+10:00 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam tincidunt sit amet ligula sit amet lacinia. In a leo nec tortor aliquet faucibus. | Business | $11,326 - $26,494 | Closed |
| TC-9a Grant Simple Test - Date Range | /site-8888/tc-9a-grant-simple-test-date-range | Updated: 2023-05-09T15:00:46+10:00 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam tincidunt sit amet ligula sit amet lacinia. In a leo nec tortor aliquet faucibus. | Not-for-profit groups, government | $11,326 - $26,494 | Open, closing in 163 days |
When I click the search listing dropdown field labelled "View those relevant to me"
# First item is hardcoded, the rest come from ES aggregation
Then the selected dropdown field should have the items:
| Hard coded |
| Business |
| Government |
| Individual |
| Not-for-profit groups |
When I click the search listing dropdown field labelled "Grant or program topic"
# These come from Tide page API response
Then the selected dropdown field should have the items:
| Arts |
| Business |
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Feature: Grid collection

Background:
Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" with status 200
And the search autocomplete request is stubbed with "/search-listing/suggestions/none" fixture
And I am using a "macbook-16" device

@mockserver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Feature: Searching listing - Pagination

Background:
Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" with status 200
And the search autocomplete request is stubbed with "/search-listing/suggestions/none" fixture
And I am using a "macbook-16" device

@mockserver
Expand All @@ -24,6 +25,7 @@ Feature: Searching listing - Pagination

Given the search network request is stubbed with fixture "/search-listing/pagination/response-page-2" and status 200
When I click on page 2 in the pagination controls
Given I wait 1 seconds
Then the search network request should be called with the "/search-listing/pagination/request-page-2" fixture
And the URL should reflect that the current page number is 2
And the results counter should show 5 to 8 of 10 results
Expand All @@ -37,6 +39,7 @@ Feature: Searching listing - Pagination

Given the search network request is stubbed with fixture "/search-listing/pagination/response-page-3" and status 200
When I click 'next' in the pagination controls
Given I wait 1 seconds
Then the search network request should be called with the "/search-listing/pagination/request-page-3" fixture
And the URL should reflect that the current page number is 3
And the results counter should show 9 to 10 of 10 results
Expand All @@ -47,6 +50,7 @@ Feature: Searching listing - Pagination

Given the search network request is stubbed with fixture "/search-listing/pagination/response-page-2" and status 200
When I click 'previous' in the pagination controls
Given I wait 1 seconds
Then the search network request should be called with the "/search-listing/pagination/request-page-2" fixture
And the URL should reflect that the current page number is 2
And the results counter should show 5 to 8 of 10 results
Expand All @@ -66,7 +70,8 @@ Feature: Searching listing - Pagination

Given the search network request is stubbed with fixture "/search-listing/pagination/response-page-3" and status 200
When I click on page 3 in the pagination controls
And the URL should reflect that the current page number is 3
Given I wait 1 seconds
Then the URL should reflect that the current page number is 3
And the results counter should show 9 to 10 of 10 results
And the search listing results should have following items:
| title |
Expand All @@ -76,6 +81,7 @@ Feature: Searching listing - Pagination
Given the search network request is stubbed with fixture "/search-listing/pagination/response-page-1" and status 200
When I type "test" into the search input
When I click the search button
Given I wait 1 seconds
Then the search network request should be called with the "/search-listing/pagination/request-page-1-with-term" fixture
And the URL should reflect that the current page number is 1
And the results counter should show 1 to 4 of 10 results
Expand Down
17 changes: 17 additions & 0 deletions examples/nuxt-app/test/features/search-listing/table.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Feature: Search listing table layout

I can see a collection of results displayed in a tabular form

Background:
Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" with status 200
And I am using a "macbook-16" device
And the search autocomplete request is stubbed with "/search-listing/suggestions/none" fixture

@mockserver
Example: Grants
Given the endpoint "/api/tide/page" with query "?path=/search-listing-table&site=8888" returns fixture "/search-listing/table/page" with status 200
And the search network request is stubbed with fixture "/search-listing/table/response" and status 200
When I visit the page "/search-listing-table"
And the search network request should be called with the "/search-listing/table/request" fixture
And the search listing layout should be "table"

Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"title": "Grants and programs",
"changed": "2022-11-02T12:47:29+11:00",
"created": "2022-11-02T12:47:29+11:00",
"type": "tide_search_listing",
"nid": "11dede11-10c0-111e1-1100-000000000330",
"showTopicTags": true,
"summary": "",
"searchListingConfig": {
"searchPlaceholder": "Search all grants and programs",
"resultsPerPage": 10
},
"queryConfig": {
"multi_match": {
"query": "{{query}}",
"fields": [
"title^3",
"field_landing_page_summary^2",
"body",
"field_paragraph_body",
"summary_processed"
]
}
},
"results": {
"layout": {
"component": "TideSearchResultsList"
},
"item": {
"grant": {
"component": "TideGrantSearchResult"
}
}
},
"globalFilters": [
{ "terms": { "type": ["grant"] } },
{ "terms": { "field_node_site": [8888] } }
],
"userFilters": [
{
"id": "audience",
"component": "TideSearchFilterDropdown",
"filter": {
"type": "terms",
"value": "field_audience_name.keyword"
},
"aggregations": {
"field": "field_audience_name.keyword",
"source": "elastic"
},
"props": {
"id": "audience",
"label": "Elastic aggregation test",
"placeholder": "Individuals and organisation types",
"type": "RplFormDropdown",
"multiple": true,
"options": [
{
"id": "1",
"label": "Hard coded",
"value": "Hard coded"
}
]
}
},
{
"id": "topic",
"component": "TideSearchFilterDropdown",
"filter": {
"type": "terms",
"value": "field_topic_name"
},
"aggregations": {
"field": "topic",
"source": "taxonomy"
},
"props": {
"id": "topic",
"label": "Taxonomy test",
"placeholder": "Grant topic",
"type": "RplFormDropdown",
"multiple": true,
"options": [
{
"id": "1",
"label": "Arts",
"value": "Arts"
},
{
"id": "2",
"label": "Business",
"value": "Business"
}
]
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"query": {
"bool": {
"must": [{ "match_all": {} }],
"filter": [
{ "terms": { "type": ["grant"] } },
{ "terms": { "field_node_site": [8888] } }
]
}
},
"size": 10,
"from": 0,
"sort": [{ "_score": "desc" }, { "_doc": "desc" }],
"aggs": {
"audience": {
"terms": {
"field": "field_audience_name.keyword",
"order": { "_key": "asc" },
"size": 30
}
}
}
}
Loading

0 comments on commit b5d57d7

Please sign in to comment.