From 0a356cc34a0e734e684ed22205d8edcfed3556fb Mon Sep 17 00:00:00 2001 From: Stefan Hauke Date: Mon, 25 Nov 2019 15:43:56 +0100 Subject: [PATCH] feat: switch from the Responsive Starter Store applications to the new headless REST application type applications (#302) - change PWA default environment configuration to use the ICM demo content 'rest' applications instead of '-' - adapt demo content naming changes for the new applications (homepage include) BREAKING CHANGE: Default environment configuration switched to the new headless 'rest' application in the ICM demo content (requires ICM version 7.10.21.0). --- .createMockdata.sh | 4 ++-- .createMockdata.table | 1 + .../specs/cms/server-html.mock.e2e-spec.ts | 10 +++++----- .../system/seo-product-detail-page.b2c.e2e-spec.ts | 2 +- e2e/test-universal.sh | 2 +- .../core/directives/server-html.directive.spec.ts | 4 ++-- .../configuration/configuration.integration.spec.ts | 6 +++--- src/app/pages/home/home-page.component.html | 2 +- src/app/pages/home/home-page.component.spec.ts | 4 ++-- .../get.json | 12 ++++++------ src/environments/environment.model.ts | 1 + 11 files changed, 25 insertions(+), 23 deletions(-) rename src/assets/mock-data/cms/includes/{pwa.include.homepage.pagelet2-Include => include.homepage.content.pagelet2-Include}/get.json (95%) diff --git a/.createMockdata.sh b/.createMockdata.sh index 93bec21343..5aaa13f429 100644 --- a/.createMockdata.sh +++ b/.createMockdata.sh @@ -16,7 +16,7 @@ trap '[ "$?" -eq "0" ] && echo SUCCESSFUL || echo FAILED' EXIT if ! command -v curl >/dev/null ; then echo "curl is not installed" ; exit 1 ; fi if ! command -v jq >/dev/null ; then echo "jq is not installed" ; exit 1 ; fi -if ! curl -f "http://10.0.206.226:4322/INTERSHOP/rest/WFS/inSPIRED-inTRONICS-Site/-" &>/dev/null ; then echo "icm is not running" ; exit 1 ; fi +if ! curl -f "http://10.0.206.226:4322/INTERSHOP/rest/WFS/inSPIRED-inTRONICS-Site/rest" &>/dev/null ; then echo "icm is not running" ; exit 1 ; fi if ! test -f .createMockdata.table ; then echo "input table does not exist" ; exit 1 ; fi cat .createMockdata.table | egrep -v '^#' | while read path params jqquery header @@ -28,5 +28,5 @@ do mkdir -p src/assets/mock-data/$path echo " to src/assets/mock-data/$path/get.json" - curl -sf -H "$header" "http://10.0.206.226:4322/INTERSHOP/rest/WFS/inSPIRED-inTRONICS-Site/-/${path}${params}" | jq -S -M "${jqquery}" | sed -e 's%/INTERSHOP/static/.*.jpg%assets/img/not_available.png%' > src/assets/mock-data/$path/get.json + curl -sf -H "$header" "http://10.0.206.226:4322/INTERSHOP/rest/WFS/inSPIRED-inTRONICS-Site/rest/${path}${params}" | jq -S -M "${jqquery}" | sed -e 's%/INTERSHOP/static/.*.jpg%assets/img/not_available.png%' > src/assets/mock-data/$path/get.json done diff --git a/.createMockdata.table b/.createMockdata.table index bf56bb2972..6d2398e79c 100644 --- a/.createMockdata.table +++ b/.createMockdata.table @@ -54,3 +54,4 @@ suggest ?SearchTerm=kodak products ?amount=9&attrs=sku,salePrice,listPrice,availability,manufacturer,image,minOrderQuantity,inStock,promotions,packingUnit,mastered,productMaster,productMasterSKU,roundedAverageRating&offset=0&returnSortKeys=true&searchTerm=kodak {elements:[.elements[]|select(.uri|test(".*/7912057"))],name,type,sortKeys,total:1,offset,amount} countries ? . Accept:application/vnd.intershop.country.v1+json customers/- ? . Authorization:BASIC\ cGF0cmljaWFAdGVzdC5pbnRlcnNob3AuZGU6IUludGVyU2hvcDAwIQ== +cms/includes/include.homepage.content.pagelet2-Include diff --git a/e2e/cypress/integration/specs/cms/server-html.mock.e2e-spec.ts b/e2e/cypress/integration/specs/cms/server-html.mock.e2e-spec.ts index 4d464846a1..7835f99ea8 100644 --- a/e2e/cypress/integration/specs/cms/server-html.mock.e2e-spec.ts +++ b/e2e/cypress/integration/specs/cms/server-html.mock.e2e-spec.ts @@ -20,13 +20,13 @@ describe('Server Html', () => { url: '**/cms/**', status: 200, response: { - definitionQualifiedName: 'app_sf_responsive_cm:pwa.include.homepage.pagelet2-Include', - displayName: 'PWA Homepage Content', - id: 'pwa.include.homepage.pagelet2-Include', + definitionQualifiedName: 'app_sf_pwa_cm:include.homepage.content.pagelet2-Include', + displayName: 'Homepage Content', + id: 'include.homepage.content.pagelet2-Include', link: { - title: 'pwa.include.homepage.pagelet2-Include', + title: 'include.homepage.content.pagelet2-Include', type: 'Link', - uri: 'inSPIRED-inTRONICS-Site/-/cms/includes/pwa.include.homepage.pagelet2-Include', + uri: 'inSPIRED-inTRONICS-Site/-/cms/includes/include.homepage.content.pagelet2-Include', }, pagelets: [ { diff --git a/e2e/cypress/integration/specs/system/seo-product-detail-page.b2c.e2e-spec.ts b/e2e/cypress/integration/specs/system/seo-product-detail-page.b2c.e2e-spec.ts index 9cccd7b5ae..773c9e69f6 100644 --- a/e2e/cypress/integration/specs/system/seo-product-detail-page.b2c.e2e-spec.ts +++ b/e2e/cypress/integration/specs/system/seo-product-detail-page.b2c.e2e-spec.ts @@ -10,7 +10,7 @@ describe('Product Detail Page Meta', () => { at(ProductDetailPage, page => { waitLoadingEnd(1000); page.metaData.check({ - title: 'Google Home - Smart Home favorable buying at our shop | Intershop PWA', + title: 'Google Home - Smart Home | Intershop PWA', url: /.*\/sku201807171/, description: 'Google Home - Hands-free help from the Google Assistant', 'og:image': /.*201807171_front.*/, diff --git a/e2e/test-universal.sh b/e2e/test-universal.sh index d51605bbf2..c806b9ce2d 100644 --- a/e2e/test-universal.sh +++ b/e2e/test-universal.sh @@ -23,7 +23,7 @@ universalTest 6 "${PWA_BASE_URL}/catComputers.1835" "

PCs

" universalTest 7 "${PWA_BASE_URL}/catComputers.1835.151" "add-to-compare" universalTest 8 "${PWA_BASE_URL}/home" "intershop-pwa-state" universalTest 9 "${PWA_BASE_URL}/home" "&q;baseURL&q;:" -universalTest 10 "${PWA_BASE_URL}/home" "" universalTest 12 "${PWA_BASE_URL}/home" "]*og-image-default" universalTest 13 "${PWA_BASE_URL}/home" "inTRONICS Home | Intershop PWA" diff --git a/src/app/core/directives/server-html.directive.spec.ts b/src/app/core/directives/server-html.directive.spec.ts index 4f07d66eaf..fc67c3e985 100644 --- a/src/app/core/directives/server-html.directive.spec.ts +++ b/src/app/core/directives/server-html.directive.spec.ts @@ -119,7 +119,7 @@ describe('Server Html Directive', () => { beforeEach(() => { @Component({ - template: `
`, + template: `
`, changeDetection: ChangeDetectionStrategy.OnPush, }) class TestComponent {} @@ -141,7 +141,7 @@ describe('Server Html Directive', () => { it('should transform the links within translated input to routing links', () => { expect(element).toMatchInlineSnapshot( - `
Get help at our HelpDesk. We are there for you!
` + `
Get help at our HelpDesk. We are there for you!
` ); }); }); diff --git a/src/app/core/store/core/configuration/configuration.integration.spec.ts b/src/app/core/store/core/configuration/configuration.integration.spec.ts index 3c5d4fa2e9..f4811e58ce 100644 --- a/src/app/core/store/core/configuration/configuration.integration.spec.ts +++ b/src/app/core/store/core/configuration/configuration.integration.spec.ts @@ -64,7 +64,7 @@ describe('Configuration Integration', () => { router.navigateByUrl('/home;channel=site'); tick(500); expect(location.path()).toMatchInlineSnapshot(`"/home;channel=site"`); - expect(getRestEndpoint(store$.state)).toMatchInlineSnapshot(`"http://example.org/INTERSHOP/rest/WFS/site/-"`); + expect(getRestEndpoint(store$.state)).toMatchInlineSnapshot(`"http://example.org/INTERSHOP/rest/WFS/site/rest"`); })); it('should set imported channel and application to state', fakeAsync(() => { @@ -78,14 +78,14 @@ describe('Configuration Integration', () => { router.navigateByUrl('/home;channel=site;redirect=1'); tick(500); expect(location.path()).toMatchInlineSnapshot(`"/home"`); - expect(getRestEndpoint(store$.state)).toMatchInlineSnapshot(`"http://example.org/INTERSHOP/rest/WFS/site/-"`); + expect(getRestEndpoint(store$.state)).toMatchInlineSnapshot(`"http://example.org/INTERSHOP/rest/WFS/site/rest"`); })); it('should preserve query parameters when redirecting', fakeAsync(() => { router.navigateByUrl('/home;channel=site;redirect=1?foo=bar&test=hello'); tick(500); expect(location.path()).toMatchInlineSnapshot(`"/home?foo=bar&test=hello"`); - expect(getRestEndpoint(store$.state)).toMatchInlineSnapshot(`"http://example.org/INTERSHOP/rest/WFS/site/-"`); + expect(getRestEndpoint(store$.state)).toMatchInlineSnapshot(`"http://example.org/INTERSHOP/rest/WFS/site/rest"`); })); it('should set imported features to state', fakeAsync(() => { diff --git a/src/app/pages/home/home-page.component.html b/src/app/pages/home/home-page.component.html index 4d45f05ffa..8d0f51756e 100644 --- a/src/app/pages/home/home-page.component.html +++ b/src/app/pages/home/home-page.component.html @@ -1 +1 @@ - + diff --git a/src/app/pages/home/home-page.component.spec.ts b/src/app/pages/home/home-page.component.spec.ts index c2a94a4df3..09140bdcc3 100644 --- a/src/app/pages/home/home-page.component.spec.ts +++ b/src/app/pages/home/home-page.component.spec.ts @@ -32,8 +32,8 @@ describe('Home Page Component', () => { fixture.detectChanges(); expect(element).toMatchInlineSnapshot(` `); }); diff --git a/src/assets/mock-data/cms/includes/pwa.include.homepage.pagelet2-Include/get.json b/src/assets/mock-data/cms/includes/include.homepage.content.pagelet2-Include/get.json similarity index 95% rename from src/assets/mock-data/cms/includes/pwa.include.homepage.pagelet2-Include/get.json rename to src/assets/mock-data/cms/includes/include.homepage.content.pagelet2-Include/get.json index d640b2f9e5..1eca60a336 100644 --- a/src/assets/mock-data/cms/includes/pwa.include.homepage.pagelet2-Include/get.json +++ b/src/assets/mock-data/cms/includes/include.homepage.content.pagelet2-Include/get.json @@ -1,13 +1,13 @@ { "customAttributes": {}, - "definitionQualifiedName": "app_sf_responsive_cm:pwa.include.homepage.pagelet2-Include", - "displayName": "PWA Homepage Content", + "definitionQualifiedName": "app_sf_pwa_cm:include.homepage.content.pagelet2-Include", + "displayName": "Homepage Content", "domain": "inSPIRED-inTRONICS-b2c-responsive", - "id": "pwa.include.homepage.pagelet2-Include", + "id": "include.homepage.content.pagelet2-Include", "link": { - "title": "pwa.include.homepage.pagelet2-Include", + "title": "include.homepage.content.pagelet2-Include", "type": "Link", - "uri": "inSPIRED-inTRONICS-Site/-/cms/includes/pwa.include.homepage.pagelet2-Include" + "uri": "inSPIRED-inTRONICS-Site/-/cms/includes/include.homepage.content.pagelet2-Include" }, "pagelets": [ { @@ -146,6 +146,6 @@ "type": "PageletRO" } ], - "resourceSetID": "app_sf_responsive_cm", + "resourceSetID": "app_sf_pwa_cm", "type": "PageletEntryPointRO" } diff --git a/src/environments/environment.model.ts b/src/environments/environment.model.ts index 261a6bff96..d2da374964 100644 --- a/src/environments/environment.model.ts +++ b/src/environments/environment.model.ts @@ -82,6 +82,7 @@ export const ENVIRONMENT_DEFAULTS: Environment = { icmChannel: 'inSPIRED-inTRONICS-Site', icmServer: 'INTERSHOP/rest/WFS', icmServerStatic: 'INTERSHOP/static/WFS', + icmApplication: 'rest', production: false, mockServerAPI: false,