Skip to content

Commit

Permalink
fix: multi-dimensional products e2e (#19157)
Browse files Browse the repository at this point in the history
Co-authored-by: Radhep Sabapathipillai <[email protected]>
  • Loading branch information
kpawelczak and RadhepS authored Aug 29, 2024
1 parent e968054 commit fb13dc1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,17 @@

import * as checkoutMultiDVariants from '../../../helpers/checkout-multi-dimensional';
import { viewportContext } from '../../../helpers/viewport-context';
import { clearAllStorage } from '../../../support/utils/clear-all-storage';

context('Multi Dimensional - checkout as guest', () => {
viewportContext(['desktop', 'mobile'], () => {
beforeEach('core tests', () => {
clearAllStorage();
describe('multi-d all-tests', () => {
checkoutMultiDVariants.testCheckoutMultiDAsGuest();
});

checkoutMultiDVariants.testCheckoutMultiDAsGuest();
});

viewportContext(['desktop'], () => {
beforeEach('core tests', () => {
clearAllStorage();
describe('multi-d all-tests', () => {
checkoutMultiDVariants.testCheckoutMultiDAsGuestAndVerifyCart();
});
checkoutMultiDVariants.testCheckoutMultiDAsGuestAndVerifyCart();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,11 @@

import { viewportContext } from '../../../helpers/viewport-context';
import * as checkoutMultiDVariants from '../../../helpers/checkout-multi-dimensional';
import {
ELECTRONICS_BASESITE,
ELECTRONICS_CURRENCY,
} from '../../../helpers/checkout-flow';
import { clearAllStorage } from '../../../support/utils/clear-all-storage';

context('Multi Dimensional - checkout flow', () => {
viewportContext(['desktop', 'mobile'], () => {
beforeEach(() => {
clearAllStorage();
Cypress.env('BASE_SITE', ELECTRONICS_BASESITE);
Cypress.env('BASE_CURRENCY', ELECTRONICS_CURRENCY);
describe('multi-d core-tests', () => {
checkoutMultiDVariants.testCheckoutRegisteredUser();
});

checkoutMultiDVariants.testCheckoutRegisteredUser();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { searchForProduct } from './product-search';
import { addProductToCart } from './applied-promotions';

export function testCheckoutMultiDAsGuest() {
it.skip('should perform checkout as guest, create an account and verify guest data', () => {
it('should perform checkout as guest, create an account and verify guest data', () => {
const multiDUser = getSampleUser();
checkout.visitHomePage();
checkout.clickHamburger();
Expand Down Expand Up @@ -93,7 +93,7 @@ export function testCheckoutMultiDAsGuest() {
}

export function testCheckoutMultiDAsGuestAndVerifyCart() {
it.skip('should perform checkout as guest, create an account and verify guest data, and verify cart persists after registering', () => {
it('should perform checkout as guest, create an account and verify guest data, and verify cart persists after registering', () => {
const multiDUser = getSampleUser();

checkout.visitHomePage();
Expand Down Expand Up @@ -179,7 +179,7 @@ export function testCheckoutMultiDAsGuestAndVerifyCart() {
}

export function testCheckoutRegisteredUser() {
it.skip('should perform checkout with a registered user', () => {
it('should perform checkout with a registered user', () => {
const regMultiDUser = getSampleUser();
checkout.visitHomePage();

Expand Down Expand Up @@ -217,11 +217,14 @@ function selectVariantAndAddToCart(color: string = 'Blue') {
.find(`img[title*="${color}"]`)
.click();

cy.wait(2000);
cy.get('cx-product-multi-dimensional-selector')
.find(`button[aria-label*="Selected, ${color} Color"]`)
.should('be.visible');

addProductToCart();

cy.get('cx-added-to-cart-dialog.d-block.fade.modal.show')
.should('be.visible')
.find('button.close[aria-label="Close Modal"]')
.click();

Expand All @@ -233,7 +236,9 @@ export function selectVariant(color: string = 'Blue') {
.find(`img[title*="${color}"]`)
.click();

cy.wait(2000);
cy.get('cx-product-multi-dimensional-selector')
.find(`button[aria-label*="Selected, ${color} Color"]`)
.should('be.visible');
}

export function goToMultiDProductFromPLP() {
Expand All @@ -243,5 +248,5 @@ export function goToMultiDProductFromPLP() {
.first()
.click();

cy.wait(2000);
cy.get('cx-product-multi-dimensional-selector').should('be.visible');
}

0 comments on commit fb13dc1

Please sign in to comment.