-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1362 from dpc-sdp/bugfix/content-collection-fix
[SD-442] move contentCollectionSearchConnector feature flag
- Loading branch information
Showing
13 changed files
with
335 additions
and
16 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
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
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
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
27 changes: 27 additions & 0 deletions
27
examples/nuxt-app/test/features/landingpage/content-collection.feature
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,27 @@ | ||
Feature: Content collection | ||
|
||
Background: | ||
Given I load the site fixture with "/site/reference" | ||
And the page endpoint for path "/" returns fixture "/landingpage/content-collection" with status 200 | ||
|
||
@mockserver | ||
Scenario: Page component - Content collection (elasticsearch) | ||
Given the "/**/_search" network request is stubbed with fixture "/landingpage/content-collection-response-elasticsearch" and status 200 as alias "ccReq" | ||
And the feature flag "contentCollectionSearchConnector" is set to "elasticsearch" | ||
And the site endpoint returns the loaded fixture | ||
When I visit the page "/" | ||
Then the content collection with ID "2192" exist with the following cards | ||
| title | content | image | url | | ||
| News for CC 01 | NP1 Etiam scelerisque lorem sit amet | /placeholders/medium.png | /news-cc-1 | | ||
| News for CC 02 | NP2 Pellentesque a pharetra magna | | /news-cc-2 | | ||
|
||
@mockserver | ||
Scenario: Page component - Content collection (appSearch) | ||
Given the "/api/as/v1/engines/**/search.json" network request is stubbed with fixture "/landingpage/content-collection-response-appsearch" and status 200 as alias "ccReq" | ||
And the feature flag "contentCollectionSearchConnector" is set to "appSearch" | ||
And the site endpoint returns the loaded fixture | ||
When I visit the page "/" | ||
Then the content collection with ID "2192" exist with the following cards | ||
| title | content | image | url | | ||
| News for CC 1 AS | NP1 Etiam scelerisque lorem sit amet | /placeholders/medium.png | /news-cc-1 | | ||
| News for CC 2 AS | NP2 Pellentesque a pharetra magna | | /news-cc-2 | |
91 changes: 91 additions & 0 deletions
91
examples/nuxt-app/test/fixtures/landingpage/content-collection-response-appsearch.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,91 @@ | ||
{ | ||
"meta": { | ||
"alerts": [], | ||
"warnings": [], | ||
"precision": 2, | ||
"engine": { | ||
"name": "content-reference-sdp-vic-gov-au-default", | ||
"type": "elasticsearch" | ||
}, | ||
"page": { | ||
"current": 1, | ||
"total_pages": 13, | ||
"total_results": 37, | ||
"size": 3 | ||
}, | ||
"request_id": "0b33285192fb0e2ac5899de6f7cada71" | ||
}, | ||
"results": [ | ||
{ | ||
"field_media_image_absolute_path": { | ||
"raw": [ | ||
"/placeholders/medium.png" | ||
] | ||
}, | ||
"field_landing_page_summary": { | ||
"snippet": "NP1 Etiam scelerisque lorem sit amet sapien iaculis, nec dignissim augue cursus. Mauris eu purus a neque tristique venenatis sit amet sed sem. Aenean" | ||
}, | ||
"title": { | ||
"raw": [ | ||
"News for CC 1 AS" | ||
] | ||
}, | ||
"type": { | ||
"raw": [ | ||
"news" | ||
] | ||
}, | ||
"url": { | ||
"raw": [ | ||
"/site-8888/news-cc-1" | ||
] | ||
}, | ||
"changed": { | ||
"raw": [ | ||
"2024-10-28T23:32:03+00:00" | ||
] | ||
}, | ||
"_meta": { | ||
"engine": "content-reference-sdp-vic-gov-au-default", | ||
"score": null, | ||
"id": "entity:node/167:en" | ||
}, | ||
"id": { | ||
"raw": "entity:node/167:en" | ||
} | ||
}, | ||
{ | ||
"field_landing_page_summary": { | ||
"snippet": "NP2 Pellentesque a pharetra magna. Pellentesque vitae est a sapien mi enim, eu sodales diam pretium in. Quisque vitae quam et lectus condimentum" | ||
}, | ||
"title": { | ||
"raw": [ | ||
"News for CC 2 AS" | ||
] | ||
}, | ||
"type": { | ||
"raw": [ | ||
"news" | ||
] | ||
}, | ||
"url": { | ||
"raw": [ | ||
"/site-8888/news-cc-2" | ||
] | ||
}, | ||
"changed": { | ||
"raw": [ | ||
"2024-10-28T23:32:03+00:00" | ||
] | ||
}, | ||
"_meta": { | ||
"engine": "content-reference-sdp-vic-gov-au-default", | ||
"score": null, | ||
"id": "entity:node/168:en" | ||
}, | ||
"id": { | ||
"raw": "entity:node/168:en" | ||
} | ||
} | ||
] | ||
} |
73 changes: 73 additions & 0 deletions
73
examples/nuxt-app/test/fixtures/landingpage/content-collection-response-elasticsearch.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,73 @@ | ||
{ | ||
"took": 2, | ||
"hits": { | ||
"total": { | ||
"value": 285, | ||
"relation": "eq" | ||
}, | ||
"max_score": null, | ||
"hits": [ | ||
{ | ||
"_index": "b56de58036ae7d6456d5b246f85ffe88--elasticsearch_index_develop_node", | ||
"_id": "entity:node/167:en", | ||
"_score": null, | ||
"_ignored": [ | ||
"body.keyword" | ||
], | ||
"_source": { | ||
"field_media_image_absolute_path": [ | ||
"/placeholders/medium.png" | ||
], | ||
"field_landing_page_summary": [ | ||
"NP1 Etiam scelerisque lorem sit amet sapien iaculis, nec dignissim augue cursus. Mauris eu purus a neque tristique venenatis sit amet sed sem. Aenean viverra lectus ut tempus sollicitudin." | ||
], | ||
"title": [ | ||
"News for CC 01" | ||
], | ||
"type": [ | ||
"news" | ||
], | ||
"url": [ | ||
"/site-8888/news-cc-1" | ||
], | ||
"changed": [ | ||
"2024-10-28T22:18:51+11:00" | ||
] | ||
}, | ||
"sort": [ | ||
2540329200000, | ||
1730114331000 | ||
] | ||
}, | ||
{ | ||
"_index": "b56de58036ae7d6456d5b246f85ffe88--elasticsearch_index_develop_node", | ||
"_id": "entity:node/168:en", | ||
"_score": null, | ||
"_ignored": [ | ||
"body.keyword" | ||
], | ||
"_source": { | ||
"field_landing_page_summary": [ | ||
"NP2 Pellentesque a pharetra magna. Pellentesque vitae est a sapien mi enim, eu sodales diam pretium in. Quisque vitae quam et lectus condimentum ultricies." | ||
], | ||
"title": [ | ||
"News for CC 02" | ||
], | ||
"type": [ | ||
"news" | ||
], | ||
"url": [ | ||
"/site-8888/news-cc-2" | ||
], | ||
"changed": [ | ||
"2024-10-28T22:18:51+11:00" | ||
] | ||
}, | ||
"sort": [ | ||
2477257200000, | ||
1730114331000 | ||
] | ||
} | ||
] | ||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
examples/nuxt-app/test/fixtures/landingpage/content-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,81 @@ | ||
{ | ||
"title": "Content Collection Landing Page", | ||
"changed": "2022-11-02T12:47:29+11:00", | ||
"created": "2022-11-02T12:47:29+11:00", | ||
"type": "landing_page", | ||
"status": "published", | ||
"nid": "11dede11-10c0-111e1-1100-000000000330", | ||
"showTopicTags": false, | ||
"topicTags": [], | ||
"sidebar": {}, | ||
"summary": "Summary", | ||
"background": "default", | ||
"header": { | ||
"title": "Test Content Collection", | ||
"backgroundImage": null | ||
}, | ||
"bodyComponents": [ | ||
{ | ||
"uuid": "b10133a8-a599-4b60-8313-a6d143cb0bd3", | ||
"component": "TideLandingPageContentCollection", | ||
"id": "2192", | ||
"title": "Content Collection", | ||
"props": { | ||
"description": "<p>My content collection</p>", | ||
"link": { | ||
"text": "My link", | ||
"url": "/my-lnk" | ||
}, | ||
"filters": [ | ||
{ | ||
"type": "any", | ||
"field": "type", | ||
"values": [ | ||
"landing_page", | ||
"publication", | ||
"news", | ||
"event" | ||
] | ||
}, | ||
{ | ||
"type": "any", | ||
"field": "field_node_site", | ||
"values": [ | ||
8888 | ||
] | ||
} | ||
], | ||
"sortBy": [ | ||
{ | ||
"field": "field_news_date", | ||
"direction": "desc" | ||
}, | ||
{ | ||
"field": "created", | ||
"direction": "desc" | ||
} | ||
], | ||
"perPage": 3, | ||
"display": { | ||
"type": "card", | ||
"style": "thumbnail" | ||
} | ||
} | ||
} | ||
], | ||
"meta": { | ||
"url": "/demo-landing-page", | ||
"langcode": "en", | ||
"description": "Nulla ultricies dignissim leo, posuere vestibulum erat cursus vitae", | ||
"additional": [], | ||
"keywords": "", | ||
"image": { | ||
"src": "/placeholders/medium.png", | ||
"alt": "Demo: Melbourne tram", | ||
"title": "Demo: Melbourne tram", | ||
"width": 1413, | ||
"height": 785, | ||
"drupal_internal__target_id": 46 | ||
} | ||
} | ||
} |
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
43 changes: 43 additions & 0 deletions
43
packages/ripple-test-utils/step_definitions/components/content-collection.ts
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,43 @@ | ||
import { Then, DataTable } from '@badeball/cypress-cucumber-preprocessor' | ||
|
||
Then( | ||
'the content collection with ID {string} exist with the following cards', | ||
(id: string, dataTable: DataTable) => { | ||
const table = dataTable.hashes() | ||
|
||
cy.get(`[data-component-id="${id}"]`).as('component') | ||
|
||
cy.get('@component') | ||
.should('exist') | ||
.should( | ||
'have.attr', | ||
'data-component-type', | ||
'TideLandingPageContentCollection' | ||
) | ||
|
||
cy.get('@component').within(() => { | ||
cy.get('.rpl-card').as('items') | ||
}) | ||
|
||
table.forEach((row, i: number) => { | ||
cy.get('@items') | ||
.eq(i) | ||
.then((item) => { | ||
cy.wrap(item).as('item') | ||
cy.get('@item').find('a').should('have.attr', 'href', row.url) | ||
cy.get('@item').find('.rpl-card__cta').should('contain', row.title) | ||
cy.get('@item') | ||
.find('.rpl-card__content') | ||
.should('contain', row.content) | ||
|
||
if (row.image) { | ||
cy.get('@item') | ||
.find('.rpl-image') | ||
.should('have.attr', 'src', row.image) | ||
} else { | ||
cy.get('@item').find('.rpl-image').should('not.exist') | ||
} | ||
}) | ||
}) | ||
} | ||
) |
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
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,7 @@ | ||
export default defineAppConfig({ | ||
ripple: { | ||
featureFlags: { | ||
contentCollectionSearchConnector: 'elasticsearch' | ||
} | ||
} | ||
}) |
Oops, something went wrong.