Setup timeout for logo update page due to slow image fetching

This commit is contained in:
Alexandre Bodin 2022-08-16 18:08:18 +02:00
parent 840391f541
commit bd48a9fffd

View File

@ -1,9 +1,11 @@
import React from 'react'; import React from 'react';
import { IntlProvider } from 'react-intl'; import { IntlProvider } from 'react-intl';
import { render as renderTL, fireEvent, screen, waitFor } from '@testing-library/react'; import { render as renderTL, fireEvent, screen, waitFor, configure } from '@testing-library/react';
import { ThemeProvider, lightTheme } from '@strapi/design-system'; import { ThemeProvider, lightTheme } from '@strapi/design-system';
import LogoInput from '../index'; import LogoInput from '../index';
configure({ asyncUtilTimeout: 8000 });
const getFakeSize = jest.fn(() => ({ const getFakeSize = jest.fn(() => ({
width: 500, width: 500,
height: 500, height: 500,
@ -28,7 +30,7 @@ const render = (props) =>
<LogoInput <LogoInput
{...props} {...props}
defaultLogo="/admin/defaultLogo.png" defaultLogo="/admin/defaultLogo.png"
onChangeLogo={() => jest.fn()} onChangeLogo={jest.fn()}
onResetMenuLogo={jest.fn()} onResetMenuLogo={jest.fn()}
/> />
</IntlProvider> </IntlProvider>
@ -172,7 +174,7 @@ describe('ApplicationsInfosPage || LogoInput', () => {
it('should show error message when uploading wrong file format', async () => { it('should show error message when uploading wrong file format', async () => {
render(); render();
const changeLogoButton = document.querySelector('button'); const changeLogoButton = screen.getByRole('button');
fireEvent.click(changeLogoButton); fireEvent.click(changeLogoButton);
fireEvent.click(screen.getByText('From url')); fireEvent.click(screen.getByText('From url'));
@ -247,8 +249,11 @@ describe('ApplicationsInfosPage || LogoInput', () => {
it('should accept upload and lead user to next modal', async () => { it('should accept upload and lead user to next modal', async () => {
render(); render();
const changeLogoButton = document.querySelector('button'); const changeLogoButton = document.querySelector('button');
fireEvent.click(changeLogoButton); fireEvent.click(changeLogoButton);
fireEvent.click(screen.getByText('From url')); fireEvent.click(screen.getByText('From url'));
const textInput = document.querySelector('input[name="logo-url"]'); const textInput = document.querySelector('input[name="logo-url"]');