diff options
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa.rb | 1 | ||||
-rw-r--r-- | qa/qa/factory/resource/group.rb | 26 | ||||
-rw-r--r-- | qa/qa/page/component/groups_filter.rb | 35 | ||||
-rw-r--r-- | qa/qa/page/dashboard/groups.rb | 9 | ||||
-rw-r--r-- | qa/qa/page/dashboard/projects.rb | 3 | ||||
-rw-r--r-- | qa/qa/page/group/show.rb | 6 |
6 files changed, 60 insertions, 20 deletions
@@ -250,6 +250,7 @@ module QA module Component autoload :ClonePanel, 'qa/page/component/clone_panel' autoload :Dropzone, 'qa/page/component/dropzone' + autoload :GroupsFilter, 'qa/page/component/groups_filter' autoload :Select2, 'qa/page/component/select2' end end diff --git a/qa/qa/factory/resource/group.rb b/qa/qa/factory/resource/group.rb index 531fccd2ad8..033fc48c08f 100644 --- a/qa/qa/factory/resource/group.rb +++ b/qa/qa/factory/resource/group.rb @@ -2,7 +2,7 @@ module QA module Factory module Resource class Group < Factory::Base - attr_writer :path, :description + attr_accessor :path, :description dependency Factory::Resource::Sandbox, as: :sandbox @@ -14,17 +14,23 @@ module QA def fabricate! sandbox.visit! - Page::Group::Show.perform do |page| - if page.has_subgroup?(@path) - page.go_to_subgroup(@path) + Page::Group::Show.perform do |group_show| + if group_show.has_subgroup?(path) + group_show.go_to_subgroup(path) else - page.go_to_new_subgroup + group_show.go_to_new_subgroup - Page::Group::New.perform do |group| - group.set_path(@path) - group.set_description(@description) - group.set_visibility('Public') - group.create + Page::Group::New.perform do |group_new| + group_new.set_path(path) + group_new.set_description(description) + group_new.set_visibility('Public') + group_new.create + end + + # Ensure that the group was actually created + group_show.wait(time: 1) do + group_show.has_text?(path) && + group_show.has_new_project_or_subgroup_dropdown? end end end diff --git a/qa/qa/page/component/groups_filter.rb b/qa/qa/page/component/groups_filter.rb new file mode 100644 index 00000000000..69d465e8ac7 --- /dev/null +++ b/qa/qa/page/component/groups_filter.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +module QA + module Page + module Component + module GroupsFilter + def self.included(base) + base.view 'app/views/shared/groups/_search_form.html.haml' do + element :groups_filter, 'search_field_tag :filter' + element :groups_filter_placeholder, 'Filter by name...' + end + + base.view 'app/views/shared/groups/_empty_state.html.haml' do + element :groups_empty_state + end + + base.view 'app/assets/javascripts/groups/components/groups.vue' do + element :groups_list_tree_container + end + end + + private + + def filter_by_name(name) + wait(reload: false) do + page.has_css?(element_selector_css(:groups_empty_state)) || + page.has_css?(element_selector_css(:groups_list_tree_container)) + end + + fill_in 'Filter by name...', with: name + end + end + end + end +end diff --git a/qa/qa/page/dashboard/groups.rb b/qa/qa/page/dashboard/groups.rb index e853e0d85e0..5654cc01e09 100644 --- a/qa/qa/page/dashboard/groups.rb +++ b/qa/qa/page/dashboard/groups.rb @@ -2,19 +2,12 @@ module QA module Page module Dashboard class Groups < Page::Base - view 'app/views/shared/groups/_search_form.html.haml' do - element :groups_filter, 'search_field_tag :filter' - element :groups_filter_placeholder, 'Filter by name...' - end + include Page::Component::GroupsFilter view 'app/views/dashboard/_groups_head.html.haml' do element :new_group_button, 'link_to _("New group")' end - def filter_by_name(name) - fill_in 'Filter by name...', with: name - end - def has_group?(name) filter_by_name(name) diff --git a/qa/qa/page/dashboard/projects.rb b/qa/qa/page/dashboard/projects.rb index 73942cb856a..5b2827c089c 100644 --- a/qa/qa/page/dashboard/projects.rb +++ b/qa/qa/page/dashboard/projects.rb @@ -3,6 +3,7 @@ module QA module Dashboard class Projects < Page::Base view 'app/views/dashboard/projects/index.html.haml' + view 'app/views/shared/projects/_search_form.html.haml' do element :form_filter_by_name, /form_tag.+id: 'project-filter-form'/ end @@ -13,6 +14,8 @@ module QA find_link(text: name).click end + private + def filter_by_name(name) page.within('form#project-filter-form') do fill_in :name, with: name diff --git a/qa/qa/page/group/show.rb b/qa/qa/page/group/show.rb index 3e0eaa392f5..ac85f16d8af 100644 --- a/qa/qa/page/group/show.rb +++ b/qa/qa/page/group/show.rb @@ -2,6 +2,8 @@ module QA module Page module Group class Show < Page::Base + include Page::Component::GroupsFilter + view 'app/views/groups/show.html.haml' do element :new_project_or_subgroup_dropdown, '.new-project-subgroup' element :new_project_or_subgroup_dropdown_toggle, '.dropdown-toggle' @@ -21,8 +23,8 @@ module QA click_link name end - def filter_by_name(name) - fill_in 'Filter by name...', with: name + def has_new_project_or_subgroup_dropdown? + page.has_css?(element_selector_css(:new_project_or_subgroup_dropdown)) end def has_subgroup?(name) |