From 26164202799f22afa77d14211fd18d4cb78bc53d Mon Sep 17 00:00:00 2001 From: nicholas Date: Wed, 18 Dec 2024 14:57:16 +0100 Subject: [PATCH] Renamed waitForVisibleDualBrands to waitForVisibleBrands and pass it the number of brands you expect --- packages/e2e-playwright/models/bcmc.ts | 4 ++-- .../tests/e2e/card/bcmc/dualBranding.spec.ts | 24 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/e2e-playwright/models/bcmc.ts b/packages/e2e-playwright/models/bcmc.ts index 4249920f8..774e65a61 100644 --- a/packages/e2e-playwright/models/bcmc.ts +++ b/packages/e2e-playwright/models/bcmc.ts @@ -5,10 +5,10 @@ class BCMC extends Card { return this.cardNumberField.locator('.adyen-checkout__card__cardNumber__brandIcon').all(); } - async waitForVisibleDualBrands() { + async waitForVisibleBrands(expectedNumber = 2) { return await this.page.waitForFunction( expectedLength => [...document.querySelectorAll('.adyen-checkout__card__cardNumber__brandIcon')].length === expectedLength, - 2 + expectedNumber ); } diff --git a/packages/e2e-playwright/tests/e2e/card/bcmc/dualBranding.spec.ts b/packages/e2e-playwright/tests/e2e/card/bcmc/dualBranding.spec.ts index 526aba173..c0618993d 100644 --- a/packages/e2e-playwright/tests/e2e/card/bcmc/dualBranding.spec.ts +++ b/packages/e2e-playwright/tests/e2e/card/bcmc/dualBranding.spec.ts @@ -20,7 +20,7 @@ test.describe('Bcmc payments with dual branding', () => { await bcmc.fillCardNumber(BCMC_CARD); await bcmc.fillExpiryDate(TEST_DATE_VALUE); - await bcmc.waitForVisibleDualBrands(); + await bcmc.waitForVisibleBrands(); const [firstBrand, secondBrand] = await bcmc.brands; expect(firstBrand).toHaveAttribute('data-value', 'bcmc'); @@ -37,7 +37,7 @@ test.describe('Bcmc payments with dual branding', () => { await bcmc.goto(URL_MAP.bcmc); await bcmc.isComponentVisible(); await bcmc.fillCardNumber(BCMC_CARD); - await bcmc.waitForVisibleDualBrands(); + await bcmc.waitForVisibleBrands(); await bcmc.selectBrand('Bancontact card'); await bcmc.pay(); @@ -61,7 +61,7 @@ test.describe('Bcmc payments with dual branding', () => { await bcmc.fillCardNumber(BCMC_CARD); await bcmc.fillExpiryDate(TEST_DATE_VALUE); - await bcmc.waitForVisibleDualBrands(); + await bcmc.waitForVisibleBrands(); const [firstBrand, secondBrand] = await bcmc.brands; expect(firstBrand).toHaveAttribute('data-value', 'bcmc'); @@ -77,7 +77,7 @@ test.describe('Bcmc payments with dual branding', () => { await bcmc.goto(URL_MAP.bcmc); await bcmc.isComponentVisible(); await bcmc.fillCardNumber(BCMC_CARD); - await bcmc.waitForVisibleDualBrands(); + await bcmc.waitForVisibleBrands(); await bcmc.selectBrand('Maestro'); await bcmc.pay(); @@ -103,7 +103,7 @@ test.describe('Bcmc payments with dual branding', () => { await bcmc.fillCardNumber(BCMC_DUAL_BRANDED_VISA); await bcmc.fillExpiryDate(TEST_DATE_VALUE); - await bcmc.waitForVisibleDualBrands(); + await bcmc.waitForVisibleBrands(); const [firstBrand, secondBrand] = await bcmc.brands; expect(firstBrand).toHaveAttribute('data-value', 'bcmc'); @@ -120,7 +120,7 @@ test.describe('Bcmc payments with dual branding', () => { await bcmc.goto(URL_MAP.bcmc); await bcmc.isComponentVisible(); await bcmc.fillCardNumber(BCMC_DUAL_BRANDED_VISA); - await bcmc.waitForVisibleDualBrands(); + await bcmc.waitForVisibleBrands(); await bcmc.selectBrand('Bancontact card'); await bcmc.pay(); @@ -144,7 +144,7 @@ test.describe('Bcmc payments with dual branding', () => { await bcmc.fillCardNumber(BCMC_DUAL_BRANDED_VISA); await bcmc.fillExpiryDate(TEST_DATE_VALUE); - await bcmc.waitForVisibleDualBrands(); + await bcmc.waitForVisibleBrands(); const [firstBrand, secondBrand] = await bcmc.brands; expect(firstBrand).toHaveAttribute('data-value', 'bcmc'); @@ -165,7 +165,7 @@ test.describe('Bcmc payments with dual branding', () => { await bcmc.fillCardNumber(BCMC_DUAL_BRANDED_VISA); await bcmc.fillExpiryDate(TEST_DATE_VALUE); - await bcmc.waitForVisibleDualBrands(); + await bcmc.waitForVisibleBrands(); await bcmc.selectBrand(/visa/i); await bcmc.pay(); @@ -192,7 +192,7 @@ test.describe('Bcmc payments with dual branding', () => { await bcmc.fillCardNumber(BCMC_DUAL_BRANDED_MC); await bcmc.fillExpiryDate(TEST_DATE_VALUE); - await bcmc.waitForVisibleDualBrands(); + await bcmc.waitForVisibleBrands(); const [firstBrand, secondBrand] = await bcmc.brands; expect(firstBrand).toHaveAttribute('data-value', 'bcmc'); @@ -208,7 +208,7 @@ test.describe('Bcmc payments with dual branding', () => { await bcmc.goto(URL_MAP.bcmc); await bcmc.isComponentVisible(); await bcmc.fillCardNumber(BCMC_DUAL_BRANDED_MC); - await bcmc.waitForVisibleDualBrands(); + await bcmc.waitForVisibleBrands(); await bcmc.selectBrand('Bancontact card'); await bcmc.pay(); @@ -232,7 +232,7 @@ test.describe('Bcmc payments with dual branding', () => { await bcmc.fillCardNumber(BCMC_DUAL_BRANDED_MC); await bcmc.fillExpiryDate(TEST_DATE_VALUE); - await bcmc.waitForVisibleDualBrands(); + await bcmc.waitForVisibleBrands(); const [firstBrand, secondBrand] = await bcmc.brands; expect(firstBrand).toHaveAttribute('data-value', 'bcmc'); @@ -251,7 +251,7 @@ test.describe('Bcmc payments with dual branding', () => { await bcmc.fillCardNumber(BCMC_DUAL_BRANDED_MC); await bcmc.fillExpiryDate(TEST_DATE_VALUE); - await bcmc.waitForVisibleDualBrands(); + await bcmc.waitForVisibleBrands(); await bcmc.selectBrand('MasterCard'); await bcmc.pay();