Skip to content

Commit

Permalink
Renamed waitForVisibleDualBrands to waitForVisibleBrands and pass it …
Browse files Browse the repository at this point in the history
…the number of brands you expect
  • Loading branch information
sponglord committed Dec 18, 2024
1 parent d279b2d commit 2616420
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions packages/e2e-playwright/models/bcmc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}

Expand Down
24 changes: 12 additions & 12 deletions packages/e2e-playwright/tests/e2e/card/bcmc/dualBranding.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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();

Expand All @@ -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');
Expand All @@ -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();

Expand All @@ -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');
Expand All @@ -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();

Expand All @@ -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');
Expand All @@ -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();
Expand All @@ -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');
Expand All @@ -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();

Expand All @@ -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');
Expand All @@ -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();
Expand Down

0 comments on commit 2616420

Please sign in to comment.