Commit cb75b51b authored by Ramya Authappan's avatar Ramya Authappan

Merge branch 'qa-consolidate-shared-issuable-spec-code' into 'master'

Consolidate shared issuable spec code

See merge request gitlab-org/gitlab!34427
parents d01c3c72 4b34411d
...@@ -354,6 +354,7 @@ module QA ...@@ -354,6 +354,7 @@ module QA
end end
module Issuable module Issuable
autoload :New, 'qa/page/issuable/new'
autoload :Sidebar, 'qa/page/issuable/sidebar' autoload :Sidebar, 'qa/page/issuable/sidebar'
end end
......
# frozen_string_literal: true
module QA
module Page
module Issuable
class New < Page::Base
view 'app/views/shared/issuable/form/_title.html.haml' do
element :issuable_form_title
end
view 'app/views/shared/issuable/form/_metadata.html.haml' do
element :issuable_milestone_dropdown
end
view 'app/views/shared/form_elements/_description.html.haml' do
element :issuable_form_description
end
view 'app/views/shared/issuable/_milestone_dropdown.html.haml' do
element :issuable_dropdown_menu_milestone
end
view 'app/views/shared/issuable/_label_dropdown.html.haml' do
element :issuable_label
end
view 'app/views/shared/issuable/form/_metadata_issuable_assignee.html.haml' do
element :assign_to_me_link
end
def fill_title(title)
fill_element :issuable_form_title, title
end
def fill_description(description)
fill_element :issuable_form_description, description
end
def choose_milestone(milestone)
click_element :issuable_milestone_dropdown
within_element(:issuable_dropdown_menu_milestone) do
click_on milestone.title
end
end
def select_label(label)
click_element :issuable_label
click_link label.title
end
def assign_to_me
click_element :assign_to_me_link
end
end
end
end
end
...@@ -3,62 +3,13 @@ ...@@ -3,62 +3,13 @@
module QA module QA
module Page module Page
module MergeRequest module MergeRequest
class New < Page::Base class New < Page::Issuable::New
view 'app/views/shared/issuable/_form.html.haml' do view 'app/views/shared/issuable/_form.html.haml' do
element :issuable_create_button element :issuable_create_button
end end
view 'app/views/shared/issuable/form/_title.html.haml' do
element :issuable_form_title
end
view 'app/views/shared/issuable/form/_metadata.html.haml' do
element :issuable_milestone_dropdown
end
view 'app/views/shared/form_elements/_description.html.haml' do
element :issuable_form_description
end
view 'app/views/shared/issuable/_milestone_dropdown.html.haml' do
element :issuable_dropdown_menu_milestone
end
view 'app/views/shared/issuable/_label_dropdown.html.haml' do
element :issuable_label
end
view 'app/views/shared/issuable/form/_metadata_issuable_assignee.html.haml' do
element :assign_to_me_link
end
def create_merge_request def create_merge_request
click_element :issuable_create_button click_element :issuable_create_button, Page::MergeRequest::Show
end
def fill_title(title)
fill_element :issuable_form_title, title
end
def fill_description(description)
fill_element :issuable_form_description, description
end
def choose_milestone(milestone)
click_element :issuable_milestone_dropdown
within_element(:issuable_dropdown_menu_milestone) do
click_on milestone.title
end
end
def select_label(label)
click_element :issuable_label
click_link label.title
end
def assign_to_me
click_element :assign_to_me_link
end end
end end
end end
......
...@@ -4,27 +4,11 @@ module QA ...@@ -4,27 +4,11 @@ module QA
module Page module Page
module Project module Project
module Issue module Issue
class New < Page::Base class New < Page::Issuable::New
view 'app/views/shared/issuable/_form.html.haml' do view 'app/views/shared/issuable/_form.html.haml' do
element :issuable_create_button element :issuable_create_button
end end
view 'app/views/shared/issuable/form/_title.html.haml' do
element :issue_title_textbox, 'form.text_field :title' # rubocop:disable QA/ElementWithPattern
end
view 'app/views/shared/form_elements/_description.html.haml' do
element :issue_description_textarea, "render 'shared/zen', f: form, attr: :description" # rubocop:disable QA/ElementWithPattern
end
def add_title(title)
fill_in 'issue_title', with: title
end
def add_description(description)
fill_in 'issue_description', with: description
end
def create_new_issue def create_new_issue
click_element :issuable_create_button, Page::Project::Issue::Show click_element :issuable_create_button, Page::Project::Issue::Show
end end
......
...@@ -32,8 +32,8 @@ module QA ...@@ -32,8 +32,8 @@ module QA
Page::Project::Show.perform(&:go_to_new_issue) Page::Project::Show.perform(&:go_to_new_issue)
Page::Project::Issue::New.perform do |new_page| Page::Project::Issue::New.perform do |new_page|
new_page.add_title(@title) new_page.fill_title(@title)
new_page.add_description(@description) new_page.fill_description(@description)
new_page.create_new_issue new_page.create_new_issue
end end
end end
......
...@@ -16,10 +16,10 @@ module QA ...@@ -16,10 +16,10 @@ module QA
it 'shows issue suggestions when creating a new issue' do it 'shows issue suggestions when creating a new issue' do
Page::Project::Show.perform(&:go_to_new_issue) Page::Project::Show.perform(&:go_to_new_issue)
Page::Project::Issue::New.perform do |new_page| Page::Project::Issue::New.perform do |new_page|
new_page.add_title("issue") new_page.fill_title("issue")
expect(new_page).to have_content(issue_title) expect(new_page).to have_content(issue_title)
new_page.add_title("Issue Board") new_page.fill_title("Issue Board")
expect(new_page).not_to have_content(issue_title) expect(new_page).not_to have_content(issue_title)
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment