@@ -11,7 +11,7 @@ const mockStore = configureStore([]);
1111const initialState = {
1212 badge : {
1313 selectedBadges : [ ] ,
14- allBadges : [ ] ,
14+ allBadges : [ ] ,
1515 } ,
1616 theme : themeMock ,
1717} ;
@@ -32,7 +32,7 @@ const tip2 = 'Want to assign multiple of the same badge to a person? Repeat the
3232const renderComponent = ( ) => {
3333 render (
3434 < Provider store = { store } >
35- < AssignBadgePopup />
35+ < AssignBadgePopup test = { true } />
3636 </ Provider > ,
3737 ) ;
3838} ;
@@ -69,6 +69,8 @@ describe('Userprofile/AssignBadgePopup Test Suite', () => {
6969 it ( 'Test case 4 : Assert the pop up contains only one table with 3 columns ' , async ( ) => {
7070 renderComponent ( ) ;
7171
72+ await new Promise ( resolve => setTimeout ( resolve , 1000 ) ) ;
73+
7274 // / Find all tables within the component
7375 const tables = screen . getAllByRole ( 'table' ) ;
7476
@@ -84,6 +86,8 @@ describe('Userprofile/AssignBadgePopup Test Suite', () => {
8486 it ( 'Test case 5 : Assert the presnce of objects associated with the search results: a table and three columns' , async ( ) => {
8587 renderComponent ( ) ;
8688
89+ await new Promise ( resolve => setTimeout ( resolve , 1000 ) ) ;
90+
8791 const table = screen . getByTestId ( 'test-badgeResults' ) ;
8892 const badge = screen . getByText ( 'Badge' ) ;
8993 const name = screen . getByText ( 'Name' ) ;
@@ -101,30 +105,38 @@ describe('Userprofile/AssignBadgePopup Test Suite', () => {
101105 expect ( message1 ) . toBeNull ( ) ;
102106 expect ( message2 ) . toBeNull ( ) ;
103107 } ) ;
104- it ( 'Test case 7 : Assert the tool tip message displayed when hovered' , async ( ) => {
105- renderComponent ( ) ;
106-
107- const infoIcon = screen . getByTestId ( 'test-selectinfo' ) ;
108- fireEvent . mouseOver ( infoIcon ) ; // trigger the tooltip
109-
110- // now grab the two <p> elements by their test IDs
111- const tip1El = await screen . findByTestId ( 'test-tip1' ) ;
112- const tip2El = await screen . findByTestId ( 'test-tip2' ) ;
113-
114- expect ( tip1El ) . toBeInTheDocument ( ) ;
115- // just check the unique leading phrase
116- expect ( tip1El ) . toHaveTextContent ( 'Hmmm, little blank boxes' ) ;
117-
118- expect ( tip2El ) . toBeInTheDocument ( ) ;
119- expect ( tip2El ) . toHaveTextContent ( 'Want to assign multiple of the same badge' ) ;
120- } ) ;
108+ it ( 'Test case 7 : Assert the tool tip message displayed when hovered' , async ( ) => {
109+ renderComponent ( ) ;
110+
111+ await new Promise ( resolve => setTimeout ( resolve , 1000 ) ) ;
112+
113+ const infoIcon = screen . getByTestId ( 'test-selectinfo' ) ;
114+ fireEvent . mouseOver ( infoIcon ) ; // trigger the tooltip
115+
116+ // now grab the two <p> elements by their test IDs
117+ const tip1El = await screen . findByTestId ( 'test-tip1' ) ;
118+ const tip2El = await screen . findByTestId ( 'test-tip2' ) ;
119+
120+ expect ( tip1El ) . toBeInTheDocument ( ) ;
121+ // just check the unique leading phrase
122+ expect ( tip1El ) . toHaveTextContent ( 'Hmmm, little blank boxes' ) ;
123+
124+ expect ( tip2El ) . toBeInTheDocument ( ) ;
125+ expect ( tip2El ) . toHaveTextContent ( 'Want to assign multiple of the same badge' ) ;
126+ } ) ;
121127 it ( 'Test case 8 : Assert if the pop up has a submit button ' , async ( ) => {
122128 renderComponent ( ) ;
129+
130+ await new Promise ( resolve => setTimeout ( resolve , 1000 ) ) ;
131+
123132 const button = screen . getByTestId ( 'test-button' ) ;
124133 expect ( button ) . toBeInTheDocument ( ) ;
125134 } ) ;
126135 it ( 'Test case 9 : Assert if the popup renders badge data correctly ' , async ( ) => {
127136 renderComponent ( ) ;
137+
138+ await new Promise ( resolve => setTimeout ( resolve , 1000 ) ) ;
139+
128140 // Find the AssignTableRow component within AssignBadgePopup
129141 const assignTableRowComponent = screen . getByTestId ( 'test-badgeResults' ) ; // Assuming you have a data-testid on the AssignTableRow
130142
0 commit comments