2015-04-26 12:48:37 +05:30
|
|
|
class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
|
|
|
|
include SharedAuthentication
|
|
|
|
include SharedProject
|
|
|
|
include SharedPaths
|
2015-09-11 14:41:01 +05:30
|
|
|
include SharedDiffNote
|
2015-04-26 12:48:37 +05:30
|
|
|
include RepoHelpers
|
|
|
|
|
|
|
|
step 'I see project commits' do
|
|
|
|
commit = @project.repository.commit
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content(@project.name)
|
|
|
|
expect(page).to have_content(commit.message[0..20])
|
|
|
|
expect(page).to have_content(commit.short_id)
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I click atom feed link' do
|
2017-08-17 22:00:37 +05:30
|
|
|
click_link "Commits feed"
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I see commits atom feed' do
|
|
|
|
commit = @project.repository.commit
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(response_headers['Content-Type']).to have_content("application/atom+xml")
|
|
|
|
expect(body).to have_selector("title", text: "#{@project.name}:master commits")
|
|
|
|
expect(body).to have_selector("author email", text: commit.author_email)
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(body).to have_selector("entry summary", text: commit.description[0..10].delete("\r\n"))
|
2016-11-03 12:29:30 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I click on tag link' do
|
|
|
|
click_link "Tag"
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I see commit SHA pre-filled' do
|
|
|
|
expect(page).to have_selector("input[value='#{sample_commit.id}']")
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I click on commit link' do
|
2017-09-10 17:25:29 +05:30
|
|
|
visit project_commit_path(@project, sample_commit.id)
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I see commit info' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content sample_commit.message
|
|
|
|
expect(page).to have_content "Showing #{sample_commit.files_changed_count} changed files"
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
2016-04-02 18:10:28 +05:30
|
|
|
step 'I fill compare fields with branches' do
|
2016-11-03 12:29:30 +05:30
|
|
|
select_using_dropdown('from', 'feature')
|
|
|
|
select_using_dropdown('to', 'master')
|
2016-04-02 18:10:28 +05:30
|
|
|
|
|
|
|
click_button 'Compare'
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I fill compare fields with refs' do
|
2016-11-03 12:29:30 +05:30
|
|
|
select_using_dropdown('from', sample_commit.parent_id, true)
|
|
|
|
select_using_dropdown('to', sample_commit.id, true)
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
click_button "Compare"
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I unfold diff' do
|
|
|
|
@diff = first('.js-unfold')
|
|
|
|
@diff.click
|
|
|
|
sleep 2
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see additional file lines' do
|
2018-03-17 18:26:18 +05:30
|
|
|
page.within @diff.query_scope do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(first('.new_line').text).not_to have_content "..."
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I see compared refs' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content "Commits (1)"
|
|
|
|
expect(page).to have_content "Showing 2 changed files"
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
2016-04-02 18:10:28 +05:30
|
|
|
step 'I visit commits list page for feature branch' do
|
2017-09-10 17:25:29 +05:30
|
|
|
visit project_commits_path(@project, 'feature', { limit: 5 })
|
2016-04-02 18:10:28 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I see feature branch commits' do
|
|
|
|
commit = @project.repository.commit('0b4bc9a')
|
|
|
|
expect(page).to have_content(@project.name)
|
|
|
|
expect(page).to have_content(commit.message[0..12])
|
|
|
|
expect(page).to have_content(commit.short_id)
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'project have an open merge request' do
|
|
|
|
create(:merge_request,
|
|
|
|
title: 'Feature',
|
|
|
|
source_project: @project,
|
|
|
|
source_branch: 'feature',
|
|
|
|
target_branch: 'master',
|
|
|
|
author: @project.users.first
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I click the "Compare" tab' do
|
|
|
|
click_link('Compare')
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I fill compare fields with branches' do
|
2016-11-03 12:29:30 +05:30
|
|
|
select_using_dropdown('from', 'master')
|
|
|
|
select_using_dropdown('to', 'feature')
|
2016-04-02 18:10:28 +05:30
|
|
|
|
|
|
|
click_button 'Compare'
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I see compared branches' do
|
|
|
|
expect(page).to have_content 'Commits (1)'
|
|
|
|
expect(page).to have_content 'Showing 1 changed file with 5 additions and 0 deletions'
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I see button to create a new merge request' do
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_link 'Create merge request'
|
2016-04-02 18:10:28 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should not see button to create a new merge request' do
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).not_to have_link 'Create merge request'
|
2016-04-02 18:10:28 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see button to the merge request' do
|
|
|
|
merge_request = MergeRequest.find_by(title: 'Feature')
|
2017-09-10 17:25:29 +05:30
|
|
|
expect(page).to have_link "View open merge request", href: project_merge_request_path(@project, merge_request)
|
2016-04-02 18:10:28 +05:30
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I see breadcrumb links' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_selector('ul.breadcrumb')
|
|
|
|
expect(page).to have_selector('ul.breadcrumb a', count: 4)
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I see commits stats' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content 'Top 50 Committers'
|
|
|
|
expect(page).to have_content 'Committers'
|
|
|
|
expect(page).to have_content 'Total commits'
|
|
|
|
expect(page).to have_content 'Authors'
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I visit a commit with an image that changed' do
|
2017-09-10 17:25:29 +05:30
|
|
|
visit project_commit_path(@project, sample_image_commit.id)
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'The diff links to both the previous and current image' do
|
2018-03-17 18:26:18 +05:30
|
|
|
links = page.all('.file-actions a')
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(links[0]['href']).to match %r{blob/#{sample_image_commit.old_blob_id}}
|
|
|
|
expect(links[1]['href']).to match %r{blob/#{sample_image_commit.new_blob_id}}
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I see inline diff button' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content "Inline"
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
2015-09-25 12:07:36 +05:30
|
|
|
|
|
|
|
step 'I click side-by-side diff button' do
|
|
|
|
find('#parallel-diff-btn').click
|
|
|
|
end
|
2015-10-24 18:46:33 +05:30
|
|
|
|
|
|
|
step 'commit has ci status' do
|
|
|
|
@project.enable_ci
|
2018-03-17 18:26:18 +05:30
|
|
|
@pipeline = create(:ci_pipeline, project: @project, sha: sample_commit.id)
|
|
|
|
create(:ci_build, pipeline: @pipeline)
|
2015-10-24 18:46:33 +05:30
|
|
|
end
|
|
|
|
|
2015-12-23 02:04:40 +05:30
|
|
|
step 'repository contains ".gitlab-ci.yml" file' do
|
2016-06-16 23:09:34 +05:30
|
|
|
allow_any_instance_of(Ci::Pipeline).to receive(:ci_yaml_file).and_return(String.new)
|
2015-12-23 02:04:40 +05:30
|
|
|
end
|
|
|
|
|
2015-10-24 18:46:33 +05:30
|
|
|
step 'I see commit ci info' do
|
2018-03-17 18:26:18 +05:30
|
|
|
expect(page).to have_content "Pipeline ##{@pipeline.id} pending"
|
2015-10-24 18:46:33 +05:30
|
|
|
end
|
2016-01-14 18:37:52 +05:30
|
|
|
|
|
|
|
step 'I search "submodules" commits' do
|
|
|
|
fill_in 'commits-search', with: 'submodules'
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see only "submodules" commits' do
|
|
|
|
expect(page).to have_content "More submodules"
|
|
|
|
expect(page).not_to have_content "Change some files"
|
|
|
|
end
|
2016-11-03 12:29:30 +05:30
|
|
|
|
|
|
|
def select_using_dropdown(dropdown_type, selection, is_commit = false)
|
|
|
|
dropdown = find(".js-compare-#{dropdown_type}-dropdown")
|
|
|
|
dropdown.find(".compare-dropdown-toggle").click
|
2017-08-17 22:00:37 +05:30
|
|
|
dropdown.find('.dropdown-menu', visible: true)
|
2016-11-03 12:29:30 +05:30
|
|
|
dropdown.fill_in("Filter by Git revision", with: selection)
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2016-11-03 12:29:30 +05:30
|
|
|
if is_commit
|
|
|
|
dropdown.find('input[type="search"]').send_keys(:return)
|
|
|
|
else
|
|
|
|
find_link(selection, visible: true).click
|
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
dropdown.find('.dropdown-menu', visible: false)
|
2016-11-03 12:29:30 +05:30
|
|
|
end
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|