diff --git a/webapp/channels/src/components/self_hosted_expansion_modal/error_page.tsx b/webapp/channels/src/components/self_hosted_expansion_modal/error_page.tsx index 2b9748de26..dc68cb4137 100644 --- a/webapp/channels/src/components/self_hosted_expansion_modal/error_page.tsx +++ b/webapp/channels/src/components/self_hosted_expansion_modal/error_page.tsx @@ -27,7 +27,7 @@ export default function SelfHostedExpansionErrorPage(props: Props) { let formattedButtonText = ( ); @@ -35,7 +35,7 @@ export default function SelfHostedExpansionErrorPage(props: Props) { if (!props.canRetry) { formattedButtonText = ( ); diff --git a/webapp/channels/src/components/self_hosted_expansion_modal/index.test.tsx b/webapp/channels/src/components/self_hosted_expansion_modal/index.test.tsx index 9ca3718f22..e793b267e3 100644 --- a/webapp/channels/src/components/self_hosted_expansion_modal/index.test.tsx +++ b/webapp/channels/src/components/self_hosted_expansion_modal/index.test.tsx @@ -3,7 +3,7 @@ import React from 'react'; -import {screen, fireEvent} from '@testing-library/react'; +import {screen, fireEvent, waitFor} from '@testing-library/react'; import {GlobalState} from 'types/store'; @@ -252,15 +252,15 @@ function fillForm(form: PurchaseForm) { changeByPlaceholder('City', form.city); selectDropdownValue('selfHostedExpansionStateSelector', form.state); changeByPlaceholder('Zip/Postal Code', form.zip); - changeByTestId('seatsInput', form.seats); if (form.agree) { fireEvent.click(screen.getByText('I have read and agree', {exact: false})); } + // not changing the license seats number, because it is expected to be pre-filled, + // with the correct number of seats (current active users - current licensed seats, or 1 if the difference is 0). + expect(document.getElementsByClassName('SelfHostedExpansionRHSCard__AddSeatsWarning')[0] as HTMLElement).toBeEnabled(); - // not changing the license seats number, - // because it is expected to be pre-filled with the correct number of seats. const completeButton = screen.getByText('Complete purchase'); @@ -307,26 +307,27 @@ describe('SelfHostedExpansionModal Open', () => { expect(screen.getByText('You must add a seat to continue')).toBeVisible(); }); - // it('happy path submit shows success screen', async () => { - // renderWithIntlAndStore(
, initialState); - // expect(screen.getByText('Complete purchase')).toBeDisabled(); - // const upgradeButton = fillForm(defaultSuccessForm); + it('happy path submit shows success screen', async () => { + renderWithIntlAndStore(
, initialState); + expect(screen.getByText('Complete purchase')).toBeDisabled(); + const upgradeButton = fillForm(defaultSuccessForm); - // upgradeButton.click(); - // await waitFor(() => expect(screen.getByText(`You're now subscribed to ${productName}`)).toBeTruthy(), {timeout: 1234}); - // }); + expect(upgradeButton).toBeEnabled(); + upgradeButton.click(); + await waitFor(() => expect(screen.getByText('You\'ve successfully updated your license seat count')).toBeTruthy(), {timeout: 1234}); + }); - // it('sad path submit shows error screen', async () => { - // renderWithIntlAndStore(
, initialState); - // expect(screen.getByText('Complete purchase')).toBeDisabled(); - // fillForm(defaultSuccessForm); - // changeByPlaceholder('Organization Name', failOrg); + it('sad path submit shows error screen', async () => { + renderWithIntlAndStore(
, initialState); + expect(screen.getByText('Complete purchase')).toBeDisabled(); + fillForm(defaultSuccessForm); + changeByPlaceholder('Organization Name', failOrg); - // const upgradeButton = screen.getByText('Complete purchase'); - // expect(upgradeButton).toBeEnabled(); - // upgradeButton.click(); - // await waitFor(() => expect(screen.getByText('Sorry, the payment verification failed')).toBeTruthy(), {timeout: 1234}); - // }); + const upgradeButton = screen.getByText('Complete purchase'); + expect(upgradeButton).toBeEnabled(); + upgradeButton.click(); + await waitFor(() => expect(screen.getByText('Sorry, the payment verification failed')).toBeTruthy(), {timeout: 1234}); + }); }); describe('SelfHostedExpansionModal RHS Card', () => { diff --git a/webapp/channels/src/components/self_hosted_expansion_modal/index.tsx b/webapp/channels/src/components/self_hosted_expansion_modal/index.tsx index efc62324a7..4bb217bc32 100644 --- a/webapp/channels/src/components/self_hosted_expansion_modal/index.tsx +++ b/webapp/channels/src/components/self_hosted_expansion_modal/index.tsx @@ -252,8 +252,6 @@ export default function SelfHostedExpansionModal() { const card = cardRef.current?.getCard(); if (!card) { const message = 'Failed to get card when it was expected'; - // eslint-disable-next-line no-console - console.error(message); setFormState({...formState, error: message}); return; } @@ -302,8 +300,6 @@ export default function SelfHostedExpansionModal() { } setFormState({...formState, submitting: false}); } catch (e) { - // eslint-disable-next-line no-console - console.error('could not complete setup', e); setFormState({...formState, error: 'unable to complete signup'}); } }; diff --git a/webapp/channels/src/components/self_hosted_expansion_modal/success_page.tsx b/webapp/channels/src/components/self_hosted_expansion_modal/success_page.tsx index 0e08a50b22..77916c9de7 100644 --- a/webapp/channels/src/components/self_hosted_expansion_modal/success_page.tsx +++ b/webapp/channels/src/components/self_hosted_expansion_modal/success_page.tsx @@ -25,7 +25,7 @@ export default function SelfHostedExpansionSuccessPage(props: Props) { const titleText = ( ); diff --git a/webapp/channels/src/i18n/en.json b/webapp/channels/src/i18n/en.json index 88c3105fb1..93298430ab 100644 --- a/webapp/channels/src/i18n/en.json +++ b/webapp/channels/src/i18n/en.json @@ -4724,6 +4724,7 @@ "self_hosted_expansion.expansion_modal.title": "Provide your payment details", "self_hosted_expansion.license_applied": "The license has been automatically applied to your Mattermost instance. Your updated invoice will be visible in the Billing section of the system console.", "self_hosted_expansion.paymentFailed": "Payment failed. Please try again or contact support.", + "self_hosted_expansion.try_again": "Try again", "self_hosted_signup.air_gapped_content": "It appears that your instance is air-gapped, or it may not be connected to the internet. To purchase a license, please visit", "self_hosted_signup.air_gapped_title": "Purchase through the customer portal", "self_hosted_signup.close": "Close",