Commit d4b9ab5f authored by Walmyr Lima e Silva Filho's avatar Walmyr Lima e Silva Filho

Merge branch 'qa/e2e-tests-for-issue-weights' into 'master'

End-to-end test for visualizing issue weight on different pages

Closes gitlab-org/quality/testcases#174

See merge request gitlab-org/gitlab-ee!16155
parents 87c5b54d 8b44c80b
......@@ -41,7 +41,7 @@
= link_to _('Edit'), '#', class: 'js-sidebar-dropdown-toggle edit-link float-right', data: { track_label: "right_sidebar", track_property: "milestone", track_event: "click_edit_button", track_value: "" }
.value.hide-collapsed
- if milestone.present?
= link_to milestone[:title], milestone[:web_url], class: "bold has-tooltip", title: sidebar_milestone_remaining_days(milestone), data: { container: "body", html: 'true', boundary: 'viewport' }
= link_to milestone[:title], milestone[:web_url], class: "bold has-tooltip", title: sidebar_milestone_remaining_days(milestone), data: { container: "body", html: 'true', boundary: 'viewport', qa_selector: 'milestone_link' }
- else
%span.no-value
= _('None')
......
......@@ -167,9 +167,8 @@ export default {
class="float-right js-weight-edit-link"
href="#"
@click="onEditClick(!shouldShowEditField)"
>{{ __('Edit') }}</a
>
{{ __('Edit') }}
</a>
</div>
<div v-if="shouldShowEditField" class="hide-collapsed">
<input
......@@ -188,15 +187,17 @@ export default {
</div>
<div v-if="shouldShowWeight" class="value hide-collapsed js-weight-weight-label">
<span v-if="!isNoValue">
<strong class="js-weight-weight-label-value">{{ weight }}</strong>
<strong class="js-weight-weight-label-value" data-qa-selector="weight_label_value">{{
weight
}}</strong>
<span v-if="editable">
-
<a class="btn-default-hover-link js-weight-remove-link" href="#" @click="removeWeight">
{{ __('remove weight') }}
</a>
<a class="btn-default-hover-link js-weight-remove-link" href="#" @click="removeWeight">{{
__('remove weight')
}}</a>
</span>
</span>
<span v-else class="no-value"> {{ noValueLabel }} </span>
<span v-else class="no-value">{{ noValueLabel }}</span>
</div>
</div>
</template>
- issue = local_assigns.fetch(:issue)
- if issue.weight
%span.issuable-weight.d-none.d-sm-inline-block.has-tooltip{ data: { container: 'body' }, title: _('Weight') }
%span.issuable-weight.d-none.d-sm-inline-block.has-tooltip{ data: { container: 'body', qa_selector: 'issuable_weight' }, title: _('Weight') }
&nbsp;
= sprite_icon('weight', size: 16, css_class: 'issue-weight-icon')
= issue.weight
......@@ -13,7 +13,7 @@
None
.title.hide-collapsed
Total issue weight
.value.hide-collapsed
.value.hide-collapsed{ data: { qa_selector: 'total_issue_weight_value' } }
- unless total_weight.zero?
%strong.bold= total_weight
- else
......
......@@ -97,6 +97,10 @@ module QA
autoload :Show, 'qa/ee/page/project/wiki/show'
end
module Milestone
autoload :Index, 'qa/ee/page/project/milestone/index'
end
module Settings
autoload :ProtectedBranches, 'qa/ee/page/project/settings/protected_branches'
autoload :MirroringRepositories, 'qa/ee/page/project/settings/mirroring_repositories'
......
......@@ -12,9 +12,17 @@ module QA
element :issue_filter_form, /form_tag.+class: 'filter-form / # rubocop:disable QA/ElementWithPattern
element :issue_filter_input, /%input.form-control.filtered-search/ # rubocop:disable QA/ElementWithPattern
end
view 'ee/app/views/projects/issues/_issue_weight.html.haml' do
element :issuable_weight
end
end
end
def issuable_weight
find_element(:issuable_weight)
end
def wait_for_issue_replication(issue)
wait do
filter_by_title(issue.title)
......
......@@ -11,6 +11,10 @@ module QA
view 'ee/app/assets/javascripts/related_issues/components/related_issues_block.vue' do
element :related_issues_loading_icon
end
view 'ee/app/assets/javascripts/sidebar/components/weight/weight.vue' do
element :weight_label_value
end
end
end
......@@ -19,6 +23,10 @@ module QA
has_no_element?(:related_issues_loading_icon)
end
end
def weight_label_value
find_element(:weight_label_value)
end
end
end
end
......
# frozen_string_literal: true
module QA
module EE
module Page
module Project
module Milestone
module Index
def self.prepended(page)
page.module_eval do
view 'ee/app/views/shared/milestones/_weight.html.haml' do
element :total_issue_weight_value
end
end
end
def total_issue_weight_value
find_element(:total_issue_weight_value)
end
end
end
end
end
end
end
......@@ -35,12 +35,17 @@ module QA
element :labels_block
element :edit_link_labels
element :dropdown_menu_labels
element :milestone_link
end
view 'app/views/shared/issuable/_close_reopen_button.html.haml' do
element :reopen_issue_button
end
def click_milestone_link
click_element(:milestone_link)
end
# Adds a comment to an issue
# attachment option should be an absolute path
def comment(text, attachment: nil, filter: :all_activities)
......
......@@ -17,3 +17,5 @@ module QA
end
end
end
QA::Page::Project::Milestone::Index.prepend_if_ee('QA::EE::Page::Project::Milestone::Index')
......@@ -3,7 +3,7 @@
module QA
module Resource
class Issue < Base
attr_writer :description, :milestone
attr_writer :description, :milestone, :weight
attribute :project do
Project.fabricate! do |resource|
......@@ -46,6 +46,7 @@ module QA
title: title
}.tap do |hash|
hash[:milestone_id] = @milestone.id if @milestone
hash[:weight] = @weight if @weight
end
end
end
......
# frozen_string_literal: true
module QA
context 'Plan' do
describe 'Issues weights' do
before do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.perform(&:sign_in_using_credentials)
end
let(:project) do
QA::Resource::Project.fabricate_via_api! do |project|
project.name = 'the-lord-of-the-rings'
end
end
let(:milestone) do
QA::EE::Resource::ProjectMilestone.fabricate_via_api! do |m|
m.project = project
m.title = 'the-fellowship-of-the-ring'
end
end
let(:weight) { 1000 }
let(:issue) do
Resource::Issue.fabricate_via_api! do |issue|
issue.milestone = milestone
issue.project = project
issue.title = 'keep-the-ring-safe'
issue.weight = weight
end
end
it 'shows the set weight in the issue page, in the milestone page, and in the issues list page' do
issue.visit!
Page::Project::Issue::Show.perform do |show|
expect(show.weight_label_value).to have_content(weight)
show.click_milestone_link
end
Page::Project::Milestone::Index.perform do |index|
expect(index.total_issue_weight_value).to have_content(weight)
end
Page::Project::Menu.perform(&:click_issues)
Page::Project::Issue::Index.perform do |index|
expect(index.issuable_weight).to have_content(weight)
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