From 1867655a3bfc9837af1e3da37d168704990ae3f8 Mon Sep 17 00:00:00 2001 From: LarisaStar <61147963+Larisa-Staroverova@users.noreply.github.com> Date: Thu, 29 Apr 2021 07:04:39 +0200 Subject: [PATCH 1/3] test: (E2e) Re-activate check for show more button (#12164) As CI is equipped with proper version settings, the check can be again executed. Closes #12138 --- .../cypress/helpers/product-configuration.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/projects/storefrontapp-e2e-cypress/cypress/helpers/product-configuration.ts b/projects/storefrontapp-e2e-cypress/cypress/helpers/product-configuration.ts index f3e9ff6856f..a2a36db3d2f 100644 --- a/projects/storefrontapp-e2e-cypress/cypress/helpers/product-configuration.ts +++ b/projects/storefrontapp-e2e-cypress/cypress/helpers/product-configuration.ts @@ -294,9 +294,7 @@ export function checkProductTitleDisplayed(): void { */ export function checkShowMoreLinkAtProductTitleDisplayed(): void { checkUpdatingMessageNotDisplayed(); - //Temporarily deactivate this check - //TODO #12138 - //cy.get('button:contains("show more")').should('be.visible'); + cy.get('button:contains("show more")').should('be.visible'); } /** From 42c6f52e308937e825f6dcc15cb959346c7d7401 Mon Sep 17 00:00:00 2001 From: AlexanderKuschner <54353334+AlexanderKuschner@users.noreply.github.com> Date: Thu, 29 Apr 2021 15:32:17 +0200 Subject: [PATCH 2/3] test: adjust cypress test for add configuration directly, checkout and order (#12201) Identify cart entry correctly; wait for API call during continue to delivery mode in checkout. closes #12067 --- .../cypress/helpers/product-configuration.ts | 18 ++ .../vendor/cpq/cpq-configuration.e2e-spec.ts | 184 ++++++++++-------- 2 files changed, 116 insertions(+), 86 deletions(-) diff --git a/projects/storefrontapp-e2e-cypress/cypress/helpers/product-configuration.ts b/projects/storefrontapp-e2e-cypress/cypress/helpers/product-configuration.ts index a2a36db3d2f..405108ceb03 100644 --- a/projects/storefrontapp-e2e-cypress/cypress/helpers/product-configuration.ts +++ b/projects/storefrontapp-e2e-cypress/cypress/helpers/product-configuration.ts @@ -1315,6 +1315,7 @@ export function checkoutB2B(): void { .contains('Continue') .click() .then(() => { + cy.wait('@deliveryMode'); cy.location('pathname').should('contain', '/checkout/delivery-mode'); cy.get('.cx-checkout-title').should('contain', 'Shipping Method'); cy.get('cx-delivery-mode').should('be.visible'); @@ -1538,3 +1539,20 @@ export function checkAmountOfBundleItems( toggleBundleItems('show'); }); } + +/** + * Verifies the amount of cart entries. + * + * @param {number} expectedCount - Expected amount of cart entries + */ +export function verifyCartCount(expectedCount: number) { + cy.log('expectedCount =' + expectedCount); + cy.get('cx-mini-cart .count').contains(expectedCount); +} + +/** + * Define alias for deliveryMode API call. + */ +export function defineDeliveryModeAlias() { + cy.intercept('PUT', '**/deliverymode*').as('deliveryMode'); +} diff --git a/projects/storefrontapp-e2e-cypress/cypress/integration/vendor/cpq/cpq-configuration.e2e-spec.ts b/projects/storefrontapp-e2e-cypress/cypress/integration/vendor/cpq/cpq-configuration.e2e-spec.ts index 8eefb9b1628..4a63cb9a3e9 100644 --- a/projects/storefrontapp-e2e-cypress/cypress/integration/vendor/cpq/cpq-configuration.e2e-spec.ts +++ b/projects/storefrontapp-e2e-cypress/cypress/integration/vendor/cpq/cpq-configuration.e2e-spec.ts @@ -1,4 +1,3 @@ -import * as cart from '../../../helpers/cart'; import * as configuration from '../../../helpers/product-configuration'; import * as configurationOverview from '../../../helpers/product-configuration-overview'; import * as productSearch from '../../../helpers/product-search'; @@ -420,100 +419,113 @@ context('CPQ Configuration', () => { describe('Configuration Process', () => { it('should be able to add a configuration directly to the cart, navigate from the cart back to the configuration and update it, checkout and order', () => { + configuration.defineDeliveryModeAlias(); configuration.goToPDPage(POWERTOOLS, PROD_CODE_CAM); configuration.clickOnAddToCartBtnOnPD(); configuration.clickOnViewCartBtnOnPD(); - type ovBundleInfo = { - name: string; - price?: string; - quantity?: string; - }; - const ovBundleInfos: ovBundleInfo[] = [ - { - name: 'SanDisk Extreme Pro 128GB SDXC', - price: '$100.00', - quantity: '1', - }, - { - name: 'Canon RF 24-105mm f4L IS USM', - price: '$1,500.00', - quantity: '1', - }, - { - name: 'LowePro Streetline SL 140', - price: '$110.00', - quantity: '1', - }, - ]; - configuration.checkAmountOfBundleItems(0, 3); - - ovBundleInfos.forEach((line, bundleItemIndex) => { - configuration.checkBundleItemName(0, bundleItemIndex, line.name); - configuration.checkBundleItemPrice(0, bundleItemIndex, line.price); - configuration.checkBundleItemQuantity( - 0, - bundleItemIndex, - line.quantity + cy.get('cx-mini-cart .count').then((elem) => { + const numberOfCartItems = Number(elem.text()); + cy.log('numberOfCartItems = ' + numberOfCartItems); + editConfigurationFromCartEntry(numberOfCartItems); + // Checkout + configuration.clickOnProceedToCheckoutBtnInCart(); + configuration.checkoutB2B(); + // Order historyorderHistory(); + configuration.selectOrderByOrderNumberAlias(POWERTOOLS); + configurationOverview.checkGroupHeaderDisplayed(GRP_CAM_MAIN, 0); + configurationOverview.checkAttrDisplayed( + 'Camera Body', + 'Canon EOS 80D', + 0 ); }); + }); + }); - //We assume the last product in the cart is the one we added - configuration.clickOnEditConfigurationLink( - configuration.getNumberOfCartItems() - 1 + function editConfigurationFromCartEntry(numberOfCartItems: number) { + //We assume the last product in the cart is the one we added + const cartEntryIndex: number = numberOfCartItems - 1; + type ovBundleInfo = { + name: string; + price?: string; + quantity?: string; + }; + const ovBundleInfos: ovBundleInfo[] = [ + { + name: 'SanDisk Extreme Pro 128GB SDXC', + price: '$100.00', + quantity: '1', + }, + { + name: 'Canon RF 24-105mm f4L IS USM', + price: '$1,500.00', + quantity: '1', + }, + { + name: 'LowePro Streetline SL 140', + price: '$110.00', + quantity: '1', + }, + ]; + configuration.checkAmountOfBundleItems( + cartEntryIndex, + ovBundleInfos.length + ); + + ovBundleInfos.forEach((line, bundleItemIndex) => { + configuration.checkBundleItemName( + cartEntryIndex, + bundleItemIndex, + line.name ); - - configuration.checkAttributeDisplayed(ATTR_CAM_BODY, RADGRP_PROD); - configuration.selectAttribute( - ATTR_CAM_BODY, - RADGRP_PROD, - VAL_CAM_BODY_D850 + configuration.checkBundleItemPrice( + cartEntryIndex, + bundleItemIndex, + line.price ); - configuration.checkValueSelected( - RADGRP_PROD, - ATTR_CAM_BODY, - VAL_CAM_BODY_D850 - ); - configuration.selectAttribute( - ATTR_CAM_BODY, - RADGRP_PROD, - VAL_CAM_BODY_EOS80D - ); - configuration.checkValueSelected( - RADGRP_PROD, - ATTR_CAM_BODY, - VAL_CAM_BODY_EOS80D - ); - configuration.selectAttribute(ATTR_CAM_LEN, CHKBOX_PROD, VAL_CAM_LEN_SI); - configuration.checkValueSelected( - CHKBOX_PROD, - ATTR_CAM_LEN, - VAL_CAM_LEN_SI - ); - configuration.clickAddToCartBtn(); - - configurationOverview.checkConfigOverviewPageDisplayed(); - configurationOverview.checkGroupHeaderDisplayed(GRP_CAM_MAIN, 0); - configurationOverview.checkAttrDisplayed( - 'Camera Body', - 'Canon EOS 80D', - 0 - ); - - configurationOverview.checkGroupHeaderDisplayed(GRP_CAM_ACC, 1); - configurationOverview.clickContinueToCartBtnOnOP(); - - cart.verifyCartNotEmpty(); - - configuration.clickOnProceedToCheckoutBtnInCart(); - configuration.checkoutB2B(); - configuration.selectOrderByOrderNumberAlias(POWERTOOLS); - configurationOverview.checkGroupHeaderDisplayed(GRP_CAM_MAIN, 0); - configurationOverview.checkAttrDisplayed( - 'Camera Body', - 'Canon EOS 80D', - 0 + configuration.checkBundleItemQuantity( + cartEntryIndex, + bundleItemIndex, + line.quantity ); }); - }); + + configuration.clickOnEditConfigurationLink(cartEntryIndex); + + configuration.checkAttributeDisplayed(ATTR_CAM_BODY, RADGRP_PROD); + configuration.selectAttribute( + ATTR_CAM_BODY, + RADGRP_PROD, + VAL_CAM_BODY_D850 + ); + configuration.checkValueSelected( + RADGRP_PROD, + ATTR_CAM_BODY, + VAL_CAM_BODY_D850 + ); + configuration.selectAttribute( + ATTR_CAM_BODY, + RADGRP_PROD, + VAL_CAM_BODY_EOS80D + ); + configuration.checkValueSelected( + RADGRP_PROD, + ATTR_CAM_BODY, + VAL_CAM_BODY_EOS80D + ); + configuration.selectAttribute(ATTR_CAM_LEN, CHKBOX_PROD, VAL_CAM_LEN_SI); + configuration.checkValueSelected(CHKBOX_PROD, ATTR_CAM_LEN, VAL_CAM_LEN_SI); + configuration.clickAddToCartBtn(); + + configurationOverview.checkConfigOverviewPageDisplayed(); + configurationOverview.checkGroupHeaderDisplayed(GRP_CAM_MAIN, 0); + configurationOverview.checkAttrDisplayed('Camera Body', 'Canon EOS 80D', 0); + + configurationOverview.checkGroupHeaderDisplayed(GRP_CAM_ACC, 1); + configurationOverview.clickContinueToCartBtnOnOP(); + + configuration.checkAmountOfBundleItems(cartEntryIndex, 4); + configuration.verifyCartCount(numberOfCartItems); + } }); From fa539cf3c48e8cfd903d16dc29c37de37c2f3f16 Mon Sep 17 00:00:00 2001 From: pla Date: Thu, 29 Apr 2021 11:54:29 -0400 Subject: [PATCH 3/3] fix: Remove CheckoutModule import in LoginRegisterModule (#12174) closes GH-12173 --- .../components/login-register/login-register.module.ts | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/feature-libs/user/account/components/login-register/login-register.module.ts b/feature-libs/user/account/components/login-register/login-register.module.ts index 839ac55bfd8..1d387e5187b 100644 --- a/feature-libs/user/account/components/login-register/login-register.module.ts +++ b/feature-libs/user/account/components/login-register/login-register.module.ts @@ -2,7 +2,6 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { RouterModule } from '@angular/router'; import { - CheckoutModule, CmsConfig, I18nModule, NotAuthGuard, @@ -13,14 +12,7 @@ import { PageSlotModule } from '@spartacus/storefront'; import { LoginRegisterComponent } from './login-register.component'; @NgModule({ - imports: [ - CommonModule, - RouterModule, - UrlModule, - PageSlotModule, - I18nModule, - CheckoutModule, - ], + imports: [CommonModule, RouterModule, UrlModule, PageSlotModule, I18nModule], providers: [ provideDefaultConfig({ cmsComponents: {