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
end
module Issuable
autoload :New, 'qa/page/issuable/new'
autoload :Sidebar, 'qa/page/issuable/sidebar'
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 @@
module QA
module Page
module MergeRequest
class New < Page::Base
class New < Page::Issuable::New
view 'app/views/shared/issuable/_form.html.haml' do
element :issuable_create_button
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
click_element :issuable_create_button
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
click_element :issuable_create_button, Page::MergeRequest::Show
end
end
end
......
......@@ -4,27 +4,11 @@ module QA
module Page
module Project
module Issue
class New < Page::Base
class New < Page::Issuable::New
view 'app/views/shared/issuable/_form.html.haml' do
element :issuable_create_button
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
click_element :issuable_create_button, Page::Project::Issue::Show
end
......
......@@ -32,8 +32,8 @@ module QA
Page::Project::Show.perform(&:go_to_new_issue)
Page::Project::Issue::New.perform do |new_page|
new_page.add_title(@title)
new_page.add_description(@description)
new_page.fill_title(@title)
new_page.fill_description(@description)
new_page.create_new_issue
end
end
......
......@@ -16,10 +16,10 @@ module QA
it 'shows issue suggestions when creating a new issue' do
Page::Project::Show.perform(&:go_to_new_issue)
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)
new_page.add_title("Issue Board")
new_page.fill_title("Issue Board")
expect(new_page).not_to have_content(issue_title)
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