Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
518eb3f6
Commit
518eb3f6
authored
Jul 17, 2020
by
Sanad Liaquat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add e2e spec to recreate user after removal
Also add page objects requried for the test
parent
ea04e393
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
91 additions
and
3 deletions
+91
-3
app/assets/javascripts/profile/account/components/delete_account_modal.vue
...ripts/profile/account/components/delete_account_modal.vue
+1
-0
app/views/layouts/nav/sidebar/_profile.html.haml
app/views/layouts/nav/sidebar/_profile.html.haml
+1
-1
app/views/profiles/accounts/show.html.haml
app/views/profiles/accounts/show.html.haml
+1
-1
qa/qa.rb
qa/qa.rb
+4
-0
qa/qa/page/profile/accounts/show.rb
qa/qa/page/profile/accounts/show.rb
+30
-0
qa/qa/page/profile/menu.rb
qa/qa/page/profile/menu.rb
+7
-0
qa/qa/resource/user.rb
qa/qa/resource/user.rb
+2
-0
qa/qa/specs/features/browser_ui/1_manage/login/register_spec.rb
...specs/features/browser_ui/1_manage/login/register_spec.rb
+45
-1
No files found.
app/assets/javascripts/profile/account/components/delete_account_modal.vue
View file @
518eb3f6
...
...
@@ -100,6 +100,7 @@ Once you confirm %{deleteAccount}, it cannot be undone or recovered.`),
name=
"password"
class=
"form-control"
type=
"password"
data-qa-selector=
"password_confirmation_field"
aria-labelledby=
"input-label"
/>
<input
...
...
app/views/layouts/nav/sidebar/_profile.html.haml
View file @
518eb3f6
...
...
@@ -18,7 +18,7 @@
%strong
.fly-out-top-item-name
=
_
(
'Profile'
)
=
nav_link
(
controller:
[
:accounts
,
:two_factor_auths
])
do
=
link_to
profile_account_path
do
=
link_to
profile_account_path
,
data:
{
qa_selector:
'profile_account_link'
}
do
.nav-icon-container
=
sprite_icon
(
'account'
)
%span
.nav-item-name
...
...
app/views/profiles/accounts/show.html.haml
View file @
518eb3f6
...
...
@@ -56,7 +56,7 @@
=
render
'users/deletion_guidance'
,
user:
current_user
%button
#delete-account-button
.btn.btn-danger.disabled
{
data:
{
toggle:
'modal'
,
target:
'#delete-account-modal'
}
}
target:
'#delete-account-modal'
,
qa_selector:
'delete_account_button'
}
}
=
s_
(
'Profiles|Delete account'
)
#delete-account-modal
{
data:
{
action_url:
user_registration_path
,
...
...
qa/qa.rb
View file @
518eb3f6
...
...
@@ -376,6 +376,10 @@ module QA
autoload
:Emails
,
'qa/page/profile/emails'
autoload
:Password
,
'qa/page/profile/password'
autoload
:TwoFactorAuth
,
'qa/page/profile/two_factor_auth'
module
Accounts
autoload
:Show
,
'qa/page/profile/accounts/show'
end
end
module
Issuable
...
...
qa/qa/page/profile/accounts/show.rb
0 → 100644
View file @
518eb3f6
# frozen_string_literal: true
module
QA
module
Page
module
Profile
module
Accounts
class
Show
<
Page
::
Base
view
'app/views/profiles/accounts/show.html.haml'
do
element
:delete_account_button
,
required:
true
end
view
'app/assets/javascripts/profile/account/components/delete_account_modal.vue'
do
element
:password_confirmation_field
end
view
'app/assets/javascripts/vue_shared/components/deprecated_modal.vue'
do
element
:save_changes_button
end
def
delete_account
(
password
)
click_element
(
:delete_account_button
)
find_element
(
:password_confirmation_field
).
set
password
click_element
(
:save_changes_button
)
end
end
end
end
end
end
qa/qa/page/profile/menu.rb
View file @
518eb3f6
...
...
@@ -11,6 +11,7 @@ module QA
element
:ssh_keys
,
'SSH Keys'
# rubocop:disable QA/ElementWithPattern
element
:profile_emails_link
element
:profile_password_link
element
:profile_account_link
end
def
click_access_tokens
...
...
@@ -25,6 +26,12 @@ module QA
end
end
def
click_account
within_sidebar
do
click_element
(
:profile_account_link
)
end
end
def
click_emails
within_sidebar
do
click_element
(
:profile_emails_link
)
...
...
qa/qa/resource/user.rb
View file @
518eb3f6
...
...
@@ -87,6 +87,8 @@ module QA
def
api_delete_path
"/users/
#{
id
}
"
rescue
NoValueError
"/users/
#{
fetch_id
(
username
)
}
"
end
def
api_get_path
...
...
qa/qa/specs/features/browser_ui/1_manage/login/register_spec.rb
View file @
518eb3f6
...
...
@@ -2,7 +2,7 @@
module
QA
RSpec
.
shared_examples
'registration and login'
do
it
'
user registers and logs
in'
do
it
'
allows the user to registers and log
in'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Resource
::
User
.
fabricate_via_browser_ui!
...
...
@@ -16,6 +16,50 @@ module QA
RSpec
.
describe
'Manage'
,
:skip_signup_disabled
do
describe
'standard'
do
it_behaves_like
'registration and login'
context
'when user account is deleted'
,
:requires_admin
do
let
(
:user
)
do
Resource
::
User
.
fabricate_via_api!
do
|
resource
|
resource
.
api_client
=
admin_api_client
end
end
before
do
# Use the UI instead of API to delete the account since
# this is the only test that exercise this UI.
# Other tests should use the API for this purpose.
Flow
::
Login
.
sign_in
(
as:
user
)
Page
::
Main
::
Menu
.
perform
(
&
:click_settings_link
)
Page
::
Profile
::
Menu
.
perform
(
&
:click_account
)
Page
::
Profile
::
Accounts
::
Show
.
perform
do
|
show
|
show
.
delete_account
(
user
.
password
)
end
end
it
'allows recreating with same credentials'
do
expect
(
Page
::
Main
::
Menu
.
perform
(
&
:signed_in?
)).
to
be_falsy
Flow
::
Login
.
sign_in
(
as:
user
,
skip_page_validation:
true
)
expect
(
page
).
to
have_text
(
"Invalid Login or password"
)
@recreated_user
=
Resource
::
User
.
fabricate_via_browser_ui!
do
|
resource
|
resource
.
name
=
user
.
name
resource
.
username
=
user
.
username
resource
.
email
=
user
.
email
end
expect
(
Page
::
Main
::
Menu
.
perform
(
&
:signed_in?
)).
to
be_truthy
end
after
do
@recreated_user
.
remove_via_api!
end
def
admin_api_client
@admin_api_client
||=
Runtime
::
API
::
Client
.
as_admin
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment