diff options
author | blackst0ne <blackst0ne.ru@gmail.com> | 2018-04-03 10:27:56 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-04-03 10:27:56 +0000 |
commit | dc4ae317ea858952acd5c91dd8034832638b3794 (patch) | |
tree | 4f62604b27b0ec1ed9f35a509380372e0bdcb638 /features | |
parent | 95b3bf26cae3c2e483df4591ec5fe492ab9746a5 (diff) | |
download | gitlab-ce-dc4ae317ea858952acd5c91dd8034832638b3794.tar.gz |
Replace the `project/issues/issues.feature` spinach test with an rspec analog
Diffstat (limited to 'features')
-rw-r--r-- | features/project/issues/issues.feature | 180 | ||||
-rw-r--r-- | features/project/issues/milestones.feature | 1 | ||||
-rw-r--r-- | features/steps/project/issues/issues.rb | 181 | ||||
-rw-r--r-- | features/steps/shared/issuable.rb | 23 | ||||
-rw-r--r-- | features/steps/shared/markdown.rb | 37 | ||||
-rw-r--r-- | features/steps/shared/note.rb | 22 | ||||
-rw-r--r-- | features/steps/shared/paths.rb | 26 | ||||
-rw-r--r-- | features/steps/shared/project.rb | 4 | ||||
-rw-r--r-- | features/steps/shared/user.rb | 4 |
9 files changed, 1 insertions, 477 deletions
diff --git a/features/project/issues/issues.feature b/features/project/issues/issues.feature deleted file mode 100644 index 819354bb780..00000000000 --- a/features/project/issues/issues.feature +++ /dev/null @@ -1,180 +0,0 @@ -@project_issues -Feature: Project Issues - Background: - Given I sign in as a user - And I own project "Shop" - And project "Shop" have "Release 0.4" open issue - And project "Shop" have "Tweet control" open issue - And project "Shop" have "Release 0.3" closed issue - And I visit project "Shop" issues page - - Scenario: I should see open issues - Given I should see "Release 0.4" in issues - And I should not see "Release 0.3" in issues - - @javascript - Scenario: I should see closed issues - Given I click link "Closed" - Then I should see "Release 0.3" in issues - And I should not see "Release 0.4" in issues - - @javascript - Scenario: I should see all issues - Given I click link "All" - Then I should see "Release 0.3" in issues - And I should see "Release 0.4" in issues - - Scenario: I visit issue page - Given I click link "Release 0.4" - Then I should see issue "Release 0.4" - - Scenario: I submit new unassigned issue - Given I click link "New Issue" - And I submit new issue "500 error on profile" - Then I should see issue "500 error on profile" - - @javascript - Scenario: I submit new unassigned issue with labels - Given project "Shop" has labels: "bug", "feature", "enhancement" - And I click link "New Issue" - And I submit new issue "500 error on profile" with label 'bug' - Then I should see issue "500 error on profile" - And I should see label 'bug' with issue - - @javascript - Scenario: I comment issue - Given I visit issue page "Release 0.4" - And I leave a comment like "XML attached" - Then I should see comment "XML attached" - And I should see an error alert section within the comment form - - @javascript - Scenario: Visiting Issues after being sorted the list - Given I visit project "Shop" issues page - And I sort the list by "Last updated" - And I visit my project's home page - And I visit project "Shop" issues page - Then The list should be sorted by "Last updated" - - @javascript - Scenario: Visiting Merge Requests after being sorted the list - Given project "Shop" has a "Bugfix MR" merge request open - And I visit project "Shop" issues page - And I sort the list by "Last updated" - And I visit project "Shop" merge requests page - Then The list should be sorted by "Last updated" - - @javascript - Scenario: Visiting Merge Requests from a differente Project after sorting - Given project "Shop" has a "Bugfix MR" merge request open - And I visit project "Shop" merge requests page - And I sort the list by "Last updated" - And I visit dashboard merge requests page - Then The list should be sorted by "Last updated" - - @javascript - Scenario: Sort issues by upvotes/downvotes - Given project "Shop" have "Bugfix" open issue - And issue "Release 0.4" have 2 upvotes and 1 downvote - And issue "Tweet control" have 1 upvote and 2 downvotes - And I sort the list by "Popularity" - Then The list should be sorted by "Popularity" - - # Markdown - - @javascript - Scenario: Headers inside the description should have ids generated for them. - Given I visit issue page "Release 0.4" - Then Header "Description header" should have correct id and link - - @javascript - Scenario: Headers inside comments should not have ids generated for them. - Given I visit issue page "Release 0.4" - And I leave a comment with a header containing "Comment with a header" - Then The comment with the header should not have an ID - - @javascript - Scenario: Blocks inside comments should not build relative links - Given I visit issue page "Release 0.4" - And I leave a comment with code block - Then The code block should be unchanged - - Scenario: Issues on empty project - Given empty project "Empty Project" - And I have an ssh key - When I visit empty project page - And I see empty project details with ssh clone info - When I visit empty project's issues page - Given I click link "New Issue" - And I submit new issue "500 error on profile" - Then I should see issue "500 error on profile" - - Scenario: Clickable labels - Given issue 'Release 0.4' has label 'bug' - And I visit project "Shop" issues page - When I click label 'bug' - And I should see "Release 0.4" in issues - And I should not see "Tweet control" in issues - - @javascript - Scenario: Issue notes should be editable with +1 - Given project "Shop" have "Release 0.4" open issue - When I visit issue page "Release 0.4" - And I leave a comment with a header containing "Comment with a header" - Then The comment with the header should not have an ID - And I edit the last comment with a +1 - Then I should see +1 in the description - - # Issue description preview - - @javascript - Scenario: I can't preview without text - Given I click link "New Issue" - And I haven't written any description text - Then The Markdown preview tab should say there is nothing to do - - @javascript - Scenario: I can preview with text - Given I click link "New Issue" - And I write a description like ":+1: Nice" - Then The Markdown preview tab should display rendered Markdown - - @javascript - Scenario: I preview an issue description - Given I click link "New Issue" - And I preview a description text like "Bug fixed :smile:" - Then I should see the Markdown preview - And I should not see the Markdown text field - - @javascript - Scenario: I can edit after preview - Given I click link "New Issue" - And I preview a description text like "Bug fixed :smile:" - Then I should see the Markdown write tab - - @javascript - Scenario: I can preview when editing an existing issue - Given I click link "Release 0.4" - And I click link "Edit" for the issue - And I preview a description text like "Bug fixed :smile:" - Then I should see the Markdown write tab - - @javascript - Scenario: I can unsubscribe from issue - Given project "Shop" have "Release 0.4" open issue - When I visit issue page "Release 0.4" - Then I should see that I am subscribed - When I click the subscription toggle - Then I should see that I am unsubscribed - - @javascript - Scenario: I submit new unassigned issue as guest - Given public project "Community" - When I visit project "Community" page - And I visit project "Community" issues page - And I click link "New Issue" - And I should not see assignee field - And I should not see milestone field - And I should not see labels field - And I submit new issue "500 error on profile" - Then I should see issue "500 error on profile" diff --git a/features/project/issues/milestones.feature b/features/project/issues/milestones.feature index d121222308d..77c8ed6e5bf 100644 --- a/features/project/issues/milestones.feature +++ b/features/project/issues/milestones.feature @@ -39,4 +39,5 @@ Feature: Project Issues Milestones Scenario: Headers inside the description should have ids generated for them. Given I click link "v2.2" + # PLEASE USE the `have_header_with_correct_id_and_link(level, text, id, parent)` matcher on migrating this spec to rspec. Then Header "Description header" should have correct id and link diff --git a/features/steps/project/issues/issues.rb b/features/steps/project/issues/issues.rb index 3cd26bb429b..baa78c23203 100644 --- a/features/steps/project/issues/issues.rb +++ b/features/steps/project/issues/issues.rb @@ -7,36 +7,14 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps include SharedMarkdown include SharedUser - step 'I should see "Release 0.4" in issues' do - expect(page).to have_content "Release 0.4" - end - step 'I should not see "Release 0.3" in issues' do expect(page).not_to have_content "Release 0.3" end - step 'I should not see "Tweet control" in issues' do - expect(page).not_to have_content "Tweet control" - end - - step 'I should see that I am subscribed' do - wait_for_requests - expect(find('.js-issuable-subscribe-button')).to have_css 'button.is-checked' - end - - step 'I should see that I am unsubscribed' do - wait_for_requests - expect(find('.js-issuable-subscribe-button')).to have_css 'button:not(.is-checked)' - end - step 'I click link "Closed"' do find('.issues-state-filters [data-state="closed"] span', text: 'Closed').click end - step 'I click the subscription toggle' do - find('.js-issuable-subscribe-button button').click - end - step 'I should see "Release 0.3" in issues' do expect(page).to have_content "Release 0.3" end @@ -51,24 +29,10 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps expect(find('.issues-state-filters > .active')).to have_content '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 - expect(page).to have_content "Release 0.4" - end - step 'I should see issue "Tweet control"' do expect(page).to have_content "Tweet control" end - step 'I click link "New issue"' do - page.within '#content-body' do - page.has_link?('New Issue') ? click_link('New Issue') : click_link('New issue') - end - end - step 'I click "author" dropdown' do page.find('.js-author-search').click sleep 1 @@ -81,18 +45,6 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps expect(users[1].text).to eq "#{current_user.name} #{current_user.to_reference}" end - step 'I submit new issue "500 error on profile"' do - fill_in "issue_title", with: "500 error on profile" - click_button "Submit issue" - end - - step 'I submit new issue "500 error on profile" with label \'bug\'' do - fill_in "issue_title", with: "500 error on profile" - click_button "Label" - click_link "bug" - click_button "Submit issue" - end - step 'I click link "500 error on profile"' do click_link "500 error on profile" end @@ -103,13 +55,6 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps end end - step 'I should see issue "500 error on profile"' do - issue = Issue.find_by(title: "500 error on profile") - expect(page).to have_content issue.title - expect(page).to have_content issue.author_name - expect(page).to have_content issue.project.name - end - step 'I fill in issue search with "Re"' do filter_issue "Re" end @@ -163,49 +108,6 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps expect(find(issues_assignee_selector)).to 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" - ) - wait_for_requests - 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 "Bugfix" open issue' do - create(:issue, - title: "Bugfix", - 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 'issue "Release 0.4" have 2 upvotes and 1 downvote' do - awardable = Issue.find_by(title: 'Release 0.4') - create_list(:award_emoji, 2, awardable: awardable) - create(:award_emoji, :downvote, awardable: awardable) - end - - step 'issue "Tweet control" have 1 upvote and 2 downvotes' do - awardable = Issue.find_by(title: 'Tweet control') - create(:award_emoji, :upvote, awardable: awardable) - create_list(:award_emoji, 2, awardable: awardable, name: 'thumbsdown') - end - step 'The list should be sorted by "Least popular"' do page.within '.issues-list' do page.within 'li.issue:nth-child(1)' do @@ -225,69 +127,16 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps end end - step 'The list should be sorted by "Popularity"' do - page.within '.issues-list' do - page.within 'li.issue:nth-child(1)' do - expect(page).to have_content 'Release 0.4' - expect(page).to have_content '2 1' - end - - page.within 'li.issue:nth-child(2)' do - expect(page).to have_content 'Tweet control' - expect(page).to have_content '1 2' - end - - page.within 'li.issue:nth-child(3)' do - expect(page).to have_content 'Bugfix' - expect(page).not_to have_content '0 0' - end - end - end - - step 'empty project "Empty Project"' do - create :project_empty_repo, 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') - page.all(:css, '.git-empty .clone').each do |element| - expect(element.text).to include(project.url_to_repo) - end - end - When "I visit project \"Community\" issues page" do project = Project.find_by(name: 'Community') visit project_issues_path(project) 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 - page.within(".js-main-target-form") do - fill_in "note[note]", with: "```\nCommand [1]: /usr/local/bin/git , see [text](doc/text)\n```" - click_button "Comment" - sleep 0.05 - end - end - - step 'I should see an error alert section within the comment form' do - page.within(".js-main-target-form") do - find(".error-alert") - end - end - - step 'The code block should be unchanged' do - expect(page).to 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 create(:issue, title: 'Bugfix1', description: 'Description for issue1', project: project) end @@ -320,36 +169,6 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps expect(page).not_to 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 - page.within ".issues-list" do - click_link 'bug' - end - end - - step 'I should not see labels field' do - page.within '.issue-form' do - expect(page).not_to have_content("Labels") - end - end - - step 'I should not see milestone field' do - page.within '.issue-form' do - expect(page).not_to have_content("Milestone") - end - end - - step 'I should not see assignee field' do - page.within '.issue-form' do - expect(page).not_to have_content("Assign to") - end - end - def filter_issue(text) fill_in 'issuable_search', with: text end diff --git a/features/steps/shared/issuable.rb b/features/steps/shared/issuable.rb index f90247c3fe8..a9174efd334 100644 --- a/features/steps/shared/issuable.rb +++ b/features/steps/shared/issuable.rb @@ -105,17 +105,6 @@ module SharedIssuable edit_issuable end - step 'I click link "Edit" for the issue' do - edit_issuable - end - - step 'I sort the list by "Last updated"' do - find('button.dropdown-toggle').click - page.within('.content ul.dropdown-menu.dropdown-menu-align-right li') do - click_link "Last updated" - end - end - step 'I sort the list by "Least popular"' do find('button.dropdown-toggle').click @@ -124,18 +113,6 @@ module SharedIssuable end end - step 'I sort the list by "Popularity"' do - find('button.dropdown-toggle').click - - page.within('.content ul.dropdown-menu.dropdown-menu-align-right li') do - click_link 'Popularity' - end - end - - step 'The list should be sorted by "Last updated"' do - expect(find('.issues-filters')).to have_content('Last updated') - end - step 'I click link "Next" in the sidebar' do page.within '.issuable-sidebar' do click_link 'Next' diff --git a/features/steps/shared/markdown.rb b/features/steps/shared/markdown.rb index c2bec2a6320..c66280127e9 100644 --- a/features/steps/shared/markdown.rb +++ b/features/steps/shared/markdown.rb @@ -18,43 +18,6 @@ module SharedMarkdown expect(find('.gfm-form .js-md-preview')).not_to be_visible end - step 'The Markdown preview tab should say there is nothing to do' do - page.within('.gfm-form') do - find('.js-md-preview-button').click - expect(find('.js-md-preview')).to have_content('Nothing to preview.') - end - end - - step 'I should not see the Markdown text field' do - expect(find('.gfm-form textarea')).not_to be_visible - end - - step 'I should see the Markdown write tab' do - expect(first('.gfm-form')).to have_link('Write', visible: true) - end - - step 'I should see the Markdown preview' do - expect(find('.gfm-form')).to have_css('.js-md-preview', visible: true) - end - - step 'The Markdown preview tab should display rendered Markdown' do - page.within('.gfm-form') do - find('.js-md-preview-button').click - expect(find('.js-md-preview')).to have_css('gl-emoji', visible: true) - end - end - - step 'I write a description like ":+1: Nice"' do - find('.gfm-form').fill_in 'Description', with: ':+1: Nice' - end - - step 'I preview a description text like "Bug fixed :smile:"' do - page.within(first('.gfm-form')) do - fill_in 'Description', with: 'Bug fixed :smile:' - click_link 'Preview' - end - end - step 'I haven\'t written any description text' do find('.gfm-form').fill_in 'Description', with: '' end diff --git a/features/steps/shared/note.rb b/features/steps/shared/note.rb index 95f0cd2156e..cbe1cae096e 100644 --- a/features/steps/shared/note.rb +++ b/features/steps/shared/note.rb @@ -114,34 +114,12 @@ module SharedNote end end - step 'I should see comment "XML attached"' do - page.within(".note") do - expect(page).to have_content("XML attached") - end - end - step 'I should see no notes at all' do expect(page).not_to have_css('.note') end # Markdown - step 'I leave a comment with a header containing "Comment with a header"' do - page.within(".js-main-target-form") do - fill_in "note[note]", with: "# Comment with a header" - click_button "Comment" - end - - wait_for_requests - end - - step 'The comment with the header should not have an ID' do - page.within(".note-body > .note-text") do - expect(page).to have_content("Comment with a header") - expect(page).not_to have_css("#comment-with-a-header") - end - end - step 'I edit the last comment with a +1' do page.within(".main-notes-list") do note = find('.note') diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb index bff0d58aaf4..9a5db75fe98 100644 --- a/features/steps/shared/paths.rb +++ b/features/steps/shared/paths.rb @@ -96,10 +96,6 @@ module SharedPaths visit assigned_issues_dashboard_path end - step 'I visit dashboard merge requests page' do - visit assigned_mrs_dashboard_path - end - step 'I visit dashboard search page' do visit search_path end @@ -200,10 +196,6 @@ module SharedPaths # Generic Project # ---------------------------------------- - step "I visit my project's home page" do - visit project_path(@project) - end - step "I visit my project's settings page" do visit edit_project_path(@project) end @@ -339,10 +331,6 @@ module SharedPaths visit project_commit_path(@project, sample_commit.id) end - step 'I visit project "Shop" issues page' do - visit project_issues_path(project) - end - step 'I visit issue page "Release 0.4"' do issue = Issue.find_by(title: "Release 0.4") visit project_issue_path(issue.project, issue) @@ -394,10 +382,6 @@ module SharedPaths wait_for_requests end - step 'I visit project "Shop" merge requests page' do - visit project_merge_requests_path(project) - end - step 'I visit forked project "Shop" merge requests page' do visit project_merge_requests_path(project) end @@ -418,11 +402,6 @@ module SharedPaths # Visibility Projects # ---------------------------------------- - step 'I visit project "Community" page' do - project = Project.find_by(name: "Community") - visit project_path(project) - end - step 'I visit project "Community" source page' do project = Project.find_by(name: 'Community') visit project_tree_path(project, root_ref) @@ -442,11 +421,6 @@ module SharedPaths # Empty Projects # ---------------------------------------- - step "I visit empty project page" do - project = Project.find_by(name: "Empty Public Project") - visit project_path(project) - end - step "I should not see command line instructions" do expect(page).not_to have_css('.empty_wrapper') end diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb index 07a0e2e072c..be848ebafa0 100644 --- a/features/steps/shared/project.rb +++ b/features/steps/shared/project.rb @@ -236,10 +236,6 @@ module SharedProject @project.update(public_builds: false) end - step 'project "Shop" has a "Bugfix MR" merge request open' do - create(:merge_request, title: "Bugfix MR", target_project: project, source_project: project, author: project.users.first) - end - def user_owns_project(user_name:, project_name:, visibility: :private) user = user_exists(user_name, username: user_name.gsub(/\s/, '').underscore) project = Project.find_by(name: project_name) diff --git a/features/steps/shared/user.rb b/features/steps/shared/user.rb index 9856c510aa0..9cadc91769d 100644 --- a/features/steps/shared/user.rb +++ b/features/steps/shared/user.rb @@ -19,10 +19,6 @@ module SharedUser User.find_by(name: name) || create(:user, { name: name, admin: false }.merge(options)) end - step 'I have an ssh key' do - create(:personal_key, user: @user) - end - step 'I have no ssh keys' do @user.keys.delete_all end |