-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chore/bin lookup pan length tests (#2956)
* Refactoring panLength.focus.regular.spec.ts to work in new framework * Refactoring panLength.focus.regular.spec.ts to work in new framework - test 7/9 * Refactoring panLength.focus.regular.spec.ts to work in new framework - test 8/9 * Refactoring panLength.focus.regular.spec.ts to work in new framework - test 9/9 * Cleaning up unused params * Skip "paste" tet until it works in Firefox and Webkit * Make clipboard permissions browser specific * Added pauses for test that behaved oddly in webkit * Refactoring panLength.focus.ssn.spec.ts to work in new framework * Shortened test descriptions * Refactoring panLength.focus.avs.spec.ts to work in new framework * Use correct mock in avs.a11y.spec.ts * Refactoring panLength.focus.kcp.spec.ts to work in new framework * Deleting old, testcafe, clientScripts files * Refactoring to make better use of the testing API and other models - part 1 * Fix typo * Refactoring to make better use of the testing API and other models - part 2 * Refactoring to make better use of the testing API and other models - part 3 * Changing test PAN to see if it is less flaky in Webkit CI
- Loading branch information
Showing
16 changed files
with
442 additions
and
384 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Card } from './card'; | ||
import { type Locator, Page } from '@playwright/test'; | ||
|
||
class CardWithKCP extends Card { | ||
readonly kcpTaxNumberField: Locator; | ||
|
||
constructor(page: Page) { | ||
super(page); | ||
this.kcpTaxNumberField = this.rootElement.locator('.adyen-checkout__field--kcp-taxNumber'); // Holder | ||
} | ||
|
||
get taxNumberInput() { | ||
return this.kcpTaxNumberField.getByRole('textbox', { name: /Cardholder birthdate/i }); | ||
} | ||
} | ||
|
||
export { CardWithKCP }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Card } from './card'; | ||
import { type Locator, Page } from '@playwright/test'; | ||
|
||
class CardWithSSN extends Card { | ||
readonly ssnField: Locator; | ||
|
||
constructor(page: Page) { | ||
super(page); | ||
this.ssnField = this.rootElement.locator('.adyen-checkout__field--socialSecurityNumber'); // Holder | ||
} | ||
|
||
get ssnInput() { | ||
return this.ssnField.getByRole('textbox', { name: /CPF\/CNPJ/i }); | ||
} | ||
} | ||
|
||
export { CardWithSSN }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
packages/e2e-playwright/tests/ui/card/binLookup/panLength/panLength.avs.clientScripts.js
This file was deleted.
Oops, something went wrong.
55 changes: 19 additions & 36 deletions
55
packages/e2e-playwright/tests/ui/card/binLookup/panLength/panLength.focus.avs.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,27 @@ | ||
import { test } from '@playwright/test'; | ||
import { mocks } from './mocks'; | ||
import { binLookupUrl, getBinLookupMock, turnOffSDKMocking } from '../../cardMocks'; | ||
import { mergeTests, expect } from '@playwright/test'; | ||
import { test as cardWithAvs } from '../../../../../fixtures/card.fixture'; | ||
import { getStoryUrl } from '../../../../utils/getStoryUrl'; | ||
import { URL_MAP } from '../../../../../fixtures/URL_MAP'; | ||
import { binLookupMock } from '../../../../../mocks/binLookup/binLookup.mock'; | ||
import { optionalDateAndCvcWithPanLengthMock } from '../../../../../mocks/binLookup/binLookup.data'; | ||
import { REGULAR_TEST_CARD } from '../../../../utils/constants'; | ||
|
||
/** | ||
* NOTE - we are mocking the response until such time as we have a genuine card that returns the properties we want to test | ||
*/ | ||
const test = mergeTests(cardWithAvs); | ||
|
||
let currentMock = null; | ||
test.describe('Test Card, binLookup w. panLength property & address fields', () => { | ||
test('#1 Fill out PAN & see that focus moves to an address field since expiryDate & cvc are optional', async ({ cardWithAvs, page }) => { | ||
await binLookupMock(page, optionalDateAndCvcWithPanLengthMock); | ||
|
||
const getMock = val => { | ||
const mock = mocks[val]; | ||
currentMock = getBinLookupMock(binLookupUrl, mock); | ||
return currentMock; | ||
}; | ||
const componentConfig = { billingAddressRequired: true, billingAddressRequiredFields: ['street', 'houseNumberOrName', 'postalCode', 'city'] }; | ||
|
||
test.describe('Test how Card Component handles binLookup returning a panLength property for a card with address fields', () => { | ||
// use config from panLength.avs.clientScripts.js | ||
await cardWithAvs.goto(getStoryUrl({ baseUrl: URL_MAP.card, componentConfig })); | ||
|
||
test.beforeEach(async () => { | ||
// todo: go to the card page | ||
// For individual test suites (that rely on binLookup & perhaps are being run in isolation) | ||
// - provide a way to ensure SDK bin mocking is turned off | ||
await turnOffSDKMocking(); | ||
}); | ||
await cardWithAvs.isComponentVisible(); | ||
|
||
await cardWithAvs.typeCardNumber(REGULAR_TEST_CARD); | ||
|
||
test('#1 Fill out PAN (binLookup w. panLength) see that focus moves to an address field since expiryDate & cvc are optional', async () => { | ||
// use mock await t.addRequestHooks(getMock('optionalDateAndCVC')); | ||
// Wait for field to appear in DOM | ||
// await cardPage.numHolder(); | ||
// | ||
// const firstDigits = REGULAR_TEST_CARD.substring(0, 15); | ||
// const lastDigits = REGULAR_TEST_CARD.substring(15, 16); | ||
// | ||
// await cardPage.cardUtils.fillCardNumber(t, firstDigits); | ||
// | ||
// await t.wait(INPUT_DELAY); | ||
// | ||
// await cardPage.cardUtils.fillCardNumber(t, lastDigits); | ||
// | ||
// // Expect focus to be place on address (street) field | ||
// await t.expect(cardPage.addressLabelWithFocus.exists).ok(); | ||
// Expect focus to be place on address (street) field | ||
await expect(cardWithAvs.cardNumberInput).not.toBeFocused(); | ||
await expect(cardWithAvs.billingAddress.streetInput).toBeFocused(); | ||
}); | ||
}); |
Oops, something went wrong.