Fixup i18n, error/success/progress modals.

Этот коммит содержится в:
Conor Macpherson
2023-04-03 10:01:40 -04:00
родитель 379f19701e
Коммит c0d4b0dfdc
5 изменённых файлов: 26 добавлений и 28 удалений

Просмотреть файл

@@ -27,7 +27,7 @@ export default function SelfHostedExpansionErrorPage(props: Props) {
let formattedButtonText = ( let formattedButtonText = (
<FormattedMessage <FormattedMessage
id='error_modal.try_again' id='self_hosted_expansion.try_again'
defaultMessage='Try again' defaultMessage='Try again'
/> />
); );
@@ -35,7 +35,7 @@ export default function SelfHostedExpansionErrorPage(props: Props) {
if (!props.canRetry) { if (!props.canRetry) {
formattedButtonText = ( formattedButtonText = (
<FormattedMessage <FormattedMessage
id='error_modal.close' id='self_hosted_expansion.close'
defaultMessage='Close' defaultMessage='Close'
/> />
); );

Просмотреть файл

@@ -3,7 +3,7 @@
import React from 'react'; import React from 'react';
import {screen, fireEvent} from '@testing-library/react'; import {screen, fireEvent, waitFor} from '@testing-library/react';
import {GlobalState} from 'types/store'; import {GlobalState} from 'types/store';
@@ -252,15 +252,15 @@ function fillForm(form: PurchaseForm) {
changeByPlaceholder('City', form.city); changeByPlaceholder('City', form.city);
selectDropdownValue('selfHostedExpansionStateSelector', form.state); selectDropdownValue('selfHostedExpansionStateSelector', form.state);
changeByPlaceholder('Zip/Postal Code', form.zip); changeByPlaceholder('Zip/Postal Code', form.zip);
changeByTestId('seatsInput', form.seats);
if (form.agree) { if (form.agree) {
fireEvent.click(screen.getByText('I have read and agree', {exact: false})); 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(); 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'); const completeButton = screen.getByText('Complete purchase');
@@ -307,26 +307,27 @@ describe('SelfHostedExpansionModal Open', () => {
expect(screen.getByText('You must add a seat to continue')).toBeVisible(); expect(screen.getByText('You must add a seat to continue')).toBeVisible();
}); });
// it('happy path submit shows success screen', async () => { it('happy path submit shows success screen', async () => {
// renderWithIntlAndStore(<div id='root-portal'><SelfHostedExpansionModal/></div>, initialState); renderWithIntlAndStore(<div id='root-portal'><SelfHostedExpansionModal/></div>, initialState);
// expect(screen.getByText('Complete purchase')).toBeDisabled(); expect(screen.getByText('Complete purchase')).toBeDisabled();
// const upgradeButton = fillForm(defaultSuccessForm); const upgradeButton = fillForm(defaultSuccessForm);
// upgradeButton.click(); expect(upgradeButton).toBeEnabled();
// await waitFor(() => expect(screen.getByText(`You're now subscribed to ${productName}`)).toBeTruthy(), {timeout: 1234}); 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 () => { it('sad path submit shows error screen', async () => {
// renderWithIntlAndStore(<div id='root-portal'><SelfHostedExpansionModal/></div>, initialState); renderWithIntlAndStore(<div id='root-portal'><SelfHostedExpansionModal/></div>, initialState);
// expect(screen.getByText('Complete purchase')).toBeDisabled(); expect(screen.getByText('Complete purchase')).toBeDisabled();
// fillForm(defaultSuccessForm); fillForm(defaultSuccessForm);
// changeByPlaceholder('Organization Name', failOrg); changeByPlaceholder('Organization Name', failOrg);
// const upgradeButton = screen.getByText('Complete purchase'); const upgradeButton = screen.getByText('Complete purchase');
// expect(upgradeButton).toBeEnabled(); expect(upgradeButton).toBeEnabled();
// upgradeButton.click(); upgradeButton.click();
// await waitFor(() => expect(screen.getByText('Sorry, the payment verification failed')).toBeTruthy(), {timeout: 1234}); await waitFor(() => expect(screen.getByText('Sorry, the payment verification failed')).toBeTruthy(), {timeout: 1234});
// }); });
}); });
describe('SelfHostedExpansionModal RHS Card', () => { describe('SelfHostedExpansionModal RHS Card', () => {

Просмотреть файл

@@ -252,8 +252,6 @@ export default function SelfHostedExpansionModal() {
const card = cardRef.current?.getCard(); const card = cardRef.current?.getCard();
if (!card) { if (!card) {
const message = 'Failed to get card when it was expected'; const message = 'Failed to get card when it was expected';
// eslint-disable-next-line no-console
console.error(message);
setFormState({...formState, error: message}); setFormState({...formState, error: message});
return; return;
} }
@@ -302,8 +300,6 @@ export default function SelfHostedExpansionModal() {
} }
setFormState({...formState, submitting: false}); setFormState({...formState, submitting: false});
} catch (e) { } catch (e) {
// eslint-disable-next-line no-console
console.error('could not complete setup', e);
setFormState({...formState, error: 'unable to complete signup'}); setFormState({...formState, error: 'unable to complete signup'});
} }
}; };

Просмотреть файл

@@ -25,7 +25,7 @@ export default function SelfHostedExpansionSuccessPage(props: Props) {
const titleText = ( const titleText = (
<FormattedMessage <FormattedMessage
id={'self_hosted_expansion.expand_success'} id={'self_hosted_expansion.expand_success'}
defaultMessage={'You\'ve successfully updated your license seat count'} defaultMessage={"You've successfully updated your license seat count"}
/> />
); );

Просмотреть файл

@@ -4724,6 +4724,7 @@
"self_hosted_expansion.expansion_modal.title": "Provide your payment details", "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>Billing section</billing> of the system console.", "self_hosted_expansion.license_applied": "The license has been automatically applied to your Mattermost instance. Your updated invoice will be visible in the <billing>Billing section</billing> of the system console.",
"self_hosted_expansion.paymentFailed": "Payment failed. Please try again or contact support.", "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_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.air_gapped_title": "Purchase through the customer portal",
"self_hosted_signup.close": "Close", "self_hosted_signup.close": "Close",