summaryrefslogtreecommitdiff
path: root/features/steps/project/issues
diff options
context:
space:
mode:
authorCiro Santilli <ciro.santilli@gmail.com>2014-10-02 18:42:54 +0200
committerCiro Santilli <ciro.santilli@gmail.com>2014-10-05 18:21:11 +0200
commitfa34901237cc244fe8b828d079af891e63de1c8f (patch)
treeb165b52a7ff478d7338068caab39ae62b7b1d06e /features/steps/project/issues
parentac71c386f98fa9b88381abbf9d20e79f57bd7957 (diff)
downloadgitlab-ce-fa34901237cc244fe8b828d079af891e63de1c8f.tar.gz
Make Spinach test names consistent
- do not add Feature to feature titles - titleize feature titles - put steps on the same path as .feature files - make feature titles match their path
Diffstat (limited to 'features/steps/project/issues')
-rw-r--r--features/steps/project/issues/filter_labels.rb79
-rw-r--r--features/steps/project/issues/issues.rb236
-rw-r--r--features/steps/project/issues/labels.rb101
-rw-r--r--features/steps/project/issues/milestones.rb59
4 files changed, 475 insertions, 0 deletions
diff --git a/features/steps/project/issues/filter_labels.rb b/features/steps/project/issues/filter_labels.rb
new file mode 100644
index 00000000000..e62fa9c84c8
--- /dev/null
+++ b/features/steps/project/issues/filter_labels.rb
@@ -0,0 +1,79 @@
+class Spinach::Features::ProjectIssuesFilterLabels < Spinach::FeatureSteps
+ include SharedAuthentication
+ include SharedProject
+ include SharedPaths
+
+ step 'I should see "bug" in labels filter' do
+ within ".labels-filter" do
+ page.should have_content "bug"
+ end
+ end
+
+ step 'I should see "feature" in labels filter' do
+ within ".labels-filter" do
+ page.should have_content "feature"
+ end
+ end
+
+ step 'I should see "enhancement" in labels filter' do
+ within ".labels-filter" do
+ page.should have_content "enhancement"
+ end
+ end
+
+ step 'I should see "Bugfix1" in issues list' do
+ within ".issues-list" do
+ page.should have_content "Bugfix1"
+ end
+ end
+
+ step 'I should see "Bugfix2" in issues list' do
+ within ".issues-list" do
+ page.should have_content "Bugfix2"
+ end
+ end
+
+ step 'I should not see "Bugfix2" in issues list' do
+ within ".issues-list" do
+ page.should_not have_content "Bugfix2"
+ end
+ end
+
+ step 'I should not see "Feature1" in issues list' do
+ within ".issues-list" do
+ page.should_not have_content "Feature1"
+ end
+ end
+
+ step 'I click link "bug"' do
+ within ".labels-filter" do
+ click_link "bug"
+ end
+ end
+
+ step 'I click link "feature"' do
+ within ".labels-filter" do
+ click_link "feature"
+ end
+ end
+
+ step 'project "Shop" has issue "Bugfix1" with labels: "bug", "feature"' do
+ project = Project.find_by(name: "Shop")
+ issue = create(:issue, title: "Bugfix1", project: project)
+ issue.labels << project.labels.find_by(title: 'bug')
+ issue.labels << project.labels.find_by(title: 'feature')
+ end
+
+ step 'project "Shop" has issue "Bugfix2" with labels: "bug", "enhancement"' do
+ project = Project.find_by(name: "Shop")
+ issue = create(:issue, title: "Bugfix2", project: project)
+ issue.labels << project.labels.find_by(title: 'bug')
+ issue.labels << project.labels.find_by(title: 'enhancement')
+ end
+
+ step 'project "Shop" has issue "Feature1" with labels: "feature"' do
+ project = Project.find_by(name: "Shop")
+ issue = create(:issue, title: "Feature1", project: project)
+ issue.labels << project.labels.find_by(title: 'feature')
+ end
+end
diff --git a/features/steps/project/issues/issues.rb b/features/steps/project/issues/issues.rb
new file mode 100644
index 00000000000..b55b3c6c8a2
--- /dev/null
+++ b/features/steps/project/issues/issues.rb
@@ -0,0 +1,236 @@
+class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
+ include SharedAuthentication
+ include SharedProject
+ include SharedNote
+ include SharedPaths
+ include SharedMarkdown
+
+ step 'I should see "Release 0.4" in issues' do
+ page.should have_content "Release 0.4"
+ end
+
+ step 'I should not see "Release 0.3" in issues' do
+ page.should_not have_content "Release 0.3"
+ end
+
+ step 'I should not see "Tweet control" in issues' do
+ page.should_not have_content "Tweet control"
+ end
+
+ step 'I click link "Closed"' do
+ click_link "Closed"
+ end
+
+ step 'I should see "Release 0.3" in issues' do
+ page.should have_content "Release 0.3"
+ end
+
+ step 'I should not see "Release 0.4" in issues' do
+ page.should_not have_content "Release 0.4"
+ end
+
+ step 'I click link "All"' do
+ click_link "All"
+ end
+
+ step 'I click link "Release 0.4"' do
+ click_link "Release 0.4"
+ end
+
+ step 'I should see issue "Release 0.4"' do
+ page.should have_content "Release 0.4"
+ end
+
+ step 'I click link "New Issue"' do
+ click_link "New Issue"
+ end
+
+ step 'I submit new issue "500 error on profile"' do
+ fill_in "issue_title", with: "500 error on profile"
+ click_button "Submit new issue"
+ end
+
+ step 'I submit new issue "500 error on profile" with label \'bug\'' do
+ fill_in "issue_title", with: "500 error on profile"
+ select 'bug', from: "Labels"
+ click_button "Submit new issue"
+ end
+
+ step 'I click link "500 error on profile"' do
+ click_link "500 error on profile"
+ end
+
+ step 'I should see label \'bug\' with issue' do
+ within '.issue-show-labels' do
+ page.should have_content 'bug'
+ end
+ end
+
+ step 'I should see issue "500 error on profile"' do
+ issue = Issue.find_by(title: "500 error on profile")
+ page.should have_content issue.title
+ page.should have_content issue.author_name
+ page.should have_content issue.project.name
+ end
+
+ step 'I fill in issue search with "Re"' do
+ filter_issue "Re"
+ end
+
+ step 'I fill in issue search with "Bu"' do
+ filter_issue "Bu"
+ end
+
+ step 'I fill in issue search with ".3"' do
+ filter_issue ".3"
+ end
+
+ step 'I fill in issue search with "Something"' do
+ filter_issue "Something"
+ end
+
+ step 'I fill in issue search with ""' do
+ filter_issue ""
+ end
+
+ step 'project "Shop" has milestone "v2.2"' do
+
+ milestone = create(:milestone, title: "v2.2", project: project)
+
+ 3.times { create(:issue, project: project, milestone: milestone) }
+ end
+
+ step 'project "Shop" has milestone "v3.0"' do
+
+ milestone = create(:milestone, title: "v3.0", project: project)
+
+ 3.times { create(:issue, project: project, milestone: milestone) }
+ end
+
+ When 'I select milestone "v3.0"' do
+ select "v3.0", from: "milestone_id"
+ end
+
+ step 'I should see selected milestone with title "v3.0"' do
+ issues_milestone_selector = "#issue_milestone_id_chzn > a"
+ find(issues_milestone_selector).should have_content("v3.0")
+ end
+
+ When 'I select first assignee from "Shop" project' do
+
+ first_assignee = project.users.first
+ select first_assignee.name, from: "assignee_id"
+ end
+
+ step 'I should see first assignee from "Shop" as selected assignee' do
+ issues_assignee_selector = "#issue_assignee_id_chzn > a"
+
+ assignee_name = project.users.first.name
+ find(issues_assignee_selector).should have_content(assignee_name)
+ end
+
+ step 'project "Shop" have "Release 0.4" open issue' do
+
+ create(:issue,
+ title: "Release 0.4",
+ project: project,
+ author: project.users.first,
+ description: "# Description header"
+ )
+ end
+
+ step 'project "Shop" have "Tweet control" open issue' do
+ create(:issue,
+ title: "Tweet control",
+ project: project,
+ author: project.users.first)
+ end
+
+ step 'project "Shop" have "Release 0.3" closed issue' do
+ create(:closed_issue,
+ title: "Release 0.3",
+ project: project,
+ author: project.users.first)
+ end
+
+ step 'empty project "Empty Project"' do
+ create :empty_project, name: 'Empty Project', namespace: @user.namespace
+ end
+
+ When 'I visit empty project page' do
+ project = Project.find_by(name: 'Empty Project')
+ visit project_path(project)
+ end
+
+ step 'I see empty project details with ssh clone info' do
+ project = Project.find_by(name: 'Empty Project')
+ all(:css, '.git-empty .clone').each do |element|
+ element.text.should include(project.url_to_repo)
+ end
+ end
+
+ When "I visit empty project's issues page" do
+ project = Project.find_by(name: 'Empty Project')
+ visit project_issues_path(project)
+ end
+
+ step 'I leave a comment with code block' do
+ within(".js-main-target-form") do
+ fill_in "note[note]", with: "```\nCommand [1]: /usr/local/bin/git , see [text](doc/text)\n```"
+ click_button "Add Comment"
+ sleep 0.05
+ end
+ end
+
+ step 'The code block should be unchanged' do
+ page.should have_content("```\nCommand [1]: /usr/local/bin/git , see [text](doc/text)\n```")
+ end
+
+ step 'project \'Shop\' has issue \'Bugfix1\' with description: \'Description for issue1\'' do
+ issue = create(:issue, title: 'Bugfix1', description: 'Description for issue1', project: project)
+ end
+
+ step 'project \'Shop\' has issue \'Feature1\' with description: \'Feature submitted for issue1\'' do
+ issue = create(:issue, title: 'Feature1', description: 'Feature submitted for issue1', project: project)
+ end
+
+ step 'I fill in issue search with \'Description for issue1\'' do
+ filter_issue 'Description for issue'
+ end
+
+ step 'I fill in issue search with \'issue1\'' do
+ filter_issue 'issue1'
+ end
+
+ step 'I fill in issue search with \'Rock and roll\'' do
+ filter_issue 'Description for issue'
+ end
+
+ step 'I should see \'Bugfix1\' in issues' do
+ page.should have_content 'Bugfix1'
+ end
+
+ step 'I should see \'Feature1\' in issues' do
+ page.should have_content 'Feature1'
+ end
+
+ step 'I should not see \'Bugfix1\' in issues' do
+ page.should_not have_content 'Bugfix1'
+ end
+
+ step 'issue \'Release 0.4\' has label \'bug\'' do
+ label = project.labels.create!(name: 'bug', color: '#990000')
+ issue = Issue.find_by!(title: 'Release 0.4')
+ issue.labels << label
+ end
+
+ step 'I click label \'bug\'' do
+ within ".issues-list" do
+ click_link 'bug'
+ end
+ end
+
+ def filter_issue(text)
+ fill_in 'issue_search', with: text
+ end
+end
diff --git a/features/steps/project/issues/labels.rb b/features/steps/project/issues/labels.rb
new file mode 100644
index 00000000000..3e3e90824b4
--- /dev/null
+++ b/features/steps/project/issues/labels.rb
@@ -0,0 +1,101 @@
+class Spinach::Features::ProjectIssuesLabels < Spinach::FeatureSteps
+ include SharedAuthentication
+ include SharedProject
+ include SharedPaths
+
+ step 'I visit \'bug\' label edit page' do
+ visit edit_project_label_path(project, bug_label)
+ end
+
+ step 'I remove label \'bug\'' do
+ within "#label_#{bug_label.id}" do
+ click_link 'Remove'
+ end
+ end
+
+ step 'I delete all labels' do
+ within '.labels' do
+ all('.btn-remove').each do |remove|
+ remove.click
+ sleep 0.05
+ end
+ end
+ end
+
+ step 'I should see labels help message' do
+ within '.labels' do
+ page.should have_content 'Create first label or generate default set of '\
+ 'labels'
+ end
+ end
+
+ step 'I submit new label \'support\'' do
+ fill_in 'Title', with: 'support'
+ fill_in 'Background Color', with: '#F95610'
+ click_button 'Save'
+ end
+
+ step 'I submit new label \'bug\'' do
+ fill_in 'Title', with: 'bug'
+ fill_in 'Background Color', with: '#F95610'
+ click_button 'Save'
+ end
+
+ step 'I submit new label with invalid color' do
+ fill_in 'Title', with: 'support'
+ fill_in 'Background Color', with: '#12'
+ click_button 'Save'
+ end
+
+ step 'I should see label label exist error message' do
+ within '.label-form' do
+ page.should have_content 'Title has already been taken'
+ end
+ end
+
+ step 'I should see label color error message' do
+ within '.label-form' do
+ page.should have_content 'Color is invalid'
+ end
+ end
+
+ step 'I should see label \'feature\'' do
+ within '.manage-labels-list' do
+ page.should have_content 'feature'
+ end
+ end
+
+ step 'I should see label \'bug\'' do
+ within '.manage-labels-list' do
+ page.should have_content 'bug'
+ end
+ end
+
+ step 'I should not see label \'bug\'' do
+ within '.manage-labels-list' do
+ page.should_not have_content 'bug'
+ end
+ end
+
+ step 'I should see label \'support\'' do
+ within '.manage-labels-list' do
+ page.should have_content 'support'
+ end
+ end
+
+ step 'I change label \'bug\' to \'fix\'' do
+ fill_in 'Title', with: 'fix'
+ fill_in 'Background Color', with: '#F15610'
+ click_button 'Save'
+ end
+
+ step 'I should see label \'fix\'' do
+ within '.manage-labels-list' do
+ page.should have_content 'fix'
+ end
+ end
+
+ def bug_label
+ project.labels.find_or_create_by(title: 'bug')
+ end
+end
diff --git a/features/steps/project/issues/milestones.rb b/features/steps/project/issues/milestones.rb
new file mode 100644
index 00000000000..89d7af3c9ee
--- /dev/null
+++ b/features/steps/project/issues/milestones.rb
@@ -0,0 +1,59 @@
+class Spinach::Features::ProjectIssuesMilestones < Spinach::FeatureSteps
+ include SharedAuthentication
+ include SharedProject
+ include SharedPaths
+ include SharedMarkdown
+
+ step 'I should see milestone "v2.2"' do
+ milestone = @project.milestones.find_by(title: "v2.2")
+ page.should have_content(milestone.title[0..10])
+ page.should have_content(milestone.expires_at)
+ page.should have_content("Browse Issues")
+ end
+
+ step 'I click link "v2.2"' do
+ click_link "v2.2"
+ end
+
+ step 'I click link "New Milestone"' do
+ click_link "New Milestone"
+ end
+
+ step 'I submit new milestone "v2.3"' do
+ fill_in "milestone_title", with: "v2.3"
+ click_button "Create milestone"
+ end
+
+ step 'I should see milestone "v2.3"' do
+ milestone = @project.milestones.find_by(title: "v2.3")
+ page.should have_content(milestone.title[0..10])
+ page.should have_content(milestone.expires_at)
+ page.should have_content("Browse Issues")
+ end
+
+ step 'project "Shop" has milestone "v2.2"' do
+ project = Project.find_by(name: "Shop")
+ milestone = create(:milestone,
+ title: "v2.2",
+ project: project,
+ description: "# Description header"
+ )
+ 3.times { create(:issue, project: project, milestone: milestone) }
+ end
+
+ step 'the milestone has open and closed issues' do
+ project = Project.find_by(name: "Shop")
+ milestone = project.milestones.find_by(title: 'v2.2')
+
+ # 3 Open issues created above; create one closed issue
+ create(:closed_issue, project: project, milestone: milestone)
+ end
+
+ When 'I click link "All Issues"' do
+ click_link 'All Issues'
+ end
+
+ step 'I should see 3 issues' do
+ page.should have_selector('#tab-issues li.issue-row', count: 4)
+ end
+end