2014-10-02 12:42:54 -04:00
|
|
|
class Spinach::Features::ProjectIssuesLabels < Spinach::FeatureSteps
|
2012-09-10 11:35:03 -04:00
|
|
|
include SharedAuthentication
|
|
|
|
include SharedProject
|
|
|
|
include SharedPaths
|
|
|
|
|
2014-07-31 07:06:14 -04:00
|
|
|
step 'I visit \'bug\' label edit page' do
|
2015-01-24 13:02:58 -05:00
|
|
|
visit edit_namespace_project_label_path(project.namespace, project, bug_label)
|
2014-07-31 07:06:14 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I remove label \'bug\'' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within "#label_#{bug_label.id}" do
|
2016-05-24 09:16:22 -04:00
|
|
|
first(:link, 'Delete').click
|
2014-07-31 07:06:14 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-09-01 05:09:07 -04:00
|
|
|
step 'I delete all labels' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within '.labels' do
|
2016-04-04 13:38:16 -04:00
|
|
|
page.all('.remove-row').each do |remove|
|
2014-09-01 05:09:07 -04:00
|
|
|
remove.click
|
|
|
|
sleep 0.05
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see labels help message' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within '.labels' do
|
2016-05-22 12:41:30 -04:00
|
|
|
expect(page).to have_content 'Create a label or generate a default set '\
|
|
|
|
'of labels'
|
2014-09-01 05:09:07 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-07-31 07:06:14 -04:00
|
|
|
step 'I submit new label \'support\'' do
|
|
|
|
fill_in 'Title', with: 'support'
|
2015-12-03 08:54:14 -05:00
|
|
|
fill_in 'Background color', with: '#F95610'
|
2015-12-03 12:32:29 -05:00
|
|
|
click_button 'Create Label'
|
2014-07-31 07:06:14 -04:00
|
|
|
end
|
|
|
|
|
2014-08-13 08:12:05 -04:00
|
|
|
step 'I submit new label \'bug\'' do
|
|
|
|
fill_in 'Title', with: 'bug'
|
2015-12-03 08:54:14 -05:00
|
|
|
fill_in 'Background color', with: '#F95610'
|
2015-12-03 12:32:29 -05:00
|
|
|
click_button 'Create Label'
|
2014-08-13 08:12:05 -04:00
|
|
|
end
|
|
|
|
|
2014-08-11 17:59:30 -04:00
|
|
|
step 'I submit new label with invalid color' do
|
|
|
|
fill_in 'Title', with: 'support'
|
2015-12-03 08:54:14 -05:00
|
|
|
fill_in 'Background color', with: '#12'
|
2015-12-03 12:32:29 -05:00
|
|
|
click_button 'Create Label'
|
2014-08-11 17:59:30 -04:00
|
|
|
end
|
|
|
|
|
2014-08-13 08:12:05 -04:00
|
|
|
step 'I should see label label exist error message' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within '.label-form' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content 'Title has already been taken'
|
2014-08-13 08:12:05 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-08-11 17:59:30 -04:00
|
|
|
step 'I should see label color error message' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within '.label-form' do
|
2015-12-01 18:53:44 -05:00
|
|
|
expect(page).to have_content 'Color must be a valid color code'
|
2014-08-11 17:59:30 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-09-11 16:53:21 -04:00
|
|
|
step 'I should see label \'feature\'' do
|
2016-05-20 17:11:29 -04:00
|
|
|
page.within '.other-labels .manage-labels-list' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content 'feature'
|
2014-09-11 16:53:21 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-08-13 08:12:05 -04:00
|
|
|
step 'I should see label \'bug\'' do
|
2016-05-20 17:11:29 -04:00
|
|
|
page.within '.other-labels .manage-labels-list' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content 'bug'
|
2014-08-13 08:12:05 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-07-31 07:06:14 -04:00
|
|
|
step 'I should not see label \'bug\'' do
|
2016-05-20 17:11:29 -04:00
|
|
|
page.within '.other-labels .manage-labels-list' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).not_to have_content 'bug'
|
2014-07-31 07:06:14 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see label \'support\'' do
|
2016-05-20 17:11:29 -04:00
|
|
|
page.within '.other-labels .manage-labels-list' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content 'support'
|
2014-07-31 07:06:14 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I change label \'bug\' to \'fix\'' do
|
|
|
|
fill_in 'Title', with: 'fix'
|
2015-12-03 08:54:14 -05:00
|
|
|
fill_in 'Background color', with: '#F15610'
|
2015-12-03 12:32:29 -05:00
|
|
|
click_button 'Save changes'
|
2014-07-31 07:06:14 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see label \'fix\'' do
|
2016-05-20 17:11:29 -04:00
|
|
|
page.within '.other-labels .manage-labels-list' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content 'fix'
|
2014-07-31 07:06:14 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def bug_label
|
|
|
|
project.labels.find_or_create_by(title: 'bug')
|
|
|
|
end
|
2012-09-10 08:34:01 -04:00
|
|
|
end
|