debian-mirror-gitlab/spec/features/projects/compare_spec.rb

65 lines
2.1 KiB
Ruby
Raw Normal View History

2016-08-24 12:49:21 +05:30
require "spec_helper"
describe "Compare", js: true do
let(:user) { create(:user) }
2017-09-10 17:25:29 +05:30
let(:project) { create(:project, :repository) }
2016-08-24 12:49:21 +05:30
before do
project.team << [user, :master]
2017-09-10 17:25:29 +05:30
sign_in user
visit project_compare_index_path(project, from: "master", to: "master")
2016-08-24 12:49:21 +05:30
end
describe "branches" do
2016-09-13 17:45:13 +05:30
it "pre-populates fields" do
2016-11-03 12:29:30 +05:30
expect(find(".js-compare-from-dropdown .dropdown-toggle-text")).to have_content("master")
expect(find(".js-compare-to-dropdown .dropdown-toggle-text")).to have_content("master")
2016-08-24 12:49:21 +05:30
end
2016-09-13 17:45:13 +05:30
it "compares branches" do
2016-11-03 12:29:30 +05:30
select_using_dropdown "from", "feature"
expect(find(".js-compare-from-dropdown .dropdown-toggle-text")).to have_content("feature")
2016-08-24 12:49:21 +05:30
2016-11-03 12:29:30 +05:30
select_using_dropdown "to", "binary-encoding"
expect(find(".js-compare-to-dropdown .dropdown-toggle-text")).to have_content("binary-encoding")
2016-08-24 12:49:21 +05:30
click_button "Compare"
2017-09-10 17:25:29 +05:30
2016-08-24 12:49:21 +05:30
expect(page).to have_content "Commits"
end
2017-08-17 22:00:37 +05:30
it "filters branches" do
select_using_dropdown("from", "wip")
find(".js-compare-from-dropdown .compare-dropdown-toggle").click
expect(find(".js-compare-from-dropdown .dropdown-content")).to have_selector("li", count: 3)
end
2016-08-24 12:49:21 +05:30
end
describe "tags" do
2016-09-13 17:45:13 +05:30
it "compares tags" do
2016-11-03 12:29:30 +05:30
select_using_dropdown "from", "v1.0.0"
expect(find(".js-compare-from-dropdown .dropdown-toggle-text")).to have_content("v1.0.0")
2016-08-24 12:49:21 +05:30
2016-11-03 12:29:30 +05:30
select_using_dropdown "to", "v1.1.0"
expect(find(".js-compare-to-dropdown .dropdown-toggle-text")).to have_content("v1.1.0")
2016-08-24 12:49:21 +05:30
click_button "Compare"
expect(page).to have_content "Commits"
end
end
2016-11-03 12:29:30 +05:30
def select_using_dropdown(dropdown_type, selection)
dropdown = find(".js-compare-#{dropdown_type}-dropdown")
dropdown.find(".compare-dropdown-toggle").click
2017-09-10 17:25:29 +05:30
# find input before using to wait for the inputs visiblity
dropdown.find('.dropdown-menu')
2016-11-03 12:29:30 +05:30
dropdown.fill_in("Filter by Git revision", with: selection)
2017-09-10 17:25:29 +05:30
wait_for_requests
# find before all to wait for the items visiblity
dropdown.find("a[data-ref=\"#{selection}\"]", match: :first)
dropdown.all("a[data-ref=\"#{selection}\"]").last.click
2016-11-03 12:29:30 +05:30
end
2016-08-24 12:49:21 +05:30
end