Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PropTrackr
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
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
kerdo
PropTrackr
Merge requests
!7
Resolve "FR-03: User Logout"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "FR-03: User Logout"
13-fr-03-user-logout
into
main
Overview
1
Commits
2
Pipelines
2
Changes
10
Merged
shyngys
requested to merge
13-fr-03-user-logout
into
main
5 months ago
Overview
1
Commits
2
Pipelines
2
Changes
10
Expand
Closes
#13 (closed)
0
0
Merge request reports
Compare
main
version 1
96eb81e1
5 months ago
main (base)
and
latest version
latest version
72987a58
2 commits,
5 months ago
version 1
96eb81e1
1 commit,
5 months ago
10 files
+
218
−
23
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
10
Search (e.g. *.vue) (Ctrl+P)
features/contexts/user_logout_context.exs
0 → 100644
+
79
−
0
Options
defmodule
UserLogoutContext
do
use
WhiteBread
.
Context
use
Hound
.
Helpers
alias
PropTrackr
.
Accounts
alias
PropTrackr
.
Repo
alias
PropTrackr
.
Accounts
.
User
scenario_starting_state
fn
_state
->
Ecto
.
Adapters
.
SQL
.
Sandbox
.
checkout
(
PropTrackr
.
Repo
)
Ecto
.
Adapters
.
SQL
.
Sandbox
.
mode
(
PropTrackr
.
Repo
,
{
:shared
,
self
()})
Hound
.
start_session
()
%{}
end
scenario_finalize
fn
_status
,
_state
->
Ecto
.
Adapters
.
SQL
.
Sandbox
.
checkin
(
PropTrackr
.
Repo
)
Hound
.
end_session
()
end
given_
~r/^there exists following accounts$/
,
fn
state
,
%{
table_data:
table
}
->
table
|>
Enum
.
map
(
fn
user_details
->
User
.
changeset
(%
User
{},
user_details
)
end
)
|>
Enum
.
each
(
fn
changeset
->
Repo
.
insert!
(
changeset
)
end
)
existing_user
=
List
.
first
(
table
)
{
:ok
,
state
|>
Map
.
put
(
:email
,
existing_user
[
:email
])
|>
Map
.
put
(
:password
,
existing_user
[
:password
])
}
end
given_
~r/^I am logged in$/
,
fn
state
->
navigate_to
(
"/login"
)
fill_field
({
:id
,
"email"
},
state
[
:email
])
fill_field
({
:id
,
"password"
},
state
[
:password
])
click
({
:id
,
"login_button"
})
assert
visible_in_page?
~r"Successfully logged in!"
assert
current_path
()
==
"/"
navigate_to
(
"/users"
)
{
:ok
,
state
}
end
when_
~r/^I click the logout button$/
,
fn
state
->
click
({
:id
,
"logout_button"
})
{
:ok
,
state
}
end
then_
~r/^I should be logged out$/
,
fn
state
->
assert
visible_in_page?
~r"You are successfully logged out"
{
:ok
,
state
}
end
and_
~r/^I should be redirected to the home page$/
,
fn
state
->
assert
current_path
()
==
"/"
{
:ok
,
state
}
end
given_
~r/^I am not logged in$/
,
fn
state
->
navigate_to
(
"/"
)
{
:ok
,
state
}
end
when_
~r/^I try to access the logout functionality$/
,
fn
state
->
navigate_to
(
"/logout"
)
{
:ok
,
state
}
end
then_
~r/^I should see an error message$/
,
fn
state
->
assert
visible_in_page?
~r"You are not logged in"
{
:ok
,
state
}
end
end
Loading