mirror of
https://github.com/strapi/strapi.git
synced 2025-12-28 07:33:17 +00:00
Merge pull request #18794 from strapi/chore/flaky-tests
This commit is contained in:
commit
50ae047484
2
.github/workflows/tests.yml
vendored
2
.github/workflows/tests.yml
vendored
@ -131,7 +131,7 @@ jobs:
|
||||
- name: Monorepo build
|
||||
uses: ./.github/actions/run-build
|
||||
- name: Run test
|
||||
run: yarn nx affected --target=test:front --nx-ignore-cycles
|
||||
run: yarn nx affected --target=test:front --nx-ignore-cycles -- --runInBand
|
||||
|
||||
e2e:
|
||||
timeout-minutes: 60
|
||||
|
||||
@ -2,7 +2,7 @@ import React from 'react';
|
||||
|
||||
import { lightTheme, ThemeProvider } from '@strapi/design-system';
|
||||
import { NotificationsProvider } from '@strapi/helper-plugin';
|
||||
import { render as renderRTL, waitFor } from '@testing-library/react';
|
||||
import { render as renderRTL, waitFor, act } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { rest } from 'msw';
|
||||
import { setupServer } from 'msw/node';
|
||||
@ -106,13 +106,15 @@ describe('InputUID', () => {
|
||||
labelAction: <>action</>,
|
||||
});
|
||||
|
||||
await waitFor(() => expect(getByText('Unavailable')).toBeInTheDocument());
|
||||
await waitFor(() => {
|
||||
expect(getByText('Unavailable')).toBeInTheDocument();
|
||||
|
||||
expect(getByText('Label')).toBeInTheDocument();
|
||||
expect(getByText('*')).toBeInTheDocument();
|
||||
expect(getByText('action')).toBeInTheDocument();
|
||||
expect(getByText('hint')).toBeInTheDocument();
|
||||
expect(getByRole('textbox')).toHaveValue('test');
|
||||
expect(getByText('Label')).toBeInTheDocument();
|
||||
expect(getByText('*')).toBeInTheDocument();
|
||||
expect(getByText('action')).toBeInTheDocument();
|
||||
expect(getByText('hint')).toBeInTheDocument();
|
||||
expect(getByRole('textbox')).toHaveValue('test');
|
||||
});
|
||||
});
|
||||
|
||||
test('renders an error', async () => {
|
||||
@ -200,6 +202,7 @@ describe('InputUID', () => {
|
||||
});
|
||||
|
||||
test('Checks the initial availability (isAvailable)', async () => {
|
||||
jest.useFakeTimers();
|
||||
const spy = jest.fn();
|
||||
|
||||
const { getByText, queryByText, queryByTestId } = render({
|
||||
@ -212,9 +215,16 @@ describe('InputUID', () => {
|
||||
|
||||
expect(getByText('Available')).toBeInTheDocument();
|
||||
|
||||
act(() => {
|
||||
jest.advanceTimersByTime(4000);
|
||||
});
|
||||
|
||||
await waitFor(() => expect(queryByText('Available')).not.toBeInTheDocument(), {
|
||||
timeout: 10000,
|
||||
});
|
||||
|
||||
jest.runOnlyPendingTimers();
|
||||
jest.useRealTimers();
|
||||
});
|
||||
|
||||
test('Checks the initial availability (!isAvailable)', async () => {
|
||||
|
||||
@ -11,6 +11,6 @@
|
||||
"build": "pack-up build && pack-up check"
|
||||
},
|
||||
"dependencies": {
|
||||
"@strapi/pack-up": "../../../"
|
||||
"@strapi/pack-up": "file:../../../"
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,6 +11,6 @@
|
||||
"build": "pack-up build && pack-up check"
|
||||
},
|
||||
"dependencies": {
|
||||
"@strapi/pack-up": "../../../"
|
||||
"@strapi/pack-up": "file:../../../"
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user