1
- import {
2
- act ,
3
- render as reactRender ,
4
- screen ,
5
- waitFor ,
6
- } from "@testing-library/react" ;
1
+ import { act , render as reactRender , screen } from "@testing-library/react" ;
7
2
import {
8
3
VariantAnalysisRepoStatus ,
9
4
VariantAnalysisScannedRepositoryDownloadStatus ,
@@ -403,15 +398,17 @@ describe(RepoRow.name, () => {
403
398
status : VariantAnalysisRepoStatus . InProgress ,
404
399
} ) ;
405
400
406
- expect ( screen . getByRole ( "checkbox" ) ) . toBeDisabled ( ) ;
401
+ const checkbox = await screen . findByRole ( "checkbox" ) ;
402
+ expect ( checkbox ) . toBeDisabled ( ) ;
407
403
} ) ;
408
404
409
405
it ( "does not allow selecting the item if the item has not been downloaded" , async ( ) => {
410
406
render ( {
411
407
status : VariantAnalysisRepoStatus . Succeeded ,
412
408
} ) ;
413
409
414
- expect ( screen . getByRole ( "checkbox" ) ) . toBeDisabled ( ) ;
410
+ const checkbox = await screen . findByRole ( "checkbox" ) ;
411
+ expect ( checkbox ) . toBeDisabled ( ) ;
415
412
} ) ;
416
413
417
414
it ( "does not allow selecting the item if the item has not been downloaded successfully" , async ( ) => {
@@ -423,11 +420,8 @@ describe(RepoRow.name, () => {
423
420
} ,
424
421
} ) ;
425
422
426
- // It seems like sometimes the first render doesn't have the checkbox disabled
427
- // Might be related to https://github.com/microsoft/vscode-webview-ui-toolkit/issues/404
428
- await waitFor ( ( ) => {
429
- expect ( screen . getByRole ( "checkbox" ) ) . toBeDisabled ( ) ;
430
- } ) ;
423
+ const checkbox = await screen . findByRole ( "checkbox" ) ;
424
+ expect ( checkbox ) . toBeDisabled ( ) ;
431
425
} ) ;
432
426
433
427
it ( "allows selecting the item if the item has been downloaded" , async ( ) => {
@@ -440,6 +434,7 @@ describe(RepoRow.name, () => {
440
434
} ,
441
435
} ) ;
442
436
443
- expect ( screen . getByRole ( "checkbox" ) ) . toBeEnabled ( ) ;
437
+ const checkbox = await screen . findByRole ( "checkbox" ) ;
438
+ expect ( checkbox ) . toBeEnabled ( ) ;
444
439
} ) ;
445
440
} ) ;
0 commit comments