diff --git a/packages/e2e-playwright/models/card.ts b/packages/e2e-playwright/models/card.ts index cafe5d969b..e1b66caafa 100644 --- a/packages/e2e-playwright/models/card.ts +++ b/packages/e2e-playwright/models/card.ts @@ -1,21 +1,70 @@ import { Locator, Page } from '@playwright/test'; import { USER_TYPE_DELAY } from '../tests/utils/constants'; +import LANG from '../../lib/src/language/locales/en-US.json'; + +const CARD_IFRAME_TITLE = LANG['creditCard.encryptedCardNumber.aria.iframeTitle']; +const EXPIRY_DATE_IFRAME_TITLE = LANG['creditCard.encryptedExpiryDate.aria.iframeTitle']; +const CVC_IFRAME_TITLE = LANG['creditCard.encryptedSecurityCode.aria.iframeTitle']; + +const CARD_IFRAME_LABEL = LANG['creditCard.encryptedCardNumber.aria.label']; +const EXPIRY_DATE_IFRAME_LABEL = LANG['creditCard.encryptedExpiryDate.aria.label']; +const CVC_IFRAME_LABEL = LANG['creditCard.encryptedSecurityCode.aria.label']; class Card { readonly rootElement: Locator; readonly rootElementSelector: string; + readonly cardNumberField: Locator; + readonly cardNumberErrorElement: Locator; readonly cardNumberInput: Locator; + + readonly expiryDateField: Locator; + readonly expiryDateErrorElement: Locator; readonly expiryDateInput: Locator; + + readonly cvcField: Locator; + readonly cvcErrorElement: Locator; readonly cvcInput: Locator; constructor(page: Page, rootElementSelector = '.adyen-checkout__card-input') { this.rootElement = page.locator(rootElementSelector); this.rootElementSelector = rootElementSelector; - this.cardNumberInput = this.rootElement.frameLocator('[title="Iframe for card number"]').locator('input[aria-label="Card number"]'); - this.expiryDateInput = this.rootElement.frameLocator('[title="Iframe for expiry date"]').locator('input[aria-label="Expiry date"]'); - this.cvcInput = this.rootElement.frameLocator('[title="Iframe for security code"]').locator('input[aria-label="Security code"]'); + /** + * Card Number elements, in Checkout + */ + this.cardNumberField = this.rootElement.locator('.adyen-checkout__field--cardNumber'); // Holder + this.cardNumberErrorElement = this.cardNumberField.locator('.adyen-checkout__error-text'); + + /** + * Card Number elements, in iframe + */ + const cardNumberIframe = this.rootElement.frameLocator(`[title="${CARD_IFRAME_TITLE}"]`); + this.cardNumberInput = cardNumberIframe.locator(`input[aria-label="${CARD_IFRAME_LABEL}"]`); + + /** + * Expiry Date elements, in Checkout + */ + this.expiryDateField = this.rootElement.locator('.adyen-checkout__field--expiryDate'); // Holder + this.expiryDateErrorElement = this.expiryDateField.locator('.adyen-checkout__error-text'); // Related error element + + /** + * Expiry Date elements, in iframe + */ + const expiryDateIframe = this.rootElement.frameLocator(`[title="${EXPIRY_DATE_IFRAME_TITLE}"]`); + this.expiryDateInput = expiryDateIframe.locator(`input[aria-label="${EXPIRY_DATE_IFRAME_LABEL}"]`); + + /** + * Security code elements, in Checkout + */ + this.cvcField = this.rootElement.locator('.adyen-checkout__field--securityCode'); // Holder + this.cvcErrorElement = this.cvcField.locator('.adyen-checkout__error-text'); // Related error element + + /** + * Security code elements, in iframe + */ + const cvcIframe = this.rootElement.frameLocator(`[title="${CVC_IFRAME_TITLE}"]`); + this.cvcInput = cvcIframe.locator(`input[aria-label="${CVC_IFRAME_LABEL}"]`); } async isComponentVisible() { @@ -28,6 +77,10 @@ class Card { await this.cardNumberInput.type(cardNumber, { delay: USER_TYPE_DELAY }); } + async deleteCardNumber() { + await this.cardNumberInput.clear(); + } + async typeExpiryDate(expiryDate: string) { await this.expiryDateInput.type(expiryDate, { delay: USER_TYPE_DELAY }); } diff --git a/packages/e2e-playwright/pages/cards/card.fixture.ts b/packages/e2e-playwright/pages/cards/card.fixture.ts index 037dfd7d2c..8bf38d6efb 100644 --- a/packages/e2e-playwright/pages/cards/card.fixture.ts +++ b/packages/e2e-playwright/pages/cards/card.fixture.ts @@ -7,6 +7,7 @@ import { optionalDateAndCvcMock } from '../../mocks/binLookup/binLookup.data'; type Fixture = { cardPage: CardPage; cardAvsPage: CardAvsPage; + cardLegacyInputModePage: CardPage; }; const test = base.extend({ @@ -26,6 +27,16 @@ const test = base.extend({ const cardAvsPage = new CardAvsPage(page); await cardAvsPage.goto(); await use(cardAvsPage); + }, + + cardLegacyInputModePage: async ({ page }, use) => { + await page.addInitScript({ + content: 'window.cardConfig = { legacyInputMode: true}' + }); + + const cardPage = new CardPage(page); + await cardPage.goto(); + await use(cardPage); } }); diff --git a/packages/e2e-playwright/playwright-report/index.html b/packages/e2e-playwright/playwright-report/index.html index 46a92e354f..d00b06678b 100644 --- a/packages/e2e-playwright/playwright-report/index.html +++ b/packages/e2e-playwright/playwright-report/index.html @@ -7,7 +7,7 @@ Playwright Test Report - @@ -59,4 +59,4 @@ \ No newline at end of file +window.playwrightReportBase64 = "data:application/zip;base64,UEsDBBQAAAgIAKt4L1c7EAXSlggAACx8AAAZAAAANmZjYWYzMDBiYjY1ZGU4OGJhNjIuanNvbu1ca2+bSBT9KyNW2iZSQpjhZbxKV2231UbarSq12g+bZCsM45gtBi8MTaw0/31nsBMeBjNgG+OHP7SOgZlh7j33cO9w5lEYOi6+soW+oA0tcyhL0mCgqTbu9QamhoSz+PhHc4zpGZYZ2BcuvjOt6ZU3icifvo0v2I9i7kcxnGBLJCG9nOCQ/t+/foy/lXZ0PrB60FahYeoq1iXVlpVhj13uEJd1/RMEb6fAxkMzcgnAD7R9AkzXBSG2ogDbHxzs2iEgPhiZ3zFw2EhCcO+QESDTCb68od0/kBsB/Dw7NqajpD960RgHjnUj0K4mgf8vbfX5XkeBP3aiMT3g+pZJHN8T+o/xbDScCdfx6KXymWD5bjSmralPZ4IdBfO2FV3VzwTT83wS/8Im7fZM8CNi+fGIZjeNbTZUk4xmhwMc0gmZTXC+rZCYAfnixBcjCcnnknEO1S9Q7ktqH+oiMtS/BdYECaZCX2IX4MncVvNpf4uHfoDB777/jd1CdYsaazE1EAMaRe0OAv8+xME732NmET18/8m8wxw9aJKR7UGW1KSDWza5kUeEPnw6S3qb0LbFO5/4JyNCJv2LC2ZRd+SHhF6OlItTjo4NqOZujXowvcxzJhNMOxRuIkmCg2tpDObfDPoVauDH/E/ZGAP2ef5TG5vh1LNSR+MRRoH7/JM8/jU5mvzYT10SksDx7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pdSiMP0VTay/FHR19u07WLcLK1mi3KHxXehxEVkf4XgAOyKMl5hO+V7S+EeH77dP/UEsDBBQAAAgIAKt4L1d7Kf12pAEAAHwEAAALAAAAcmVwb3J0Lmpzb269lE1r3DAQhv+KUKEnd2Pv+ht66aGQQ3vpsbuHsTSu1ZUtY43aLIv/eyV7i0NCKARSn0Yzo3nfeQS+8h4JJBDw+sqlm4CUGXhdpHm5y/K48l9ZZckc8VZptLz+fl2ie8lrnrcC2kMcN02eSSzLBvI9Xzu/Qo++Q8Ak7zT+AHG5H0ZHX4zEu5DcPUnu7IhiR9ZfJ7S0CoXoRaEPjSgTmSUVFBkWcSYPaVuG64p0kH6XsE8XJrEFp4nhg59PDLRmFoWbUH5WqKVlZFgHv5Cp4MSy34o6RpcRPx69/AMdOXu/1nrv0icH1+OkxJF7qXEyP/3Uv7t2k+mV631BG3EDudJ6JQmtBn/1EHFhtOv9tMy/w/ZIaZEVEYdhMLRkArRTxI0jYRZH69Iog1Wg7lY+85omhxGf0Ho0K2ogAtH1OCzn03yao3/xP+R5jlWaNFWRJ1Uqq0LAY/579g2JPdmOwSBf+Rj6PzLfFy9BT/ZJ/HbQfav1c21YgryC9laibWQ4uGE7eiethvNliexZjeMtu+ltzrMqL+ag8Ahh0N0gvqX6sz/K/AdQSwECPwMUAAAICACreC9XOxAF0pYIAAAsfAAAGQAAAAAAAAAAAAAAtIEAAAAANmZjYWYzMDBiYjY1ZGU4OGJhNjIuanNvblBLAQI/AxQAAAgIAKt4L1d7Kf12pAEAAHwEAAALAAAAAAAAAAAAAAC0gc0IAAByZXBvcnQuanNvblBLBQYAAAAAAgACAIAAAACaCgAAAAA="; \ No newline at end of file diff --git a/packages/e2e-playwright/tests/card/card.spec.ts b/packages/e2e-playwright/tests/card/card.spec.ts index 2dbd87971e..915268ee8f 100644 --- a/packages/e2e-playwright/tests/card/card.spec.ts +++ b/packages/e2e-playwright/tests/card/card.spec.ts @@ -1,7 +1,12 @@ import { test, expect } from '../../pages/cards/card.fixture'; import { REGULAR_TEST_CARD, TEST_CVC_VALUE, TEST_DATE_VALUE } from '../utils/constants'; +import LANG from '../../../lib/src/language/locales/en-US.json'; -test('should fill in card fields and complete the payment', async ({ cardPage }) => { +const PAN_ERROR_NOT_VALID = LANG['error.va.sf-cc-num.01']; +const PAN_ERROR_EMPTY = LANG['error.va.sf-cc-num.02']; +const PAN_ERROR_NOT_COMPLETE = LANG['error.va.sf-cc-num.04']; + +test('#1 Should fill in card fields and complete the payment', async ({ cardPage }) => { const { card, page } = cardPage; await card.typeCardNumber(REGULAR_TEST_CARD); @@ -12,3 +17,34 @@ test('should fill in card fields and complete the payment', async ({ cardPage }) await expect(page.locator('#result-message')).toHaveText('Authorised'); }); + +test('#2 PAN that consists of the same digit (but passes luhn) causes an error', async ({ cardPage }) => { + const { card, page } = cardPage; + + await card.typeCardNumber('3333 3333 3333 3333 3333'); + + await cardPage.pay(); + + await expect(card.cardNumberErrorElement).toBeVisible(); + await expect(card.cardNumberErrorElement).toHaveText(PAN_ERROR_NOT_VALID); +}); + +test('#3 Clicking pay button with an empty PAN causes an "empty" error on the PAN field', async ({ cardPage }) => { + const { card, page } = cardPage; + + await cardPage.pay(); + + await expect(card.cardNumberErrorElement).toBeVisible(); + await expect(card.cardNumberErrorElement).toHaveText(PAN_ERROR_EMPTY); +}); + +test('#4 PAN that consists of only 1 digit causes a "wrong length" error ', async ({ cardPage }) => { + const { card, page } = cardPage; + + await card.typeCardNumber('4'); + + await cardPage.pay(); + + await expect(card.cardNumberErrorElement).toBeVisible(); + await expect(card.cardNumberErrorElement).toHaveText(PAN_ERROR_NOT_COMPLETE); +}); diff --git a/packages/e2e-playwright/tests/card/legacyInputMode/card.legacyInputMode.spec.ts b/packages/e2e-playwright/tests/card/legacyInputMode/card.legacyInputMode.spec.ts new file mode 100644 index 0000000000..774c1f8f40 --- /dev/null +++ b/packages/e2e-playwright/tests/card/legacyInputMode/card.legacyInputMode.spec.ts @@ -0,0 +1,49 @@ +import { test, expect } from '../../../pages/cards/card.fixture'; + +test('#1 By default expect all securedFields to have inputs with type="text" & inputmode="numeric"', async ({ cardPage }) => { + const { card } = cardPage; + + await card.isComponentVisible(); + + const panInputType = await card.cardNumberInput.getAttribute('type'); + await expect(panInputType).toEqual('text'); + + const panInputMode = await card.cardNumberInput.getAttribute('inputmode'); + await expect(panInputMode).toEqual('numeric'); + + const expiryDateInputType = await card.expiryDateInput.getAttribute('type'); + await expect(expiryDateInputType).toEqual('text'); + + const expiryDateInputMode = await card.expiryDateInput.getAttribute('inputmode'); + await expect(expiryDateInputMode).toEqual('numeric'); + + const cvcInputType = await card.cvcInput.getAttribute('type'); + await expect(cvcInputType).toEqual('text'); + + const cvcInputMode = await card.cvcInput.getAttribute('inputmode'); + await expect(cvcInputMode).toEqual('numeric'); +}); + +test('#2 Set legacyInputMode and expect all securedFields to have inputs with type="tel"', async ({ cardLegacyInputModePage }) => { + const { card, page } = cardLegacyInputModePage; + + await card.isComponentVisible(); + + const panInputType = await card.cardNumberInput.getAttribute('type'); + await expect(panInputType).toEqual('tel'); + + const panInputMode = await card.cardNumberInput.getAttribute('inputmode'); + await expect(panInputMode).toBeNull(); + + const expiryDateInputType = await card.expiryDateInput.getAttribute('type'); + await expect(expiryDateInputType).toEqual('tel'); + + const expiryDateInputMode = await card.expiryDateInput.getAttribute('inputmode'); + await expect(expiryDateInputMode).toBeNull(); + + const cvcInputType = await card.cvcInput.getAttribute('type'); + await expect(cvcInputType).toEqual('tel'); + + const cvcInputMode = await card.cvcInput.getAttribute('inputmode'); + await expect(cvcInputMode).toBeNull(); +}); diff --git a/packages/e2e/tests/cards/general/general.test.js b/packages/e2e/tests/cards/general/general.test.js deleted file mode 100644 index 4ae1a9ef05..0000000000 --- a/packages/e2e/tests/cards/general/general.test.js +++ /dev/null @@ -1,97 +0,0 @@ -import { REGULAR_TEST_CARD } from '../utils/constants'; -import CardComponentPage from '../../_models/CardComponent.page'; -import LANG from '../../../../lib/src/language/locales/en-US.json'; - -const EMPTY_PAN = LANG['error.va.sf-cc-num.02']; -const INCORRECTLY_FILLED_PAN = LANG['error.va.sf-cc-num.04']; - -const cardPage = new CardComponentPage(); - -fixture`Testing some general functionality and UI on the regular card component`.beforeEach(async t => { - await t.navigateTo(cardPage.pageUrl); -}); - -test('#1 Can fill out the fields in the regular card and make a successful payment', async t => { - // Wait for field to appear in DOM - await cardPage.numHolder(); - - // handler for alert that's triggered on successful payment - await t.setNativeDialogHandler(() => true); - - await cardPage.cardUtils.fillCardNumber(t, REGULAR_TEST_CARD); - - await cardPage.cardUtils.fillDateAndCVC(t); - - // click pay - await t - .click(cardPage.payButton) - // no visible errors - .expect(cardPage.numLabelTextError.exists) - .notOk() - .expect(cardPage.dateLabelTextError.exists) - .notOk() - .expect(cardPage.cvcLabelTextError.exists) - .notOk() - .wait(1000); - - // Check the value of the alert text - const history = await t.getNativeDialogHistory(); - await t.expect(history[0].text).eql('Authorised'); -}); - -// KEEP AS REF - process needed if we actually want to be able to store or log the value of an attr on an iframe -// await t.switchToMainWindow().switchToIframe(cardPage.iframeSelector.nth(0)); -// const idVal = await getInputSelector('encryptedCardNumber', true).getAttribute('id'); -// console.log('### general.test:::: idVal', idVal); -// await t.switchToMainWindow(); -// await t.expect(numAttrVal).eql(idVal); - -test('#2 PAN that consists of the same digit (but passes luhn) causes an error', async t => { - // Wait for field to appear in DOM - await cardPage.numHolder(); - - await cardPage.cardUtils.fillCardNumber(t, '3333 3333 3333 3333 3333'); - - await cardPage.setForceClick(true); - - // Click label text to force the blur event on the card field - await t - .click(cardPage.dateLabelText) - // visible error - .expect(cardPage.numLabelTextError.exists) - .ok(); -}); - -test('#3 Clicking pay button with an empty PAN causes an "empty" error on the PAN field', async t => { - // Wait for field to appear in DOM - await cardPage.numHolder(); - - // Click pay - await t - .click(cardPage.payButton) - // visible error - .expect(cardPage.numLabelTextError.exists) - .ok() - // with text - .expect(cardPage.numErrorText.withExactText(EMPTY_PAN).exists) - .ok(); -}); - -test('#4 PAN that consists of the 1 digit causes a "wrong length" error ', async t => { - // Wait for field to appear in DOM - await cardPage.numHolder(); - - await cardPage.cardUtils.fillCardNumber(t, '4'); - - await cardPage.setForceClick(true); - - // Click label text to force the blur event on the card field - await t - .click(cardPage.dateLabelText) - // visible error - .expect(cardPage.numLabelTextError.exists) - .ok() - // with text - .expect(cardPage.numErrorText.withExactText(INCORRECTLY_FILLED_PAN).exists) - .ok(); -}); diff --git a/packages/e2e/tests/cards/legacyInputMode/legacyInputMode.clientScripts.js b/packages/e2e/tests/cards/legacyInputMode/legacyInputMode.clientScripts.js deleted file mode 100644 index 43ca173a0d..0000000000 --- a/packages/e2e/tests/cards/legacyInputMode/legacyInputMode.clientScripts.js +++ /dev/null @@ -1,5 +0,0 @@ -window.cardConfig = { - type: 'scheme', - brands: ['mc', 'visa', 'amex'], - legacyInputMode: true -}; diff --git a/packages/e2e/tests/cards/legacyInputMode/legacyInputMode.test.js b/packages/e2e/tests/cards/legacyInputMode/legacyInputMode.test.js deleted file mode 100644 index 8c2964876a..0000000000 --- a/packages/e2e/tests/cards/legacyInputMode/legacyInputMode.test.js +++ /dev/null @@ -1,35 +0,0 @@ -import { Selector } from 'testcafe'; -import { start, getIframeSelector } from '../../utils/commonUtils'; -import { CARDS_URL } from '../../pages'; - -const TEST_SPEED = 1; - -const iframeSelector = getIframeSelector('.card-field iframe'); - -fixture`Testing setting legacyInputMode`.page(CARDS_URL).clientScripts('legacyInputMode.clientScripts.js'); - -test('Set legacyInputMode and expect all securedFields to have inputs with type="tel"', async t => { - // Start, allow time for iframes to load - await start(t, 2000, TEST_SPEED); - - // Expect CardNumber field to have input type 'tel' - await t - .switchToIframe(iframeSelector.nth(0)) - .expect(Selector('[data-fieldtype="encryptedCardNumber"]').getAttribute('type')) - .eql('tel') - .switchToMainWindow(); - - // Expect ExpiryDate field to have input type 'tel' - await t - .switchToIframe(iframeSelector.nth(1)) - .expect(Selector('[data-fieldtype="encryptedExpiryDate"]').getAttribute('type')) - .eql('tel') - .switchToMainWindow(); - - // Expect CVC field to have input type 'tel' - await t - .switchToIframe(iframeSelector.nth(2)) - .expect(Selector('[data-fieldtype="encryptedSecurityCode"]').getAttribute('type')) - .eql('tel') - .switchToMainWindow(); -}); diff --git a/packages/e2e/tests/cards/legacyInputMode/noLegacyInputMode.clientScripts.js b/packages/e2e/tests/cards/legacyInputMode/noLegacyInputMode.clientScripts.js deleted file mode 100644 index 9a9c537ecd..0000000000 --- a/packages/e2e/tests/cards/legacyInputMode/noLegacyInputMode.clientScripts.js +++ /dev/null @@ -1,4 +0,0 @@ -window.cardConfig = { - type: 'scheme', - brands: ['mc', 'visa', 'amex'] -}; diff --git a/packages/e2e/tests/cards/legacyInputMode/noLegacyInputMode.test.js b/packages/e2e/tests/cards/legacyInputMode/noLegacyInputMode.test.js deleted file mode 100644 index c2fb824979..0000000000 --- a/packages/e2e/tests/cards/legacyInputMode/noLegacyInputMode.test.js +++ /dev/null @@ -1,41 +0,0 @@ -import { Selector } from 'testcafe'; -import { start, getIframeSelector } from '../../utils/commonUtils'; -import { CARDS_URL } from '../../pages'; - -const TEST_SPEED = 1; - -const iframeSelector = getIframeSelector('.card-field iframe'); - -fixture`Testing not setting legacyInputMode`.page(CARDS_URL).clientScripts('noLegacyInputMode.clientScripts.js'); - -test('Do not set legacyInputMode and expect all securedFields to have inputs with type="text" & inputmode="numeric"', async t => { - // Start, allow time for iframes to load - await start(t, 2000, TEST_SPEED); - - // Expect CardNumber field to have input type="text" & inputmode="numeric" - await t - .switchToIframe(iframeSelector.nth(0)) - .expect(Selector('[data-fieldtype="encryptedCardNumber"]').getAttribute('type')) - .eql('text') - .expect(Selector('[data-fieldtype="encryptedCardNumber"]').getAttribute('inputmode')) - .eql('numeric') - .switchToMainWindow(); - - // Expect ExpiryDate field to have input type type="text" & inputmode="numeric" - await t - .switchToIframe(iframeSelector.nth(1)) - .expect(Selector('[data-fieldtype="encryptedExpiryDate"]').getAttribute('type')) - .eql('text') - .expect(Selector('[data-fieldtype="encryptedExpiryDate"]').getAttribute('inputmode')) - .eql('numeric') - .switchToMainWindow(); - - // Expect CVC field to have input type type="text" & inputmode="numeric" - await t - .switchToIframe(iframeSelector.nth(2)) - .expect(Selector('[data-fieldtype="encryptedSecurityCode"]').getAttribute('type')) - .eql('text') - .expect(Selector('[data-fieldtype="encryptedSecurityCode"]').getAttribute('inputmode')) - .eql('numeric') - .switchToMainWindow(); -});