diff --git a/app/client/src/App.test.js b/app/client/src/App.test.js index 45a71e33ff6107566ff200aa86aace6669573868..9170134cd80d0f59d3af29ddb79a8b3a15f6989c 100644 --- a/app/client/src/App.test.js +++ b/app/client/src/App.test.js @@ -1,5 +1,5 @@ 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)) +});