Skip to content

Commit

Permalink
Use PaymentIcon tests, remove unused tests
Browse files Browse the repository at this point in the history
- payment icon feature tests were not used before,
using them now to indicate better which banner uses payment icons

- remove unused tests

- use previously unused test (checkbox test)
  • Loading branch information
moiikana committed Feb 12, 2025
1 parent a66d50a commit d3b4ec6
Show file tree
Hide file tree
Showing 11 changed files with 87 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { softCloseFeatures } from '@test/features/SoftCloseDesktop';
import { Timer } from '@src/utils/Timer';
import { TimerStub } from '@test/fixtures/TimerStub';
import { fakeFormActions } from '@test/fixtures/FakeFormActions';
import { paymentIconFeatures } from '@test/features/PaymentIcons';

const formModel = useFormModel();
const translator = ( key: string ): string => key;
Expand Down Expand Up @@ -140,4 +141,13 @@ describe( 'BannerCtrl.vue', () => {
await alreadyDonatedLinkFeatures[ testName ]( getWrapper() );
} );
} );

describe( 'Payment Icons', () => {
test.each( [
[ 'expectShowsPayPalLogo' ],
[ 'expectShowsCreditCardLogos' ]
] )( '%s', async ( testName: string ) => {
await paymentIconFeatures[ testName ]( getWrapper() );
} );
} );
} );
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { CurrencyEn } from '@src/utils/DynamicContent/formatters/CurrencyEn';
import { useOfFundsFeatures } from '@test/features/UseOfFunds';
import { bannerContentAnimatedTextFeatures, bannerContentDateAndTimeFeatures, bannerContentDisplaySwitchFeatures, bannerContentFeatures } from '@test/features/BannerContent';
import { TrackerStub } from '@test/fixtures/TrackerStub';
import { donationFormFeatures } from '@test/features/forms/MainDonation_UpgradeToYearlyButton';
import { donationFormFeatures } from '@test/features/forms/MainDonationDonationReceipt_UpgradeToYearlyButton';
import { useFormModel } from '@src/components/composables/useFormModel';
import { resetFormModel } from '@test/resetFormModel';
import { bannerAutoHideFeatures, bannerMainFeatures } from '@test/features/MainBanner';
Expand All @@ -19,6 +19,7 @@ import { softCloseFeatures } from '@test/features/SoftCloseDesktop';
import { Timer } from '@src/utils/Timer';
import { TimerStub } from '@test/fixtures/TimerStub';
import { fakeFormActions } from '@test/fixtures/FakeFormActions';
import { paymentIconFeatures } from '@test/features/PaymentIcons';

const formModel = useFormModel();
const translator = ( key: string ): string => key;
Expand Down Expand Up @@ -105,7 +106,8 @@ describe( 'BannerVar.vue', () => {
[ 'expectMainDonationFormSubmitsWhenYearlyIsSelected' ],
[ 'expectMainDonationFormGoesToUpgrade' ],
[ 'expectUpgradeToYearlyFormSubmitsUpgrade' ],
[ 'expectUpgradeToYearlyFormSubmitsDontUpgrade' ]
[ 'expectUpgradeToYearlyFormSubmitsDontUpgrade' ],
[ 'expectMainDonationFormShowsDonationReceiptCheckbox' ]
] )( '%s', async ( testName: string ) => {
await donationFormFeatures[ testName ]( getWrapper() );
} );
Expand Down Expand Up @@ -188,4 +190,13 @@ describe( 'BannerVar.vue', () => {
await alreadyDonatedLinkFeatures[ testName ]( getWrapper() );
} );
} );

describe( 'Payment Icons', () => {
test.each( [
[ 'expectShowsPayPalLogo' ],
[ 'expectShowsCreditCardLogos' ]
] )( '%s', async ( testName: string ) => {
await paymentIconFeatures[ testName ]( getWrapper() );
} );
} );
} );
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { bannerContentAnimatedTextFeatures, bannerContentDateAndTimeFeatures } f
import { TimerStub } from '@test/fixtures/TimerStub';
import { Timer } from '@src/utils/Timer';
import { fakeFormActions } from '@test/fixtures/FakeFormActions';
import { paymentIconFeatures } from '@test/features/PaymentIcons';

let pageScroller: PageScroller;
let tracker: Tracker;
Expand Down Expand Up @@ -165,4 +166,13 @@ describe( 'BannerCtrl.vue', () => {
await fullPageBannerFeatures[ testName ]( getWrapper() );
} );
} );

describe( 'Payment Icons', () => {
test.each( [
[ 'expectShowsPayPalLogo' ],
[ 'expectShowsCreditCardLogos' ]
] )( '%s', async ( testName: string ) => {
await paymentIconFeatures[ testName ]( getWrapper() );
} );
} );
} );
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { UseOfFundsShownEvent } from '@src/tracking/events/UseOfFundsShownEvent'
import { Timer } from '@src/utils/Timer';
import { TimerStub } from '@test/fixtures/TimerStub';
import { fakeFormActions } from '@test/fixtures/FakeFormActions';
import { paymentIconFeatures } from '@test/features/PaymentIcons';

let pageScroller: PageScroller;
let tracker: Tracker;
Expand Down Expand Up @@ -184,4 +185,13 @@ describe( 'BannerVar.vue', () => {
await fullPageBannerFeatures[ testName ]( getWrapper() );
} );
} );

describe( 'Payment Icons', () => {
test.each( [
[ 'expectShowsPayPalLogo' ],
[ 'expectShowsCreditCardLogos' ]
] )( '%s', async ( testName: string ) => {
await paymentIconFeatures[ testName ]( getWrapper() );
} );
} );
} );
10 changes: 10 additions & 0 deletions test/banners/pad/C25_WMDE_iPad_DE_00/components/BannerCtrl.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { bannerMainFeatures } from '@test/features/MainBanner';
import { TimerStub } from '@test/fixtures/TimerStub';
import { Timer } from '@src/utils/Timer';
import { fakeFormActions } from '@test/fixtures/FakeFormActions';
import { paymentIconFeatures } from '@test/features/PaymentIcons';

