Skip to content

refactor(site): refactor login screen #10768

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 20, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix test
  • Loading branch information
BrunoQuaresma committed Nov 17, 2023
commit 3900c4a730a238f7800c1d5172ea9f65f1a4bb1d
29 changes: 0 additions & 29 deletions site/src/pages/LoginPage/LoginPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
} from "testHelpers/renderHelpers";
import { server } from "testHelpers/server";
import { LoginPage } from "./LoginPage";
import * as TypesGen from "api/typesGenerated";

describe("LoginPage", () => {
beforeEach(() => {
Expand Down Expand Up @@ -76,32 +75,4 @@ describe("LoginPage", () => {
// Then
await screen.findByText("Setup");
});

it("hides password authentication if OIDC/GitHub is enabled and displays on click", async () => {
const authMethods: TypesGen.AuthMethods = {
password: { enabled: true },
github: { enabled: true },
oidc: { enabled: true, signInText: "", iconUrl: "" },
};

// Given
server.use(
rest.get("/api/v2/users/authmethods", async (req, res, ctx) => {
return res(ctx.status(200), ctx.json(authMethods));
}),
);

// When
render(<LoginPage />);

// Then
expect(screen.queryByText(Language.passwordSignIn)).not.toBeInTheDocument();
await screen.findByText(Language.githubSignIn);

const showPasswordAuthLink = screen.getByText("Email and password");
await userEvent.click(showPasswordAuthLink);

await screen.findByText(Language.passwordSignIn);
await screen.findByText(Language.githubSignIn);
});
});