Skip to content

Commit 8f64f50

Browse files
authored
All bcmc tests first make call to go to a URL (#3030)
* All bcmc tests first make call to go to a URL. This is consistent with how other tests work * Removed unnecessary 2nd arg in call to card.typeCardNumber * Fix: 3DS2 test checks correct endpoint before assessing final result * Renamed waitForVisibleDualBrands to waitForVisibleBrands and pass it the number of brands you expect * Added missing calls to load url
1 parent 0e730a3 commit 8f64f50

File tree

6 files changed

+44
-19
lines changed

6 files changed

+44
-19
lines changed

packages/e2e-playwright/fixtures/card.fixture.ts

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ const test = base.extend<Fixture>({
3333
},
3434
bcmc: async ({ page }, use) => {
3535
const bcmc = new BCMC(page);
36-
await bcmc.goto(URL_MAP.bcmc);
3736
await use(bcmc);
3837
}
3938
});

packages/e2e-playwright/models/bcmc.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ class BCMC extends Card {
55
return this.cardNumberField.locator('.adyen-checkout__card__cardNumber__brandIcon').all();
66
}
77

8-
async waitForVisibleDualBrands() {
8+
async waitForVisibleBrands(expectedNumber = 2) {
99
return await this.page.waitForFunction(
1010
expectedLength => [...document.querySelectorAll('.adyen-checkout__card__cardNumber__brandIcon')].length === expectedLength,
11-
2
11+
expectedNumber
1212
);
1313
}
1414

packages/e2e-playwright/tests/a11y/bcmc/bancontact.visa.a11y.spec.ts

+6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
import { test, expect } from '../../../fixtures/card.fixture';
22
import { BCMC_DUAL_BRANDED_VISA, DUAL_BRANDED_CARD, TEST_CVC_VALUE, TEST_DATE_VALUE, VISA_CARD } from '../../utils/constants';
3+
import { URL_MAP } from '../../../fixtures/URL_MAP';
34

45
test('BCMC logo should have correct alt text', async ({ bcmc }) => {
6+
await bcmc.goto(URL_MAP.bcmc);
57
await bcmc.typeCardNumber('41');
68
expect(bcmc.rootElement.getByAltText(/bancontact card/i)).toBeTruthy();
79
});
810

911
test('Visa logo should have correct alt text', async ({ bcmc }) => {
12+
await bcmc.goto(URL_MAP.bcmc);
1013
await bcmc.typeCardNumber(VISA_CARD);
1114
expect(bcmc.rootElement.getByAltText(/visa/i)).toBeTruthy();
1215
});
@@ -17,6 +20,7 @@ test(
1720
'then click Visa logo and expect comp to not be valid' +
1821
'then click BCMC logo and expect comp to be valid again',
1922
async ({ page, bcmc }) => {
23+
await bcmc.goto(URL_MAP.bcmc);
2024
await bcmc.typeCardNumber(BCMC_DUAL_BRANDED_VISA);
2125
await bcmc.typeExpiryDate(TEST_DATE_VALUE);
2226
expect(bcmc.cvcField).toBeHidden();
@@ -42,6 +46,7 @@ test(
4246
'then click Visa logo and expect comp to not be valid' +
4347
'then enter CVC and expect comp to be valid',
4448
async ({ bcmc, page }) => {
49+
await bcmc.goto(URL_MAP.bcmc);
4550
await bcmc.typeCardNumber(BCMC_DUAL_BRANDED_VISA);
4651
await bcmc.typeExpiryDate(TEST_DATE_VALUE);
4752
await page.waitForFunction(() => globalThis.component.isValid === true);
@@ -60,6 +65,7 @@ test(
6065
'then re-add it' +
6166
'and expect Visa logo to be shown a second time (showing CSF has reset state)',
6267
async ({ bcmc }) => {
68+
await bcmc.goto(URL_MAP.bcmc);
6369
await bcmc.typeCardNumber(DUAL_BRANDED_CARD);
6470
expect(bcmc.rootElement.getByAltText(/visa/i)).toBeTruthy();
6571
await bcmc.deleteCardNumber();

packages/e2e-playwright/tests/e2e/card/bcmc/dualBranding.spec.ts

+32-12
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,19 @@ import {
88
TEST_DATE_VALUE,
99
THREEDS2_CHALLENGE_PASSWORD
1010
} from '../../../utils/constants';
11+
import { URL_MAP } from '../../../../fixtures/URL_MAP';
1112

1213
test.describe('Bcmc payments with dual branding', () => {
1314
test.describe('Bancontact (BCMC) / Maestro brands', () => {
1415
test.describe('Selecting the Bancontact brand', () => {
1516
test('should submit the bcmc payment', async ({ bcmc }) => {
17+
await bcmc.goto(URL_MAP.bcmc);
18+
1619
await bcmc.isComponentVisible();
1720

1821
await bcmc.fillCardNumber(BCMC_CARD);
1922
await bcmc.fillExpiryDate(TEST_DATE_VALUE);
20-
await bcmc.waitForVisibleDualBrands();
23+
await bcmc.waitForVisibleBrands();
2124

2225
const [firstBrand, secondBrand] = await bcmc.brands;
2326
expect(firstBrand).toHaveAttribute('data-value', 'bcmc');
@@ -31,16 +34,18 @@ test.describe('Bcmc payments with dual branding', () => {
3134
});
3235

3336
test('should not submit the bcmc payment with incomplete form data', async ({ bcmc }) => {
37+
await bcmc.goto(URL_MAP.bcmc);
3438
await bcmc.isComponentVisible();
3539
await bcmc.fillCardNumber(BCMC_CARD);
36-
await bcmc.waitForVisibleDualBrands();
40+
await bcmc.waitForVisibleBrands();
3741
await bcmc.selectBrand('Bancontact card');
3842
await bcmc.pay();
3943

4044
await expect(bcmc.expiryDateErrorElement).toHaveText('Enter the expiry date');
4145
});
4246

4347
test('should not submit the bcmc payment with invalid bcmc card number', async ({ bcmc }) => {
48+
await bcmc.goto(URL_MAP.bcmc);
4449
await bcmc.isComponentVisible();
4550
await bcmc.fillCardNumber(`${BCMC_CARD}111`);
4651
await bcmc.pay();
@@ -51,11 +56,12 @@ test.describe('Bcmc payments with dual branding', () => {
5156

5257
test.describe('Selecting the maestro brand', () => {
5358
test('should submit the maestro payment', async ({ bcmc }) => {
59+
await bcmc.goto(URL_MAP.bcmc);
5460
await bcmc.isComponentVisible();
5561

5662
await bcmc.fillCardNumber(BCMC_CARD);
5763
await bcmc.fillExpiryDate(TEST_DATE_VALUE);
58-
await bcmc.waitForVisibleDualBrands();
64+
await bcmc.waitForVisibleBrands();
5965

6066
const [firstBrand, secondBrand] = await bcmc.brands;
6167
expect(firstBrand).toHaveAttribute('data-value', 'bcmc');
@@ -68,16 +74,18 @@ test.describe('Bcmc payments with dual branding', () => {
6874
});
6975

7076
test('should not submit the maestro payment with incomplete form data', async ({ bcmc }) => {
77+
await bcmc.goto(URL_MAP.bcmc);
7178
await bcmc.isComponentVisible();
7279
await bcmc.fillCardNumber(BCMC_CARD);
73-
await bcmc.waitForVisibleDualBrands();
80+
await bcmc.waitForVisibleBrands();
7481
await bcmc.selectBrand('Maestro');
7582
await bcmc.pay();
7683

7784
await expect(bcmc.expiryDateErrorElement).toHaveText('Enter the expiry date');
7885
});
7986

8087
test('should not submit the maestro payment with invalid maestro card number', async ({ bcmc }) => {
88+
await bcmc.goto(URL_MAP.bcmc);
8189
await bcmc.isComponentVisible();
8290
await bcmc.fillCardNumber(`${BCMC_CARD}111`);
8391
await bcmc.pay();
@@ -90,11 +98,12 @@ test.describe('Bcmc payments with dual branding', () => {
9098
test.describe('Bancontact (BCMC) / Visa Debit brands', () => {
9199
test.describe('Selecting the Bancontact brand', () => {
92100
test('should submit the bcmc payment', async ({ bcmc }) => {
101+
await bcmc.goto(URL_MAP.bcmc);
93102
await bcmc.isComponentVisible();
94103

95104
await bcmc.fillCardNumber(BCMC_DUAL_BRANDED_VISA);
96105
await bcmc.fillExpiryDate(TEST_DATE_VALUE);
97-
await bcmc.waitForVisibleDualBrands();
106+
await bcmc.waitForVisibleBrands();
98107

99108
const [firstBrand, secondBrand] = await bcmc.brands;
100109
expect(firstBrand).toHaveAttribute('data-value', 'bcmc');
@@ -108,16 +117,18 @@ test.describe('Bcmc payments with dual branding', () => {
108117
});
109118

110119
test('should not submit the bcmc payment with incomplete form data', async ({ bcmc }) => {
120+
await bcmc.goto(URL_MAP.bcmc);
111121
await bcmc.isComponentVisible();
112122
await bcmc.fillCardNumber(BCMC_DUAL_BRANDED_VISA);
113-
await bcmc.waitForVisibleDualBrands();
123+
await bcmc.waitForVisibleBrands();
114124
await bcmc.selectBrand('Bancontact card');
115125
await bcmc.pay();
116126

117127
await expect(bcmc.expiryDateErrorElement).toHaveText('Enter the expiry date');
118128
});
119129

120130
test('should not submit the bcmc payment with invalid bcmc card number', async ({ bcmc }) => {
131+
await bcmc.goto(URL_MAP.bcmc);
121132
await bcmc.isComponentVisible();
122133
await bcmc.fillCardNumber(`${BCMC_DUAL_BRANDED_VISA}111`);
123134
await bcmc.pay();
@@ -128,11 +139,12 @@ test.describe('Bcmc payments with dual branding', () => {
128139

129140
test.describe('Selecting the visa brand', () => {
130141
test('should submit the visa payment', async ({ bcmc }) => {
142+
await bcmc.goto(URL_MAP.bcmc);
131143
await bcmc.isComponentVisible();
132144

133145
await bcmc.fillCardNumber(BCMC_DUAL_BRANDED_VISA);
134146
await bcmc.fillExpiryDate(TEST_DATE_VALUE);
135-
await bcmc.waitForVisibleDualBrands();
147+
await bcmc.waitForVisibleBrands();
136148

137149
const [firstBrand, secondBrand] = await bcmc.brands;
138150
expect(firstBrand).toHaveAttribute('data-value', 'bcmc');
@@ -148,11 +160,12 @@ test.describe('Bcmc payments with dual branding', () => {
148160
});
149161

150162
test('should not submit the visa payment with incomplete form data', async ({ bcmc }) => {
163+
await bcmc.goto(URL_MAP.bcmc);
151164
await bcmc.isComponentVisible();
152165

153166
await bcmc.fillCardNumber(BCMC_DUAL_BRANDED_VISA);
154167
await bcmc.fillExpiryDate(TEST_DATE_VALUE);
155-
await bcmc.waitForVisibleDualBrands();
168+
await bcmc.waitForVisibleBrands();
156169

157170
await bcmc.selectBrand(/visa/i);
158171
await bcmc.pay();
@@ -161,6 +174,7 @@ test.describe('Bcmc payments with dual branding', () => {
161174
});
162175

163176
test('should not submit the visa payment with invalid visa card number', async ({ bcmc }) => {
177+
await bcmc.goto(URL_MAP.bcmc);
164178
await bcmc.isComponentVisible();
165179
await bcmc.fillCardNumber(`${BCMC_DUAL_BRANDED_VISA}111`);
166180
await bcmc.pay();
@@ -173,11 +187,12 @@ test.describe('Bcmc payments with dual branding', () => {
173187
test.describe('Bancontact (BCMC) / MC brands', () => {
174188
test.describe('Selecting the Bancontact brand', () => {
175189
test('should submit the bcmc payment', async ({ bcmc }) => {
190+
await bcmc.goto(URL_MAP.bcmc);
176191
await bcmc.isComponentVisible();
177192

178193
await bcmc.fillCardNumber(BCMC_DUAL_BRANDED_MC);
179194
await bcmc.fillExpiryDate(TEST_DATE_VALUE);
180-
await bcmc.waitForVisibleDualBrands();
195+
await bcmc.waitForVisibleBrands();
181196

182197
const [firstBrand, secondBrand] = await bcmc.brands;
183198
expect(firstBrand).toHaveAttribute('data-value', 'bcmc');
@@ -190,16 +205,18 @@ test.describe('Bcmc payments with dual branding', () => {
190205
});
191206

192207
test('should not submit the bcmc payment with incomplete form data', async ({ bcmc }) => {
208+
await bcmc.goto(URL_MAP.bcmc);
193209
await bcmc.isComponentVisible();
194210
await bcmc.fillCardNumber(BCMC_DUAL_BRANDED_MC);
195-
await bcmc.waitForVisibleDualBrands();
211+
await bcmc.waitForVisibleBrands();
196212
await bcmc.selectBrand('Bancontact card');
197213
await bcmc.pay();
198214

199215
await expect(bcmc.expiryDateErrorElement).toHaveText('Enter the expiry date');
200216
});
201217

202218
test('should not submit the bcmc payment with invalid bcmc card number', async ({ bcmc }) => {
219+
await bcmc.goto(URL_MAP.bcmc);
203220
await bcmc.isComponentVisible();
204221
await bcmc.fillCardNumber(`${BCMC_DUAL_BRANDED_MC}111`);
205222
await bcmc.pay();
@@ -210,11 +227,12 @@ test.describe('Bcmc payments with dual branding', () => {
210227

211228
test.describe('Selecting the mc brand', () => {
212229
test('should submit the mc payment', async ({ bcmc }) => {
230+
await bcmc.goto(URL_MAP.bcmc);
213231
await bcmc.isComponentVisible();
214232

215233
await bcmc.fillCardNumber(BCMC_DUAL_BRANDED_MC);
216234
await bcmc.fillExpiryDate(TEST_DATE_VALUE);
217-
await bcmc.waitForVisibleDualBrands();
235+
await bcmc.waitForVisibleBrands();
218236

219237
const [firstBrand, secondBrand] = await bcmc.brands;
220238
expect(firstBrand).toHaveAttribute('data-value', 'bcmc');
@@ -228,11 +246,12 @@ test.describe('Bcmc payments with dual branding', () => {
228246
});
229247

230248
test('should not submit the mc payment with incomplete form data', async ({ bcmc }) => {
249+
await bcmc.goto(URL_MAP.bcmc);
231250
await bcmc.isComponentVisible();
232251

233252
await bcmc.fillCardNumber(BCMC_DUAL_BRANDED_MC);
234253
await bcmc.fillExpiryDate(TEST_DATE_VALUE);
235-
await bcmc.waitForVisibleDualBrands();
254+
await bcmc.waitForVisibleBrands();
236255

237256
await bcmc.selectBrand('MasterCard');
238257
await bcmc.pay();
@@ -241,6 +260,7 @@ test.describe('Bcmc payments with dual branding', () => {
241260
});
242261

243262
test('should not submit the mc payment with invalid mc card number', async ({ bcmc }) => {
263+
await bcmc.goto(URL_MAP.bcmc);
244264
await bcmc.isComponentVisible();
245265
await bcmc.fillCardNumber(`${BCMC_DUAL_BRANDED_MC}111`);
246266
await bcmc.pay();

packages/e2e-playwright/tests/e2e/card/threeDS2/card.threeDS2.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ test.describe('Card with 3DS2', () => {
3131
});
3232

3333
test('should handle full flow (fingerprint & challenge)', async ({ page, card }) => {
34-
const submitFingerprintResponsePromise = page.waitForResponse(response => response.url().includes('/submitThreeDS2Fingerprint'));
34+
const makeDetailsCallResponsePromise = page.waitForResponse(response => response.url().includes('/paymentDetails')); // Check for sessions' /paymentDetails call
3535

3636
await card.goto(URL_MAP.card);
3737

@@ -43,10 +43,10 @@ test.describe('Card with 3DS2', () => {
4343
await card.threeDs2Challenge.fillInPassword(THREEDS2_CHALLENGE_PASSWORD);
4444
await card.threeDs2Challenge.submit();
4545

46-
const fingerPrintResponse = await submitFingerprintResponsePromise;
46+
const detailsCallResponse = await makeDetailsCallResponsePromise;
4747

4848
await expect(card.paymentResult).toContainText(PAYMENT_RESULT.authorised);
49-
expect(fingerPrintResponse.status()).toBe(200);
49+
expect(detailsCallResponse.status()).toBe(200);
5050
});
5151

5252
test('should handle challenge-only flow', async ({ page, card }) => {

packages/e2e-playwright/tests/ui/card/binLookup/panLength/panLength.focus.regular.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ test.describe('Test Card, & binLookup w. panLength property', () => {
108108
// Card out of date
109109
await card.fillExpiryDate('12/90');
110110

111-
await card.typeCardNumber(CARD_WITH_PAN_LENGTH, 300);
111+
await card.typeCardNumber(CARD_WITH_PAN_LENGTH);
112112

113113
// Expect UI change - expiryDate field has focus
114114
await expect(card.cardNumberInput).not.toBeFocused();

0 commit comments

Comments
 (0)