const formModel = useFormModel();
const translator = ( key: string ): string => key;
Expand Down Expand Up @@ -120,4 +121,13 @@ describe( 'BannerCtrl.vue', () => {
} );
} );

describe( 'Payment Icons', () => {
test.each( [
[ 'expectShowsPayPalLogo' ],
[ 'expectShowsCreditCardLogos' ]
] )( '%s', async ( testName: string ) => {
await paymentIconFeatures[ testName ]( getWrapper() );
} );
} );

} );
10 changes: 10 additions & 0 deletions test/banners/pad/C25_WMDE_iPad_DE_00/components/BannerVar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { bannerMainFeatures } from '@test/features/MainBanner';
import { Timer } from '@src/utils/Timer';
import { TimerStub } from '@test/fixtures/TimerStub';
import { fakeFormActions } from '@test/fixtures/FakeFormActions';
import { paymentIconFeatures } from '@test/features/PaymentIcons';

const formModel = useFormModel();
const translator = ( key: string ): string => key;
Expand Down Expand Up @@ -120,4 +121,13 @@ describe( 'BannerCtrl.vue', () => {
} );
} );

describe( 'Payment Icons', () => {
test.each( [
[ 'expectShowsPayPalLogo' ],
[ 'expectShowsCreditCardLogos' ]
] )( '%s', async ( testName: string ) => {
await paymentIconFeatures[ testName ]( getWrapper() );
} );
} );

} );
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { alreadyDonatedLinkFeatures } from '@test/features/AlreadyDonatedLink';
import { TimerStub } from '@test/fixtures/TimerStub';
import { Timer } from '@src/utils/Timer';
import { fakeFormActions } from '@test/fixtures/FakeFormActions';
import { paymentIconFeatures } from '@test/features/PaymentIcons';

const formModel = useFormModel();
const translator = ( key: string ): string => key;
Expand Down Expand Up @@ -151,4 +152,14 @@ describe( 'BannerCtrl.vue', () => {
} );
} );

describe( 'Payment Icons', () => {
test.each( [
[ 'expectShowsPayPalLogo' ],
[ 'expectShowsCreditCardLogos' ],
[ 'expectShowsSepaLogo' ]
] )( '%s', async ( testName: string ) => {
await paymentIconFeatures[ testName ]( getWrapper() );
} );
} );

} );
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { alreadyDonatedLinkFeatures } from '@test/features/AlreadyDonatedLink';
import { TimerStub } from '@test/fixtures/TimerStub';
import { Timer } from '@src/utils/Timer';
import { fakeFormActions } from '@test/fixtures/FakeFormActions';
import { paymentIconFeatures } from '@test/features/PaymentIcons';

const formModel = useFormModel();
const translator = ( key: string ): string => key;
Expand Down Expand Up @@ -151,4 +152,14 @@ describe( 'BannerVar.vue', () => {
} );
} );

describe( 'Payment Icons', () => {
test.each( [
[ 'expectShowsPayPalLogo' ],
[ 'expectShowsCreditCardLogos' ],
[ 'expectShowsSepaLogo' ]
] )( '%s', async ( testName: string ) => {
await paymentIconFeatures[ testName ]( getWrapper() );
} );
} );

} );
3 changes: 2 additions & 1 deletion test/features/PaymentIcons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { expect } from 'vitest';
const expectShowsCreditCardLogos = ( wrapper: VueWrapper<any> ): void => {
expect( wrapper.find( '.visa-logo' ).exists() ).toBeTruthy();
expect( wrapper.find( '.mastercard-logo' ).exists() ).toBeTruthy();
expect( wrapper.find( '.amex-logo' ).exists() ).toBeTruthy();
// the amex logo is currently not supported by our provider: https://phabricator.wikimedia.org/T352980
// expect( wrapper.find( '.amex-logo' ).exists() ).toBeTruthy();
};

const expectShowsPayPalLogo = ( wrapper: VueWrapper<any> ): void => {
Expand Down
6 changes: 0 additions & 6 deletions test/features/forms/MainDonation_UpgradeToYearlyButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ export const donationFormFeatures: Record<string, ( wrapper: VueWrapper<any> ) =
PaymentMethods.PAYPAL,
'5'
),
expectMainDonationFormSubmitsWhenAmountIsGreaterThanMaxAmount: async ( wrapper: VueWrapper<any> ) => expectMainDonationFormSubmits(
wrapper,
Intervals.YEARLY,
PaymentMethods.PAYPAL,
'25'
),
expectMainDonationFormGoesToUpgrade: ( wrapper: VueWrapper<any> ) => expectMainDonationFormGoesToPageOnSubmit( wrapper,
Pages.UpgradeToYearly,
Intervals.ONCE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ export const donationFormFeatures: Record<string, ( wrapper: VueWrapper<any> ) =
PaymentMethods.PAYPAL,
'10'
),
expectMainDonationFormSubmitsWhenAmountIsGreaterThanMaxAmount: async ( wrapper: VueWrapper<any> ) => expectMainDonationFormSubmits(
wrapper,
Intervals.YEARLY,
PaymentMethods.PAYPAL,
'25'
),
expectMainDonationFormGoesToUpgrade: ( wrapper: VueWrapper<any> ) => expectMainDonationFormGoesToPageOnSubmit( wrapper,
Pages.UpgradeToYearly,
Intervals.ONCE,
Expand Down

0 comments on commit d3b4ec6

Please sign in to comment.