2015-04-26 12:48:37 +05:30
|
|
|
class Spinach::Features::ProjectCommitsBranches < Spinach::FeatureSteps
|
|
|
|
include SharedAuthentication
|
|
|
|
include SharedProject
|
|
|
|
include SharedPaths
|
|
|
|
|
|
|
|
step 'I click link "All"' do
|
|
|
|
click_link "All"
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see "Shop" all branches list' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content "Branches"
|
|
|
|
expect(page).to have_content "master"
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I click link "Protected"' do
|
|
|
|
click_link "Protected"
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see "Shop" protected branches list' do
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within ".protected-branches-list" do
|
|
|
|
expect(page).to have_content "stable"
|
|
|
|
expect(page).not_to have_content "master"
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'project "Shop" has protected branches' do
|
|
|
|
project = Project.find_by(name: "Shop")
|
2016-09-13 17:45:13 +05:30
|
|
|
create(:protected_branch, project: project, name: "stable")
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I click new branch link' do
|
|
|
|
click_link "New branch"
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I submit new branch form' do
|
|
|
|
fill_in 'branch_name', with: 'deploy_keys'
|
2017-08-17 22:00:37 +05:30
|
|
|
select_branch('master')
|
2015-04-26 12:48:37 +05:30
|
|
|
click_button 'Create branch'
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I submit new branch form with invalid name' do
|
|
|
|
fill_in 'branch_name', with: '1.0 stable'
|
2017-08-17 22:00:37 +05:30
|
|
|
select_branch('master')
|
2015-04-26 12:48:37 +05:30
|
|
|
click_button 'Create branch'
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I submit new branch form with branch that already exists' do
|
|
|
|
fill_in 'branch_name', with: 'master'
|
2017-08-17 22:00:37 +05:30
|
|
|
select_branch('master')
|
2015-04-26 12:48:37 +05:30
|
|
|
click_button 'Create branch'
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see new branch created' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content 'deploy_keys'
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see new an error that branch is invalid' do
|
2016-01-14 18:37:52 +05:30
|
|
|
expect(page).to have_content 'Branch name is invalid'
|
|
|
|
expect(page).to have_content "can't contain spaces"
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see new an error that branch already exists' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content 'Branch already exists'
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
step 'I filter for branch improve/awesome' do
|
|
|
|
fill_in 'branch-search', with: 'improve/awesome'
|
|
|
|
find('#branch-search').native.send_keys(:enter)
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step "I click branch 'improve/awesome' delete link" do
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within '.js-branch-improve\/awesome' do
|
2015-04-26 12:48:37 +05:30
|
|
|
find('.btn-remove').click
|
|
|
|
sleep 0.05
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step "I should not see branch 'improve/awesome'" do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page.all(visible: true)).not_to have_content 'improve/awesome'
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
def select_branch(branch_name)
|
|
|
|
click_button 'master'
|
|
|
|
|
|
|
|
page.within '#new-branch-form .dropdown-menu' do
|
|
|
|
click_link branch_name
|
|
|
|
end
|
|
|
|
end
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|