-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: product notifications (price, in stock) (#1327)
* the product notification functionality for in stock and price notifications in the My Account Area (listing/editing/deleting) and on PDP (creating/editing/deleting) implemented as an extension for the PWA * requires ICM version 7.10.40.1 for adapted email templates, REST functionality is already available in earlier versions Closes: #693 Co-authored-by: Andreas Steinmann <asteinmann@intershop.com> Co-authored-by: Silke <s.grueber@intershop.de>
- Loading branch information
1 parent
6888947
commit c07edca
Showing
63 changed files
with
3,092 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
e2e/cypress/e2e/pages/account/edit-product-notification.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export class EditProductNotificationModule { | ||
private priceInput = () => cy.get('ish-fieldset-field').find('[data-testing-id="priceValue"]'); | ||
|
||
private emailInput = () => cy.get('ish-fieldset-field').find('[data-testing-id="email"]'); | ||
|
||
editPriceNotification(price: number, email: string) { | ||
this.priceInput().clear(); | ||
this.priceInput().type(price.toString()); | ||
this.emailInput().clear(); | ||
this.emailInput().type(email); | ||
cy.get('.modal-footer button.btn-primary').click(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
e2e/cypress/e2e/pages/account/product-notifications-overview.page.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { BreadcrumbModule } from '../breadcrumb.module'; | ||
import { HeaderModule } from '../header.module'; | ||
|
||
export class ProductNotificationsOverviewPage { | ||
readonly tag = 'ish-account-product-notifications-page '; | ||
|
||
readonly header = new HeaderModule(); | ||
readonly breadcrumb = new BreadcrumbModule(); | ||
|
||
get productNotificationsArray() { | ||
return cy.get('[data-testing-id="product-notification-list-item"]'); | ||
} | ||
|
||
get productNotificationNameArray() { | ||
return this.productNotificationsArray.find('a[data-testing-id="product-name-link"]').invoke('text'); | ||
} | ||
|
||
get productNotificationMessage() { | ||
return this.productNotificationsArray.find('div[data-testing-id="product-notification-message"]').invoke('text'); | ||
} | ||
|
||
get productNotificationListItems() { | ||
return cy.get('[data-testing-id = "product-notification-list-item"]'); | ||
} | ||
|
||
get productNotificationListItemLinks() { | ||
return this.productNotificationListItems.find('a[data-testing-id="product-name-link"]'); | ||
} | ||
|
||
updateProductNotificationByProductName(productName: string, price: number, email: string) { | ||
this.productNotificationsArray | ||
.find('a') | ||
.contains(productName) | ||
.closest('[data-testing-id="product-notification-list-item"]') | ||
.find('[data-testing-id="product-notification-edit"]') | ||
.click(); | ||
cy.get('[data-testing-id="priceValue"]').clear().type(price.toString()); | ||
cy.get('[data-testing-id="email"]').clear().type(email); | ||
cy.get('[data-testing-id="product-notification-edit-dialog-edit"]').click(); | ||
} | ||
|
||
deleteProductNotificationByProductName(productName: string) { | ||
this.productNotificationsArray | ||
.find('a') | ||
.contains(productName) | ||
.closest('[data-testing-id="product-notification-list-item"]') | ||
.find('[data-testing-id="product-notification-delete"]') | ||
.click(); | ||
cy.get('[data-testing-id="confirm"]').click(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 109 additions & 0 deletions
109
e2e/cypress/e2e/specs/extras/price-notifications.b2c.e2e-spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
import { at, waitLoadingEnd } from '../../framework'; | ||
import { createUserViaREST } from '../../framework/users'; | ||
import { LoginPage } from '../../pages/account/login.page'; | ||
import { MyAccountPage } from '../../pages/account/my-account.page'; | ||
import { ProductNotificationsOverviewPage } from '../../pages/account/product-notifications-overview.page'; | ||
import { sensibleDefaults } from '../../pages/account/registration.page'; | ||
import { CategoryPage } from '../../pages/shopping/category.page'; | ||
import { FamilyPage } from '../../pages/shopping/family.page'; | ||
import { ProductDetailPage } from '../../pages/shopping/product-detail.page'; | ||
|
||
describe('Product Notification MyAccount Functionality', () => { | ||
const _ = { | ||
user: { | ||
login: `test${new Date().getTime()}@testcity.de`, | ||
...sensibleDefaults, | ||
}, | ||
category: 'Home-Entertainment', | ||
subcategory: 'Home-Entertainment.SmartHome', | ||
product1: { | ||
sku: '201807171', | ||
name: 'Google Home', | ||
}, | ||
product2: { | ||
sku: '201807191', | ||
name: 'Philips Hue bridge', | ||
}, | ||
email1: 'patricia@test.intershop.de', | ||
email2: 'test@test.intershop.de', | ||
}; | ||
|
||
before(() => { | ||
createUserViaREST(_.user); | ||
LoginPage.navigateTo('/account/notifications'); | ||
at(LoginPage, page => { | ||
page.fillForm(_.user.login, _.user.password); | ||
page.submit().its('response.statusCode').should('equal', 200); | ||
waitLoadingEnd(); | ||
}); | ||
at(ProductNotificationsOverviewPage); | ||
}); | ||
|
||
it('user creates two product price notifications', () => { | ||
at(ProductNotificationsOverviewPage, page => { | ||
page.header.gotoCategoryPage(_.category); | ||
}); | ||
|
||
at(CategoryPage, page => page.gotoSubCategory(_.subcategory)); | ||
at(FamilyPage, page => page.productList.gotoProductDetailPageBySku(_.product1.sku)); | ||
at(ProductDetailPage, page => { | ||
page.editProductNotification(); | ||
page.editProductNotificationModule.editPriceNotification(150, _.email1); | ||
page.header.goToMyAccount(); | ||
}); | ||
|
||
at(MyAccountPage, page => { | ||
page.navigateToProductNotifications(); | ||
}); | ||
|
||
at(ProductNotificationsOverviewPage, page => { | ||
page.breadcrumb.items.should('have.length', 3); | ||
page.productNotificationNameArray.should('contain', _.product1.name); | ||
page.productNotificationMessage.should('contain', '150'); | ||
page.productNotificationMessage.should('contain', _.email1); | ||
}); | ||
|
||
at(ProductNotificationsOverviewPage, page => { | ||
page.header.gotoCategoryPage(_.category); | ||
}); | ||
|
||
at(CategoryPage, page => page.gotoSubCategory(_.subcategory)); | ||
at(FamilyPage, page => page.productList.gotoProductDetailPageBySku(_.product2.sku)); | ||
at(ProductDetailPage, page => { | ||
page.editProductNotification(); | ||
page.editProductNotificationModule.editPriceNotification(50, _.email1); | ||
page.header.goToMyAccount(); | ||
}); | ||
|
||
at(MyAccountPage, page => { | ||
page.navigateToProductNotifications(); | ||
}); | ||
|
||
at(ProductNotificationsOverviewPage, page => { | ||
page.productNotificationMessage.should('contain', '50'); | ||
page.productNotificationListItemLinks.should('have.length', 2); | ||
}); | ||
}); | ||
|
||
it('user updates a product notification', () => { | ||
at(ProductNotificationsOverviewPage, page => { | ||
page.updateProductNotificationByProductName(_.product1.name, 130, _.email2); | ||
|
||
page.productNotificationMessage.should('contain', '130'); | ||
page.productNotificationMessage.should('contain', _.email2); | ||
}); | ||
}); | ||
|
||
it('user deletes one notification', () => { | ||
at(ProductNotificationsOverviewPage, page => { | ||
page.productNotificationsArray.then($listItems => { | ||
const initLen = $listItems.length; | ||
|
||
page.deleteProductNotificationByProductName(_.product1.name); | ||
|
||
page.productNotificationsArray.should('have.length', initLen - 1); | ||
page.productNotificationNameArray.should('not.contain', _.product1.sku); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
**/lazy* |
24 changes: 24 additions & 0 deletions
24
src/app/extensions/product-notifications/exports/product-notifications-exports.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { NgModule } from '@angular/core'; | ||
|
||
import { FeatureToggleModule } from 'ish-core/feature-toggle.module'; | ||
import { LAZY_FEATURE_MODULE } from 'ish-core/utils/module-loader/module-loader.service'; | ||
|
||
import { LazyProductNotificationEditComponent } from './lazy-product-notification-edit/lazy-product-notification-edit.component'; | ||
|
||
@NgModule({ | ||
imports: [FeatureToggleModule], | ||
providers: [ | ||
{ | ||
provide: LAZY_FEATURE_MODULE, | ||
useValue: { | ||
feature: 'productNotifications', | ||
location: () => | ||
import('../store/product-notifications-store.module').then(m => m.ProductNotificationsStoreModule), | ||
}, | ||
multi: true, | ||
}, | ||
], | ||
declarations: [LazyProductNotificationEditComponent], | ||
exports: [LazyProductNotificationEditComponent], | ||
}) | ||
export class ProductNotificationsExportsModule {} |
Oops, something went wrong.