diff options
author | Rémy Coutable <remy@rymai.me> | 2017-09-12 06:35:16 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-09-12 06:35:16 +0000 |
commit | 90ac1bfb55a4bbd297e66e5a8c7206f97d21ab92 (patch) | |
tree | b705ce9621116095a3d4c6b18cb0970df6f3cc44 | |
parent | 021724eef20c9b7770119cd9ec367198f19cf442 (diff) | |
parent | c0b0e506e3bb713e5406c7f2052f01674f3d7dab (diff) | |
download | gitlab-ce-90ac1bfb55a4bbd297e66e5a8c7206f97d21ab92.tar.gz |
Merge branch 'replace_milestone.feature' into 'master'
Replace the 'project/milestone.feature' spinach test with an rspec analog
See merge request !14171
-rw-r--r-- | changelogs/unreleased/replace_milestone-feature.yml | 5 | ||||
-rw-r--r-- | features/project/milestone.feature | 16 | ||||
-rw-r--r-- | features/steps/project/project_milestone.rb | 62 | ||||
-rw-r--r-- | spec/features/projects/milestones/user_interacts_with_labels_spec.rb | 40 |
4 files changed, 45 insertions, 78 deletions
diff --git a/changelogs/unreleased/replace_milestone-feature.yml b/changelogs/unreleased/replace_milestone-feature.yml new file mode 100644 index 00000000000..effe6d65645 --- /dev/null +++ b/changelogs/unreleased/replace_milestone-feature.yml @@ -0,0 +1,5 @@ +--- +title: Replace the project/milestone.feature spinach test with an rspec analog +merge_request: 14171 +author: Vitaliy @blackst0ne Klachkov +type: other diff --git a/features/project/milestone.feature b/features/project/milestone.feature deleted file mode 100644 index 5e7b211fa27..00000000000 --- a/features/project/milestone.feature +++ /dev/null @@ -1,16 +0,0 @@ -Feature: Project Milestone - Background: - Given I sign in as a user - And I own project "Shop" - And project "Shop" has labels: "bug", "feature", "enhancement" - And project "Shop" has milestone "v2.2" - And milestone has issue "Bugfix1" with labels: "bug", "feature" - And milestone has issue "Bugfix2" with labels: "bug", "enhancement" - - @javascript - Scenario: Listing labels from labels tab - Given I visit project "Shop" milestones page - And I click link "v2.2" - And I click link "Labels" - Then I should see the list of labels - And I should see the labels "bug", "enhancement" and "feature" diff --git a/features/steps/project/project_milestone.rb b/features/steps/project/project_milestone.rb deleted file mode 100644 index b2d08515e77..00000000000 --- a/features/steps/project/project_milestone.rb +++ /dev/null @@ -1,62 +0,0 @@ -class Spinach::Features::ProjectMilestone < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedPaths - include WaitForRequests - - step 'milestone has issue "Bugfix1" with labels: "bug", "feature"' do - project = Project.find_by(name: "Shop") - milestone = project.milestones.find_by(title: 'v2.2') - issue = create(:issue, title: "Bugfix1", project: project, milestone: milestone) - issue.labels << project.labels.find_by(title: 'bug') - issue.labels << project.labels.find_by(title: 'feature') - end - - step 'milestone has issue "Bugfix2" with labels: "bug", "enhancement"' do - project = Project.find_by(name: "Shop") - milestone = project.milestones.find_by(title: 'v2.2') - issue = create(:issue, title: "Bugfix2", project: project, milestone: milestone) - issue.labels << project.labels.find_by(title: 'bug') - issue.labels << project.labels.find_by(title: 'enhancement') - 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 'I should see the list of labels' do - expect(page).to have_selector('ul.manage-labels-list') - end - - step 'I should see the labels "bug", "enhancement" and "feature"' do - wait_for_requests - - page.within('#tab-issues') do - expect(page).to have_content 'bug' - expect(page).to have_content 'enhancement' - expect(page).to have_content 'feature' - end - end - - step 'I should see the "bug" label listed only once' do - page.within('#tab-labels') do - expect(page).to have_content('bug', count: 1) - end - end - - step 'I click link "v2.2"' do - click_link "v2.2" - end - - step 'I click link "Labels"' do - page.within('.nav-sidebar') do - page.find(:xpath, "//a[@href='#tab-labels']").click - end - end -end diff --git a/spec/features/projects/milestones/user_interacts_with_labels_spec.rb b/spec/features/projects/milestones/user_interacts_with_labels_spec.rb new file mode 100644 index 00000000000..f6a82f80d65 --- /dev/null +++ b/spec/features/projects/milestones/user_interacts_with_labels_spec.rb @@ -0,0 +1,40 @@ +require 'spec_helper' + +describe 'User interacts with labels' do + let(:user) { create(:user) } + let(:project) { create(:project, namespace: user.namespace) } + let(:milestone) { create(:milestone, project: project, title: 'v2.2', description: '# Description header') } + let(:issue1) { create(:issue, project: project, title: 'Bugfix1', milestone: milestone) } + let(:issue2) { create(:issue, project: project, title: 'Bugfix2', milestone: milestone) } + let(:label_bug) { create(:label, project: project, title: 'bug') } + let(:label_feature) { create(:label, project: project, title: 'feature') } + let(:label_enhancement) { create(:label, project: project, title: 'enhancement') } + + before do + project.add_master(user) + sign_in(user) + + issue1.labels << [label_bug, label_feature] + issue2.labels << [label_bug, label_enhancement] + + visit(project_milestones_path(project)) + end + + it 'shows the list of labels', :js do + click_link('v2.2') + + page.within('.nav-sidebar') do + page.find(:xpath, "//a[@href='#tab-labels']").click + end + + expect(page).to have_selector('ul.manage-labels-list') + + wait_for_requests + + page.within('#tab-labels') do + expect(page).to have_content(label_bug.title) + expect(page).to have_content(label_enhancement.title) + expect(page).to have_content(label_feature.title) + end + end +end |