Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lecture-devops-app
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
s80984
lecture-devops-app
Commits
0248488e
Commit
0248488e
authored
4 years ago
by
Jakob Fleisch
Browse files
Options
Downloads
Patches
Plain Diff
Add client test for login and registration forms
parent
a3c3cb0e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/client/src/App.test.js
+19
-1
19 additions, 1 deletion
app/client/src/App.test.js
with
19 additions
and
1 deletion
app/client/src/App.test.js
+
19
−
1
View file @
0248488e
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
))
});
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment