Skip to content

Commit

Permalink
test: fix flakyness for quote-configurator.e2e tests (CXSPA-5170) (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
Stofftiger authored Nov 7, 2023
1 parent bdaea25 commit 04a681c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import * as quote from '../../../../helpers/quote';
import * as cart from '../../../../helpers/cart';
import * as configuration from '../../../../helpers/product-configurator';
import * as configurationVc from '../../../../helpers/product-configurator-vc';
import * as configurationOverview from '../../../../helpers/product-configurator-overview';

Expand Down Expand Up @@ -33,8 +33,7 @@ context('Quote<->Configurator integration', () => {
quote.login(EMAIL, PASSWORD, USER);
// add a product - so that it is guaranteed that clear cart link is available
quote.addProductToCart(TEST_PRODUCT_NON_CONFIGURABLE, '1');
cart.clearActiveCart();
cart.validateEmptyCart();
quote.clearActiveCart();
quote.logout();
});

Expand All @@ -47,25 +46,17 @@ context('Quote<->Configurator integration', () => {
it('should not allow to request quote if the configuration has issues', () => {
quote.addProductToCart(TEST_PRODUCT_CONFIGURABLE_WITH_ISSUES, '1');
quote.clickOnRequestQuote(true);

//we are still in cart, for now just check that
//TODO check for messages once https://jira.tools.sap/browse/CXSPA-4079 is done
cy.get('cx-cart-details').should('exist');

//remove conflicting entry
cart.removeCartItem({ name: TEST_PRODUCT_CONFIGURABLE_WITH_ISSUES });
quote.clearActiveCart();
});

it('should support creation of a draft quote including VC configurable product (CXSPA-4158)', () => {
configurationVc.registerConfigurationUpdateRoute();
quote.prepareQuote(TEST_PRODUCT_CONFIGURABLE, 1, false);
quote.checkTotalEstimatedPrice('$270.00');
quote.clickOnEditConfigurationLink(1);
configurationVc.selectAttributeAndWait(
configuration.selectAttribute(
CONF_BS_THROATWIDTH,
radioGroup,
CONF_BS_LARGEWIDTH,
false
CONF_BS_LARGEWIDTH
);
configurationVc.clickAddToCartBtn();
configurationOverview.clickContinueToCartBtnOnOPAndExpectQuote();
Expand Down
9 changes: 9 additions & 0 deletions projects/storefrontapp-e2e-cypress/cypress/helpers/quote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as authentication from './auth-forms';
import * as common from './common';
import * as productConfigurator from './product-configurator';
import * as asm from './asm';
import * as cart from './cart';

export const READ_QUOTE = '@READ_QUOTE';
export const UPDATE_QUOTE_ITEM = '@UPDATE_QUOTE_ITEM';
Expand Down Expand Up @@ -1395,6 +1396,14 @@ export function addProductAndCheckForGlobalMessage(
});
}

/**
* Clear the active cart and verify the cart is empty.
*/
export function clearActiveCart() {
cart.clearActiveCart();
cart.validateEmptyCart();
}

/**
* Registers read quote route.
*/
Expand Down

0 comments on commit 04a681c

Please sign in to comment.