summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-07-17 21:09:23 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-07-17 21:09:23 +0000
commit1d84a028b42a1a3aed36a0f3a6cae970c8df8e69 (patch)
tree1ebd0249d20169a0b8be47dc541e9c2676d62648 /qa
parentec72da1833d94bb1556af94193ccf2a93c9cb939 (diff)
downloadgitlab-ce-1d84a028b42a1a3aed36a0f3a6cae970c8df8e69.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r--qa/qa.rb4
-rw-r--r--qa/qa/page/profile/accounts/show.rb30
-rw-r--r--qa/qa/page/profile/menu.rb7
-rw-r--r--qa/qa/resource/user.rb2
-rw-r--r--qa/qa/specs/features/browser_ui/1_manage/login/register_spec.rb46
5 files changed, 88 insertions, 1 deletions
diff --git a/qa/qa.rb b/qa/qa.rb
index 823adade6f3..66f1bd5eb35 100644
--- a/qa/qa.rb
+++ b/qa/qa.rb
@@ -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
diff --git a/qa/qa/page/profile/accounts/show.rb b/qa/qa/page/profile/accounts/show.rb
new file mode 100644
index 00000000000..eec4efe1734
--- /dev/null
+++ b/qa/qa/page/profile/accounts/show.rb
@@ -0,0 +1,30 @@
+# 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
diff --git a/qa/qa/page/profile/menu.rb b/qa/qa/page/profile/menu.rb
index e7baaf3d40a..41c350f94ef 100644
--- a/qa/qa/page/profile/menu.rb
+++ b/qa/qa/page/profile/menu.rb
@@ -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)
diff --git a/qa/qa/resource/user.rb b/qa/qa/resource/user.rb
index 41908a71cf9..462da743318 100644
--- a/qa/qa/resource/user.rb
+++ b/qa/qa/resource/user.rb
@@ -87,6 +87,8 @@ module QA
def api_delete_path
"/users/#{id}"
+ rescue NoValueError
+ "/users/#{fetch_id(username)}"
end
def api_get_path
diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/register_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/register_spec.rb
index 9dfeec37869..bb01be9d86e 100644
--- a/qa/qa/specs/features/browser_ui/1_manage/login/register_spec.rb
+++ b/qa/qa/specs/features/browser_ui/1_manage/login/register_spec.rb
@@ -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 login' 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