name: 'onboarding.create_project.new_code_definition.create_x_projects2',
}),
globalSettingRadio: byRole('radio', { name: 'new_code_definition.global_setting' }),
+ createErrorMessage: byText('onboarding.create_project.github.warning.message'),
};
beforeAll(() => {
expect(screen.getByText('alm.configuration.selector.placeholder')).toBeInTheDocument();
expect(ui.instanceSelector.get()).toBeInTheDocument();
- await selectEvent.select(ui.instanceSelector.get(), [/conf-github-3/]);
+ await waitFor(() => selectEvent.select(ui.instanceSelector.get(), [/conf-github-3/]));
+
+ expect(await ui.createErrorMessage.find()).toBeInTheDocument();
expect(window.location.replace).not.toHaveBeenCalled();
});
expect(await ui.instanceSelector.find()).toBeInTheDocument();
- await selectEvent.select(ui.organizationSelector.get(), [/org-1/]);
+ await waitFor(() => selectEvent.select(ui.organizationSelector.get(), [/org-1/]));
expect(await ui.project1.find()).toBeInTheDocument();
expect(ui.project2.get()).toBeInTheDocument();
expect(await ui.instanceSelector.find()).toBeInTheDocument();
- await selectEvent.select(ui.organizationSelector.get(), [/org-1/]);
+ await waitFor(() => selectEvent.select(ui.organizationSelector.get(), [/org-1/]));
expect(await ui.project1.find()).toBeInTheDocument();
expect(ui.project1Checkbox.get()).not.toBeChecked();
expect(await ui.instanceSelector.find()).toBeInTheDocument();
- await selectEvent.select(ui.organizationSelector.get(), [/org-1/]);
+ await waitFor(() => selectEvent.select(ui.organizationSelector.get(), [/org-1/]));
const inputSearch = screen.getByRole('searchbox');
await user.click(inputSearch);
expect(await ui.instanceSelector.find()).toBeInTheDocument();
- await selectEvent.select(ui.organizationSelector.get(), [/org-1/]);
+ await waitFor(() => selectEvent.select(ui.organizationSelector.get(), [/org-1/]));
const loadMore = await screen.findByRole('button', { name: 'show_more' });
expect(loadMore).toBeInTheDocument();
expect(await ui.instanceSelector.find()).toBeInTheDocument();
- await selectEvent.select(ui.organizationSelector.get(), [/org-1/]);
+ await waitFor(() => selectEvent.select(ui.organizationSelector.get(), [/org-1/]));
expect(screen.getByText('no_results')).toBeInTheDocument();
});
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { act, screen, waitFor, within } from '@testing-library/react';
+import { screen, waitFor, within } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import selectEvent from 'react-select-event';
import { QualityGatesServiceMock } from '../../../../api/mocks/QualityGatesServiceMock';
const builtInQualityGate = await screen.findByText('Sonar way');
- await act(async () => {
- await user.click(builtInQualityGate);
- });
+ await user.click(builtInQualityGate);
expect(await screen.findByText(/quality_gates.is_built_in.cayc.description/)).toBeInTheDocument();
expect(await screen.findByText(/quality_gates.is_built_in.description/)).toBeInTheDocument();
// Using keyboard
await user.click(createButton);
- await act(async () => {
- await user.click(screen.getByRole('textbox', { name: /name.*/ }));
- await user.keyboard('testone');
- await user.click(screen.getByRole('button', { name: 'quality_gate.create' }));
- });
+ await user.click(screen.getByRole('textbox', { name: /name.*/ }));
+ await user.keyboard('testone');
+ await user.click(screen.getByRole('button', { name: 'quality_gate.create' }));
expect(await screen.findByRole('button', { name: 'testone' })).toBeInTheDocument();
// Using modal button
expect(saveButton).toBeDisabled();
const nameInput = screen.getByRole('textbox', { name: /name.*/ });
- await act(async () => {
- await user.click(nameInput);
- await user.keyboard('testtwo');
- await user.click(saveButton);
- });
+ await user.click(nameInput);
+ await user.keyboard('testtwo');
+ await user.click(saveButton);
const newQG = await screen.findByRole('button', { name: 'testtwo' });
await user.click(copyButton);
const nameInput = screen.getByRole('textbox', { name: /name.*/ });
expect(nameInput).toBeInTheDocument();
- await act(async () => {
- await user.click(nameInput);
- await user.keyboard(' bis{Enter}');
- });
+ await user.click(nameInput);
+ await user.keyboard(' bis{Enter}');
expect(await screen.findByRole('button', { name: /.* bis/ })).toBeInTheDocument();
});
const qualityGate = await screen.findByText('Sonar way');
- await act(async () => {
- await user.click(qualityGate);
- });
+ await user.click(qualityGate);
expect(await byRole('alertdialog').find()).toBeInTheDocument();
.get(),
).toBeInTheDocument();
- await act(async () => {
- await user.click(byRole('alertdialog').byRole('button', { name: 'next' }).get());
- });
+ await user.click(byRole('alertdialog').byRole('button', { name: 'next' }).get());
expect(
byRole('alertdialog')
.get(),
).toBeInTheDocument();
- await act(async () => {
- await user.click(byRole('alertdialog').byRole('button', { name: 'next' }).get());
- });
+ await user.click(byRole('alertdialog').byRole('button', { name: 'next' }).get());
expect(
byRole('alertdialog')
.get(),
).toBeInTheDocument();
- await act(async () => {
- await user.click(byRole('alertdialog').byRole('button', { name: 'dismiss' }).get());
- });
+ await user.click(byRole('alertdialog').byRole('button', { name: 'dismiss' }).get());
expect(byRole('alertdialog').query()).not.toBeInTheDocument();
expect(dismissNotice).toHaveBeenLastCalledWith(NoticeType.QG_CAYC_CONDITIONS_SIMPLIFICATION);
const qualityGate = await screen.findByText('Sonar way');
- await act(async () => {
- await user.click(qualityGate);
- });
+ await user.click(qualityGate);
expect(byRole('alertdialog').query()).not.toBeInTheDocument();
});