gitlab-org--gitlab-foss/spec/features/merge_requests/mini_pipeline_graph_spec.rb
Lin Jen-Shin 70eb0c6a88 Merge remote-tracking branch 'upstream/master' into rename-builds-controller
* upstream/master: (307 commits)
  Address feedback
  Add small update for the i18n guide.
  update webpack to v2.6.1 patch release to fix "Can't find variable: Promise" error
  update webpack-bundle-analyzer past v2.4.1 to support NamedChunksPlugin
  name all webpack chunks to improve long term cacheability
  add NameAllModulesPlugin to cover shortcomings of NamedModulesPlugin
  upgrade to latest webpack version
  Only use DROP INDEX CONCURRENTLY on postgreql 9.2+
  Provide default for calculating label text color (!11681)
  Add failing test for #32728
  Bugfix: Always use the default language when generating emails.
  Remove unecessary commit pattern check
  Add regexp_for_value helper method
  Remove shared example and improve sub_group_issuables_spec.rb
  Remove 'should' from scenario in has_subgroup_title_spec.rb
  Cartfile git and binary methods cannot take a GitHub repo
  Fix terminals support for Kubernetes service
  Add review comments to compare_spec.rb
  Fix transient error clicking dropdown items in compare_spec.rb
  Use non-global jQuery reference within raven bundle
  ...
2017-05-26 18:25:32 +08:00

98 lines
2.8 KiB
Ruby

require 'rails_helper'
feature 'Mini Pipeline Graph', :js, :feature do
let(:user) { create(:user) }
let(:project) { create(:project, :public) }
let(:merge_request) { create(:merge_request, source_project: project, head_pipeline: pipeline) }
let(:pipeline) { create(:ci_empty_pipeline, project: project, ref: 'master', status: 'running', sha: project.commit.id) }
let(:build) { create(:ci_build, pipeline: pipeline, stage: 'test', commands: 'test') }
before do
build.run
login_as(user)
visit namespace_project_merge_request_path(project.namespace, project, merge_request)
end
it 'should display a mini pipeline graph' do
expect(page).to have_selector('.mr-widget-pipeline-graph')
end
describe 'build list toggle' do
let(:toggle) do
find('.mini-pipeline-graph-dropdown-toggle')
first('.mini-pipeline-graph-dropdown-toggle')
end
it 'should expand when hovered' do
before_width = evaluate_script("$('.mini-pipeline-graph-dropdown-toggle:visible').outerWidth();")
toggle.hover
after_width = evaluate_script("$('.mini-pipeline-graph-dropdown-toggle:visible').outerWidth();")
expect(before_width).to be < after_width
end
it 'should show dropdown caret when hovered' do
toggle.hover
expect(toggle).to have_selector('.fa-caret-down')
end
it 'should show tooltip when hovered' do
toggle.hover
expect(toggle.find(:xpath, '..')).to have_selector('.tooltip')
end
end
describe 'builds list menu' do
let(:toggle) do
find('.mini-pipeline-graph-dropdown-toggle')
first('.mini-pipeline-graph-dropdown-toggle')
end
before do
toggle.click
wait_for_requests
end
it 'should open when toggle is clicked' do
expect(toggle.find(:xpath, '..')).to have_selector('.mini-pipeline-graph-dropdown-menu')
end
it 'should close when toggle is clicked again' do
toggle.trigger('click')
expect(toggle.find(:xpath, '..')).not_to have_selector('.mini-pipeline-graph-dropdown-menu')
end
it 'should close when clicking somewhere else' do
find('body').click
expect(toggle.find(:xpath, '..')).not_to have_selector('.mini-pipeline-graph-dropdown-menu')
end
describe 'build list build item' do
let(:build_item) do
find('.mini-pipeline-graph-dropdown-item')
first('.mini-pipeline-graph-dropdown-item')
end
it 'should visit the build page when clicked' do
build_item.click
find('.build-page')
expect(current_path).to eql(namespace_project_job_path(project.namespace, project, build))
end
it 'should show tooltip when hovered' do
build_item.hover
expect(build_item.find(:xpath, '..')).to have_selector('.tooltip')
end
end
end
end