Skip to content
Snippets Groups Projects
Unverified Commit e69f872b authored by Lucendio's avatar Lucendio Committed by GitHub
Browse files

Merge pull request #15 from jakobfleisch/test/render-login-registration

Add client test for login and registration forms
parents a3c3cb0e 0248488e
No related branches found
No related tags found
No related merge requests found
import React from 'react';
import { render } from '@testing-library/react';
import { render, waitForElement, fireEvent } from '@testing-library/react';
import App from './App';
test.skip('renders header title "ToDo App"', () => {
......@@ -13,3 +13,21 @@ test('renders a header title', () => {
const header = container.querySelector('.header-main')
expect(header).toHaveTextContent(/.+/);
});
test('renders a login form', async () => {
const { getByText } = render(<App />);
await waitForElement(() => getByText(/Sign in/i))
await waitForElement(() => getByText(/Email/i))
await waitForElement(() => getByText(/Password/i))
await waitForElement(() => getByText(/Login/i))
});
test('renders registration form when register button clicked', async () => {
const { getByText } = render(<App />);
await waitForElement(() => getByText(/Signup/i))
fireEvent.click(getByText('Signup'))
await waitForElement(() => getByText(/Your name/i))
await waitForElement(() => getByText(/Your email/i))
await waitForElement(() => getByText(/Your password/i))
await waitForElement(() => getByText(/Create User/i))
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment