Commit 2590ff59 authored by Walmyr Lima e Silva Filho's avatar Walmyr Lima e Silva Filho

Merge branch 'test-for-burndown-chart' into 'master'

Add automated test  for the burndown chart starter feature

Closes gitlab-org/quality/testcases#175

See merge request gitlab-org/gitlab!18009
parents d6ee7289 fd3d0f26
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
.btn-group.js-burndown-data-selector .btn-group.js-burndown-data-selector
%button.btn.btn-sm.btn-primary{ data: { show: 'count' } } %button.btn.btn-sm.btn-primary{ data: { show: 'count' } }
Issues Issues
%button.btn.btn-sm.btn-primary.btn-inverted{ data: { show: 'weight' } } %button.btn.btn-sm.btn-primary.btn-inverted{ data: { show: 'weight', qa_selector: 'weight_button' } }
Issue weight Issue weight
.burndown-chart{ data: { start_date: burndown.start_date.strftime("%Y-%m-%d"), .burndown-chart{ data: { start_date: burndown.start_date.strftime("%Y-%m-%d"),
due_date: burndown.due_date.strftime("%Y-%m-%d"), due_date: burndown.due_date.strftime("%Y-%m-%d"),
burndown_events_path: expose_url(burndown_endpoint) } } burndown_events_path: expose_url(burndown_endpoint), qa_selector: 'burndown_chart' } }
- elsif show_burndown_placeholder?(milestone, warning) - elsif show_burndown_placeholder?(milestone, warning)
.burndown-hint.content-block.container-fluid .burndown-hint.content-block.container-fluid
......
...@@ -259,6 +259,7 @@ module QA ...@@ -259,6 +259,7 @@ module QA
module Milestone module Milestone
autoload :New, 'qa/page/project/milestone/new' autoload :New, 'qa/page/project/milestone/new'
autoload :Index, 'qa/page/project/milestone/index' autoload :Index, 'qa/page/project/milestone/index'
autoload :Show, 'qa/page/project/milestone/show'
end end
module Operations module Operations
...@@ -449,6 +450,7 @@ module QA ...@@ -449,6 +450,7 @@ module QA
autoload :Logging, 'qa/support/page/logging' autoload :Logging, 'qa/support/page/logging'
end end
autoload :Api, 'qa/support/api' autoload :Api, 'qa/support/api'
autoload :Dates, 'qa/support/dates'
autoload :Waiter, 'qa/support/waiter' autoload :Waiter, 'qa/support/waiter'
autoload :Retrier, 'qa/support/retrier' autoload :Retrier, 'qa/support/retrier'
end end
......
...@@ -107,7 +107,7 @@ module QA ...@@ -107,7 +107,7 @@ module QA
end end
module Milestone module Milestone
autoload :Index, 'qa/ee/page/project/milestone/index' autoload :Show, 'qa/ee/page/project/milestone/show'
end end
module Settings module Settings
......
...@@ -5,15 +5,28 @@ module QA ...@@ -5,15 +5,28 @@ module QA
module Page module Page
module Project module Project
module Milestone module Milestone
module Index module Show
def self.prepended(page) def self.prepended(page)
page.module_eval do page.module_eval do
view 'ee/app/views/shared/milestones/_burndown.html.haml' do
element :burndown_chart
element :weight_button
end
view 'ee/app/views/shared/milestones/_weight.html.haml' do view 'ee/app/views/shared/milestones/_weight.html.haml' do
element :total_issue_weight_value element :total_issue_weight_value
end end
end end
end end
def click_weight_button
click_element(:weight_button)
end
def burndown_chart
find_element(:burndown_chart)
end
def total_issue_weight_value def total_issue_weight_value
find_element(:total_issue_weight_value) find_element(:total_issue_weight_value)
end end
......
...@@ -4,7 +4,10 @@ module QA ...@@ -4,7 +4,10 @@ module QA
module EE module EE
module Resource module Resource
class ProjectMilestone < QA::Resource::Base class ProjectMilestone < QA::Resource::Base
attr_writer :start_date, :due_date
attribute :id attribute :id
attribute :iid
attribute :title attribute :title
attribute :project do attribute :project do
...@@ -30,7 +33,10 @@ module QA ...@@ -30,7 +33,10 @@ module QA
def api_post_body def api_post_body
{ {
title: title title: title
} }.tap do |hash|
hash[:start_date] = @start_date if @start_date
hash[:due_date] = @due_date if @due_date
end
end end
end end
end end
......
...@@ -17,5 +17,3 @@ module QA ...@@ -17,5 +17,3 @@ module QA
end end
end end
end end
QA::Page::Project::Milestone::Index.prepend_if_ee('QA::EE::Page::Project::Milestone::Index')
# frozen_string_literal: true
module QA
module Page
module Project
module Milestone
class Show < Page::Base
end
end
end
end
end
QA::Page::Project::Milestone::Show.prepend_if_ee('QA::EE::Page::Project::Milestone::Show')
# frozen_string_literal: true
module QA
context 'Plan' do
describe 'Burndown chart' do
include ::QA::Support::Dates
let(:project) do
Resource::Project.fabricate_via_api! do |project|
project.name = 'project-to-test-burndown-chart'
end
end
let(:milestone) do
QA::EE::Resource::ProjectMilestone.fabricate_via_api! do |m|
m.project = project
m.title = 'v1'
m.start_date = current_date_yyyy_mm_dd
m.due_date = next_month_yyyy_mm_dd
end
end
before do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.perform(&:sign_in_using_credentials)
weight_of_two = 2
create_issue('Issue 1', project, milestone, weight_of_two)
create_issue('Issue 2', project, milestone, weight_of_two)
end
it 'shows burndown chart on milestone page' do
milestone.visit!
Page::Project::Milestone::Show.perform do |show|
expect(show.burndown_chart).to be_visible
expect(show.burndown_chart).to have_content("Open issues")
show.click_weight_button
expect(show.burndown_chart).to have_content('Open issue weight')
end
end
def create_issue(title, project, milestone, weight)
Resource::Issue.fabricate_via_api! do |issue|
issue.project = project
issue.title = title
issue.milestone = milestone
issue.weight = weight
end
end
end
end
end
...@@ -4,17 +4,15 @@ module QA ...@@ -4,17 +4,15 @@ module QA
# https://gitlab.com/gitlab-org/gitlab/issues/13360 # https://gitlab.com/gitlab-org/gitlab/issues/13360
context 'Plan', :skip do context 'Plan', :skip do
describe 'Epics roadmap' do describe 'Epics roadmap' do
include Support::Dates
let(:epic) do let(:epic) do
EE::Resource::Epic.fabricate_via_api! do |epic| EE::Resource::Epic.fabricate_via_api! do |epic|
current_date = DateTime.now
current_date_yyyy_mm_dd = current_date.strftime("%Y/%m/%d")
next_month_date_yyyy_mm_dd = current_date.next_month.strftime("%Y/%m/%d")
epic.title = 'Epic created via API to test roadmap' epic.title = 'Epic created via API to test roadmap'
epic.start_date_is_fixed = true epic.start_date_is_fixed = true
epic.start_date_fixed = current_date_yyyy_mm_dd epic.start_date_fixed = current_date_yyyy_mm_dd
epic.due_date_is_fixed = true epic.due_date_is_fixed = true
epic.due_date_fixed = next_month_date_yyyy_mm_dd epic.due_date_fixed = next_month_yyyy_mm_dd
end end
end end
......
...@@ -41,8 +41,8 @@ module QA ...@@ -41,8 +41,8 @@ module QA
show.click_milestone_link show.click_milestone_link
end end
Page::Project::Milestone::Index.perform do |index| Page::Project::Milestone::Show.perform do |show|
expect(index.total_issue_weight_value).to have_content(weight) expect(show.total_issue_weight_value).to have_content(weight)
end end
Page::Project::Menu.perform(&:click_issues) Page::Project::Menu.perform(&:click_issues)
......
# frozen_string_literal: true
module QA
module Support
module Dates
def current_date_yyyy_mm_dd
current_date.strftime("%Y/%m/%d")
end
def next_month_yyyy_mm_dd
current_date.next_month.strftime("%Y/%m/%d")
end
private
def current_date
DateTime.now
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