Commit 969d192f authored by Ash McKenzie's avatar Ash McKenzie

Merge branch '296202-date-test' into 'master'

Add project pipeline statistics test case for variable length months

See merge request gitlab-org/gitlab!50704
parents 75772266 ba3d6e77
......@@ -42,13 +42,19 @@ RSpec.describe 'rendering project pipeline statistics' do
expect(graphql_data_at(:project, :pipelineAnalytics, :weekPipelinesLabels).length).to eq(8)
end
it "contains two arrays of 31 elements each for the month pipelines" do
post_graphql(query, current_user: user)
shared_examples 'monthly statistics' do |timestamp, expected_quantity|
it "contains two arrays of #{expected_quantity} elements each for the month pipelines" do
travel_to(timestamp) { post_graphql(query, current_user: user) }
expect(graphql_data_at(:project, :pipelineAnalytics, :monthPipelinesTotals).length).to eq(31)
expect(graphql_data_at(:project, :pipelineAnalytics, :monthPipelinesLabels).length).to eq(31)
expect(graphql_data_at(:project, :pipelineAnalytics, :monthPipelinesTotals).length).to eq(expected_quantity)
expect(graphql_data_at(:project, :pipelineAnalytics, :monthPipelinesLabels).length).to eq(expected_quantity)
end
end
it_behaves_like 'monthly statistics', Time.zone.local(2019, 2, 28), 32
it_behaves_like 'monthly statistics', Time.zone.local(2020, 12, 30), 31
it_behaves_like 'monthly statistics', Time.zone.local(2020, 12, 31), 32
it "contains two arrays of 13 elements each for the year pipelines" do
post_graphql(query, current_user: user)
......
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