aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/app/components/__tests__
diff options
context:
space:
mode:
authorDavid Cho-Lerat <david.cho-lerat@sonarsource.com>2023-11-23 11:54:16 +0100
committersonartech <sonartech@sonarsource.com>2023-11-24 20:02:45 +0000
commit9185ced7d163951ab0c5b537be08fc52fe25f14e (patch)
tree150c1ce94eed17ad6ac3f2fb9f380d14b90b20cc /server/sonar-web/src/main/js/app/components/__tests__
parent248944fdf04de4a443182ecb17e12716105d5b21 (diff)
downloadsonarqube-9185ced7d163951ab0c5b537be08fc52fe25f14e.tar.gz
sonarqube-9185ced7d163951ab0c5b537be08fc52fe25f14e.zip
SONAR-21017 Tests: get => find + add timeouts that will be reverted by the upcoming RTL upgrade
Diffstat (limited to 'server/sonar-web/src/main/js/app/components/__tests__')
-rw-r--r--server/sonar-web/src/main/js/app/components/__tests__/GlobalMessagesContainer-it.tsx8
1 files changed, 5 insertions, 3 deletions
diff --git a/server/sonar-web/src/main/js/app/components/__tests__/GlobalMessagesContainer-it.tsx b/server/sonar-web/src/main/js/app/components/__tests__/GlobalMessagesContainer-it.tsx
index f89127aa2b0..908c4026f53 100644
--- a/server/sonar-web/src/main/js/app/components/__tests__/GlobalMessagesContainer-it.tsx
+++ b/server/sonar-web/src/main/js/app/components/__tests__/GlobalMessagesContainer-it.tsx
@@ -26,7 +26,7 @@ function NullComponent() {
return null;
}
-it('should display messages', () => {
+it('should display messages', async () => {
jest.useFakeTimers();
// we render anything, the GlobalMessageContainer is rendered independently from routing
@@ -35,14 +35,16 @@ it('should display messages', () => {
addGlobalErrorMessage('This is an error');
addGlobalSuccessMessage('This was a triumph!');
- expect(screen.getByRole('alert')).toHaveTextContent('This is an error');
+ expect(await screen.findByRole('alert')).toHaveTextContent('This is an error');
expect(screen.getByRole('status')).toHaveTextContent('This was a triumph!');
// No duplicate message
addGlobalErrorMessage('This is an error');
expect(screen.getByRole('alert')).toHaveTextContent(/^This is an error$/);
addGlobalSuccessMessage('This was a triumph!');
- expect(screen.getByRole('status')).toHaveTextContent(/^This was a triumph!This was a triumph!$/);
+ expect(await screen.findByRole('status')).toHaveTextContent(
+ /^This was a triumph!This was a triumph!$/,
+ );
jest.runAllTimers();