Skip to content
Snippets Groups Projects
Commit b7dfe2ae authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent 25cb337c
No related branches found
No related tags found
No related merge requests found
Showing
with 485 additions and 10 deletions
Loading
Loading
@@ -13,7 +13,7 @@ msgstr ""
"X-Crowdin-Project: gitlab-ee\n"
"X-Crowdin-Language: zh-TW\n"
"X-Crowdin-File: /master/locale/gitlab.pot\n"
"PO-Revision-Date: 2019-06-14 20:00\n"
"PO-Revision-Date: 2019-06-18 11:44\n"
 
msgid " Please sign in."
msgstr ""
Loading
Loading
Loading
Loading
@@ -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'
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
# 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')
Loading
Loading
@@ -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')
# 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
# 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
# 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
Loading
Loading
@@ -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')
Loading
Loading
@@ -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)
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
# 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
Loading
Loading
@@ -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)
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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
# 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' }
 
Loading
Loading
# 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
Loading
Loading
@@ -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
 
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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)
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -30,7 +30,7 @@ module RuboCop
def in_type?(node)
path = node.location.expression.source_buffer.name
 
path.include?(TYPES_DIR)
path.include? TYPES_DIR
end
 
def whitelisted?(class_node)
Loading
Loading
@@ -44,7 +44,7 @@ module RuboCop
end
 
def superclass_constant(class_node)
# First one is the class name itself, second is it's superclass
# First one is the class name itself, second is its superclass
_class_constant, *others = class_node.descendants
 
others.find { |node| node.const_type? && node&.const_name != 'Types' }
Loading
Loading
# frozen_string_literal: true
# This cop checks for missing GraphQL field descriptions.
#
# @example
#
# # bad
# class AwfulClass
# field :some_field, GraphQL::STRING_TYPE
# end
#
# class TerribleClass
# argument :some_argument, GraphQL::STRING_TYPE
# end
#
# # good
# class GreatClass
# argument :some_field,
# GraphQL::STRING_TYPE,
# description: "Well described - a superb description"
#
# field :some_field,
# GraphQL::STRING_TYPE,
# description: "A thorough and compelling description"
# end
module RuboCop
module Cop
module Graphql
class Descriptions < RuboCop::Cop::Cop
MSG = 'Please add a `description` property.'
# ability_field and permission_field set a default description.
def_node_matcher :fields, <<~PATTERN
(send nil? :field $...)
PATTERN
def_node_matcher :arguments, <<~PATTERN
(send nil? :argument $...)
PATTERN
def_node_matcher :has_description?, <<~PATTERN
(hash <(pair (sym :description) _) ...>)
PATTERN
def on_send(node)
matches = fields(node) || arguments(node)
return if matches.nil?
add_offense(node, location: :expression) unless has_description?(matches.last)
end
end
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment