Skip to content

Commit

Permalink
#56 Automated testing loginform
Browse files Browse the repository at this point in the history
  • Loading branch information
SandraBergstrom committed Jul 4, 2023
1 parent 01889bb commit 66160ec
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/pages/auth/__tests__/LoginForm.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { render, screen, fireEvent } from "@testing-library/react";
import { BrowserRouter as Router } from "react-router-dom";
import LogInForm from "../LoginForm";

test("renders Login page ", () => {
render(
<Router>
<LogInForm />
</Router>
);

// screen.debug();

// Check to see if username field is rendered to the user
const usernameField = screen.getByPlaceholderText('Enter username');
expect(usernameField).toBeInTheDocument();

const passwordField = screen.getByPlaceholderText('Password');
expect(passwordField).toBeInTheDocument();

const submitButton = screen.getByRole("button", { name: "Login" });
expect(submitButton).toBeInTheDocument();

});

0 comments on commit 66160ec

Please sign in to comment.