From f76898f6b05149cba50bbd157695458598183577 Mon Sep 17 00:00:00 2001 From: Jonathan Danse Date: Tue, 2 Jun 2026 15:48:25 +0200 Subject: [PATCH 1/2] Add getGroupRestrictionNames to BO payment preferences page object Allows tests to read the customer groups listed in the "Group restrictions" table, needed to assert the per-shop filtering of group restrictions. Co-Authored-By: Claude Opus 4.8 --- src/interfaces/BO/payment/preferences.ts | 1 + .../develop/pages/BO/payment/preferences.ts | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/interfaces/BO/payment/preferences.ts b/src/interfaces/BO/payment/preferences.ts index 7dbda21f7..aba19f7b4 100644 --- a/src/interfaces/BO/payment/preferences.ts +++ b/src/interfaces/BO/payment/preferences.ts @@ -4,6 +4,7 @@ import {type Page} from '@playwright/test'; export interface BOPaymentPreferencesPageInterface extends BOBasePagePageInterface { readonly pageTitle: string; + getGroupRestrictionNames(page: Page): Promise; setCarrierRestriction(page: Page, carrierID: number, paymentModule: string, valueWanted: boolean): Promise; setCountryRestriction(page: Page, countryID: number, paymentModule: string, valueWanted: boolean): Promise; setCurrencyRestriction(page: Page, paymentModule: string, valueWanted: boolean): Promise; diff --git a/src/versions/develop/pages/BO/payment/preferences.ts b/src/versions/develop/pages/BO/payment/preferences.ts index c85d43e3e..bd8d9ad74 100644 --- a/src/versions/develop/pages/BO/payment/preferences.ts +++ b/src/versions/develop/pages/BO/payment/preferences.ts @@ -20,6 +20,10 @@ class BOPaymentPreferencesPage extends BOBasePage implements BOPaymentPreference private readonly groupRestrictionsSaveButton: string; + private readonly groupRestrictionsTableRow: (row: number) => string; + + private readonly groupRestrictionsTableRows: string; + private readonly carrierRestrictionsCheckbox: (paymentModule: string, carrierID: number) => string; private readonly carrierRestrictionSaveButton: string; @@ -42,6 +46,9 @@ class BOPaymentPreferencesPage extends BOBasePage implements BOPaymentPreference this.countryRestrictionsCheckbox = (paymentModule: string, countryID: number) => 'input[id^="form_country_restrictions_' + `${paymentModule}_"][value="${countryID}"]`; this.groupRestrictionsSaveButton = '#form-group-restrictions-save-button'; + // One row per customer group in the group restrictions table, the group name being the first cell. + this.groupRestrictionsTableRows = 'div.card:has(#form-group-restrictions-save-button) table tbody tr'; + this.groupRestrictionsTableRow = (row: number) => `${this.groupRestrictionsTableRows}:nth-child(${row})`; // Selectors fot carrier restriction this.carrierRestrictionsCheckbox = (paymentModule: string, carrierID: number) => '#form_carrier_restrictions_' + `${paymentModule}_${carrierID}`; @@ -123,6 +130,25 @@ class BOPaymentPreferencesPage extends BOBasePage implements BOPaymentPreference await page.locator(this.carrierRestrictionSaveButton).click(); return this.getAlertSuccessBlockParagraphContent(page); } + + /** + * Get the names of the customer groups listed in the group restrictions table. + * In a multishop context, only the groups of the currently selected shop should be listed. + * @param page {Page} Browser tab + * @returns {Promise} + */ + async getGroupRestrictionNames(page: Page): Promise { + await this.waitForVisibleSelector(page, this.groupRestrictionsSaveButton); + + const rowsNumber = await page.locator(this.groupRestrictionsTableRows).count(); + const groupNames: string[] = []; + + for (let row = 1; row <= rowsNumber; row++) { + groupNames.push(await this.getTextContent(page, `${this.groupRestrictionsTableRow(row)} td:first-child`)); + } + + return groupNames; + } } module.exports = new BOPaymentPreferencesPage(); From 0b83d197d21947cde44b8a2406187841cfa9c329 Mon Sep 17 00:00:00 2001 From: Jonathan Danse Date: Wed, 3 Jun 2026 09:17:55 +0200 Subject: [PATCH 2/2] Update src/versions/develop/pages/BO/payment/preferences.ts Co-authored-by: Progi1984 --- src/versions/develop/pages/BO/payment/preferences.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/versions/develop/pages/BO/payment/preferences.ts b/src/versions/develop/pages/BO/payment/preferences.ts index bd8d9ad74..006eff99f 100644 --- a/src/versions/develop/pages/BO/payment/preferences.ts +++ b/src/versions/develop/pages/BO/payment/preferences.ts @@ -47,7 +47,7 @@ class BOPaymentPreferencesPage extends BOBasePage implements BOPaymentPreference + `${paymentModule}_"][value="${countryID}"]`; this.groupRestrictionsSaveButton = '#form-group-restrictions-save-button'; // One row per customer group in the group restrictions table, the group name being the first cell. - this.groupRestrictionsTableRows = 'div.card:has(#form-group-restrictions-save-button) table tbody tr'; + this.groupRestrictionsTableRows = `div.card:has(${this.groupRestrictionsSaveButton}) table tbody tr`; this.groupRestrictionsTableRow = (row: number) => `${this.groupRestrictionsTableRows}:nth-child(${row})`; // Selectors fot carrier restriction this.carrierRestrictionsCheckbox = (paymentModule: string, carrierID: number) => '#form_carrier_restrictions_'