-
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.
Added test checking BCMC's UI when in the Dropin
- Loading branch information
Showing
4 changed files
with
79 additions
and
0 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
34 changes: 34 additions & 0 deletions
34
packages/e2e-playwright/tests/ui/dropin/bcmc/bancontact.dropin.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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { test, expect } from './dropinWithBcmc.fixture'; | ||
import { URL_MAP } from '../../../../fixtures/URL_MAP'; | ||
|
||
test.describe('Bcmc in dropin', () => { | ||
test('UI looks as expected with no user interaction', async ({ dropinWithBcmc, bcmc }) => { | ||
const expectedAltAttributes = ['Bancontact card', 'MasterCard', 'VISA', 'Maestro']; | ||
|
||
await dropinWithBcmc.goto(URL_MAP.dropinWithSession_BCMC_noStoredPms); | ||
|
||
// Check shown card brands in Dropin | ||
expect(await dropinWithBcmc.visibleCardBrands).toHaveLength(4); | ||
|
||
// Check list of brands | ||
const visibleBrands = await dropinWithBcmc.visibleCardBrands; | ||
|
||
visibleBrands.forEach((img, index) => { | ||
expect(img).toHaveAttribute('alt', expectedAltAttributes[index]); | ||
}); | ||
|
||
await dropinWithBcmc.selectPaymentMethod('bcmc'); | ||
|
||
await bcmc.isComponentVisible(); | ||
|
||
await bcmc.waitForVisibleBrands(1); | ||
|
||
const [firstBrand, secondBrand] = await bcmc.brands; | ||
|
||
// Only a single brand in the PAN input | ||
expect(firstBrand).toHaveAttribute('alt', /bancontact/i); | ||
|
||
// Hidden Cvc | ||
await bcmc.getCVCInputInDropin.waitFor({ state: 'hidden' }); | ||
}); | ||
}); |
28 changes: 28 additions & 0 deletions
28
packages/e2e-playwright/tests/ui/dropin/bcmc/dropinWithBcmc.fixture.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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { test as base, mergeTests, expect } from '@playwright/test'; | ||
import { DropinWithSession } from '../../../../models/dropinWithSession'; | ||
import { test as card } from '../../../../fixtures/card.fixture'; | ||
|
||
class DropinWithBcmc extends DropinWithSession { | ||
get bcmc() { | ||
return super.getPaymentMethodLabelByType('bcmc'); | ||
} | ||
|
||
get visibleCardBrands() { | ||
return this.bcmc.locator('.adyen-checkout__payment-method__brands').getByRole('img').all(); | ||
} | ||
} | ||
|
||
type Fixture = { | ||
dropinWithBcmc: DropinWithBcmc; | ||
}; | ||
|
||
const dropin = base.extend<Fixture>({ | ||
dropinWithBcmc: async ({ page }, use) => { | ||
const dropin = new DropinWithBcmc(page); | ||
await use(dropin); | ||
} | ||
}); | ||
|
||
const test = mergeTests(card, dropin); | ||
|
||
export { test, expect }; |