From 5231d86b1aa05f6424fd8335f805fb42794d2698 Mon Sep 17 00:00:00 2001 From: Anton Lantukh Date: Thu, 26 Sep 2024 17:23:40 +0200 Subject: [PATCH] fix(e2e): fix cleeng tests (#624) --- platforms/web/test-e2e/tests/offers/choose_offer_test.ts | 1 + platforms/web/test-e2e/tests/payments/payments_test.ts | 8 ++++---- platforms/web/test-e2e/utils/constants.ts | 2 +- platforms/web/test/types.ts | 1 + 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/platforms/web/test-e2e/tests/offers/choose_offer_test.ts b/platforms/web/test-e2e/tests/offers/choose_offer_test.ts index 5a7b4fb52..66ea117e6 100644 --- a/platforms/web/test-e2e/tests/offers/choose_offer_test.ts +++ b/platforms/web/test-e2e/tests/offers/choose_offer_test.ts @@ -16,6 +16,7 @@ const jwProps: ProviderProps = { fieldWrapper: '', hasInlineOfferSwitch: true, }; + const cleengProps: ProviderProps = { config: testConfigs.svod, monthlyOffer: constants.offers.monthlyOffer.cleeng, diff --git a/platforms/web/test-e2e/tests/payments/payments_test.ts b/platforms/web/test-e2e/tests/payments/payments_test.ts index e717954b5..07096115b 100644 --- a/platforms/web/test-e2e/tests/payments/payments_test.ts +++ b/platforms/web/test-e2e/tests/payments/payments_test.ts @@ -15,6 +15,7 @@ const jwProps: ProviderProps = { canRenewSubscription: false, fieldWrapper: '', hasInlineOfferSwitch: true, + cardInfo: Array.of(['Card number', '•••• •••• •••• 1111'], ['Expiry date', '03/2030'], ['Security code', '******']), }; const cleengProps: ProviderProps = { @@ -27,6 +28,7 @@ const cleengProps: ProviderProps = { canRenewSubscription: true, fieldWrapper: 'iframe', hasInlineOfferSwitch: false, + cardInfo: Array.of(['Card number', '•••• •••• •••• 1115'], ['Expiry date', '03/2030'], ['Security code', '******']), }; runTestSuite(jwProps, 'JW Player'); @@ -37,8 +39,6 @@ function runTestSuite(props: ProviderProps, providerName: string) { const today = new Date(); - const cardInfo = Array.of(['Card number', '•••• •••• •••• 1111'], ['Expiry date', '03/2030'], ['Security code', '******']); - Feature(`payments - ${providerName}`).retry(Number(process.env.TEST_RETRY_COUNT) || 0); Before(async ({ I }) => { @@ -84,7 +84,7 @@ function runTestSuite(props: ProviderProps, providerName: string) { await checkSubscription(I, addYear(today), today, props.yearlyOffer.price, props.hasInlineOfferSwitch); - cardInfo.forEach(([label, value]) => I.seeInField(label, value)); + props.cardInfo?.forEach(([label, value]) => I.seeInField(label, value)); }); Scenario(`I can cancel my subscription - ${providerName}`, async ({ I }) => { @@ -93,7 +93,7 @@ function runTestSuite(props: ProviderProps, providerName: string) { await cancelPlan(I, addYear(today), props.canRenewSubscription, providerName); // Still see payment info - cardInfo.forEach(([label, value]) => I.seeInField(label, value)); + props.cardInfo?.forEach(([label, value]) => I.seeInField(label, value)); }); Scenario(`I can renew my subscription - ${providerName}`, async ({ I }) => { diff --git a/platforms/web/test-e2e/utils/constants.ts b/platforms/web/test-e2e/utils/constants.ts index fbc18d5c9..88c215b00 100644 --- a/platforms/web/test-e2e/utils/constants.ts +++ b/platforms/web/test-e2e/utils/constants.ts @@ -101,6 +101,6 @@ export default { }, creditCard: { inplayer: '4111111111111111', - cleeng: '5555444433331111', + cleeng: '5555341244441115', }, }; diff --git a/platforms/web/test/types.ts b/platforms/web/test/types.ts index 5eb66a16f..0b14f09c6 100644 --- a/platforms/web/test/types.ts +++ b/platforms/web/test/types.ts @@ -26,4 +26,5 @@ export type ProviderProps = { locale?: string | undefined; fieldWrapper?: string; hasInlineOfferSwitch: boolean; + cardInfo?: string[][]; };