@@ -98,7 +98,7 @@ describe("LoginPage", () => {
98
98
render ( < LoginPage /> )
99
99
100
100
// Then
101
- await screen . findByText ( Language . passwordSignIn )
101
+ expect ( await screen . queryByText ( Language . passwordSignIn ) ) . not . toBeInTheDocument ( )
102
102
await screen . findByText ( Language . githubSignIn )
103
103
} )
104
104
@@ -121,4 +121,32 @@ describe("LoginPage", () => {
121
121
// Then
122
122
await screen . findByText ( "Setup" )
123
123
} )
124
+
125
+ it ( "hides password authentication if OIDC/GitHub is enabled and displays on click" , async ( ) => {
126
+ const authMethods : TypesGen . AuthMethods = {
127
+ password : { enabled : true } ,
128
+ github : { enabled : true } ,
129
+ oidc : { enabled : true , signInText : "" , iconUrl : "" } ,
130
+ }
131
+
132
+ // Given
133
+ server . use (
134
+ rest . get ( "/api/v2/users/authmethods" , async ( req , res , ctx ) => {
135
+ return res ( ctx . status ( 200 ) , ctx . json ( authMethods ) )
136
+ } ) ,
137
+ )
138
+
139
+ // When
140
+ render ( < LoginPage /> )
141
+
142
+ // Then
143
+ expect ( await screen . queryByText ( Language . passwordSignIn ) ) . not . toBeInTheDocument ( )
144
+ await screen . findByText ( Language . githubSignIn )
145
+
146
+ const showPasswordAuthLink = screen . getByText ( "Show password login" )
147
+ await userEvent . click ( showPasswordAuthLink ) ;
148
+
149
+ await screen . findByText ( Language . passwordSignIn )
150
+ await screen . findByText ( Language . githubSignIn )
151
+ } )
124
152
} )
0 commit comments