From e321cb6ce92508c0509314021ef49fbef2a2a47e Mon Sep 17 00:00:00 2001 From: David Featherston Date: Thu, 17 Aug 2023 11:00:38 +1000 Subject: [PATCH 01/15] feat(@dpc-sdp/nuxt-ripple): add support for new print logo cms field --- packages/nuxt-ripple/components/TideBaseLayout.vue | 1 - packages/nuxt-ripple/mapping/site/index.ts | 4 +++- packages/ripple-tide-api/types.d.ts | 1 + .../src/components/primary-nav/RplPrimaryNav.stories.mdx | 4 ++-- .../primary-nav/components/nav-bar/RplPrimaryNavBar.css | 1 + .../primary-nav/components/nav-bar/RplPrimaryNavBar.vue | 4 ++-- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/nuxt-ripple/components/TideBaseLayout.vue b/packages/nuxt-ripple/components/TideBaseLayout.vue index 1560bdec03..87547698fe 100644 --- a/packages/nuxt-ripple/components/TideBaseLayout.vue +++ b/packages/nuxt-ripple/components/TideBaseLayout.vue @@ -13,7 +13,6 @@ ({ primaryLogo: { href: '#', src: 'img/primary-nav-logo-primary.svg', - printsrc: 'img/primary-nav-logo-primary-print.svg', + printSrc: 'img/primary-nav-logo-primary-print.svg', altText: 'Primary logo alt text' }, items: RplPrimaryNavItems @@ -121,7 +121,7 @@ This example uses a supplied secondary logo. href: '#', src: 'img/primary-nav-logo-secondary.svg', altText: 'Secondary logo alt text', - printsrc: 'img/primary-nav-logo-secondary-print.svg' + printSrc: 'img/primary-nav-logo-secondary-print.svg' } }} > diff --git a/packages/ripple-ui-core/src/components/primary-nav/components/nav-bar/RplPrimaryNavBar.css b/packages/ripple-ui-core/src/components/primary-nav/components/nav-bar/RplPrimaryNavBar.css index 585a041790..8910434e23 100644 --- a/packages/ripple-ui-core/src/components/primary-nav/components/nav-bar/RplPrimaryNavBar.css +++ b/packages/ripple-ui-core/src/components/primary-nav/components/nav-bar/RplPrimaryNavBar.css @@ -49,6 +49,7 @@ height: 30px; padding-top: var(--rpl-sp-1); padding-bottom: var(--rpl-sp-1); + fill: var(--rpl-clr-type-default); } } diff --git a/packages/ripple-ui-core/src/components/primary-nav/components/nav-bar/RplPrimaryNavBar.vue b/packages/ripple-ui-core/src/components/primary-nav/components/nav-bar/RplPrimaryNavBar.vue index 2478bfdb13..0370dccde9 100644 --- a/packages/ripple-ui-core/src/components/primary-nav/components/nav-bar/RplPrimaryNavBar.vue +++ b/packages/ripple-ui-core/src/components/primary-nav/components/nav-bar/RplPrimaryNavBar.vue @@ -81,7 +81,7 @@ const handleToggleItem = (level: number, item) => { { :alt="primaryLogo.altText" /> Date: Thu, 17 Aug 2023 14:06:54 +1000 Subject: [PATCH 02/15] test: refactor page and site mocking step definitions --- examples/nuxt-app/cypress.config.mjs | 3 ++- .../test/features/errors/errors.feature | 6 ++--- .../test/features/event/event.feature | 4 +-- .../test/features/grant/grant.feature | 4 +-- .../test/features/landingpage/forms.feature | 24 ++++++++--------- .../test/features/landingpage/home.feature | 8 +++--- .../features/landingpage/languages.feature | 6 ++--- .../test/features/media/media.feature | 8 +++--- .../nuxt-app/test/features/news/news.feature | 4 +-- .../publication-page/publication-page.feature | 4 +-- .../features/publication/publication.feature | 4 +-- .../search-listing/aggregations.feature | 4 +-- .../features/search-listing/errors.feature | 6 ++--- .../features/search-listing/filters.feature | 18 ++++++------- .../features/search-listing/grants.feature | 12 ++++----- .../features/search-listing/grid-list.feature | 4 +-- .../search-listing/pagination.feature | 8 +++--- .../test/features/search-listing/sort.feature | 4 +-- .../features/search-listing/table.feature | 4 +-- .../test/features/site/alerts.feature | 20 +++++++------- .../features/site/shared-elements.feature | 26 +++++++++---------- .../nuxt-app/test/features/site/theme.feature | 12 ++++----- .../test/features/sitemap/sitemap.feature | 2 +- .../add/content-type/test.feature.t | 4 +-- .../step_definitions/common/mocks.ts | 25 +++++++++++++++--- 25 files changed, 122 insertions(+), 102 deletions(-) diff --git a/examples/nuxt-app/cypress.config.mjs b/examples/nuxt-app/cypress.config.mjs index 6ed8768c89..5329014d44 100644 --- a/examples/nuxt-app/cypress.config.mjs +++ b/examples/nuxt-app/cypress.config.mjs @@ -5,7 +5,8 @@ import * as rplCypressConfigPkg from '@dpc-sdp/ripple-test-utils' export default defineConfig({ projectId: 'mie4kg', env: { - searchIndex: process.env.NUXT_PUBLIC_TIDE_APP_SEARCH_ENGINE_NAME + searchIndex: process.env.NUXT_PUBLIC_TIDE_APP_SEARCH_ENGINE_NAME, + NUXT_PUBLIC_TIDE_SITE: process.env.NUXT_PUBLIC_TIDE_SITE, }, e2e: { baseUrl: 'http://localhost:3000', diff --git a/examples/nuxt-app/test/features/errors/errors.feature b/examples/nuxt-app/test/features/errors/errors.feature index e7bd62482a..00d5872033 100644 --- a/examples/nuxt-app/test/features/errors/errors.feature +++ b/examples/nuxt-app/test/features/errors/errors.feature @@ -3,18 +3,18 @@ Feature: Error pages As a site user I can see relevant error pages displayed. Background: - Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" with status 200 + Given the site endpoint returns fixture "/site/reference" with status 200 @mockserver Example: 500 - Given the endpoint "/api/tide/page" with query "?path=/500&site=8888" returns fixture "/errors/500" with status 500 + Given the page endpoint for path "/500" returns fixture "/errors/500" with status 500 When I visit the page "/500" Then the error page "/500" has a status of 500 And the error content contains the status 500 @mockserver Example: 404 - Given the endpoint "/api/tide/page" with query "?path=/404&site=8888" returns fixture "/errors/404" with status 404 + Given the page endpoint for path "/404" returns fixture "/errors/404" with status 404 When I visit the page "/404" Then the error page "/404" has a status of 404 And the error content contains the status 404 diff --git a/examples/nuxt-app/test/features/event/event.feature b/examples/nuxt-app/test/features/event/event.feature index 8ecca23cf0..4c611900fb 100644 --- a/examples/nuxt-app/test/features/event/event.feature +++ b/examples/nuxt-app/test/features/event/event.feature @@ -3,8 +3,8 @@ Feature: Event page Example of mocked page Background: - Given the endpoint "/api/tide/page" with query "?path=/sample-event&site=8888" returns fixture "/event/sample-event" with status 200 - And the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" with status 200 + Given the page endpoint for path "/sample-event" returns fixture "/event/sample-event" with status 200 + And the site endpoint returns fixture "/site/reference" with status 200 When I visit the page "/sample-event" @mockserver diff --git a/examples/nuxt-app/test/features/grant/grant.feature b/examples/nuxt-app/test/features/grant/grant.feature index 53c5498ffe..d9e01edbdc 100644 --- a/examples/nuxt-app/test/features/grant/grant.feature +++ b/examples/nuxt-app/test/features/grant/grant.feature @@ -3,8 +3,8 @@ Feature: Grant page Example of mocked page Background: - Given the endpoint "/api/tide/page" with query "?path=/tc-9a-grant-simple-test-date-range&site=8888" returns fixture "/grant/tc-9a-grant-simple-test-date-range" with status 200 - And the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" with status 200 + Given the page endpoint for path "/tc-9a-grant-simple-test-date-range" returns fixture "/grant/tc-9a-grant-simple-test-date-range" with status 200 + And the site endpoint returns fixture "/site/reference" with status 200 When I visit the page "/tc-9a-grant-simple-test-date-range" @mockserver diff --git a/examples/nuxt-app/test/features/landingpage/forms.feature b/examples/nuxt-app/test/features/landingpage/forms.feature index e6ac8b648f..4054ba0b01 100644 --- a/examples/nuxt-app/test/features/landingpage/forms.feature +++ b/examples/nuxt-app/test/features/landingpage/forms.feature @@ -5,8 +5,8 @@ Feature: Forms @mockserver Scenario: Kitchen sink Given the mock server has started - And the endpoint "/api/tide/page" with query "?path=/kitchen-sink&site=8888" returns fixture "/landingpage/full-form" with status 200 - And the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" with status 200 + And the page endpoint for path "/kitchen-sink" returns fixture "/landingpage/full-form" with status 200 + And the site endpoint returns fixture "/site/reference" with status 200 Given I visit the page "/kitchen-sink" Then the landing page component "TideLandingPageWebForm" should exist And the form with ID "full_form" should exist @@ -42,8 +42,8 @@ Feature: Forms @mockserver Scenario: Error summary Given the mock server has started - And the endpoint "/api/tide/page" with query "?path=/kitchen-sink&site=8888" returns fixture "/landingpage/full-form" with status 200 - And the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" with status 200 + And page api returns fixture "/landingpage/full-form" with status 200 + And site api returns fixture "/site/reference" with status 200 Given I visit the page "/kitchen-sink" Then the landing page component "TideLandingPageWebForm" should exist And the form with ID "full_form" should exist @@ -61,8 +61,8 @@ Feature: Forms @mockserver Scenario: Simple validation Given the mock server has started - And the endpoint "/api/tide/page" with query "?path=/kitchen-sink&site=8888" returns fixture "/landingpage/full-form" with status 200 - And the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" with status 200 + And the page endpoint for path "/kitchen-sink" returns fixture "/landingpage/full-form" with status 200 + And the site endpoint returns fixture "/site/reference" with status 200 Given I visit the page "/kitchen-sink" Then the landing page component "TideLandingPageWebForm" should exist And the form with ID "full_form" should exist @@ -79,8 +79,8 @@ Feature: Forms @mockserver Scenario: Form submission - Error Given the mock server has started - And the endpoint "/api/tide/page" with query "?path=/kitchen-sink&site=8888" returns fixture "/landingpage/full-form" with status 200 - And the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" with status 200 + And the page endpoint for path "/kitchen-sink" returns fixture "/landingpage/full-form" with status 200 + And the site endpoint returns fixture "/site/reference" with status 200 And posting to endpoint "/api/tide/webform_submission/full_form" with query "?id=8888" returns fixture "/landingpage/full-form-error-response" with status 500 Given I visit the page "/kitchen-sink" Then the landing page component "TideLandingPageWebForm" should exist @@ -100,8 +100,8 @@ Feature: Forms @mockserver Scenario: Form submission - Success Given the mock server has started - And the endpoint "/api/tide/page" with query "?path=/kitchen-sink&site=8888" returns fixture "/landingpage/full-form" with status 200 - And the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" with status 200 + And the page endpoint for path "/kitchen-sink" returns fixture "/landingpage/full-form" with status 200 + And the site endpoint returns fixture "/site/reference" with status 200 And posting to endpoint "/api/tide/webform_submission/full_form" with query "?site=8888" returns fixture "/landingpage/full-form-success-response" with status 201 Given I visit the page "/kitchen-sink" Then the landing page component "TideLandingPageWebForm" should exist @@ -128,8 +128,8 @@ Feature: Forms @mockserver Scenario: Field counter Given the mock server has started - And the endpoint "/api/tide/page" with query "?path=/kitchen-sink&site=8888" returns fixture "/landingpage/full-form" with status 200 - And the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" with status 200 + And the page endpoint for path "/kitchen-sink" returns fixture "/landingpage/full-form" with status 200 + And the site endpoint returns fixture "/site/reference" with status 200 Given I visit the page "/kitchen-sink" Then the landing page component "TideLandingPageWebForm" should exist And the form with ID "full_form" should exist diff --git a/examples/nuxt-app/test/features/landingpage/home.feature b/examples/nuxt-app/test/features/landingpage/home.feature index 5550805fad..6bc630fb35 100644 --- a/examples/nuxt-app/test/features/landingpage/home.feature +++ b/examples/nuxt-app/test/features/landingpage/home.feature @@ -2,13 +2,13 @@ Feature: Home page Example of mocked page Background: - Given the endpoint "/api/tide/page" with query "?path=/&site=8888" returns fixture "/landingpage/home" with status 200 - And the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" with status 200 + Given the page endpoint for path "/" returns fixture "/landingpage/home" with status 200 + And the site endpoint returns fixture "/site/reference" with status 200 Given I visit the page "/" @mockserver Scenario: On 404 - Given the endpoint "/api/tide/page" with query "?path=/404&site=8888" returns fixture "/errors/404" with status 404 + Given the page endpoint for path "/404" returns fixture "/errors/404" with status 404 Given I visit the page "/404" @mockserver @@ -62,7 +62,7 @@ Feature: Home page @mockserver Scenario: Header component - Search banner - Given the endpoint "/api/tide/page" with query "?path=/search/cats&site=8888" returns fixture "/landingpage/home" with status 200 + Given the page endpoint for path "/search/cats" returns fixture "/landingpage/home" with status 200 Then a search banner with ID "1911" should exist with the placeholder "Test search placeholder" Then in a search banner with ID "1911", searching for "cats" should take me to "/search/cats" diff --git a/examples/nuxt-app/test/features/landingpage/languages.feature b/examples/nuxt-app/test/features/landingpage/languages.feature index 08b07c7e21..93129e1feb 100644 --- a/examples/nuxt-app/test/features/landingpage/languages.feature +++ b/examples/nuxt-app/test/features/landingpage/languages.feature @@ -1,18 +1,18 @@ Feature: Languages Background: - Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" with status 200 + Given the site endpoint returns fixture "/site/reference" with status 200 @mockserver Scenario: RTL languages load with the correct font and direction - Given the endpoint "/api/tide/page" with query "?path=/arabic-page&site=8888" returns fixture "/landingpage/languages-ar" with status 200 + Given the page endpoint for path "/arabic-page" returns fixture "/landingpage/languages-ar" with status 200 When I visit the page "/arabic-page" Then The section ".rpl-header" should be display "rtl" in "ar" with the font "Noto Kufi Arabic" And The section "#rpl-main" should be display "rtl" in "ar" with the font "Noto Kufi Arabic" @mockserver Scenario: LTR languages load with the correct font and direction - Given the endpoint "/api/tide/page" with query "?path=/korean-page&site=8888" returns fixture "/landingpage/languages-ko" with status 200 + Given the page endpoint for path "/korean-page" returns fixture "/landingpage/languages-ko" with status 200 When I visit the page "/korean-page" Then The section ".rpl-header" should be display "ltr" in "ko" with the font "Noto Sans KR" And The section "#rpl-main" should be display "ltr" in "ko" with the font "Noto Sans KR" diff --git a/examples/nuxt-app/test/features/media/media.feature b/examples/nuxt-app/test/features/media/media.feature index ec779843e8..3cbf0647f6 100644 --- a/examples/nuxt-app/test/features/media/media.feature +++ b/examples/nuxt-app/test/features/media/media.feature @@ -4,8 +4,8 @@ Feature: Media page @mockserver Example: Video - Given the endpoint "/api/tide/page" with query "?path=/media/36&site=8888" returns fixture "/media/36" with status 200 - And the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" with status 200 + Given the page endpoint for path "/media/36" returns fixture "/media/36" with status 200 + And the site endpoint returns fixture "/site/reference" with status 200 When I visit the page "/media/36" Then the title should be "Demo: Embedded Video" And the media page should display content which includes "Video transcript content" @@ -14,8 +14,8 @@ Feature: Media page @mockserver Example: Audio - Given the endpoint "/api/tide/page" with query "?path=/media/271&site=8888" returns fixture "/media/271" with status 200 - And the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" with status 200 + Given the page endpoint for path "/media/271" returns fixture "/media/271" with status 200 + And the site endpoint returns fixture "/site/reference" with status 200 When I visit the page "/media/271" Then the title should be "Demo: Audio" And the media page should display content which includes "Audio transcript content" diff --git a/examples/nuxt-app/test/features/news/news.feature b/examples/nuxt-app/test/features/news/news.feature index fcda1ce7c3..695daaa3e1 100644 --- a/examples/nuxt-app/test/features/news/news.feature +++ b/examples/nuxt-app/test/features/news/news.feature @@ -1,8 +1,8 @@ Feature: News page Background: - Given the endpoint "/api/tide/page" with query "?path=/sample-news&site=8888" returns fixture "/news/sample-news" with status 200 - And the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" with status 200 + Given the page endpoint for path "/sample-news" returns fixture "/news/sample-news" with status 200 + And the site endpoint returns fixture "/site/reference" with status 200 When I visit the page "/sample-news" @mockserver diff --git a/examples/nuxt-app/test/features/publication-page/publication-page.feature b/examples/nuxt-app/test/features/publication-page/publication-page.feature index 53c8ab10f6..ee148defc4 100644 --- a/examples/nuxt-app/test/features/publication-page/publication-page.feature +++ b/examples/nuxt-app/test/features/publication-page/publication-page.feature @@ -3,9 +3,9 @@ Feature: Publication page page Example of mocked page Background: - Given the endpoint "/api/tide/page" with query "?path=/demo-publication/demo-publication-chapter-1&site=8888" returns fixture "/publication-page/sample-publication-page" with status 200 + Given the page endpoint for path "/demo-publication/demo-publication-chapter-1" returns fixture "/publication-page/sample-publication-page" with status 200 And the endpoint "/api/tide/publication-index" with query "?id=11dede11-10c0-111e1-1100-000000000500" returns fixture "/publication/sample-index" with status 200 - And the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" with status 200 + And the site endpoint returns fixture "/site/reference" with status 200 @mockserver Example: On load diff --git a/examples/nuxt-app/test/features/publication/publication.feature b/examples/nuxt-app/test/features/publication/publication.feature index 671941995e..87ca4f0dc4 100644 --- a/examples/nuxt-app/test/features/publication/publication.feature +++ b/examples/nuxt-app/test/features/publication/publication.feature @@ -3,9 +3,9 @@ Feature: Publication page Example of mocked page Background: - Given the endpoint "/api/tide/page" with query "?path=/sample-publication&site=8888" returns fixture "/publication/sample-publication" with status 200 + Given the page endpoint for path "/sample-publication" returns fixture "/publication/sample-publication" with status 200 And the endpoint "/api/tide/publication-index" with query "?id=11dede11-10c0-111e1-1100-000000000500" returns fixture "/publication/sample-index" with status 200 - And the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" with status 200 + And the site endpoint returns fixture "/site/reference" with status 200 @mockserver Example: On load diff --git a/examples/nuxt-app/test/features/search-listing/aggregations.feature b/examples/nuxt-app/test/features/search-listing/aggregations.feature index 1b32774a0b..c0f03998ca 100644 --- a/examples/nuxt-app/test/features/search-listing/aggregations.feature +++ b/examples/nuxt-app/test/features/search-listing/aggregations.feature @@ -3,13 +3,13 @@ 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 + Given the site endpoint 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 + Given the page endpoint for path "/aggregations" 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" diff --git a/examples/nuxt-app/test/features/search-listing/errors.feature b/examples/nuxt-app/test/features/search-listing/errors.feature index 692e560af0..0da2a57a8a 100644 --- a/examples/nuxt-app/test/features/search-listing/errors.feature +++ b/examples/nuxt-app/test/features/search-listing/errors.feature @@ -3,13 +3,13 @@ Feature: Searching listing - Errors As a user I get notified of problems on the search listing page Background: - Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" 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 And I am using a "macbook-16" device @mockserver Example: No results message - Given the endpoint "/api/tide/page" with query "?path=/errors&site=8888" returns fixture "/search-listing/errors/page" with status 200 + Given the page endpoint for path "/errors" returns fixture "/search-listing/errors/page" with status 200 And the search network request is stubbed with fixture "/search-listing/errors/response-empty" and status 200 And the current date is "Fri, 02 Feb 2050 03:04:05 GMT" When I visit the page "/errors" @@ -32,7 +32,7 @@ Feature: Searching listing - Errors @mockserver Example: Search error - Given the endpoint "/api/tide/page" with query "?path=/errors&site=8888" returns fixture "/search-listing/errors/page" with status 200 + Given the page endpoint for path "/errors" returns fixture "/search-listing/errors/page" with status 200 And the search network request is stubbed with fixture "/search-listing/errors/response-error" and status 403 And the current date is "Fri, 02 Feb 2050 03:04:05 GMT" When I visit the page "/errors" diff --git a/examples/nuxt-app/test/features/search-listing/filters.feature b/examples/nuxt-app/test/features/search-listing/filters.feature index 989bb10069..f81b0a7ef0 100644 --- a/examples/nuxt-app/test/features/search-listing/filters.feature +++ b/examples/nuxt-app/test/features/search-listing/filters.feature @@ -3,13 +3,13 @@ Feature: Search listing - Filter As a user I can apply filters to my search Background: - Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" 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 And I am using a "macbook-16" device @mockserver Example: Raw filter - Should reflect the value from the URL - Given the endpoint "/api/tide/page" with query "?path=/filters&site=8888" returns fixture "/search-listing/filters/page" with status 200 + Given the page endpoint for path "/filters" returns fixture "/search-listing/filters/page" with status 200 And the search network request is stubbed with fixture "/search-listing/filters/response" and status 200 And the current date is "Fri, 02 Feb 2050 03:04:05 GMT" @@ -25,7 +25,7 @@ Feature: Search listing - Filter @mockserver Example: Term filter - Should reflect a single value from the URL - Given the endpoint "/api/tide/page" with query "?path=/filters&site=8888" returns fixture "/search-listing/filters/page" with status 200 + Given the page endpoint for path "/filters" returns fixture "/search-listing/filters/page" with status 200 And the search network request is stubbed with fixture "/search-listing/filters/response" and status 200 And the current date is "Fri, 02 Feb 2050 03:04:05 GMT" @@ -40,7 +40,7 @@ Feature: Search listing - Filter @mockserver Example: Term filter - Should reflect an array from the URL - Given the endpoint "/api/tide/page" with query "?path=/filters&site=8888" returns fixture "/search-listing/filters/page" with status 200 + Given the page endpoint for path "/filters" returns fixture "/search-listing/filters/page" with status 200 And the search network request is stubbed with fixture "/search-listing/filters/response" and status 200 And the current date is "Fri, 02 Feb 2050 03:04:05 GMT" @@ -55,7 +55,7 @@ Feature: Search listing - Filter @mockserver Example: Terms (with an 's') - Should reflect a single value from the URL - Given the endpoint "/api/tide/page" with query "?path=/filters&site=8888" returns fixture "/search-listing/filters/page" with status 200 + Given the page endpoint for path "/filters" returns fixture "/search-listing/filters/page" with status 200 And the search network request is stubbed with fixture "/search-listing/filters/response" and status 200 And the current date is "Fri, 02 Feb 2050 03:04:05 GMT" @@ -70,7 +70,7 @@ Feature: Search listing - Filter @mockserver Example: Terms (with an 's') - Should reflect an array from the URL - Given the endpoint "/api/tide/page" with query "?path=/filters&site=8888" returns fixture "/search-listing/filters/page" with status 200 + Given the page endpoint for path "/filters" returns fixture "/search-listing/filters/page" with status 200 And the search network request is stubbed with fixture "/search-listing/filters/response" and status 200 And the current date is "Fri, 02 Feb 2050 03:04:05 GMT" @@ -85,7 +85,7 @@ Feature: Search listing - Filter @mockserver Example: Custom function filters - Should reflect an array from the URL - Given the endpoint "/api/tide/page" with query "?path=/filters&site=8888" returns fixture "/search-listing/filters/page" with status 200 + Given the page endpoint for path "/filters" returns fixture "/search-listing/filters/page" with status 200 And the search network request is stubbed with fixture "/search-listing/filters/response" and status 200 And the current date is "Fri, 02 Feb 2050 03:04:05 GMT" @@ -100,7 +100,7 @@ Feature: Search listing - Filter @mockserver Example: Clear filters - Given the endpoint "/api/tide/page" with query "?path=/filters&site=8888" returns fixture "/search-listing/filters/page" with status 200 + Given the page endpoint for path "/filters" returns fixture "/search-listing/filters/page" with status 200 And the search network request is stubbed with fixture "/search-listing/filters/response" and status 200 And the current date is "Fri, 02 Feb 2050 03:04:05 GMT" @@ -146,7 +146,7 @@ Feature: Search listing - Filter @mockserver Example: Should update the URL when the filters are applied - Given the endpoint "/api/tide/page" with query "?path=/filters&site=8888" returns fixture "/search-listing/filters/page" with status 200 + Given the page endpoint for path "/filters" returns fixture "/search-listing/filters/page" with status 200 And the search network request is stubbed with fixture "/search-listing/filters/response" and status 200 And the current date is "Fri, 02 Feb 2050 03:04:05 GMT" diff --git a/examples/nuxt-app/test/features/search-listing/grants.feature b/examples/nuxt-app/test/features/search-listing/grants.feature index e9e6f8a500..cae7c202d1 100644 --- a/examples/nuxt-app/test/features/search-listing/grants.feature +++ b/examples/nuxt-app/test/features/search-listing/grants.feature @@ -3,13 +3,13 @@ Feature: Grants collection As a user I can search for grants and filter them by status Background: - Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" 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 And I am using a "macbook-16" device @mockserver Example: Results formatting - Given the endpoint "/api/tide/page" with query "?path=/grants&site=8888" returns fixture "/search-listing/grants/page" with status 200 + Given the page endpoint for path "/grants" returns fixture "/search-listing/grants/page" with status 200 And the search network request is stubbed with fixture "/search-listing/grants/response" and status 200 And the current date is "Fri, 02 Feb 2050 03:04:05 GMT" When I visit the page "/grants" @@ -23,7 +23,7 @@ Feature: Grants collection @mockserver Example: Grant status filter - Open - Given the endpoint "/api/tide/page" with query "?path=/grants&site=8888" returns fixture "/search-listing/grants/page" with status 200 + Given the page endpoint for path "/grants" returns fixture "/search-listing/grants/page" with status 200 And the search network request is stubbed with fixture "/search-listing/grants/response" and status 200 And the current date is "Fri, 02 Feb 2050 03:04:05 GMT" When I visit the page "/grants?status=open" @@ -32,7 +32,7 @@ Feature: Grants collection @mockserver Example: Grant status filter - Closed - Given the endpoint "/api/tide/page" with query "?path=/grants&site=8888" returns fixture "/search-listing/grants/page" with status 200 + Given the page endpoint for path "/grants" returns fixture "/search-listing/grants/page" with status 200 And the search network request is stubbed with fixture "/search-listing/grants/response" and status 200 And the current date is "Fri, 02 Feb 2050 03:04:05 GMT" When I visit the page "/grants?status=closed" @@ -41,7 +41,7 @@ Feature: Grants collection @mockserver Example: Grant status filter - Ongoing - Given the endpoint "/api/tide/page" with query "?path=/grants&site=8888" returns fixture "/search-listing/grants/page" with status 200 + Given the page endpoint for path "/grants" returns fixture "/search-listing/grants/page" with status 200 And the search network request is stubbed with fixture "/search-listing/grants/response" and status 200 And the current date is "Fri, 02 Feb 2050 03:04:05 GMT" When I visit the page "/grants?status=ongoing" @@ -50,7 +50,7 @@ Feature: Grants collection @mockserver Example: Grant status filter - Opening soon - Given the endpoint "/api/tide/page" with query "?path=/grants&site=8888" returns fixture "/search-listing/grants/page" with status 200 + Given the page endpoint for path "/grants" returns fixture "/search-listing/grants/page" with status 200 And the search network request is stubbed with fixture "/search-listing/grants/response" and status 200 And the current date is "Fri, 02 Feb 2050 03:04:05 GMT" When I visit the page "/grants?status=opening_soon" diff --git a/examples/nuxt-app/test/features/search-listing/grid-list.feature b/examples/nuxt-app/test/features/search-listing/grid-list.feature index 45cc7dc1a2..7e66759d28 100644 --- a/examples/nuxt-app/test/features/search-listing/grid-list.feature +++ b/examples/nuxt-app/test/features/search-listing/grid-list.feature @@ -3,13 +3,13 @@ Feature: Grid collection As a site I can see a collection of links to other pages in a grid and interact with it to find the one I want. Background: - Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" 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 And I am using a "macbook-16" device @mockserver Example: Emergency resource portal - Given the endpoint "/api/tide/page" with query "?path=/search-list-grid&site=8888" returns fixture "/search-listing/grid/page" with status 200 + Given the page endpoint for path "/search-list-grid" returns fixture "/search-listing/grid/page" with status 200 And the search network request is stubbed with fixture "/search-listing/grid/response" and status 200 When I visit the page "/search-list-grid" Then the search listing page should have 9 results diff --git a/examples/nuxt-app/test/features/search-listing/pagination.feature b/examples/nuxt-app/test/features/search-listing/pagination.feature index fcfa7b4705..d9d8495e1d 100644 --- a/examples/nuxt-app/test/features/search-listing/pagination.feature +++ b/examples/nuxt-app/test/features/search-listing/pagination.feature @@ -3,13 +3,13 @@ Feature: Searching listing - Pagination As a user I can navigate through pages of results using pagination controls Background: - Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" 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 And I am using a "macbook-16" device @mockserver Example: Pagination controls - Given the endpoint "/api/tide/page" with query "?path=/pagination&site=8888" returns fixture "/search-listing/pagination/page" with status 200 + Given the page endpoint for path "/pagination" returns fixture "/search-listing/pagination/page" with status 200 And the search network request is stubbed with fixture "/search-listing/pagination/response-page-1" and status 200 And the current date is "Fri, 02 Feb 2050 03:04:05 GMT" When I visit the page "/pagination" @@ -63,7 +63,7 @@ Feature: Searching listing - Pagination @mockserver Example: Searching resets to page 1 - Given the endpoint "/api/tide/page" with query "?path=/pagination&site=8888" returns fixture "/search-listing/pagination/page" with status 200 + Given the page endpoint for path "/pagination" returns fixture "/search-listing/pagination/page" with status 200 And the search network request is stubbed with fixture "/search-listing/pagination/response-page-1" and status 200 And the current date is "Fri, 02 Feb 2050 03:04:05 GMT" When I visit the page "/pagination" @@ -94,7 +94,7 @@ Feature: Searching listing - Pagination @mockserver Example: Reads initial page from URL - Given the endpoint "/api/tide/page" with query "?path=/pagination&site=8888" returns fixture "/search-listing/pagination/page" with status 200 + Given the page endpoint for path "/pagination" returns fixture "/search-listing/pagination/page" with status 200 And the search network request is stubbed with fixture "/search-listing/pagination/response-page-3" and status 200 And the current date is "Fri, 02 Feb 2050 03:04:05 GMT" When I visit the page "/pagination?page=3" diff --git a/examples/nuxt-app/test/features/search-listing/sort.feature b/examples/nuxt-app/test/features/search-listing/sort.feature index 564d180650..8bea36d5d0 100644 --- a/examples/nuxt-app/test/features/search-listing/sort.feature +++ b/examples/nuxt-app/test/features/search-listing/sort.feature @@ -3,13 +3,13 @@ Feature: Search listing - Filter As a user I can see search results sorted in a useful way Background: - Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" 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 And I am using a "macbook-16" device @mockserver Example: Custom sort from config - Given the endpoint "/api/tide/page" with query "?path=/sort&site=8888" returns fixture "/search-listing/sort/page" with status 200 + Given the page endpoint for path "/sort" returns fixture "/search-listing/sort/page" with status 200 And the search network request is stubbed with fixture "/search-listing/sort/response" and status 200 And the current date is "Fri, 02 Feb 2050 03:04:05 GMT" diff --git a/examples/nuxt-app/test/features/search-listing/table.feature b/examples/nuxt-app/test/features/search-listing/table.feature index f13d7401a1..a16474199a 100644 --- a/examples/nuxt-app/test/features/search-listing/table.feature +++ b/examples/nuxt-app/test/features/search-listing/table.feature @@ -3,13 +3,13 @@ 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 + Given the site endpoint 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 + Given the page endpoint for path "/search-listing-table" 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 diff --git a/examples/nuxt-app/test/features/site/alerts.feature b/examples/nuxt-app/test/features/site/alerts.feature index f83503dc0d..1f6f60c963 100644 --- a/examples/nuxt-app/test/features/site/alerts.feature +++ b/examples/nuxt-app/test/features/site/alerts.feature @@ -4,8 +4,8 @@ Feature: Site alerts @mockserver Scenario: Alert display - Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/alerts" with status 200 - And the endpoint "/api/tide/page" with query "?path=/&site=8888" returns fixture "/landingpage/home" with status 200 + Given the site endpoint returns fixture "/site/alerts" with status 200 + And the page endpoint for path "/" returns fixture "/landingpage/home" with status 200 Given I visit the page "/" Then the following alerts should be displayed in this order | title | icon | variant | linkText | linkUrl | @@ -29,8 +29,8 @@ Feature: Site alerts | ALERT_8 | | ALERT_9 | - Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/alerts" with status 200 - And the endpoint "/api/tide/page" with query "?path=/&site=8888" returns fixture "/landingpage/home" with status 200 + Given the site endpoint returns fixture "/site/alerts" with status 200 + And the page endpoint for path "/" returns fixture "/landingpage/home" with status 200 Given I visit the page "/" Then the following alerts should be displayed in this order @@ -44,8 +44,8 @@ Feature: Site alerts @mockserver Scenario: User dismisses alert - Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/alerts" with status 200 - And the endpoint "/api/tide/page" with query "?path=/&site=8888" returns fixture "/landingpage/home" with status 200 + Given the site endpoint returns fixture "/site/alerts" with status 200 + And the page endpoint for path "/" returns fixture "/landingpage/home" with status 200 Given I visit the page "/" When the user dismisses the alert with ID "ALERT_2" @@ -79,8 +79,8 @@ Feature: Site alerts | ALERT_8 | | ALERT_9 | - Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/alerts" with status 200 - And the endpoint "/api/tide/page" with query "?path=/&site=8888" returns fixture "/landingpage/home" with status 200 + Given the site endpoint returns fixture "/site/alerts" with status 200 + And the page endpoint for path "/" returns fixture "/landingpage/home" with status 200 Given I visit the page "/" When the user dismisses the alert with ID "ALERT_6" @@ -104,8 +104,8 @@ Feature: Site alerts @mockserver Scenario: More details link - Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/alerts" with status 200 - And the endpoint "/api/tide/page" with query "?path=/&site=8888" returns fixture "/landingpage/home" with status 200 + Given the site endpoint returns fixture "/site/alerts" with status 200 + And the page endpoint for path "/" returns fixture "/landingpage/home" with status 200 Given I visit the page "/" Then clicking the more details link for the alert with ID "ALERT_2" should take me to "/demo-link" diff --git a/examples/nuxt-app/test/features/site/shared-elements.feature b/examples/nuxt-app/test/features/site/shared-elements.feature index ed3509cb1a..aafe8e5f1a 100644 --- a/examples/nuxt-app/test/features/site/shared-elements.feature +++ b/examples/nuxt-app/test/features/site/shared-elements.feature @@ -4,8 +4,8 @@ Feature: Shared site elements @mockserver Scenario: Breadcrumbs (page exists in menu) - Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/shared-elements" with status 200 - And the endpoint "/api/tide/page" with query "?path=/level-3-item-2&site=8888" returns fixture "/landingpage/home" with status 200 + Given the site endpoint returns fixture "/site/shared-elements" with status 200 + And the page endpoint for path "/level-3-item-2" returns fixture "/landingpage/home" with status 200 Given I visit the page "/level-3-item-2" Then the breadcrumbs should have the following items | text | url | @@ -16,8 +16,8 @@ Feature: Shared site elements @mockserver Scenario: Breadcrumbs (page does not exists in menu) - Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/shared-elements" with status 200 - And the endpoint "/api/tide/page" with query "?path=/some-random-page&site=8888" returns fixture "/landingpage/home" with status 200 + Given the site endpoint returns fixture "/site/shared-elements" with status 200 + And the page endpoint for path "/some-random-page" returns fixture "/landingpage/home" with status 200 Given I visit the page "/some-random-page" Then the breadcrumbs should have the following items | text | url | @@ -27,23 +27,23 @@ Feature: Shared site elements @mockserver Scenario: Breadcrumbs (root page) - Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/shared-elements" with status 200 - And the endpoint "/api/tide/page" with query "?path=/&site=8888" returns fixture "/landingpage/home" with status 200 + Given the site endpoint returns fixture "/site/shared-elements" with status 200 + And the page endpoint for path "/" returns fixture "/landingpage/home" with status 200 Given I visit the page "/" Then the breadcrumbs should not exist @mockserver Scenario: Last updated date - Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/shared-elements" with status 200 - And the endpoint "/api/tide/page" with query "?path=/some-random-page&site=8888" returns fixture "/landingpage/home" with status 200 + Given the site endpoint returns fixture "/site/shared-elements" with status 200 + And the page endpoint for path "/some-random-page" returns fixture "/landingpage/home" with status 200 Given I visit the page "/some-random-page" Then the last updated date text should read "Updated 2 November 2022" @mockserver Scenario: Topics and tags - Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/shared-elements" with status 200 - And the endpoint "/api/tide/page" with query "?path=/some-random-page&site=8888" returns fixture "/landingpage/home" with status 200 + Given the site endpoint returns fixture "/site/shared-elements" with status 200 + And the page endpoint for path "/some-random-page" returns fixture "/landingpage/home" with status 200 Given I visit the page "/some-random-page" Then the page should have the following topic tags @@ -53,8 +53,8 @@ Feature: Shared site elements @mockserver Scenario: Footer - Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/shared-elements" with status 200 - And the endpoint "/api/tide/page" with query "?path=/some-random-page&site=8888" returns fixture "/landingpage/home" with status 200 + Given the site endpoint returns fixture "/site/shared-elements" with status 200 + And the page endpoint for path "/some-random-page" returns fixture "/landingpage/home" with status 200 Given I visit the page "/some-random-page" Then the footer nav section with title "Level 1 - Item 1" should have the following links @@ -72,7 +72,7 @@ Feature: Shared site elements Then the footer copyright text should be "Test footer copyright html" Then the footer acknowledgement text should be "Test footer acknowledgement" Then the footer should have the following logos - | alt | url | src | + | alt | url | src | | Test logo 1 | /test-logo-1 | https://develop.content.reference.sdp.vic.gov.au/sites/default/files/tide_demo_content/Aerial-shot-of-new-housing-development.jpg?w=1984 | | Test logo 2 | /test-logo-2 | https://develop.content.reference.sdp.vic.gov.au/sites/default/files/tide_demo_content/2018-19-State-Budget.jpg?w=1984 | diff --git a/examples/nuxt-app/test/features/site/theme.feature b/examples/nuxt-app/test/features/site/theme.feature index 30254b97ee..e75e5b8f39 100644 --- a/examples/nuxt-app/test/features/site/theme.feature +++ b/examples/nuxt-app/test/features/site/theme.feature @@ -4,8 +4,8 @@ Feature: Site theme @mockserver Scenario: Default Theme - Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" with status 200 - And the endpoint "/api/tide/page" with query "?path=/&site=8888" returns fixture "/landingpage/home" with status 200 + Given the site endpoint returns fixture "/site/reference" with status 200 + And the page endpoint for path "/" returns fixture "/landingpage/home" with status 200 Given I visit the page "/" Then the site header background color should be "rgb(107, 25, 163)" Then the site footer should have the "default" theme applied @@ -14,15 +14,15 @@ Feature: Site theme @mockserver Scenario: Alternate Theme - Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/theme-red" with status 200 - And the endpoint "/api/tide/page" with query "?path=/&site=8888" returns fixture "/landingpage/home" with status 200 + Given the site endpoint returns fixture "/site/theme-red" with status 200 + And the page endpoint for path "/" returns fixture "/landingpage/home" with status 200 Given I visit the page "/" Then the site header background color should be "rgb(225, 57, 64)" @mockserver Scenario: Feature flags set neutral theme - Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/neutral-footer" with status 200 - And the endpoint "/api/tide/page" with query "?path=/&site=8888" returns fixture "/landingpage/image-banner" with status 200 + Given the site endpoint returns fixture "/site/neutral-footer" with status 200 + And the page endpoint for path "/" returns fixture "/landingpage/image-banner" with status 200 Given I visit the page "/" Then the site footer should have the "neutral" theme applied And ripple buttons should have the "neutral" theme applied diff --git a/examples/nuxt-app/test/features/sitemap/sitemap.feature b/examples/nuxt-app/test/features/sitemap/sitemap.feature index e92b5da397..3c85c0c63b 100644 --- a/examples/nuxt-app/test/features/sitemap/sitemap.feature +++ b/examples/nuxt-app/test/features/sitemap/sitemap.feature @@ -4,7 +4,7 @@ Feature: Sitemap @mockserver Scenario: Visit sitemap - Given the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/shared-elements" with status 200 + Given the site endpoint returns fixture "/site/shared-elements" with status 200 Given I visit the page "/sitemap" Then the sitemap should be rendered with these items | text | diff --git a/packages/nuxt-ripple-cli/src/commands/add/_templates/add/content-type/test.feature.t b/packages/nuxt-ripple-cli/src/commands/add/_templates/add/content-type/test.feature.t index 29adf7d8fc..ac7a7b8592 100644 --- a/packages/nuxt-ripple-cli/src/commands/add/_templates/add/content-type/test.feature.t +++ b/packages/nuxt-ripple-cli/src/commands/add/_templates/add/content-type/test.feature.t @@ -5,8 +5,8 @@ to: "<%= locals.createTests ? `${cypressPath}/e2e/${h.changeCase.kebabCase(name) Feature: <%= name %> page Background: - Given the endpoint "/api/tide/page" with query "?path=/sample-<%= h.changeCase.kebabCase(name) %>&site=8888" returns fixture "/<%= h.changeCase.kebabCase(name) %>/sample-<%= h.changeCase.kebabCase(name) %>" with status 200 - And the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" with status 200 + Given the page endpoint for path "/sample-<%= h.changeCase.kebabCase(name) %>" returns fixture "/<%= h.changeCase.kebabCase(name) %>/sample-<%= h.changeCase.kebabCase(name) %>" with status 200 + And the site endpoint returns fixture "/site/reference" with status 200 When I visit the page "/sample-<%= h.changeCase.kebabCase(name) %>" @mockserver diff --git a/packages/ripple-test-utils/step_definitions/common/mocks.ts b/packages/ripple-test-utils/step_definitions/common/mocks.ts index b3f7be91bf..9585d9d030 100644 --- a/packages/ripple-test-utils/step_definitions/common/mocks.ts +++ b/packages/ripple-test-utils/step_definitions/common/mocks.ts @@ -31,10 +31,29 @@ Given(`the mock server has been stopped`, () => { }) Given( - `the endpoint {string} with query {string} returns fixture {string} with status {int}`, - (route: string, query: string, fixture: string, status: number) => { + `the site endpoint returns fixture {string} with status {int}`, + (fixture: string, status: number) => { + cy.fixture(fixture).then((response) => { + cy.task('setMockRouteWithQuery', { + route: '/api/tide/site', + status, + response, + query: `?id=${Cypress.env('NUXT_PUBLIC_TIDE_SITE')}` + }) + }) + } +) + +Given( + `the page endpoint for path {string} returns fixture {string} with status {int}`, + (path: string, fixture: string, status: number) => { cy.fixture(fixture).then((response) => { - cy.task('setMockRouteWithQuery', { route, status, response, query }) + cy.task('setMockRouteWithQuery', { + route: '/api/tide/page', + status, + response, + query: `?path=${path}&site=${Cypress.env('NUXT_PUBLIC_TIDE_SITE')}` + }) }) } ) From 1493fd9ff973a5b50b12349532afecb28b143cab Mon Sep 17 00:00:00 2001 From: Jeffrey Dowdle Date: Thu, 17 Aug 2023 14:18:26 +1000 Subject: [PATCH 03/15] test: fix incorrectly named step --- examples/nuxt-app/test/features/landingpage/forms.feature | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/nuxt-app/test/features/landingpage/forms.feature b/examples/nuxt-app/test/features/landingpage/forms.feature index 4054ba0b01..c4a362c199 100644 --- a/examples/nuxt-app/test/features/landingpage/forms.feature +++ b/examples/nuxt-app/test/features/landingpage/forms.feature @@ -42,8 +42,8 @@ Feature: Forms @mockserver Scenario: Error summary Given the mock server has started - And page api returns fixture "/landingpage/full-form" with status 200 - And site api returns fixture "/site/reference" with status 200 + And page endpoint for path "/kitchen-sink" returns fixture "/landingpage/full-form" with status 200 + And site endpoint returns fixture "/site/reference" with status 200 Given I visit the page "/kitchen-sink" Then the landing page component "TideLandingPageWebForm" should exist And the form with ID "full_form" should exist From dcbae1b22f2e9fa9e76d7f0411aa7a0e1b3c655e Mon Sep 17 00:00:00 2001 From: Jeffrey Dowdle Date: Thu, 17 Aug 2023 14:19:44 +1000 Subject: [PATCH 04/15] test: brought back generic api mock step for publication tests --- .../ripple-test-utils/step_definitions/common/mocks.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/ripple-test-utils/step_definitions/common/mocks.ts b/packages/ripple-test-utils/step_definitions/common/mocks.ts index 9585d9d030..cc19ff152a 100644 --- a/packages/ripple-test-utils/step_definitions/common/mocks.ts +++ b/packages/ripple-test-utils/step_definitions/common/mocks.ts @@ -30,6 +30,15 @@ Given(`the mock server has been stopped`, () => { cy.log('the mock server has been stopped') }) +Given( + `the endpoint {string} with query {string} returns fixture {string} with status {int}`, + (route: string, query: string, fixture: string, status: number) => { + cy.fixture(fixture).then((response) => { + cy.task('setMockRouteWithQuery', { route, status, response, query }) + }) + } +) + Given( `the site endpoint returns fixture {string} with status {int}`, (fixture: string, status: number) => { From e26565bb6c630ee586d4e01610c213bb9a55f711 Mon Sep 17 00:00:00 2001 From: Jeffrey Dowdle Date: Thu, 17 Aug 2023 14:28:27 +1000 Subject: [PATCH 05/15] test: fixed broken test --- examples/nuxt-app/test/features/landingpage/forms.feature | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/nuxt-app/test/features/landingpage/forms.feature b/examples/nuxt-app/test/features/landingpage/forms.feature index c4a362c199..b4831d9629 100644 --- a/examples/nuxt-app/test/features/landingpage/forms.feature +++ b/examples/nuxt-app/test/features/landingpage/forms.feature @@ -42,8 +42,8 @@ Feature: Forms @mockserver Scenario: Error summary Given the mock server has started - And page endpoint for path "/kitchen-sink" returns fixture "/landingpage/full-form" with status 200 - And site endpoint returns fixture "/site/reference" with status 200 + And the page endpoint for path "/kitchen-sink" returns fixture "/landingpage/full-form" with status 200 + And the site endpoint returns fixture "/site/reference" with status 200 Given I visit the page "/kitchen-sink" Then the landing page component "TideLandingPageWebForm" should exist And the form with ID "full_form" should exist From 49ab2a1ecb01a62b9f235657b667c6ea8fd3178c Mon Sep 17 00:00:00 2001 From: Jeffrey Dowdle Date: Thu, 17 Aug 2023 14:41:57 +1000 Subject: [PATCH 06/15] test: add generic site and base url for tests --- .github/workflows/nuxt.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nuxt.yml b/.github/workflows/nuxt.yml index e887458cdc..cd0deff83c 100644 --- a/.github/workflows/nuxt.yml +++ b/.github/workflows/nuxt.yml @@ -61,8 +61,8 @@ jobs: env: CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} TZ: 'Australia/Melbourne' - NUXT_PUBLIC_TIDE_BASE_URL: 'https://develop.content.reference.sdp.vic.gov.au/' - NUXT_PUBLIC_TIDE_SITE: '8888' + NUXT_PUBLIC_TIDE_BASE_URL: 'https://test.base.url/' + NUXT_PUBLIC_TIDE_SITE: 'TEST_SITE' NUXT_PUBLIC_API_URL: 'http://localhost:3001' NUXT_PUBLIC_TIDE_APP_SEARCH_ENGINE_NAME: a83890f7a31dea14e1ae83c6f0afacca-appsearch-index-default-node API_PORT: '3001' From cfe8a30d06177b1f862f55fded6d321c34c95327 Mon Sep 17 00:00:00 2001 From: Jeffrey Dowdle Date: Thu, 17 Aug 2023 14:54:57 +1000 Subject: [PATCH 07/15] ci: run actions if action config changes --- .github/workflows/components.yml | 1 + .github/workflows/docs.yml | 1 + .github/workflows/nuxt.yml | 1 + .github/workflows/vue.yml | 1 + .github/workflows/webcomponents.yml | 1 + 5 files changed, 5 insertions(+) diff --git a/.github/workflows/components.yml b/.github/workflows/components.yml index 6567dac0b2..92c085edd0 100644 --- a/.github/workflows/components.yml +++ b/.github/workflows/components.yml @@ -2,6 +2,7 @@ name: UI Libraries on: push: paths: + - '.github/**' - 'packages/ripple-storybook/**' - 'packages/ripple-ui-core/**' - 'packages/ripple-ui-forms/**' diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index bf8b123eae..255e519bd4 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -2,6 +2,7 @@ name: Docs on: push: paths: + - '.github/**' - 'docs' - 'packages/ripple-ui-core/**' - 'packages/ripple-ui-forms/**' diff --git a/.github/workflows/nuxt.yml b/.github/workflows/nuxt.yml index cd0deff83c..25392bde58 100644 --- a/.github/workflows/nuxt.yml +++ b/.github/workflows/nuxt.yml @@ -2,6 +2,7 @@ name: Nuxt on: push: paths: + - '.github/**' - 'examples/nuxt-app/**' - 'packages/**' - 'pnpm-lock.yaml' diff --git a/.github/workflows/vue.yml b/.github/workflows/vue.yml index c6a2bb5cf7..83fe662175 100644 --- a/.github/workflows/vue.yml +++ b/.github/workflows/vue.yml @@ -2,6 +2,7 @@ name: Vue on: push: paths: + - '.github/**' - 'examples/vue-app/**' - 'packages/ripple-ui-core/**' - 'packages/ripple-ui-forms/**' diff --git a/.github/workflows/webcomponents.yml b/.github/workflows/webcomponents.yml index 8f66dc8ab5..e93717bcb3 100644 --- a/.github/workflows/webcomponents.yml +++ b/.github/workflows/webcomponents.yml @@ -2,6 +2,7 @@ name: Webcomponents on: push: paths: + - '.github/**' - 'examples/webcomponents/**' - 'packages/ripple-ui-core/**' - 'packages/ripple-ui-forms/**' From 43e9c3583d19dce854502b40a44551362ecda35a Mon Sep 17 00:00:00 2001 From: Jeffrey Dowdle Date: Thu, 17 Aug 2023 14:57:35 +1000 Subject: [PATCH 08/15] ci: re-run actions when the action is modified --- .github/workflows/components.yml | 2 +- .github/workflows/docs.yml | 2 +- .github/workflows/nuxt.yml | 2 +- .github/workflows/vue.yml | 2 +- .github/workflows/webcomponents.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/components.yml b/.github/workflows/components.yml index 92c085edd0..823ce0f618 100644 --- a/.github/workflows/components.yml +++ b/.github/workflows/components.yml @@ -2,7 +2,7 @@ name: UI Libraries on: push: paths: - - '.github/**' + - '.github/components.yml' - 'packages/ripple-storybook/**' - 'packages/ripple-ui-core/**' - 'packages/ripple-ui-forms/**' diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 255e519bd4..addfa8564d 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -2,7 +2,7 @@ name: Docs on: push: paths: - - '.github/**' + - '.github/docs.yml' - 'docs' - 'packages/ripple-ui-core/**' - 'packages/ripple-ui-forms/**' diff --git a/.github/workflows/nuxt.yml b/.github/workflows/nuxt.yml index 25392bde58..dc9fae4623 100644 --- a/.github/workflows/nuxt.yml +++ b/.github/workflows/nuxt.yml @@ -2,7 +2,7 @@ name: Nuxt on: push: paths: - - '.github/**' + - '.github/nuxt.yml' - 'examples/nuxt-app/**' - 'packages/**' - 'pnpm-lock.yaml' diff --git a/.github/workflows/vue.yml b/.github/workflows/vue.yml index 83fe662175..6dc8117a3e 100644 --- a/.github/workflows/vue.yml +++ b/.github/workflows/vue.yml @@ -2,7 +2,7 @@ name: Vue on: push: paths: - - '.github/**' + - '.github/vue.yml' - 'examples/vue-app/**' - 'packages/ripple-ui-core/**' - 'packages/ripple-ui-forms/**' diff --git a/.github/workflows/webcomponents.yml b/.github/workflows/webcomponents.yml index e93717bcb3..e33632481e 100644 --- a/.github/workflows/webcomponents.yml +++ b/.github/workflows/webcomponents.yml @@ -2,7 +2,7 @@ name: Webcomponents on: push: paths: - - '.github/**' + - '.github/webcomponents.yml' - 'examples/webcomponents/**' - 'packages/ripple-ui-core/**' - 'packages/ripple-ui-forms/**' From 512e107457ce9e457e9ff0aca54d738b379c99c5 Mon Sep 17 00:00:00 2001 From: Jeffrey Dowdle Date: Thu, 17 Aug 2023 14:59:24 +1000 Subject: [PATCH 09/15] ci: fix action paths --- .github/workflows/components.yml | 2 +- .github/workflows/docs.yml | 2 +- .github/workflows/nuxt.yml | 2 +- .github/workflows/vue.yml | 2 +- .github/workflows/webcomponents.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/components.yml b/.github/workflows/components.yml index 823ce0f618..f76ef9145a 100644 --- a/.github/workflows/components.yml +++ b/.github/workflows/components.yml @@ -2,7 +2,7 @@ name: UI Libraries on: push: paths: - - '.github/components.yml' + - '.github/workflows/components.yml' - 'packages/ripple-storybook/**' - 'packages/ripple-ui-core/**' - 'packages/ripple-ui-forms/**' diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index addfa8564d..44066a7ec1 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -2,7 +2,7 @@ name: Docs on: push: paths: - - '.github/docs.yml' + - '.github/workflows/docs.yml' - 'docs' - 'packages/ripple-ui-core/**' - 'packages/ripple-ui-forms/**' diff --git a/.github/workflows/nuxt.yml b/.github/workflows/nuxt.yml index dc9fae4623..cb55878358 100644 --- a/.github/workflows/nuxt.yml +++ b/.github/workflows/nuxt.yml @@ -2,7 +2,7 @@ name: Nuxt on: push: paths: - - '.github/nuxt.yml' + - '.github/workflows/nuxt.yml' - 'examples/nuxt-app/**' - 'packages/**' - 'pnpm-lock.yaml' diff --git a/.github/workflows/vue.yml b/.github/workflows/vue.yml index 6dc8117a3e..4087db6351 100644 --- a/.github/workflows/vue.yml +++ b/.github/workflows/vue.yml @@ -2,7 +2,7 @@ name: Vue on: push: paths: - - '.github/vue.yml' + - '.github/workflows/vue.yml' - 'examples/vue-app/**' - 'packages/ripple-ui-core/**' - 'packages/ripple-ui-forms/**' diff --git a/.github/workflows/webcomponents.yml b/.github/workflows/webcomponents.yml index e33632481e..0f6400b7a2 100644 --- a/.github/workflows/webcomponents.yml +++ b/.github/workflows/webcomponents.yml @@ -2,7 +2,7 @@ name: Webcomponents on: push: paths: - - '.github/webcomponents.yml' + - '.github/workflows/webcomponents.yml' - 'examples/webcomponents/**' - 'packages/ripple-ui-core/**' - 'packages/ripple-ui-forms/**' From 52ff7c54b8704a00a32832ed44d365452015139b Mon Sep 17 00:00:00 2001 From: Jeffrey Dowdle Date: Thu, 17 Aug 2023 15:08:53 +1000 Subject: [PATCH 10/15] ci: wait for correct site id --- .github/workflows/nuxt.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nuxt.yml b/.github/workflows/nuxt.yml index cb55878358..3bd6b7ebc9 100644 --- a/.github/workflows/nuxt.yml +++ b/.github/workflows/nuxt.yml @@ -75,4 +75,4 @@ jobs: install: false build: pnpm build start: pnpm start - wait-on: 'http://localhost:3000/api/tide/site?id=8888' + wait-on: 'http://localhost:3000/api/tide/site?id=TEST_SITE' From 96367702db9879e4b0c0d585053faee098d7ffd1 Mon Sep 17 00:00:00 2001 From: Jeffrey Dowdle Date: Thu, 17 Aug 2023 15:20:04 +1000 Subject: [PATCH 11/15] ci: try waiting on an asset instead of api endpoint --- .github/workflows/nuxt.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nuxt.yml b/.github/workflows/nuxt.yml index 3bd6b7ebc9..5ed0182ee8 100644 --- a/.github/workflows/nuxt.yml +++ b/.github/workflows/nuxt.yml @@ -75,4 +75,4 @@ jobs: install: false build: pnpm build start: pnpm start - wait-on: 'http://localhost:3000/api/tide/site?id=TEST_SITE' + wait-on: 'http://localhost:3000/assets/fonts/VIC-Regular.woff2' From ab8918249d4685048e368cf64e91d60ad5937b00 Mon Sep 17 00:00:00 2001 From: Jeffrey Dowdle Date: Thu, 17 Aug 2023 15:34:44 +1000 Subject: [PATCH 12/15] ci: removed hardcoded site id from tests --- .../nuxt-app/test/features/landingpage/forms.feature | 4 ++-- .../step_definitions/common/mocks.ts | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/examples/nuxt-app/test/features/landingpage/forms.feature b/examples/nuxt-app/test/features/landingpage/forms.feature index b4831d9629..b6b97bcae1 100644 --- a/examples/nuxt-app/test/features/landingpage/forms.feature +++ b/examples/nuxt-app/test/features/landingpage/forms.feature @@ -81,7 +81,7 @@ Feature: Forms Given the mock server has started And the page endpoint for path "/kitchen-sink" returns fixture "/landingpage/full-form" with status 200 And the site endpoint returns fixture "/site/reference" with status 200 - And posting to endpoint "/api/tide/webform_submission/full_form" with query "?id=8888" returns fixture "/landingpage/full-form-error-response" with status 500 + And posting form to endpoint "/api/tide/webform_submission/full_form" returns fixture "/landingpage/full-form-error-response" with status 500 Given I visit the page "/kitchen-sink" Then the landing page component "TideLandingPageWebForm" should exist And the form with ID "full_form" should exist @@ -102,7 +102,7 @@ Feature: Forms Given the mock server has started And the page endpoint for path "/kitchen-sink" returns fixture "/landingpage/full-form" with status 200 And the site endpoint returns fixture "/site/reference" with status 200 - And posting to endpoint "/api/tide/webform_submission/full_form" with query "?site=8888" returns fixture "/landingpage/full-form-success-response" with status 201 + And posting form to endpoint "/api/tide/webform_submission/full_form" returns fixture "/landingpage/full-form-success-response" with status 201 Given I visit the page "/kitchen-sink" Then the landing page component "TideLandingPageWebForm" should exist And the form with ID "full_form" should exist diff --git a/packages/ripple-test-utils/step_definitions/common/mocks.ts b/packages/ripple-test-utils/step_definitions/common/mocks.ts index cc19ff152a..e9c24711fa 100644 --- a/packages/ripple-test-utils/step_definitions/common/mocks.ts +++ b/packages/ripple-test-utils/step_definitions/common/mocks.ts @@ -77,10 +77,15 @@ Given( ) Given( - `posting to endpoint {string} with query {string} returns fixture {string} with status {int}`, - (route: string, query: string, fixture: string, status: number) => { + `posting form to endpoint {string} returns fixture {string} with status {int}`, + (route: string, fixture: string, status: number) => { cy.fixture(fixture).then((response) => { - cy.task('setMockPostRouteWithQuery', { route, status, response, query }) + cy.task('setMockPostRouteWithQuery', { + route, + status, + response, + query: `?site=${Cypress.env('NUXT_PUBLIC_TIDE_SITE')}` + }) }) } ) From 7dfed15c40bac256e0e08bbce46ffc5cda4610a9 Mon Sep 17 00:00:00 2001 From: Jeffrey Dowdle Date: Thu, 17 Aug 2023 15:47:47 +1000 Subject: [PATCH 13/15] ci: removed search engine name from cypres env var --- .github/workflows/nuxt.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/nuxt.yml b/.github/workflows/nuxt.yml index 5ed0182ee8..76ed3b5160 100644 --- a/.github/workflows/nuxt.yml +++ b/.github/workflows/nuxt.yml @@ -65,7 +65,6 @@ jobs: NUXT_PUBLIC_TIDE_BASE_URL: 'https://test.base.url/' NUXT_PUBLIC_TIDE_SITE: 'TEST_SITE' NUXT_PUBLIC_API_URL: 'http://localhost:3001' - NUXT_PUBLIC_TIDE_APP_SEARCH_ENGINE_NAME: a83890f7a31dea14e1ae83c6f0afacca-appsearch-index-default-node API_PORT: '3001' LOG_LEVEL: 'debug' # DEBUG: '@cypress/github-action' From f98c8589af2053f14c484dd67304c67ce7a49e08 Mon Sep 17 00:00:00 2001 From: Jeffrey Dowdle Date: Thu, 17 Aug 2023 15:55:47 +1000 Subject: [PATCH 14/15] ci(@dpc-sdp/nuxt-ripple-cli): updated cypress test action template to be more generic --- .../commands/init/_templates/layer/latest/github/main.yml.t | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/nuxt-ripple-cli/src/commands/init/_templates/layer/latest/github/main.yml.t b/packages/nuxt-ripple-cli/src/commands/init/_templates/layer/latest/github/main.yml.t index 79f4c63b03..8f35361a1b 100644 --- a/packages/nuxt-ripple-cli/src/commands/init/_templates/layer/latest/github/main.yml.t +++ b/packages/nuxt-ripple-cli/src/commands/init/_templates/layer/latest/github/main.yml.t @@ -37,13 +37,13 @@ jobs: uses: cypress-io/github-action@v5 env: DEBUG: '@cypress/github-action' - NUXT_PUBLIC_TIDE_BASE_URL: 'https://develop.content.reference.sdp.vic.gov.au/' - NUXT_PUBLIC_TIDE_SITE: '8888' + NUXT_PUBLIC_TIDE_BASE_URL: 'https://test.base.url/' + NUXT_PUBLIC_TIDE_SITE: 'TEST_SITE' NUXT_PUBLIC_API_URL: 'http://localhost:3001' API_PORT: '3001' NODE_AUTH_TOKEN: ${{secrets.GPR_NPM_INSTALL_TOKEN}} with: build: npm run build start: npm start - wait-on: 'http://localhost:3000/api/tide/site?id=8888' + wait-on: 'http://localhost:3000/assets/fonts/VIC-Regular.woff2' From b482350288ae630c1d9232a3327b5a0c1d405d14 Mon Sep 17 00:00:00 2001 From: Jeffrey Dowdle Date: Fri, 18 Aug 2023 08:43:28 +1000 Subject: [PATCH 15/15] chore(@dpc-sdp/nuxt-ripple-cli): added missing files to layer ci command --- .../latest/cypress/features/example.feature.t | 10 ++++++++ .../support/step_definitions/index.ts.t | 4 ++++ .../latest/github/PULL_REQUEST_TEMPLATE.md.t | 24 +++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 packages/nuxt-ripple-cli/src/commands/init/_templates/layer/latest/cypress/features/example.feature.t create mode 100644 packages/nuxt-ripple-cli/src/commands/init/_templates/layer/latest/cypress/support/step_definitions/index.ts.t create mode 100644 packages/nuxt-ripple-cli/src/commands/init/_templates/layer/latest/github/PULL_REQUEST_TEMPLATE.md.t diff --git a/packages/nuxt-ripple-cli/src/commands/init/_templates/layer/latest/cypress/features/example.feature.t b/packages/nuxt-ripple-cli/src/commands/init/_templates/layer/latest/cypress/features/example.feature.t new file mode 100644 index 0000000000..fa7237ab65 --- /dev/null +++ b/packages/nuxt-ripple-cli/src/commands/init/_templates/layer/latest/cypress/features/example.feature.t @@ -0,0 +1,10 @@ +--- +to: cypress/features/example.feature +--- +Feature: Example test + +This is an example test which should be modified or removed as required. See @dpc-sdp/ripple-test-utils for more info. + +@mockserver @skip +Scenario: Example - delete me. + Given I visit the page "/" diff --git a/packages/nuxt-ripple-cli/src/commands/init/_templates/layer/latest/cypress/support/step_definitions/index.ts.t b/packages/nuxt-ripple-cli/src/commands/init/_templates/layer/latest/cypress/support/step_definitions/index.ts.t new file mode 100644 index 0000000000..ee64f42349 --- /dev/null +++ b/packages/nuxt-ripple-cli/src/commands/init/_templates/layer/latest/cypress/support/step_definitions/index.ts.t @@ -0,0 +1,4 @@ +--- +to: cypress/support/step_definitions/index.ts +--- +import '@dpc-sdp/ripple-test-utils/step_definitions' diff --git a/packages/nuxt-ripple-cli/src/commands/init/_templates/layer/latest/github/PULL_REQUEST_TEMPLATE.md.t b/packages/nuxt-ripple-cli/src/commands/init/_templates/layer/latest/github/PULL_REQUEST_TEMPLATE.md.t new file mode 100644 index 0000000000..d219207410 --- /dev/null +++ b/packages/nuxt-ripple-cli/src/commands/init/_templates/layer/latest/github/PULL_REQUEST_TEMPLATE.md.t @@ -0,0 +1,24 @@ +--- +to: .github/PULL_REQUEST_TEMPLATE.yml +--- + + +**Issue**: + +### What I did + +- +- + +### How to test + +- +- + +### Checklist + + +- [ ] I have read the [Ripple documentation](https://www.ripple.sdp.vic.gov.au/framework/) documentation around adding custom functionality. +- [ ] I have added Cypress integration tests for new content types or components +- [ ] I have added unit tests for helper functions +- [ ] This PR requires changes to environment variables which need to be added in https://github.com/dpc-sdp/sdp-cmdb