summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-13 13:26:31 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-13 13:26:31 +0000
commitb7dfe2ae4054aa40e15182fd3c6cb7dd39f131db (patch)
tree5ab080ca9cadeb6cd9578bf301e4e9e8810bed9e /qa
parent25cb337cf12438169f1b14bc5dace8a06a7356e3 (diff)
downloadgitlab-ce-b7dfe2ae4054aa40e15182fd3c6cb7dd39f131db.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r--qa/qa.rb8
-rw-r--r--qa/qa/page/group/menu.rb33
-rw-r--r--qa/qa/page/group/settings/general.rb85
-rw-r--r--qa/qa/page/group/sub_menus/common.rb38
-rw-r--r--qa/qa/page/group/sub_menus/members.rb48
-rw-r--r--qa/qa/page/profile/two_factor_auth.rb17
-rw-r--r--qa/qa/page/project/menu.rb2
-rw-r--r--qa/qa/page/project/settings/advanced.rb27
-rw-r--r--qa/qa/page/project/settings/main.rb10
-rw-r--r--qa/qa/page/project/settings/members.rb35
-rw-r--r--qa/qa/page/project/settings/visibility_features_permissions.rb26
-rw-r--r--qa/qa/page/project/show.rb4
-rw-r--r--qa/qa/runtime/feature.rb11
-rw-r--r--qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb3
-rw-r--r--qa/qa/specs/features/browser_ui/2_plan/issue/mentions_spec.rb58
-rw-r--r--qa/qa/support/retrier.rb7
-rw-r--r--qa/spec/runtime/feature_spec.rb21
17 files changed, 426 insertions, 7 deletions
diff --git a/qa/qa.rb b/qa/qa.rb
index b38c39a621f..dc9ef3ac464 100644
--- a/qa/qa.rb
+++ b/qa/qa.rb
@@ -162,6 +162,12 @@ module QA
module Group
autoload :New, 'qa/page/group/new'
autoload :Show, 'qa/page/group/show'
+ autoload :Menu, 'qa/page/group/menu'
+
+ module SubMenus
+ autoload :Common, 'qa/page/group/sub_menus/common'
+ autoload :Members, 'qa/page/group/sub_menus/members'
+ end
module Settings
autoload :General, 'qa/page/group/settings/general'
@@ -222,6 +228,7 @@ module QA
autoload :MergeRequest, 'qa/page/project/settings/merge_request'
autoload :Members, 'qa/page/project/settings/members'
autoload :MirroringRepositories, 'qa/page/project/settings/mirroring_repositories'
+ autoload :VisibilityFeaturesPermissions, 'qa/page/project/settings/visibility_features_permissions'
end
module SubMenus
@@ -278,6 +285,7 @@ module QA
autoload :Menu, 'qa/page/profile/menu'
autoload :PersonalAccessTokens, 'qa/page/profile/personal_access_tokens'
autoload :SSHKeys, 'qa/page/profile/ssh_keys'
+ autoload :TwoFactorAuth, 'qa/page/profile/two_factor_auth'
end
module Issuable
diff --git a/qa/qa/page/group/menu.rb b/qa/qa/page/group/menu.rb
new file mode 100644
index 00000000000..6353895ffd4
--- /dev/null
+++ b/qa/qa/page/group/menu.rb
@@ -0,0 +1,33 @@
+# frozen_string_literal: true
+
+module QA
+ module Page
+ module Group
+ class Menu < Page::Base
+ include SubMenus::Common
+
+ view 'app/views/layouts/nav/sidebar/_group.html.haml' do
+ element :group_settings_item
+ element :group_members_item
+ element :general_settings_link
+ end
+
+ def click_group_members_item
+ within_sidebar do
+ click_element(:group_members_item)
+ end
+ end
+
+ def click_group_general_settings_item
+ hover_element(:group_settings_item) do
+ within_submenu(:group_sidebar_submenu) do
+ click_element(:general_settings_link)
+ end
+ end
+ end
+ end
+ end
+ end
+end
+
+QA::Page::Group::Menu.prepend_if_ee('QA::EE::Page::Group::Menu')
diff --git a/qa/qa/page/group/settings/general.rb b/qa/qa/page/group/settings/general.rb
index 07b421f154a..efc8bbd7482 100644
--- a/qa/qa/page/group/settings/general.rb
+++ b/qa/qa/page/group/settings/general.rb
@@ -5,14 +5,99 @@ module QA
module Group
module Settings
class General < QA::Page::Base
+ include ::QA::Page::Settings::Common
+
view 'app/views/groups/edit.html.haml' do
element :permission_lfs_2fa_section
end
+
view 'app/views/groups/settings/_permissions.html.haml' do
element :save_permissions_changes_button
end
+
+ view 'app/views/groups/settings/_general.html.haml' do
+ element :group_name_field
+ element :save_name_visibility_settings_button
+ end
+
+ view 'app/views/shared/_visibility_radios.html.haml' do
+ element :internal_radio, 'qa_selector: "#{visibility_level_label(level).downcase}_radio"' # rubocop:disable QA/ElementWithPattern, Lint/InterpolationCheck
+ end
+
+ view 'app/views/groups/settings/_lfs.html.haml' do
+ element :lfs_checkbox
+ end
+
+ view 'app/views/shared/_allow_request_access.html.haml' do
+ element :request_access_checkbox
+ end
+
+ view 'app/views/groups/settings/_two_factor_auth.html.haml' do
+ element :require_2fa_checkbox
+ end
+
+ view 'app/views/groups/settings/_project_creation_level.html.haml' do
+ element :project_creation_level_dropdown
+ end
+
+ def set_group_name(name)
+ find_element(:group_name_field).send_keys([:command, 'a'], :backspace)
+ find_element(:group_name_field).set name
+ end
+
+ def set_group_visibility(visibility)
+ find_element("#{visibility.downcase}_radio").click
+ end
+
+ def click_save_name_visibility_settings_button
+ click_element(:save_name_visibility_settings_button)
+ end
+
+ def set_lfs_enabled
+ expand_section :permission_lfs_2fa_section
+ check_element :lfs_checkbox
+ click_element :save_permissions_changes_button
+ end
+
+ def set_lfs_disabled
+ expand_section :permission_lfs_2fa_section
+ uncheck_element :lfs_checkbox
+ click_element :save_permissions_changes_button
+ end
+
+ def set_request_access_enabled
+ expand_section :permission_lfs_2fa_section
+ check_element :request_access_checkbox
+ click_element :save_permissions_changes_button
+ end
+
+ def set_request_access_disabled
+ expand_section :permission_lfs_2fa_section
+ uncheck_element :request_access_checkbox
+ click_element :save_permissions_changes_button
+ end
+
+ def set_require_2fa_enabled
+ expand_section :permission_lfs_2fa_section
+ check_element :require_2fa_checkbox
+ click_element :save_permissions_changes_button
+ end
+
+ def set_require_2fa_disabled
+ expand_section :permission_lfs_2fa_section
+ uncheck_element :require_2fa_checkbox
+ click_element :save_permissions_changes_button
+ end
+
+ def set_project_creation_level(value)
+ expand_section :permission_lfs_2fa_section
+ select_element(:project_creation_level_dropdown, value)
+ click_element :save_permissions_changes_button
+ end
end
end
end
end
end
+
+QA::Page::Group::Settings::General.prepend_if_ee('QA::EE::Page::Group::Settings::General')
diff --git a/qa/qa/page/group/sub_menus/common.rb b/qa/qa/page/group/sub_menus/common.rb
new file mode 100644
index 00000000000..a378db80e4b
--- /dev/null
+++ b/qa/qa/page/group/sub_menus/common.rb
@@ -0,0 +1,38 @@
+# frozen_string_literal: true
+
+module QA
+ module Page
+ module Group
+ module SubMenus
+ module Common
+ def self.included(base)
+ base.class_eval do
+ view 'app/views/layouts/nav/sidebar/_group.html.haml' do
+ element :group_sidebar
+ end
+ end
+ end
+
+ def hover_element(element)
+ within_sidebar do
+ find_element(element).hover
+ yield
+ end
+ end
+
+ def within_sidebar
+ within_element(:group_sidebar) do
+ yield
+ end
+ end
+
+ def within_submenu(element)
+ within_element(element) do
+ yield
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/page/group/sub_menus/members.rb b/qa/qa/page/group/sub_menus/members.rb
new file mode 100644
index 00000000000..c8b3f5bb422
--- /dev/null
+++ b/qa/qa/page/group/sub_menus/members.rb
@@ -0,0 +1,48 @@
+# frozen_string_literal: true
+
+module QA
+ module Page
+ module Group
+ module SubMenus
+ class Members < Page::Base
+ include Page::Component::UsersSelect
+
+ view 'app/views/groups/group_members/_new_group_member.html.haml' do
+ element :add_to_group_button
+ end
+
+ view 'app/helpers/groups/group_members_helper.rb' do
+ element :member_select_field
+ end
+
+ view 'app/views/shared/members/_member.html.haml' do
+ element :member_row
+ element :access_level_dropdown
+ element :delete_member_button
+ element :developer_access_level_link, 'qa_selector: "#{role.downcase}_access_level_link"' # rubocop:disable QA/ElementWithPattern, Lint/InterpolationCheck
+ end
+
+ def add_member(username)
+ select_user :member_select_field, username
+ click_element :add_to_group_button
+ end
+
+ def update_access_level(username, access_level)
+ within_element(:member_row, text: username) do
+ click_element :access_level_dropdown
+ click_element "#{access_level.downcase}_access_level_link"
+ end
+ end
+
+ def remove_member(username)
+ page.accept_confirm do
+ within_element(:member_row, text: username) do
+ click_element :delete_member_button
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/page/profile/two_factor_auth.rb b/qa/qa/page/profile/two_factor_auth.rb
new file mode 100644
index 00000000000..a3ff5f603fa
--- /dev/null
+++ b/qa/qa/page/profile/two_factor_auth.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+module QA
+ module Page
+ module Profile
+ class TwoFactorAuth < Page::Base
+ view 'app/assets/javascripts/pages/profiles/two_factor_auths/index.js' do
+ element :configure_it_later_button
+ end
+
+ def click_configure_it_later_button
+ click_element :configure_it_later_button
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/page/project/menu.rb b/qa/qa/page/project/menu.rb
index a9226927741..5967213a52b 100644
--- a/qa/qa/page/project/menu.rb
+++ b/qa/qa/page/project/menu.rb
@@ -40,4 +40,4 @@ module QA
end
end
-QA::Page::Project::Menu.prepend_if_ee('QA::EE::Page::Project::SubMenus::SecurityCompliance')
+QA::Page::Project::Menu.prepend_if_ee('QA::EE::Page::Project::Menu')
diff --git a/qa/qa/page/project/settings/advanced.rb b/qa/qa/page/project/settings/advanced.rb
index ab4e3d757b6..3a5067a9541 100644
--- a/qa/qa/page/project/settings/advanced.rb
+++ b/qa/qa/page/project/settings/advanced.rb
@@ -12,6 +12,13 @@ module QA
element :project_path_field
element :change_path_button
element :transfer_button
+ element :archive_project_link
+ element :unarchive_project_link
+ end
+
+ view 'app/views/projects/_export.html.haml' do
+ element :export_project_link
+ element :download_export_link
end
def update_project_path_to(path)
@@ -38,6 +45,26 @@ module QA
fill_confirmation_text(project_name)
click_confirm_button
end
+
+ def click_export_project_link
+ click_element :export_project_link
+ end
+
+ def click_download_export_link
+ click_element :download_export_link
+ end
+
+ def archive_project
+ page.accept_alert("Are you sure that you want to archive this project?") do
+ click_element :archive_project_link
+ end
+ end
+
+ def unarchive_project
+ page.accept_alert("Are you sure that you want to unarchive this project?") do
+ click_element :unarchive_project_link
+ end
+ end
end
end
end
diff --git a/qa/qa/page/project/settings/main.rb b/qa/qa/page/project/settings/main.rb
index a196fc0123a..6b26c82a46f 100644
--- a/qa/qa/page/project/settings/main.rb
+++ b/qa/qa/page/project/settings/main.rb
@@ -18,6 +18,10 @@ module QA
element :save_naming_topics_avatar_button
end
+ view 'app/views/projects/edit.html.haml' do
+ element :visibility_features_permissions_content
+ end
+
def rename_project_to(name)
fill_project_name(name)
click_save_changes
@@ -36,6 +40,12 @@ module QA
Advanced.perform(&block)
end
end
+
+ def expand_visibility_project_features_permissions(&block)
+ expand_section(:visibility_features_permissions_content) do
+ VisibilityFeaturesPermissions.perform(&block)
+ end
+ end
end
end
end
diff --git a/qa/qa/page/project/settings/members.rb b/qa/qa/page/project/settings/members.rb
index 7fed93ca83f..2ef018fd983 100644
--- a/qa/qa/page/project/settings/members.rb
+++ b/qa/qa/page/project/settings/members.rb
@@ -6,6 +6,7 @@ module QA
module Settings
class Members < Page::Base
include Page::Component::UsersSelect
+ include QA::Page::Component::Select2
view 'app/views/projects/project_members/_new_project_member.html.haml' do
element :member_select_input
@@ -16,10 +17,44 @@ module QA
element :members_list
end
+ view 'app/views/projects/project_members/index.html.haml' do
+ element :invite_group_tab
+ end
+
+ view 'app/views/projects/project_members/_new_project_group.html.haml' do
+ element :group_select_field
+ element :invite_group_button
+ end
+
+ view 'app/views/shared/members/_group.html.haml' do
+ element :group_row
+ element :delete_group_access_link
+ end
+
+ def select_group(group_name)
+ click_element :group_select_field
+ search_and_select(group_name)
+ end
+
+ def invite_group(group_name)
+ click_element :invite_group_tab
+ select_group(group_name)
+ click_element :invite_group_button
+ end
+
def add_member(username)
select_user :member_select_input, username
click_element :add_member_button
end
+
+ def remove_group(group_name)
+ click_element :invite_group_tab
+ page.accept_alert do
+ within_element(:group_row, text: group_name) do
+ click_element :delete_group_access_link
+ end
+ end
+ end
end
end
end
diff --git a/qa/qa/page/project/settings/visibility_features_permissions.rb b/qa/qa/page/project/settings/visibility_features_permissions.rb
new file mode 100644
index 00000000000..1d6686ae360
--- /dev/null
+++ b/qa/qa/page/project/settings/visibility_features_permissions.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+module QA
+ module Page
+ module Project
+ module Settings
+ class VisibilityFeaturesPermissions < Page::Base
+ include QA::Page::Component::Select2
+
+ view 'app/views/projects/edit.html.haml' do
+ element :visibility_features_permissions_save_button
+ end
+
+ view 'app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue' do
+ element :project_visibility_dropdown
+ end
+
+ def set_project_visibility(visibility)
+ select_element(:project_visibility_dropdown, visibility)
+ click_element :visibility_features_permissions_save_button
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/page/project/show.rb b/qa/qa/page/project/show.rb
index 549992f271b..102b6144a1e 100644
--- a/qa/qa/page/project/show.rb
+++ b/qa/qa/page/project/show.rb
@@ -56,6 +56,10 @@ module QA
element :spinner
end
+ view 'app/views/projects/buttons/_download.html.haml' do
+ element :download_source_code_button
+ end
+
def wait_for_viewers_to_load
wait(reload: false) do
has_no_element?(:spinner)
diff --git a/qa/qa/runtime/feature.rb b/qa/qa/runtime/feature.rb
index 1b4ae7adbbe..b74f343ba7b 100644
--- a/qa/qa/runtime/feature.rb
+++ b/qa/qa/runtime/feature.rb
@@ -18,6 +18,11 @@ module QA
set_feature(key, false)
end
+ def enabled?(key)
+ feature = JSON.parse(get_features).find { |flag| flag["name"] == key }
+ feature && feature["state"] == "on"
+ end
+
private
def api_client
@@ -31,6 +36,12 @@ module QA
raise SetFeatureError, "Setting feature flag #{key} to #{value} failed with `#{response}`."
end
end
+
+ def get_features
+ request = Runtime::API::Request.new(api_client, "/features")
+ response = get(request.url)
+ response.body
+ end
end
end
end
diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb
index cdb85902758..317e31feea8 100644
--- a/qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb
+++ b/qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb
@@ -1,8 +1,7 @@
# frozen_string_literal: true
module QA
- # Failure issue https://gitlab.com/gitlab-org/quality/staging/issues/68
- context 'Plan', :quarantine do
+ context 'Plan' do
describe 'filter issue comments activities' do
let(:issue_title) { 'issue title' }
diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/mentions_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/mentions_spec.rb
new file mode 100644
index 00000000000..b68a24ec538
--- /dev/null
+++ b/qa/qa/specs/features/browser_ui/2_plan/issue/mentions_spec.rb
@@ -0,0 +1,58 @@
+# frozen_string_literal: true
+
+module QA
+ context 'Plan' do
+ describe 'mention' do
+ let(:user) do
+ Resource::User.fabricate_via_api! do |user|
+ user.name = "bob"
+ user.password = "1234test"
+ end
+ end
+
+ before do
+ QA::Runtime::Env.personal_access_token = QA::Runtime::Env.admin_personal_access_token
+
+ unless QA::Runtime::Env.personal_access_token
+ Runtime::Browser.visit(:gitlab, Page::Main::Login)
+ Page::Main::Login.perform(&:sign_in_using_admin_credentials)
+ end
+
+ QA::Runtime::Env.personal_access_token = nil
+
+ Page::Main::Menu.perform(&:sign_out) if Page::Main::Menu.perform { |p| p.has_personal_area?(wait: 0) }
+
+ Runtime::Browser.visit(:gitlab, Page::Main::Login)
+
+ Page::Main::Login.perform(&:sign_in_using_credentials)
+
+ project = Resource::Project.fabricate_via_api! do |resource|
+ resource.name = 'project-to-test-mention'
+ end
+ project.visit!
+
+ Page::Project::Show.perform(&:go_to_members_settings)
+ Page::Project::Settings::Members.perform do |members|
+ members.add_member(user.username)
+ end
+
+ issue = Resource::Issue.fabricate_via_api! do |issue|
+ issue.title = 'issue to test mention'
+ issue.project = project
+ end
+ issue.visit!
+ end
+
+ it 'user mentions another user in an issue' do
+ Page::Project::Issue::Show.perform do |show|
+ at_username = "@#{user.username}"
+
+ show.select_all_activities_filter
+ show.comment(at_username)
+
+ expect(show).to have_link(at_username)
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/support/retrier.rb b/qa/qa/support/retrier.rb
index 720f1d17037..3b02cb4855b 100644
--- a/qa/qa/support/retrier.rb
+++ b/qa/qa/support/retrier.rb
@@ -24,7 +24,7 @@ module QA
end
end
- def retry_until(max_attempts: 3, reload_page: nil, sleep_interval: 0)
+ def retry_until(max_attempts: 3, reload_page: nil, sleep_interval: 0, exit_on_failure: false)
QA::Runtime::Logger.debug("with retry_until: max_attempts #{max_attempts}; sleep_interval #{sleep_interval}; reload_page:#{reload_page}")
attempts = 0
@@ -40,6 +40,11 @@ module QA
attempts += 1
end
+ if exit_on_failure
+ QA::Runtime::Logger.debug("Raising exception after #{max_attempts} attempts")
+ raise
+ end
+
false
end
end
diff --git a/qa/spec/runtime/feature_spec.rb b/qa/spec/runtime/feature_spec.rb
index 192299b7857..94638d99b01 100644
--- a/qa/spec/runtime/feature_spec.rb
+++ b/qa/spec/runtime/feature_spec.rb
@@ -3,7 +3,8 @@
describe QA::Runtime::Feature do
let(:api_client) { double('QA::Runtime::API::Client') }
let(:request) { Struct.new(:url).new('http://api') }
- let(:response) { Struct.new(:code).new(201) }
+ let(:response_post) { Struct.new(:code).new(201) }
+ let(:response_get) { Struct.new(:code, :body).new(200, '[{ "name": "a-flag", "state": "on" }]') }
before do
allow(described_class).to receive(:api_client).and_return(api_client)
@@ -18,7 +19,7 @@ describe QA::Runtime::Feature do
expect(described_class)
.to receive(:post)
.with(request.url, { value: true })
- .and_return(response)
+ .and_return(response_post)
subject.enable('a-flag')
end
@@ -33,9 +34,23 @@ describe QA::Runtime::Feature do
expect(described_class)
.to receive(:post)
.with(request.url, { value: false })
- .and_return(response)
+ .and_return(response_post)
subject.disable('a-flag')
end
end
+
+ describe '.enabled?' do
+ it 'returns a feature flag state' do
+ expect(QA::Runtime::API::Request)
+ .to receive(:new)
+ .with(api_client, "/features")
+ .and_return(request)
+ expect(described_class)
+ .to receive(:get)
+ .and_return(response_get)
+
+ expect(subject.enabled?('a-flag')).to be_truthy
+ end
+ end
end