@@ -226,7 +226,7 @@ describe('<CourseOutline />', () => {
226226 } ) ;
227227
228228 it ( 'check video sharing option shows error on failure' , async ( ) => {
229- const { findByLabelText , queryByRole } = render ( < RootWrapper /> ) ;
229+ render ( < RootWrapper /> ) ;
230230
231231 axiosMock
232232 . onPost ( getCourseBlockApiUrl ( courseId ) , {
@@ -235,7 +235,7 @@ describe('<CourseOutline />', () => {
235235 } ,
236236 } )
237237 . reply ( 500 ) ;
238- const optionDropdown = await findByLabelText ( statusBarMessages . videoSharingTitle . defaultMessage ) ;
238+ const optionDropdown = await screen . findByLabelText ( statusBarMessages . videoSharingTitle . defaultMessage ) ;
239239 await act (
240240 async ( ) => fireEvent . change ( optionDropdown , { target : { value : VIDEO_SHARING_OPTIONS . allOff } } ) ,
241241 ) ;
@@ -247,8 +247,10 @@ describe('<CourseOutline />', () => {
247247 } ,
248248 } ) ) ;
249249
250- const alertElement = queryByRole ( 'alert' ) ;
251- expect ( alertElement ) . toHaveTextContent (
250+ const alertElements = screen . queryAllByRole ( 'alert' ) ;
251+ expect ( alertElements . find (
252+ ( el ) => el . classList . contains ( 'alert-content' ) ,
253+ ) ) . toHaveTextContent (
252254 pageAlertMessages . alertFailedGeneric . defaultMessage ,
253255 ) ;
254256 } ) ;
@@ -511,9 +513,10 @@ describe('<CourseOutline />', () => {
511513 notificationDismissUrl : '/some/url' ,
512514 } ) ;
513515
514- const { findByRole } = render ( < RootWrapper /> ) ;
515- expect ( await findByRole ( 'alert' ) ) . toBeInTheDocument ( ) ;
516- const dismissBtn = await findByRole ( 'button' , { name : 'Dismiss' } ) ;
516+ render ( < RootWrapper /> ) ;
517+ const alert = await screen . findByText ( pageAlertMessages . configurationErrorTitle . defaultMessage ) ;
518+ expect ( alert ) . toBeInTheDocument ( ) ;
519+ const dismissBtn = await screen . findByRole ( 'button' , { name : 'Dismiss' } ) ;
517520 axiosMock
518521 . onDelete ( '/some/url' )
519522 . reply ( 204 ) ;
@@ -2160,10 +2163,10 @@ describe('<CourseOutline />', () => {
21602163 } ) ;
21612164
21622165 it ( 'check whether unit copy & paste option works correctly' , async ( ) => {
2163- const { findAllByTestId , queryByTestId , findAllByRole } = render ( < RootWrapper /> ) ;
2166+ render ( < RootWrapper /> ) ;
21642167 // get first section -> first subsection -> first unit element
21652168 const [ section ] = courseOutlineIndexMock . courseStructure . childInfo . children ;
2166- const [ sectionElement ] = await findAllByTestId ( 'section-card' ) ;
2169+ const [ sectionElement ] = await screen . findAllByTestId ( 'section-card' ) ;
21672170 const [ subsection ] = section . childInfo . children ;
21682171 axiosMock
21692172 . onGet ( getXBlockApiUrl ( section . id ) )
@@ -2202,7 +2205,7 @@ describe('<CourseOutline />', () => {
22022205 await act ( async ( ) => fireEvent . mouseOver ( clipboardLabel ) ) ;
22032206
22042207 // find clipboard content popover link
2205- const popoverContent = queryByTestId ( 'popover-content' ) ;
2208+ const popoverContent = screen . queryByTestId ( 'popover-content' ) ;
22062209 expect ( popoverContent . tagName ) . toBe ( 'A' ) ;
22072210 expect ( popoverContent ) . toHaveAttribute ( 'href' , `${ getConfig ( ) . STUDIO_BASE_URL } ${ unit . studioUrl } ` ) ;
22082211
@@ -2233,8 +2236,10 @@ describe('<CourseOutline />', () => {
22332236 errorFiles : [ 'error.css' ] ,
22342237 } ) ;
22352238
2239+ let alerts = await screen . findAllByRole ( 'alert' ) ;
2240+ // Exclude processing notification toast
2241+ alerts = alerts . filter ( ( el ) => ! el . classList . contains ( 'toast-container' ) ) ;
22362242 // 3 alerts should be present
2237- const alerts = await findAllByRole ( 'alert' ) ;
22382243 expect ( alerts . length ) . toEqual ( 3 ) ;
22392244
22402245 // check alerts for errorFiles
0 commit comments