Commit e7ca2350 authored by Walmyr Lima e Silva Filho's avatar Walmyr Lima e Silva Filho Committed by Mark Lapierre

Add end-to-end test for the related issues feature

parent f6b1a0c3
......@@ -195,6 +195,7 @@ export default {
class="js-issue-count-badge-add-button issue-count-badge-add-button btn btn-sm btn-default"
:aria-label="__('Add an issue')"
data-placement="top"
data-qa-selector="related_issues_plus_button"
@click="$emit('toggleAddRelatedIssuesForm', $event)"
>
<i class="fa fa-plus" aria-hidden="true"></i>
......
......@@ -10,8 +10,18 @@ module QA
def self.prepended(page)
page.module_eval do
view 'ee/app/assets/javascripts/related_issues/components/add_issuable_form.vue' do
element :add_issue_button
end
view 'ee/app/assets/javascripts/related_issues/components/related_issuable_input.vue' do
element :add_issue_input
end
view 'ee/app/assets/javascripts/related_issues/components/related_issues_block.vue' do
element :related_issuable_item
element :related_issues_loading_icon
element :related_issues_plus_button
end
view 'ee/app/assets/javascripts/sidebar/components/weight/weight.vue' do
......@@ -36,6 +46,16 @@ module QA
click_element(:remove_weight_link)
end
def relate_issue(issue)
click_element(:related_issues_plus_button)
fill_element(:add_issue_input, issue.web_url)
send_keys_to_element(:add_issue_input, :enter)
end
def related_issuable_item
find_element(:related_issuable_item)
end
def set_weight(weight)
click_element(:edit_weight_link)
fill_element(:weight_input_field, weight)
......
......@@ -35,6 +35,10 @@ module QA
element :more_assignees_link
end
view 'app/assets/javascripts/vue_shared/components/issue/related_issuable_item.vue' do
element :remove_issue_button
end
view 'app/helpers/dropdowns_helper.rb' do
element :dropdown_input_field
end
......@@ -76,6 +80,10 @@ module QA
click_element(:milestone_link)
end
def click_remove_issue_button
click_element(:remove_issue_button)
end
# Adds a comment to an issue
# attachment option should be an absolute path
def comment(text, attachment: nil, filter: :all_activities)
......
......@@ -15,6 +15,7 @@ module QA
end
attribute :id
attribute :iid
attribute :assignee_ids
attribute :labels
attribute :title
......
# frozen_string_literal: true
module QA
context 'Plan' do
describe 'Related issues' do
let(:project) do
Resource::Project.fabricate_via_api! do |resource|
resource.name = 'project-to-test-related-issues'
end
end
before do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.perform(&:sign_in_using_credentials)
@issue_1 = Resource::Issue.fabricate_via_api! do |issue|
issue.project = project
issue.title = 'Issue 1'
end
@issue_2 = Resource::Issue.fabricate_via_api! do |issue|
issue.project = project
issue.title = 'Issue 2'
end
end
it 'relates and unrelates one issue to/from another' do
@issue_1.visit!
Page::Project::Issue::Show.perform do |show|
show.relate_issue(@issue_2)
expect(show).to have_content("marked this issue as related to ##{@issue_2.iid}")
expect(show.related_issuable_item).to have_content(@issue_2.title)
show.click_remove_issue_button
expect(show).to have_content("removed the relation with ##{@issue_2.iid}")
expect(show).not_to have_content(@issue_2.title)
end
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