Skip to content

Commit

Permalink
fix: e2e test optimisations and small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
langemike authored Feb 8, 2024
1 parent 86b461f commit b700fbb
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/common/src/controllers/AccountController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export default class AccountController {
if (error.message.toLowerCase().includes('invalid param email')) {
throw new FormValidationError({ email: [i18next.t('account:login.wrong_email')] });
} else {
throw new FormValidationError({ email: [i18next.t('account:login.wrong_combination')] });
throw new FormValidationError({ form: [i18next.t('account:login.wrong_combination')] });
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/ui-react/src/containers/Layout/Layout.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
flex: 1;
}

div.footer {
.footer {
padding: 20px 40px;
line-height: 18px;
letter-spacing: 0.15px;
text-align: center;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.14), 0 3px 4px rgba(0, 0, 0, 0.12), 0 1px 5px rgba(0, 0, 0, 0.2);

> div > a,
a,
a:visited,
a:active,
a:hover {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-react/src/pages/LegacySeries/LegacySeries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const LegacySeries = () => {

// User, entitlement
const { user, subscription } = useAccountStore(({ user, subscription }) => ({ user, subscription }), shallow);
const { isEntitled, mediaOffers } = useEntitlement(episode);
const { isEntitled, mediaOffers } = useEntitlement(episode || firstEpisode);
const hasMediaOffers = !!mediaOffers.length;
const isLoggedIn = !!user;
const hasSubscription = !!subscription;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const MediaSeries: ScreenComponent<PlaylistItem> = ({ data: seriesMedia }) => {

// User, entitlement
const { user, subscription } = useAccountStore(({ user, subscription }) => ({ user, subscription }), shallow);
const { isEntitled, mediaOffers } = useEntitlement(episode);
const { isEntitled, mediaOffers } = useEntitlement(episode || firstEpisode);
const hasMediaOffers = !!mediaOffers.length;

const isLoggedIn = !!user;
Expand Down
1 change: 1 addition & 0 deletions platforms/web/.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ APP_PLAYER_ID=M4qoGvUk


### Web-only env vars (not sent to common/src/env configureEnv())
APP_FOOTER_TEXT=\u00a9 JW Player | [jwplayer.com](https://www.jwplayer.com/)

# the default language that the app should load when the language couldn't be detected
APP_DEFAULT_LANGUAGE=en
Expand Down
2 changes: 1 addition & 1 deletion platforms/web/test-e2e/tests/inline_layout_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Scenario('I can see the series inline player layout', async ({ I }) => {
I.see(constants.minecraftAnimationWorkshopDescription);
I.see('Favorite');
I.see('Share');
I.seeTextEquals('Minecraft Animation Workshop', 'h2');
I.seeTextEquals('Minecraft Animation Workshop', 'h1');
I.see('Season 1', locate({ css: 'select' }).inside(videoListLocator));
I.see('S1:E2', locate({ css: 'a[aria-label="Basics Of Blender"]' }).inside(videoListLocator));
I.see('S1:E3', locate({ css: 'a[aria-label="Using Mineways"]' }).inside(videoListLocator));
Expand Down
16 changes: 10 additions & 6 deletions platforms/web/test-e2e/tests/payments/subscription_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const jwProps: ProviderProps = {
creditCard: constants.creditCard.inplayer,
applicableTax: 0,
canRenewSubscription: false,
canOpenReceipts: false,
fieldWrapper: '',
hasInlineOfferSwitch: true,
};
Expand All @@ -25,6 +26,7 @@ const cleengProps: ProviderProps = {
creditCard: constants.creditCard.cleeng,
applicableTax: 21,
canRenewSubscription: true,
canOpenReceipts: false, // Cleeng returns an error on Sandbox making this test flaky
fieldWrapper: 'iframe',
hasInlineOfferSwitch: false,
};
Expand Down Expand Up @@ -204,13 +206,15 @@ function runTestSuite(props: ProviderProps, providerName: string) {

I.scrollPageToBottom();

// Open the invoice which is opened in a new tab
I.click('Show receipt');
I.switchToNextTab();
if (props.canOpenReceipts) {
// Open the invoice which is opened in a new tab
I.click('Show receipt');
I.switchToNextTab();

// Assert invoice functionality by validating the presence of the purchase button
I.seeElement('.purchase-button');
I.closeCurrentTab();
// Assert invoice functionality by validating the presence of the purchase button
I.seeElement('.purchase-button');
I.closeCurrentTab();
}
}
});
}
1 change: 1 addition & 0 deletions platforms/web/test/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export type ProviderProps = {
creditCard: string;
applicableTax: number;
canRenewSubscription: boolean;
canOpenReceipts?: boolean;
shouldMakePayment?: boolean;
locale?: string | undefined;
fieldWrapper?: string;
Expand Down

0 comments on commit b700fbb

Please sign in to comment.