Skip to content

Commit a83301e

Browse files
authored
Merge branch 'develop' into feature/CXSPA-9645
2 parents 6af6cdf + c6cae26 commit a83301e

File tree

19 files changed

+252
-114
lines changed

19 files changed

+252
-114
lines changed

.github/workflows/pr-title-check.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,20 @@ on:
66

77
jobs:
88
check-pr-title:
9+
name: PR - Check PR title
910
runs-on: ubuntu-latest
1011
steps:
1112
- name: Validate PR title
1213
id: validate
1314
env:
1415
PR_TITLE: ${{ github.event.pull_request.title }}
1516
run: |
16-
echo "Checking PR title: $PR_TITLE"
17+
echo "Checking PR title: ${PR_TITLE}"
1718
18-
if [[ ! "$PR_TITLE" =~ ^(docs|feat|fix|perf|refactor|style|test|chore):\ .+ ]]; then
19-
echo "❌ PR title is invalid."
19+
REGEX='^(docs|feat|fix|perf|refactor|style|test|chore)(\([^)]*\))?:\ .+'
20+
21+
if [[ ! "$PR_TITLE" =~ $REGEX ]]; then
22+
echo "❌ PR title is invalid. Example of a valid title: \`feat: Add user authentication\`, \`chore(deps): update dependency babel-loader to v10\`. Allowed prefixes: docs, feat, fix, perf, refactor, style, test, chore"
2023
exit 1
2124
fi
2225

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

projects/core/src/auth/user-auth/services/oauth-lib-wrapper.service.spec.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,5 +293,22 @@ describe('OAuthLibWrapperService', () => {
293293
tokenReceived: false,
294294
});
295295
});
296+
297+
it('should reject promise if oAuthService.tryLogin throws an error', async () => {
298+
const error = new Error('Login failed');
299+
300+
spyOn(oAuthService, 'tryLogin').and.returnValue(Promise.reject(error));
301+
302+
try {
303+
await service.tryLogin();
304+
fail('Expected tryLogin() to throw');
305+
} catch (err) {
306+
expect(err).toEqual(error);
307+
}
308+
309+
expect(oAuthService.tryLogin).toHaveBeenCalledWith({
310+
disableOAuth2StateCheck: true,
311+
});
312+
});
296313
});
297314
});

