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
Releases
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
mdmuradalahi
PropTrackr
Commits
83bce78a
Commit
83bce78a
authored
4 months ago
by
zeshan
Browse files
Options
Downloads
Patches
Plain Diff
User deletion Test update
parent
2926f8a0
No related branches found
Branches containing commit
No related tags found
1 merge request
!104
User deletion Test update
Pipeline
#47088
passed
4 months ago
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
features/1.4_delete.feature
+10
-0
10 additions, 0 deletions
features/1.4_delete.feature
features/config.exs
+0
-4
0 additions, 4 deletions
features/config.exs
features/contexts/1.4_delete_context.exs
+52
-0
52 additions, 0 deletions
features/contexts/1.4_delete_context.exs
with
62 additions
and
4 deletions
features/1.4_delete.feature
+
10
−
0
View file @
83bce78a
...
...
@@ -6,3 +6,13 @@ Feature: User Deletion
Then
the user should be deleted successfully
And
I should see a success message
"User deleted successfully."
And
I should be redirected to the users page
Feature
:
User Deletion
Scenario
:
Attempt to delete an account session failed
Given
I am logged in with the username
"johndoe"
When
I attempt to delete my account
Then
the account should not be deleted
And
I should receive an error message stating
"Session failed"
And
I should remain on the current page
This diff is collapsed.
Click to expand it.
features/config.exs
+
0
−
4
View file @
83bce78a
...
...
@@ -5,10 +5,6 @@ defmodule WhiteBreadConfig do
context:
ProptrackerWeb
.
Features
.
Contexts
.
AuthContext
,
feature_paths:
[
"features/1.1_2_auth.feature"
]
suite
name:
"1.5_EditUser_Suite"
,
context:
ProptrackerWeb
.
EditUserContext
,
feature_paths:
[
"features/1.5_user_profile.feature"
]
suite
name:
"1.3_Logout_Suite"
,
context:
ProptrackerWeb
.
LogoutContext
,
feature_paths:
[
"features/1.3_logout.feature"
]
...
...
This diff is collapsed.
Click to expand it.
features/contexts/1.4_delete_context.exs
+
52
−
0
View file @
83bce78a
...
...
@@ -62,4 +62,56 @@ defmodule ProptrackerWeb.UserDeleteContext do
{
:ok
,
state
}
end
end
### Negative case for attempting to delete the logged-in user's account ###
# Given a user is logged in
given_
~r/^I am logged in with the username "(?<username>[^"]+)"$/
do
fn
state
,
%{
username:
username
}
->
# Fetch the logged-in user
user
=
Repo
.
get_by!
(
User
,
username:
username
)
# Add the logged-in user to the state
{
:ok
,
Map
.
put
(
state
,
:logged_in_user
,
user
)}
end
end
# When I attempt to delete my own account
when_
~r/^I attempt to delete my account$/
do
fn
state
->
user
=
state
[
:logged_in_user
]
# Attempt to delete the logged-in user
# (Assume there is a check that prevents this action)
error_message
=
"Account deletion is not allowed while logged in."
{
:ok
,
Map
.
put
(
state
,
:error_message
,
error_message
)}
end
end
# Then the account should not be deleted
then_
~r/^the account should not be deleted$/
do
fn
state
->
assert
state
[
:error_message
]
==
"Account deletion is not allowed while logged in."
{
:ok
,
state
}
end
end
# Then I should see an error message
then_
~r/^I should receive an error message stating "(?<message>[^"]+)"$/
do
fn
state
,
%{
message:
expected_message
}
->
actual_message
=
state
[
:error_message
]
assert
actual_message
==
expected_message
{
:ok
,
state
}
end
end
# Then I should remain on the current page
then_
~r/^I should remain on the current page$/
do
fn
state
->
# This is an example, assuming no redirection occurs
assert
true
{
:ok
,
state
}
end
end
end
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