aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps
diff options
context:
space:
mode:
authorViktor Vorona <viktor.vorona@sonarsource.com>2024-02-20 16:30:04 +0100
committersonartech <sonartech@sonarsource.com>2024-02-21 20:02:34 +0000
commit5d533287777a3e2841a32b7b9a3e76aeb2bd5100 (patch)
treeb615073519cdfce586f2053c439c580119713414 /server/sonar-web/src/main/js/apps
parent6148545c1a5d5c34c206b5109b6c8741b8df4b14 (diff)
downloadsonarqube-5d533287777a3e2841a32b7b9a3e76aeb2bd5100.tar.gz
sonarqube-5d533287777a3e2841a32b7b9a3e76aeb2bd5100.zip
SONAR-21692 Remove test warnings from QualityGate, CaycGuide, GitHub
Diffstat (limited to 'server/sonar-web/src/main/js/apps')
-rw-r--r--server/sonar-web/src/main/js/apps/create/project/__tests__/GitHub-it.tsx15
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/CaYCConditionsSimplificationGuide.tsx1
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/QualityGate-it.tsx48
3 files changed, 24 insertions, 40 deletions
diff --git a/server/sonar-web/src/main/js/apps/create/project/__tests__/GitHub-it.tsx b/server/sonar-web/src/main/js/apps/create/project/__tests__/GitHub-it.tsx
index b14cc0f66bb..a742d14d7ab 100644
--- a/server/sonar-web/src/main/js/apps/create/project/__tests__/GitHub-it.tsx
+++ b/server/sonar-web/src/main/js/apps/create/project/__tests__/GitHub-it.tsx
@@ -67,6 +67,7 @@ const ui = {
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(() => {
@@ -109,7 +110,9 @@ it('should not redirect to github when url is malformated', async () => {
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();
});
@@ -121,7 +124,7 @@ it('should show import project feature when the authentication is successfull',
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();
@@ -173,7 +176,7 @@ it('should import several projects', async () => {
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();
@@ -238,7 +241,7 @@ it('should show search filter when the authentication is successful', async () =
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);
@@ -261,7 +264,7 @@ it('should have load more', async () => {
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();
@@ -289,7 +292,7 @@ it('should show no result message when there are no projects', async () => {
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();
});
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/CaYCConditionsSimplificationGuide.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/CaYCConditionsSimplificationGuide.tsx
index 80ce44fce6a..0ea24e58a14 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/CaYCConditionsSimplificationGuide.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/CaYCConditionsSimplificationGuide.tsx
@@ -88,7 +88,6 @@ export default function CaYCConditionsSimplificationGuide({ qualityGate }: Props
return (
<SpotlightTour
- debug
continuous
run={shouldRun}
closeLabel={translate('dismiss')}
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/QualityGate-it.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/QualityGate-it.tsx
index f12283529bc..a1fac39603b 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/QualityGate-it.tsx
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/__tests__/QualityGate-it.tsx
@@ -17,7 +17,7 @@
* 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';
@@ -79,9 +79,7 @@ it('should render the built-in quality gate properly', async () => {
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();
@@ -95,11 +93,9 @@ it('should be able to create a quality gate then delete it', async () => {
// 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
@@ -109,11 +105,9 @@ it('should be able to create a quality gate then delete it', async () => {
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' });
@@ -147,10 +141,8 @@ it('should be able to copy a quality gate which is CaYC compliant', async () =>
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();
});
@@ -498,9 +490,7 @@ it('should display CaYC condition simplification tour for users who didnt dismis
const qualityGate = await screen.findByText('Sonar way');
- await act(async () => {
- await user.click(qualityGate);
- });
+ await user.click(qualityGate);
expect(await byRole('alertdialog').find()).toBeInTheDocument();
@@ -510,9 +500,7 @@ it('should display CaYC condition simplification tour for users who didnt dismis
.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')
@@ -520,9 +508,7 @@ it('should display CaYC condition simplification tour for users who didnt dismis
.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')
@@ -530,9 +516,7 @@ it('should display CaYC condition simplification tour for users who didnt dismis
.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);
@@ -549,9 +533,7 @@ it('should not display CaYC condition simplification tour for users who dismisse
const qualityGate = await screen.findByText('Sonar way');
- await act(async () => {
- await user.click(qualityGate);
- });
+ await user.click(qualityGate);
expect(byRole('alertdialog').query()).not.toBeInTheDocument();
});