From e26d4e1f31d15e42b3974ebf1efdda9b1d14bc47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4hnlein?= Date: Fri, 13 Dec 2019 13:25:54 +0100 Subject: [PATCH] fix: save quote request from modal dialog navigates to my account (#56) --- .../pages/account/quote-list.page.ts | 2 +- .../integration/pages/header.module.ts | 2 +- .../pages/shopping/quote-request.dialog.ts | 34 +++++++++++++++++++ .../quoting/quote-handling.b2b.e2e-spec.ts | 4 +-- ...product-add-to-quote-dialog.component.html | 5 +-- ...duct-add-to-quote-dialog.component.spec.ts | 9 ++++- .../product-add-to-quote-dialog.component.ts | 16 ++++++++- .../quote-edit/quote-edit.component.html | 2 +- src/assets/i18n/de_DE.json | 2 +- src/assets/i18n/en_US.json | 2 +- src/assets/i18n/fr_FR.json | 2 +- 11 files changed, 68 insertions(+), 12 deletions(-) diff --git a/e2e/cypress/integration/pages/account/quote-list.page.ts b/e2e/cypress/integration/pages/account/quote-list.page.ts index 17f7edb210..cb60924842 100644 --- a/e2e/cypress/integration/pages/account/quote-list.page.ts +++ b/e2e/cypress/integration/pages/account/quote-list.page.ts @@ -10,7 +10,7 @@ export class QuoteListPage { } goToQuoteDetailLink(id: string) { - cy.get(`a[href="/account/quote/${id}"]`) + cy.get(`a[href="/account/quote-request/${id}"], a[href="/account/quote/${id}"]`) .first() .click(); } diff --git a/e2e/cypress/integration/pages/header.module.ts b/e2e/cypress/integration/pages/header.module.ts index b1712d30a9..a4830674be 100644 --- a/e2e/cypress/integration/pages/header.module.ts +++ b/e2e/cypress/integration/pages/header.module.ts @@ -36,7 +36,7 @@ export class HeaderModule { } get myAccountLink() { - return cy.get('[data-testing-id="user-status-desktop"] [data-testing-id="link-myaccount"]'); + return cy.get('[data-testing-id="link-myaccount"]:visible'); } goToMyAccount() { diff --git a/e2e/cypress/integration/pages/shopping/quote-request.dialog.ts b/e2e/cypress/integration/pages/shopping/quote-request.dialog.ts index e1933f3c28..501debc191 100644 --- a/e2e/cypress/integration/pages/shopping/quote-request.dialog.ts +++ b/e2e/cypress/integration/pages/shopping/quote-request.dialog.ts @@ -1,9 +1,20 @@ +import { waitLoadingEnd } from '../../framework'; +import { MyAccountPage } from '../account/my-account.page'; +import { QuoteListPage } from '../account/quote-list.page'; +import { HeaderModule } from '../header.module'; + export class QuoteRequestDialog { readonly tag = 'ish-product-add-to-quote-dialog'; + readonly header = new HeaderModule(); + readonly myAccountPage = new MyAccountPage(); + readonly quoteListPage = new QuoteListPage(); + private saveQuoteRequestButton = () => cy.get('[data-testing-id="saveQuoteRequest"]'); private submitQuoteRequestButton = () => cy.get('[data-testing-id="submitQuoteRequest"]'); + private hideButton = () => cy.get('.close'); private quantityInput = () => cy.get('[data-testing-id="quantity"]'); + private quoteId = () => cy.get('[data-testing-id="quoteId"]'); saveQuoteRequest() { this.saveQuoteRequestButton().click(); @@ -16,4 +27,27 @@ export class QuoteRequestDialog { setQuantity(quantity: number) { this.quantityInput().type(quantity.toString()); } + + hide() { + this.hideButton().click(); + } + + gotoQuoteDetail() { + this.quoteId().then(x => { + const id = x.attr('data-quote-id'); + this.hide(); + this.header.goToMyAccount(); + this.myAccountPage.navigateToQuoting(); + waitLoadingEnd(); + this.quoteListPage.goToQuoteDetailLink(id); + }); + } + + get productId() { + return cy.get('[itemprop="sku"]'); + } + + get quoteState() { + return cy.get('ish-quote-state'); + } } diff --git a/e2e/cypress/integration/specs/quoting/quote-handling.b2b.e2e-spec.ts b/e2e/cypress/integration/specs/quoting/quote-handling.b2b.e2e-spec.ts index 354e90d724..2c46230c29 100644 --- a/e2e/cypress/integration/specs/quoting/quote-handling.b2b.e2e-spec.ts +++ b/e2e/cypress/integration/specs/quoting/quote-handling.b2b.e2e-spec.ts @@ -49,7 +49,7 @@ describe('Quote Handling', () => { page.addProductToQuoteRequest(); }); at(QuoteRequestDialog, dialog => { - dialog.saveQuoteRequest(); + dialog.gotoQuoteDetail(); }); at(QuoteDetailPage, page => { page.totalPrice.should('contain', _.product.price * quantity); @@ -62,7 +62,7 @@ describe('Quote Handling', () => { at(CategoryPage, page => page.gotoSubCategory(_.categoryId)); at(FamilyPage, page => page.productList.addProductToQuoteRequest(_.product.sku)); at(QuoteRequestDialog, dialog => { - dialog.saveQuoteRequest(); + dialog.gotoQuoteDetail(); }); at(QuoteDetailPage, page => { page.totalPrice.should('contain', _.product.price); diff --git a/src/app/extensions/quoting/shared/product/product-add-to-quote-dialog/product-add-to-quote-dialog.component.html b/src/app/extensions/quoting/shared/product/product-add-to-quote-dialog/product-add-to-quote-dialog.component.html index 1cf45e0bc9..7e31d08478 100644 --- a/src/app/extensions/quoting/shared/product/product-add-to-quote-dialog/product-add-to-quote-dialog.component.html +++ b/src/app/extensions/quoting/shared/product/product-add-to-quote-dialog/product-add-to-quote-dialog.component.html @@ -22,7 +22,9 @@

{{ 'quote.items.table.heading' | translate }}

- {{ 'quote.edit.saved.your_quote_request_has_been_saved.text' | translate }} + {{ 'quote.edit.saved.your_quote_request_has_been_saved.text' | translate: { '0': displayName } }}
diff --git a/src/assets/i18n/de_DE.json b/src/assets/i18n/de_DE.json index 4ae53c5613..3233407771 100644 --- a/src/assets/i18n/de_DE.json +++ b/src/assets/i18n/de_DE.json @@ -2503,7 +2503,7 @@ "quote.edit.unsubmitted.provide_comment.text": "Fügen Sie ihrer Preisanfrage einen Kommentar hinzu.", "quote.edit.unsubmitted.seller_comment.label": "Kommentar des Anbieters:", "quote.edit.submitted.your_quote_request_has_been_submitted.text": "Ihre Preisanfrage wurde am {{0}} gesendet. Sie werden per E-Mail über ein Angebot informiert.", - "quote.edit.saved.your_quote_request_has_been_saved.text": "Ihre Preisanfrage wurde gespeichert.", + "quote.edit.saved.your_quote_request_has_been_saved.text": "Ihre Preisanfrage \"{{0}}\" wurde gespeichert.", "quote.edit.submitted.your_quote_expired.text": "Ihr Preisangebot ist am {{0}} {{1}} abgelaufen.", "quote.edit.back_to_shopping.link": "Weiter einkaufen", "quote.edit.back_to_quotes.link": "Zurück zu Preisangeboten", diff --git a/src/assets/i18n/en_US.json b/src/assets/i18n/en_US.json index 8503bf0bb1..203097b1f1 100644 --- a/src/assets/i18n/en_US.json +++ b/src/assets/i18n/en_US.json @@ -2503,7 +2503,7 @@ "quote.edit.unsubmitted.provide_comment.text": "Provide a comment for your quote request", "quote.edit.unsubmitted.seller_comment.label": "Seller Comment:", "quote.edit.submitted.your_quote_request_has_been_submitted.text": "Your quote request has been submitted at {{0}}. You will be informed about a quotation via e-mail.", - "quote.edit.saved.your_quote_request_has_been_saved.text": "Your quote request has been saved.", + "quote.edit.saved.your_quote_request_has_been_saved.text": "Your quote request \"{{0}}\" has been saved.", "quote.edit.submitted.your_quote_expired.text": "Your quote expired at {{0}} {{1}}.", "quote.edit.back_to_shopping.link": "Back to Shopping", "quote.edit.back_to_quotes.link": "Back to Quotes", diff --git a/src/assets/i18n/fr_FR.json b/src/assets/i18n/fr_FR.json index f3c51a6cc1..d46b47b0c6 100644 --- a/src/assets/i18n/fr_FR.json +++ b/src/assets/i18n/fr_FR.json @@ -2502,7 +2502,7 @@ "quote.edit.unsubmitted.provide_comment.text": "Entrez un commentaire pour votre demande de devis", "quote.edit.unsubmitted.seller_comment.label": "Commentaire du vendeur :", "quote.edit.submitted.your_quote_request_has_been_submitted.text": "Votre demande de devis a été soumise à {{0}}. Vous serez informé sur votre demande de devis par courriel.", - "quote.edit.saved.your_quote_request_has_been_saved.text": "Votre demande de devis a été enregistrée.", + "quote.edit.saved.your_quote_request_has_been_saved.text": "Votre demande de devis \"{{0}}\" a été enregistrée.", "quote.edit.submitted.your_quote_expired.text": "Votre devis a expiré à {{0}} {{1}}.", "quote.edit.back_to_shopping.link": "Retour au magasin", "quote.edit.back_to_quotes.link": "Retour aux devis",