Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit475b2bf

Browse files
committed
Fixed and added LoginPage test
1 parent9480f8e commit475b2bf

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

‎site/src/pages/LoginPage/LoginPage.test.tsx

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ describe("LoginPage", () => {
9898
render(<LoginPage/>)
9999

100100
// Then
101-
awaitscreen.findByText(Language.passwordSignIn)
101+
expect(awaitscreen.queryByText(Language.passwordSignIn)).not.toBeInTheDocument()
102102
awaitscreen.findByText(Language.githubSignIn)
103103
})
104104

@@ -121,4 +121,32 @@ describe("LoginPage", () => {
121121
// Then
122122
awaitscreen.findByText("Setup")
123123
})
124+
125+
it("hides password authentication if OIDC/GitHub is enabled and displays on click",async()=>{
126+
constauthMethods: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+
returnres(ctx.status(200),ctx.json(authMethods))
136+
}),
137+
)
138+
139+
// When
140+
render(<LoginPage/>)
141+
142+
// Then
143+
expect(awaitscreen.queryByText(Language.passwordSignIn)).not.toBeInTheDocument()
144+
awaitscreen.findByText(Language.githubSignIn)
145+
146+
constshowPasswordAuthLink=screen.getByText("Show password login")
147+
awaituserEvent.click(showPasswordAuthLink);
148+
149+
awaitscreen.findByText(Language.passwordSignIn)
150+
awaitscreen.findByText(Language.githubSignIn)
151+
})
124152
})

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp