aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps
diff options
context:
space:
mode:
authorstanislavh <stanislav.honcharov@sonarsource.com>2024-02-20 12:21:39 +0100
committersonartech <sonartech@sonarsource.com>2024-02-20 20:02:38 +0000
commit18c7cff2230d27fce08f6b10b507eac9c12f4030 (patch)
tree9c57685e4967b9f15bcd1f987fead0f3d0463501 /server/sonar-web/src/main/js/apps
parent9dad49eb7171c374a67b5352cb5bd4db79589e6e (diff)
downloadsonarqube-18c7cff2230d27fce08f6b10b507eac9c12f4030.tar.gz
sonarqube-18c7cff2230d27fce08f6b10b507eac9c12f4030.zip
SONAR-21692 Remove RTL warnings from maintenance, marketplace,overview pages
Diffstat (limited to 'server/sonar-web/src/main/js/apps')
-rw-r--r--server/sonar-web/src/main/js/apps/maintenance/components/__tests__/App-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/__tests__/MarketplaceApp-it.tsx13
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/__tests__/ActivityPanel-it.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/__tests__/App-test.tsx11
4 files changed, 17 insertions, 15 deletions
diff --git a/server/sonar-web/src/main/js/apps/maintenance/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/maintenance/components/__tests__/App-test.tsx
index ca7c8f4356c..b9608bb6993 100644
--- a/server/sonar-web/src/main/js/apps/maintenance/components/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/maintenance/components/__tests__/App-test.tsx
@@ -233,7 +233,7 @@ describe('Setup', () => {
.mockResolvedValueOnce({ state: 'MIGRATION_SUCCEEDED' });
renderSetupApp();
- const user = userEvent.setup();
+ const user = userEvent.setup({ advanceTimers: jest.advanceTimersByTime });
jest.runOnlyPendingTimers();
@@ -241,7 +241,7 @@ describe('Setup', () => {
expect(title).toBeInTheDocument();
// Trigger DB migration.
- user.click(screen.getByRole('button'));
+ await user.click(screen.getByRole('button'));
const message = await screen.findByText('MESSAGE');
expect(message).toBeInTheDocument();
diff --git a/server/sonar-web/src/main/js/apps/marketplace/__tests__/MarketplaceApp-it.tsx b/server/sonar-web/src/main/js/apps/marketplace/__tests__/MarketplaceApp-it.tsx
index 54c5f8fdf5b..26a952d8927 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/__tests__/MarketplaceApp-it.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/__tests__/MarketplaceApp-it.tsx
@@ -17,7 +17,6 @@
* 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 } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import React, { useState } from 'react';
import { NavigationServiceMock } from '../../../api/mocks/NavigationServiceMock';
@@ -133,7 +132,7 @@ it('should install, uninstall, update', async () => {
expect(ui.updateButton.get(rows[1])).toBeInTheDocument();
expect(ui.updateButton.get(rows[1])).toHaveTextContent('1.3.0');
expect(ui.updatePending.query(rows[1])).not.toBeInTheDocument();
- await act(() => user.click(ui.updateButton.get(rows[1])));
+ await user.click(ui.updateButton.get(rows[1]));
expect(await ui.updatePending.find(rows[1])).toBeInTheDocument();
expect(ui.updateButton.query(rows[1])).not.toBeInTheDocument();
@@ -142,7 +141,7 @@ it('should install, uninstall, update', async () => {
expect(ui.uninstallButton.query(rows[2])).not.toBeInTheDocument();
expect(ui.updateButton.query(rows[2])).not.toBeInTheDocument();
expect(ui.installPending.query(rows[2])).not.toBeInTheDocument();
- await act(() => user.click(ui.installButton.get(rows[2])));
+ await user.click(ui.installButton.get(rows[2]));
expect(await ui.installPending.find(rows[2])).toBeInTheDocument();
expect(ui.installButton.query(rows[2])).not.toBeInTheDocument();
@@ -157,7 +156,7 @@ it('should install, uninstall, update', async () => {
expect(ui.acceptTerms.get(rows[4])).not.toBeChecked();
await user.click(ui.acceptTerms.get(rows[4]));
expect(ui.installButton.get(rows[4])).toBeEnabled();
- await act(() => user.click(ui.installButton.get(rows[4])));
+ await user.click(ui.installButton.get(rows[4]));
expect(await ui.installPending.find(rows[4])).toBeInTheDocument();
expect(ui.installButton.query(rows[4])).not.toBeInTheDocument();
@@ -167,7 +166,7 @@ it('should install, uninstall, update', async () => {
expect(ui.updateButton.get(rows[5])).toBeInTheDocument();
expect(ui.updateButton.get(rows[5])).toHaveTextContent('1.2.0');
expect(ui.updatePending.query(rows[5])).not.toBeInTheDocument();
- await act(() => user.click(ui.updateButton.get(rows[5])));
+ await user.click(ui.updateButton.get(rows[5]));
expect(await ui.updatePending.find(rows[5])).toBeInTheDocument();
expect(ui.uninstallButton.query(rows[5])).not.toBeInTheDocument();
expect(ui.updateButton.query(rows[5])).not.toBeInTheDocument();
@@ -236,8 +235,8 @@ describe('accessibility', () => {
renderMarketplaceApp();
const row = (await ui.pluginRow.findAll())[1];
await expect(document.body).toHaveNoA11yViolations();
- await act(() => user.click(ui.riskConsentButton.get()));
- await act(() => user.click(ui.releaseDetailsButton.get(row)));
+ await user.click(ui.riskConsentButton.get());
+ await user.click(ui.releaseDetailsButton.get(row));
await expect(document.body).toHaveNoA11yViolations();
});
});
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ActivityPanel-it.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ActivityPanel-it.tsx
index 729b78dc82b..c76a55708f3 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ActivityPanel-it.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/ActivityPanel-it.tsx
@@ -188,8 +188,8 @@ function renderActivityPanel() {
],
}),
mockAnalysis({ key: 'bar' }),
- mockAnalysis(),
- mockAnalysis(),
+ mockAnalysis({ key: 'baz' }),
+ mockAnalysis({ key: 'qux' }),
];
const mockedProps: ActivityPanelProps = {
diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/App-test.tsx b/server/sonar-web/src/main/js/apps/overview/components/__tests__/App-test.tsx
index ae106dde1f1..c167092bab9 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/__tests__/App-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/App-test.tsx
@@ -117,7 +117,6 @@ describe('Permission provisioning', () => {
jest.useFakeTimers({ advanceTimers: true });
});
afterEach(() => {
- jest.runOnlyPendingTimers();
jest.useRealTimers();
});
it('should render warning when permission is sync', async () => {
@@ -130,8 +129,8 @@ describe('Permission provisioning', () => {
);
renderApp();
- await jest.runOnlyPendingTimersAsync();
+ jest.runOnlyPendingTimers();
expect(
await screen.findByText('provisioning.permission_synch_in_progress'),
).toBeInTheDocument();
@@ -145,9 +144,13 @@ describe('Permission provisioning', () => {
}),
);
- await jest.runOnlyPendingTimersAsync();
+ jest.runOnlyPendingTimers();
- expect(screen.queryByText('provisioning.permission_synch_in_progress')).not.toBeInTheDocument();
+ await waitFor(() => {
+ expect(
+ screen.queryByText('provisioning.permission_synch_in_progress'),
+ ).not.toBeInTheDocument();
+ });
});
});