projects/core/src/auth/user-auth/services/oauth-lib-wrapper.service.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export class OAuthLibWrapperService {
132132
* In cases where we don't receive this event, the token has been obtained from storage.
133133
*/
134134
tryLogin(): Promise<OAuthTryLoginResult> {
135-
return new Promise((resolve) => {
135+
return new Promise((resolve, reject) => {
136136
// We use the 'token_received' event to check if we have returned
137137
// from the auth server.
138138
let tokenReceivedEvent: OAuthEvent | undefined;
@@ -154,6 +154,9 @@ export class OAuthLibWrapperService {
154154
tokenReceived: !!tokenReceivedEvent,
155155
});
156156
})
157+
.catch((error) => {
158+
reject(error);
159+
})
157160
.finally(() => {
158161
subscription.unsubscribe();
159162
});

projects/storefrontapp-e2e-cypress/cypress/e2e/accessibility/header-and-footer.a11y-e2e.cy.ts

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,60 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7+
import { viewportContext } from '../../helpers/viewport-context';
78
import { standardUser } from '../../sample-data/shared-users';
89

9-
describe('Header and Footer Continuum tests', () => {
10+
describe('Header and Footer Continuum tests', { testIsolation: false }, () => {
1011
beforeEach(() => {
1112
cy.a11yContinuumSetup();
12-
cy.visit('/');
13-
cy.get('[section="header"]').as('header');
14-
cy.get('[section="footer"]').as('footer');
13+
cy.clearLocalStorage();
14+
cy.clearCookies();
1515
});
16+
17+
context('Footer', () => {
18+
it('Main footer body', () => {
19+
cy.visit('/');
20+
cy.get('footer a');
21+
cy.get('footer').a11yRunContinuumTest();
22+
});
23+
24+
it('Consent Management dialog', () => {
25+
cy.get('footer').get('button').contains(' Consent Management').click();
26+
cy.get('.modal-dialog').contains(' Select all ').click();
27+
cy.get('.modal-dialog').a11yRunContinuumTest();
28+
cy.get('.close').first().click();
29+
});
30+
});
31+
1632
context('Header', () => {
1733
it('Main header body', () => {
18-
cy.get('@header').get('a').contains('Brands');
19-
cy.get('@header').a11yRunContinuumTest();
34+
cy.get('header').get('nav button[aria-label="Brands"]').click();
35+
cy.get('header').get('a').contains('Canon');
36+
cy.get('header').a11yRunContinuumTest();
2037
});
2138

2239
it('My Account dropdown', () => {
2340
cy.requireLoggedIn(standardUser);
2441
cy.reload();
25-
cy.get('@header')
26-
.get('nav[aria-label="My Account"]')
27-
.a11yRunContinuumTest();
42+
cy.get('header').get('.accNavComponent button').click();
43+
cy.get('nav a').contains(' Order History ');
44+
cy.get('nav[aria-label="My Account"]').a11yRunContinuumTest();
2845
});
29-
});
3046

31-
context('Footer', () => {
32-
it('Main footer body', () => {
33-
cy.get('@footer').a11yRunContinuumTest();
34-
});
47+
viewportContext(['mobile'], () => {
48+
it('Hamburger menu', () => {
49+
cy.get('cx-hamburger-menu button').click();
50+
cy.get('a').contains('Brands');
51+
cy.get('header').a11yRunContinuumTest();
3552

36-
it('Consent Management dialog', () => {
37-
cy.get('@footer').get('button').contains(' Consent Management').click();
38-
cy.get('.modal-dialog').contains(' Select all ').click();
39-
cy.get('.modal-dialog').a11yRunContinuumTest();
53+
cy.get('button[aria-label="Brands"]').click();
54+
cy.get('button').contains('Cameras');
55+
cy.get('nav[aria-label="Category menu"]').a11yRunContinuumTest();
56+
57+
cy.get('button').contains('Cameras').click();
58+
cy.get('a').contains('Canon');
59+
cy.get('nav[aria-label="Category menu"]').a11yRunContinuumTest();
60+
});
4061
});
4162
});
4263
});
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2025 SAP Spartacus team <spartacus-team@sap.com>
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
import { viewportContext } from '../../helpers/viewport-context';
8+
9+
describe('Product Search Page', { testIsolation: false }, () => {
10+
beforeEach(() => {
11+
cy.a11yContinuumSetup();
12+
});
13+
14+
it('Searchbar', () => {
15+
cy.visit('/search/camera');
16+
cy.get('cx-product-list-item');
17+
cy.get('cx-searchbox input').type('cam').get('.products a');
18+
cy.get('cx-searchbox').a11yRunContinuumTest();
19+
cy.get('body').click(0, 0);
20+
});
21+
22+
it('Page content with list view', () => {
23+
cy.get('cx-product-list').a11yRunContinuumTest();
24+
});
25+
26+
it('Grid view', () => {
27+
cy.get('button.cx-product-grid').first().click();
28+
cy.get('#product-results-list').a11yRunContinuumTest();
29+
});
30+
31+
it('Sorting dropdown', () => {
32+
cy.get('cx-sorting').first().click();
33+
cy.get('ng-dropdown-panel').a11yRunContinuumTest();
34+
});
35+
36+
it('Facets', () => {
37+
cy.visit('/search/camera?query=camera:relevance:availableInStores:Chiba');
38+
cy.get('cx-active-facets a');
39+
cy.get('cx-product-facet-navigation').a11yRunContinuumTest();
40+
});
41+
42+
viewportContext(['mobile'], () => {
43+
it('Facets Modal', () => {
44+
cy.get('cx-product-facet-navigation .dialog-trigger').click();
45+
cy.get('cx-facet-list .value');
46+
cy.get('.dialog.active').a11yRunContinuumTest();
47+
});
48+
});
49+
});

projects/storefrontapp-e2e-cypress/cypress/e2e/regression/product-search/product-search.core-e2e.cy.ts

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,30 @@ context('Product search', { testIsolation: false }, () => {
2222
});
2323

2424
describe('Pagination', () => {
25-
it('should navigate to the next page and display results', () => {
25+
it('should test pagination and display results', () => {
26+
cy.log('NAVIGATE TO NEXT PAGE AND DISPLAY RESULTS:');
2627
productSearchFlow.verifyNextPage(2);
27-
});
2828

29-
it('should be able navigate to the specified page number and display results', () => {
29+
cy.log('NAVIGATE TO A SPECIFIED PAGE AND DISPLAY RESULTS:');
3030
productSearchFlow.verifyChoosePage(3);
31-
});
3231

33-
it('should navigate to the previous page and display results', () => {
32+
cy.log('NAVIGATE TO PREVIOUS PAGE AND DISPLAY RESULTS:');
3433
productSearchFlow.verifyPreviousPage(2);
3534
});
3635
});
3736

38-
describe('product list view mode', () => {
37+
describe('Product list view mode', () => {
3938
it('should be able to switch to grid mode', () => {
4039
productSearchFlow.viewMode();
4140
});
4241
});
4342

4443
describe('Facets', () => {
45-
it('should filter results using facet filtering', () => {
44+
it('should filter results using facet filtering and clear active facet', () => {
45+
cy.log('FILTER RESULTS USING FACET FILTERING:');
4646
productSearchFlow.filterUsingFacetFiltering();
47-
});
4847

49-
it('should be able to clear active facet', () => {
48+
cy.log('CLEAR ACTIVE FACET:');
5049
productSearchFlow.clearActiveFacet();
5150
});
5251
});
@@ -56,27 +55,23 @@ context('Product search', { testIsolation: false }, () => {
5655
cy.visit('/');
5756
});
5857

59-
it('should be able to sort by lowest price', () => {
58+
it('should be able to sort by different sort options', () => {
59+
cy.log('SORT BY LOWEST PRICE:');
6060
productSearchFlow.sortByLowestPrice();
61-
});
6261

63-
it('should be able to sort by highest price', () => {
62+
cy.log('SORT BY HIGHEST PRICE:');
6463
productSearchFlow.sortByHighestPrice();
65-
});
6664

67-
it('should be able to sort by name ascending', () => {
65+
cy.log('SORT BY NAME ASCENDING:');
6866
productSearchFlow.sortByNameAscending();
69-
});
7067

71-
it('should be able to sort by name descending', () => {
68+
cy.log('SORT BY NAME DESCENDING:');
7269
productSearchFlow.sortByNameDescending();
73-
});
7470

75-
it('should be able to sort by relevance', () => {
71+
cy.log('SORT BY RELEVANCE:');
7672
productSearchFlow.sortByRelevance();
77-
});
7873

79-
it('should be able to sort by top rated', () => {
74+
cy.log('SORT BY TOP RATED:');
8075
productSearchFlow.sortByTopRated();
8176
});
8277
});

projects/storefrontapp-e2e-cypress/cypress/helpers/checkout-multi-dimensional.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export function testCheckoutMultiDAsGuest() {
9393
}
9494

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

9999
checkout.visitHomePage();

projects/storefrontlib/cms-components/content/tab/tab.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<ng-container *ngIf="mode$ | async as mode">
22
<!-- Tab List is the list of buttons to open tabs -->
33
<div
4-
[attr.role]="mode === TAB_MODE.ACCORDIAN ? 'presentation' : 'tablist'"
4+
[attr.role]="mode === TAB_MODE.ACCORDIAN ? 'null' : 'tablist'"
55
[attr.aria-label]="config.label | cxTranslate"
66
[class]="mode.toLowerCase()"
77
>

projects/storefrontlib/cms-components/content/tab/tab.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ describe('TabComponent', () => {
352352

353353
it('should display menu buttons for tabs', () => {
354354
const accordianEl = document.querySelector('div[class="accordian"]');
355-
expect(accordianEl?.role).toEqual('presentation');
355+
expect(accordianEl?.role).toEqual('null');
356356
const buttonEls = document.querySelectorAll('button[role="button"]');
357357
expect(buttonEls.length).toEqual(4);
358358

0 commit comments

Comments
 (0)