Skip to content

Commit

Permalink
fix: disable jwp test suites altogether and display loading state in …
Browse files Browse the repository at this point in the history
…startwatchingbutton
  • Loading branch information
mirovladimitrovski committed Sep 27, 2024
1 parent aa4d71e commit 679d348
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const StartWatchingButton: React.VFC<Props> = ({ item, playUrl, disabled = false
const watchHistoryItem = useWatchHistoryStore((state) => item && state.getItem(item));
const videoProgress = watchHistoryItem?.progress;

useOffers();
const { isLoading: isOffersLoading } = useOffers();

// entitlement
const setRequestedMediaOffers = useCheckoutStore((s) => s.setRequestedMediaOffers);
Expand Down Expand Up @@ -98,7 +98,8 @@ const StartWatchingButton: React.VFC<Props> = ({ item, playUrl, disabled = false
startIcon={isEntitled ? <Icon icon={Play} /> : undefined}
onClick={handleStartWatchingClick}
fullWidth={breakpoint < Breakpoint.md}
disabled={disabled}
disabled={disabled || isOffersLoading}
busy={isOffersLoading}
>
{videoProgress ? (
<div className={styles.progressRail}>
Expand Down
16 changes: 2 additions & 14 deletions platforms/web/test-e2e/tests/offers/choose_offer_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ const cleengProps: ProviderProps = {
hasInlineOfferSwitch: false,
};

runTestSuite(jwProps, 'JW Player', true);
// runTestSuite(jwProps, 'JW Player');
runTestSuite(cleengProps, 'Cleeng');

function runTestSuite(props: ProviderProps, providerName: string, isAccessBridgeEnabled = false) {
function runTestSuite(props: ProviderProps, providerName: string) {
let paidLoginContext: LoginContext;

Feature(`choose offer - ${providerName}`).retry(Number(process.env.TEST_RETRY_COUNT) || 0);
Expand Down Expand Up @@ -62,10 +62,6 @@ function runTestSuite(props: ProviderProps, providerName: string, isAccessBridge
});

Scenario(`I can see offered subscriptions - ${providerName}`, async ({ I }) => {
if (isAccessBridgeEnabled) {
return;
}

paidLoginContext = await I.registerOrLogin(paidLoginContext);

I.amOnPage(constants.paymentsUrl);
Expand Down Expand Up @@ -95,10 +91,6 @@ function runTestSuite(props: ProviderProps, providerName: string, isAccessBridge
});

Scenario(`I can choose an offer - ${providerName}`, async ({ I }) => {
if (isAccessBridgeEnabled) {
return;
}

paidLoginContext = await I.registerOrLogin(paidLoginContext);

I.amOnPage(constants.offersUrl);
Expand Down Expand Up @@ -131,10 +123,6 @@ function runTestSuite(props: ProviderProps, providerName: string, isAccessBridge
});

Scenario(`I can see payment types - ${providerName}`, async ({ I }) => {
if (isAccessBridgeEnabled) {
return;
}

paidLoginContext = await I.registerOrLogin(paidLoginContext);

await goToCheckout(I);
Expand Down
16 changes: 2 additions & 14 deletions platforms/web/test-e2e/tests/payments/coupons_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ const cleengProps: ProviderProps = {
hasInlineOfferSwitch: false,
};

runTestSuite(jwProps, 'JW Player', true);
// runTestSuite(jwProps, 'JW Player');
runTestSuite(cleengProps, 'Cleeng');

function runTestSuite(props: ProviderProps, providerName: string, isAccessBridgeEnabled = false) {
function runTestSuite(props: ProviderProps, providerName: string) {
let couponLoginContext: LoginContext;

const today = new Date();
Expand All @@ -51,10 +51,6 @@ function runTestSuite(props: ProviderProps, providerName: string, isAccessBridge
});

Scenario(`I can redeem coupons - ${providerName}`, async ({ I }) => {
if (isAccessBridgeEnabled) {
return;
}

await goToCheckout(I);

I.click('Redeem coupon');
Expand Down Expand Up @@ -96,18 +92,10 @@ function runTestSuite(props: ProviderProps, providerName: string, isAccessBridge
});

Scenario(`I can cancel a free subscription - ${providerName}`, async ({ I }) => {
if (isAccessBridgeEnabled) {
return;
}

cancelPlan(I, addYear(today), props.canRenewSubscription, providerName);
});

Scenario(`I can renew a free subscription - ${providerName}`, async ({ I }) => {
if (isAccessBridgeEnabled) {
return;
}

if (props.canRenewSubscription) {
renewPlan(I, addYear(today), props.yearlyOffer.price);
} else {
Expand Down
24 changes: 2 additions & 22 deletions platforms/web/test-e2e/tests/payments/payments_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ const cleengProps: ProviderProps = {
cardInfo: Array.of(['Card number', '•••• •••• •••• 1115'], ['Expiry date', '03/2030'], ['Security code', '******']),
};

runTestSuite(jwProps, 'JW Player', true);
// runTestSuite(jwProps, 'JW Player');
runTestSuite(cleengProps, 'Cleeng');

function runTestSuite(props: ProviderProps, providerName: string, isAccessBridgeEnabled = false) {
function runTestSuite(props: ProviderProps, providerName: string) {
let paidLoginContext: LoginContext;

const today = new Date();
Expand All @@ -48,10 +48,6 @@ function runTestSuite(props: ProviderProps, providerName: string, isAccessBridge
});

Scenario(`I can open the PayPal site - ${providerName}`, async ({ I }) => {
if (isAccessBridgeEnabled) {
return;
}

paidLoginContext = await I.registerOrLogin(paidLoginContext);

await goToCheckout(I);
Expand All @@ -65,10 +61,6 @@ function runTestSuite(props: ProviderProps, providerName: string, isAccessBridge
});

Scenario(`I can finish my subscription with credit card - ${providerName}`, async ({ I }) => {
if (isAccessBridgeEnabled) {
return;
}

paidLoginContext = await I.registerOrLogin(paidLoginContext);

await goToCheckout(I);
Expand Down Expand Up @@ -96,10 +88,6 @@ function runTestSuite(props: ProviderProps, providerName: string, isAccessBridge
});

Scenario(`I can cancel my subscription - ${providerName}`, async ({ I }) => {
if (isAccessBridgeEnabled) {
return;
}

paidLoginContext = await I.registerOrLogin(paidLoginContext);

await cancelPlan(I, addYear(today), props.canRenewSubscription, providerName);
Expand All @@ -109,21 +97,13 @@ function runTestSuite(props: ProviderProps, providerName: string, isAccessBridge
});

Scenario(`I can renew my subscription - ${providerName}`, async ({ I }) => {
if (isAccessBridgeEnabled) {
return;
}

if (props.canRenewSubscription) {
paidLoginContext = await I.registerOrLogin(paidLoginContext);
renewPlan(I, addYear(today), props.yearlyOffer.price);
}
});

Scenario(`I can view my invoices - ${providerName}`, async ({ I }) => {
if (isAccessBridgeEnabled) {
return;
}

if (props.canRenewSubscription) {
paidLoginContext = await I.registerOrLogin(paidLoginContext);
I.amOnPage(constants.paymentsUrl);
Expand Down

0 comments on commit 679d348

Please sign in to comment.