Skip to content

Commit 3f44edc

Browse files
test/CXSPA-9270 CXSPA-7795: E2E test for Quote-Order link (#20101)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent b441290 commit 3f44edc

File tree

3 files changed

+83
-1
lines changed

3 files changed

+83
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2025 SAP Spartacus team <[email protected]>
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
import { FeaturesConfig } from '@spartacus/core';
8+
import * as order from '../../../../helpers/b2b/b2b-order-details';
9+
import * as quote from '../../../../helpers/b2b/b2b-quote';
10+
import { CURRENCY_USD } from '../../../../helpers/site-context-selector';
11+
import { POWERTOOLS_BASESITE } from '../../../../sample-data/b2b-checkout';
12+
import { clearAllStorage } from '../../../../support/utils/clear-all-storage';
13+
const BUYER_EMAIL = '[email protected]';
14+
const BUYER_PASSWORD = 'welcome';
15+
const BUYER_USER = 'James Weber';
16+
describe('Navigate from Quote to Order and vice-versa (CXSPA-7795, CXSPA-9270) ', () => {
17+
beforeEach(() => {
18+
clearAllStorage();
19+
Cypress.env('BASE_SITE', POWERTOOLS_BASESITE);
20+
Cypress.env('BASE_CURRENCY', CURRENCY_USD);
21+
cy.cxConfig({
22+
features: {
23+
showOrderQuoteLink: true,
24+
},
25+
} as FeaturesConfig);
26+
cy.visit('/');
27+
});
28+
it('should navigate from Quote to Order and vice-versa', () => {
29+
quote.login(BUYER_EMAIL, BUYER_PASSWORD, BUYER_USER);
30+
quote.goToQuoteListPage();
31+
quote.openQuoteInQuoteList(quote.STATUS_ORDERED);
32+
quote.goToOrderDetail();
33+
order.goToQuoteDetail();
34+
quote.logout();
35+
});
36+
});

Diff for: projects/storefrontapp-e2e-cypress/cypress/helpers/b2b/b2b-order-details.ts

+17
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,20 @@ export function getStubbedUnitLevelOrderDetails() {
3737
{ body: unitLevelOrder }
3838
);
3939
}
40+
41+
export function goToQuoteDetail() {
42+
cy.get('div[id="quote-container"]').within(() => {
43+
let quoteID = '';
44+
cy.get('.cx-card-title')
45+
.contains('Quote ID')
46+
.then((element) => {
47+
quoteID = element.text().replace('Quote ID ', '').trim();
48+
});
49+
cy.get('.cx-card-actions')
50+
.contains('Quote Detail')
51+
.click()
52+
.then(() => {
53+
cy.url().should('include', `/my-account/quote/${quoteID}`);
54+
});
55+
});
56+
}

Diff for: projects/storefrontapp-e2e-cypress/cypress/helpers/b2b/b2b-quote.ts

+30-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export const DELETE_QUOTE_ITEM = '@DELETE_QUOTE_ITEM';
1717
export const ADD_QUOTE_COMMENT = '@ADD_QUOTE_COMMENT';
1818
export const PERFORM_QUOTE_ACTION = '@PERFORM_QUOTE_ACTION';
1919
export const STATUS_SUBMITTED = 'Submitted';
20+
export const STATUS_ORDERED = 'Ordered';
2021
export const STATUS_REQUESTED = 'Requested';
2122
export const STATUS_CANCELED = 'Cancelled';
2223
export const STATUS_DRAFT = 'Draft';
@@ -113,6 +114,21 @@ export function checkQuoteStatusInQuoteList(status: string) {
113114
});
114115
}
115116

117+
/**
118+
* Open the first quote of a certain status in the quote list.
119+
*
120+
* @param status - Quote status
121+
*/
122+
export function openQuoteInQuoteList(status: string) {
123+
log(
124+
'Open the first quote of a certain status in the quote list',
125+
openQuoteInQuoteList.name
126+
);
127+
cy.get(listComponentSelector).within(() => {
128+
cy.get('tr').contains('.cx-status', status).click();
129+
});
130+
}
131+
116132
/**
117133
* Verifies whether the quote overview page is displayed.
118134
*/
@@ -1148,7 +1164,7 @@ function clickCancelQuoteBtn(editMode: boolean) {
11481164
*/
11491165
export function goToQuoteListPage(): void {
11501166
log('Go to the quote list page', goToQuoteListPage.name);
1151-
const location = `${SHOP_NAME}/en/USD/my-account/quotes`;
1167+
const location = `${Cypress.env('BASE_SITE')}/en/USD/my-account/quotes`;
11521168
cy.visit(location).then(() => {
11531169
cy.location('pathname').should('contain', location);
11541170
checkQuoteListDisplayed();
@@ -1593,6 +1609,19 @@ export function createNewCart() {
15931609
cy.get('.CartPageTemplate');
15941610
});
15951611
}
1612+
/**
1613+
* Click on order detail link within a quote.
1614+
*/
1615+
export function goToOrderDetail() {
1616+
log('Click on order detail link within a quote', goToOrderDetail.name);
1617+
cy.get('.cx-action-link')
1618+
.contains('Order Detail')
1619+
.click()
1620+
.then(() => {
1621+
cy.url().should('include', `/my-account/order/`);
1622+
cy.get('cx-order-overview').should('be.visible');
1623+
});
1624+
}
15961625
/**
15971626
* Verifies if the save active cart popup is shown.
15981627
*

0 commit comments

Comments
 (0)