Skip to content

Commit

Permalink
feat: switch from the Responsive Starter Store applications to the ne…
Browse files Browse the repository at this point in the history
…w 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).
  • Loading branch information
shauke authored and dhhyi committed Jul 28, 2020
1 parent a63d2a2 commit 0a356cc
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .createMockdata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
1 change: 1 addition & 0 deletions .createMockdata.table
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 5 additions & 5 deletions e2e/cypress/integration/specs/cms/server-html.mock.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.*/,
Expand Down
2 changes: 1 addition & 1 deletion e2e/test-universal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ universalTest 6 "${PWA_BASE_URL}/catComputers.1835" "<h3>PCs</h3>"
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" "<ish-content-include includeid=.pwa.include.homepage.pagelet2-Include"
universalTest 10 "${PWA_BASE_URL}/home" "<ish-content-include includeid=.include.homepage.content.pagelet2-Include"
universalTest 11 "${PWA_BASE_URL}/home" "<link rel=.canonical. href=.${PWA_BASE_URL}/home.>"
universalTest 12 "${PWA_BASE_URL}/home" "<meta property=.og:image. content=.${PWA_BASE_URL}[^>]*og-image-default"
universalTest 13 "${PWA_BASE_URL}/home" "<title>inTRONICS Home | Intershop PWA</title>"
Expand Down
4 changes: 2 additions & 2 deletions src/app/core/directives/server-html.directive.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ describe('Server Html Directive', () => {

beforeEach(() => {
@Component({
template: ` <div [ishServerHtml]="'get.help.at' | translate: { '0': 'page://systempage.helpdesk' }"></div> `,
template: ` <div [ishServerHtml]="'get.help.at' | translate: { '0': 'page://page.helpdesk' }"></div> `,
changeDetection: ChangeDetectionStrategy.OnPush,
})
class TestComponent {}
Expand All @@ -141,7 +141,7 @@ describe('Server Html Directive', () => {

it('should transform the links within translated input to routing links', () => {
expect(element).toMatchInlineSnapshot(
`<div>Get help at <a href="/page/systempage.helpdesk">our HelpDesk</a>. We are there for you!</div>`
`<div>Get help at <a href="/page/page.helpdesk">our HelpDesk</a>. We are there for you!</div>`
);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand All @@ -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(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/home/home-page.component.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<ish-content-include includeId="pwa.include.homepage.pagelet2-Include"></ish-content-include>
<ish-content-include includeId="include.homepage.content.pagelet2-Include"></ish-content-include>
4 changes: 2 additions & 2 deletions src/app/pages/home/home-page.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ describe('Home Page Component', () => {
fixture.detectChanges();
expect(element).toMatchInlineSnapshot(`
<ish-content-include
includeid="pwa.include.homepage.pagelet2-Include"
ng-reflect-include-id="pwa.include.homepage.pagelet2-"
includeid="include.homepage.content.pagelet2-Include"
ng-reflect-include-id="include.homepage.content.pagel"
></ish-content-include>
`);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -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": [
{
Expand Down Expand Up @@ -146,6 +146,6 @@
"type": "PageletRO"
}
],
"resourceSetID": "app_sf_responsive_cm",
"resourceSetID": "app_sf_pwa_cm",
"type": "PageletEntryPointRO"
}
1 change: 1 addition & 0 deletions src/environments/environment.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 0a356cc

Please sign in to comment.