-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First dropin test, for default view of card brands, passes
- Loading branch information
Showing
3 changed files
with
32 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,37 @@ | ||
import { test as base, expect } from '@playwright/test'; | ||
import { test as base, expect, Page } from '@playwright/test'; | ||
import { DropinPage } from './dropin.page'; | ||
|
||
type Fixture = { | ||
dropinPage: DropinPage; | ||
dropinPage_cardBrands_defaultView: DropinPage; | ||
}; | ||
|
||
const test = base.extend<Fixture>({ | ||
dropinPage: async ({ page }, use) => { | ||
const dropinPage = new DropinPage(page); | ||
await dropinPage.goto(); | ||
await use(dropinPage); | ||
await useDropinPage(page, use); | ||
}, | ||
|
||
dropinPage_cardBrands_defaultView: async ({ page }, use) => { | ||
const pmsConfig = JSON.stringify({ | ||
paymentMethodsConfiguration: { | ||
card: { | ||
showBrandsUnderCardNumber: false, | ||
brands: ['visa', 'mc', 'amex', 'discover', 'cup', 'maestro', 'bijcard', 'diners', 'jcb', 'synchrony_cbcc'] | ||
} | ||
} | ||
}); | ||
await page.addInitScript({ | ||
content: `window.mainConfiguration = ${pmsConfig}` | ||
}); | ||
|
||
await useDropinPage(page, use); | ||
} | ||
}); | ||
|
||
const useDropinPage = async (page: Page, use: any, PageType = DropinPage) => { | ||
const dropinPage = new PageType(page); | ||
await dropinPage.goto(); | ||
await use(dropinPage); | ||
}; | ||
|
||
export { test, expect }; |
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,26 +1,18 @@ | ||
import { test, expect } from '../../pages/dropin/dropin.fixture'; | ||
|
||
test.describe('Dropin', () => { | ||
test('should select highlighted issuer and update pay button label', async ({ dropinPage }) => { | ||
const { dropin, page } = dropinPage; | ||
test('should select highlighted issuer and update pay button label', async ({ dropinPage_cardBrands_defaultView }) => { | ||
const { dropin, page } = dropinPage_cardBrands_defaultView; | ||
|
||
await dropin.isComponentVisible(); | ||
|
||
// await page.waitForTimeout(5000); | ||
const creditCard = dropin.getPaymentMethodItem('Credit Card'); | ||
await creditCard.scrollIntoViewIfNeeded(); | ||
|
||
await dropin.creditCard.scrollIntoViewIfNeeded(); | ||
const brandsHolder = creditCard.locator('.adyen-checkout__payment-method__brands'); | ||
|
||
const imgCount = await dropin.brandsHolder.getByRole('img').count(); | ||
const imgCount = await brandsHolder.getByRole('img').count(); | ||
|
||
await expect(imgCount).toEqual(10); | ||
|
||
// const creditCard = dropin.getPaymentMethodItem('Credit Card'); | ||
// await creditCard.scrollIntoViewIfNeeded(); | ||
// | ||
// const brandsHolder = creditCard.locator('.adyen-checkout__payment-method__brands'); | ||
// | ||
// const imgCount = await brandsHolder.getByRole('img').count(); | ||
// | ||
// await expect(imgCount).toEqual(10); | ||
}); | ||
}); |