@@ -38,7 +38,7 @@ describe('ManageProfileComponent tests', () => {
3838
3939 await renderComponent ( getProfile , setProfile ) ;
4040
41- expect ( screen . getByText ( / L o a d i n g ... / i ) ) . toBeInTheDocument ( ) ;
41+ expect ( screen . getByTestId ( 'profile-loading' ) ) . toBeInTheDocument ( ) ;
4242 } ) ;
4343
4444 it ( 'renders profile form after successfully fetching profile' , async ( ) => {
@@ -53,11 +53,11 @@ describe('ManageProfileComponent tests', () => {
5353
5454 await renderComponent ( getProfile , setProfile ) ;
5555
56- expect ( screen . getByLabelText ( 'Display Name ') ) . toHaveValue ( 'John Doe' ) ;
57- expect ( screen . getByLabelText ( 'First Name ') ) . toHaveValue ( 'John' ) ;
58- expect ( screen . getByLabelText ( 'Last Name ') ) . toHaveValue ( 'Doe' ) ;
59- expect ( screen . getByLabelText ( 'Email ') ) . toHaveValue ( '[email protected] ' ) ; 60- expect ( screen . getByLabelText ( 'Discord Username ') ) . toHaveValue ( 'johndoe#1234' ) ;
56+ expect ( screen . getByTestId ( 'edit-displayName ') ) . toHaveValue ( 'John Doe' ) ;
57+ expect ( screen . getByTestId ( 'edit-firstName ') ) . toHaveValue ( 'John' ) ;
58+ expect ( screen . getByTestId ( 'edit-lastName ') ) . toHaveValue ( 'Doe' ) ;
59+ expect ( screen . getByTestId ( 'edit-email ') ) . toHaveValue ( '[email protected] ' ) ; 60+ expect ( screen . getByTestId ( 'edit-discordUsername ') ) . toHaveValue ( 'johndoe#1234' ) ;
6161 } ) ;
6262
6363 it ( 'handles profile fetch failure gracefully' , async ( ) => {
@@ -67,7 +67,6 @@ describe('ManageProfileComponent tests', () => {
6767
6868 await renderComponent ( getProfile , setProfile ) ;
6969
70- expect ( screen . getByText ( / F a i l e d t o l o a d u s e r p r o f i l e / i) ) . toBeInTheDocument ( ) ;
7170 expect ( notificationsMock ) . toHaveBeenCalledWith (
7271 expect . objectContaining ( {
7372 message : 'Failed to load user profile' ,
@@ -94,9 +93,9 @@ describe('ManageProfileComponent tests', () => {
9493 const user = userEvent . setup ( ) ;
9594
9695 // Edit fields
97- await user . clear ( screen . getByLabelText ( 'Display Name ') ) ;
98- await user . type ( screen . getByLabelText ( 'Display Name ') , 'Jane Doe' ) ;
99- await user . type ( screen . getByLabelText ( 'Discord Username ') , 'janedoe#5678' ) ;
96+ await user . clear ( screen . getByTestId ( 'edit-displayName ') ) ;
97+ await user . type ( screen . getByTestId ( 'edit-displayName ') , 'Jane Doe' ) ;
98+ await user . type ( screen . getByTestId ( 'edit-discordUsername ') , 'janedoe#5678' ) ;
10099
101100 // Save changes
102101 const saveButton = screen . getByRole ( 'button' , { name : 'Save' } ) ;
0 commit comments