Commit e4447de23fa41fd67db31e3ca97dbee7349a026c
1 parent
21bfd1e7
Exists in
master
and in
4 other branches
Cucumber refactoring
Showing
13 changed files
with
163 additions
and
119 deletions
Show diff stats
features/projects/issues/issues.feature
| ... | ... | @@ -4,7 +4,7 @@ Feature: Issues |
| 4 | 4 | And I own project "Shop" |
| 5 | 5 | And project "Shop" have "Release 0.4" open issue |
| 6 | 6 | And project "Shop" have "Release 0.3" closed issue |
| 7 | - And I visit project "Shop" issues page | |
| 7 | + And I visit project "Shop" issues page | |
| 8 | 8 | |
| 9 | 9 | Scenario: I should see open issues |
| 10 | 10 | Given I should see "Release 0.4" in issues |
| ... | ... | @@ -36,3 +36,31 @@ Feature: Issues |
| 36 | 36 | Given I visit issue page "Release 0.4" |
| 37 | 37 | And I leave a comment like "XML attached" |
| 38 | 38 | Then I should see comment "XML attached" |
| 39 | + | |
| 40 | + @javascript | |
| 41 | + Scenario: I search issue | |
| 42 | + Given I fill in issue search with "Release" | |
| 43 | + Then I should see "Release 0.4" in issues | |
| 44 | + And I should not see "Release 0.3" in issues | |
| 45 | + | |
| 46 | + @javascript | |
| 47 | + Scenario: I search issue that not exist | |
| 48 | + Given I fill in issue search with "Bug" | |
| 49 | + Then I should not see "Release 0.4" in issues | |
| 50 | + And I should not see "Release 0.3" in issues | |
| 51 | + | |
| 52 | + | |
| 53 | + @javascript | |
| 54 | + Scenario: I search all issues | |
| 55 | + Given I click link "All" | |
| 56 | + And I fill in issue search with "0.3" | |
| 57 | + Then I should see "Release 0.3" in issues | |
| 58 | + And I should not see "Release 0.4" in issues | |
| 59 | + | |
| 60 | + @javascript | |
| 61 | + Scenario: I clear search | |
| 62 | + Given I click link "All" | |
| 63 | + And I fill in issue search with "Something" | |
| 64 | + And I fill in issue search with "" | |
| 65 | + Then I should see "Release 0.4" in issues | |
| 66 | + And I should see "Release 0.3" in issues | ... | ... |
| ... | ... | @@ -0,0 +1,21 @@ |
| 1 | +include LoginHelpers | |
| 2 | + | |
| 3 | +Given /^I signin as a user$/ do | |
| 4 | + login_as :user | |
| 5 | +end | |
| 6 | + | |
| 7 | +When /^I click link "(.*?)"$/ do |link| | |
| 8 | + click_link link | |
| 9 | +end | |
| 10 | + | |
| 11 | +When /^I click button "(.*?)"$/ do |button| | |
| 12 | + click_button button | |
| 13 | +end | |
| 14 | + | |
| 15 | +When /^I fill in "(.*?)" with "(.*?)"$/ do |field, value| | |
| 16 | + fill_in field, :with => value | |
| 17 | +end | |
| 18 | + | |
| 19 | +Given /^show me page$/ do | |
| 20 | + save_and_open_page | |
| 21 | +end | ... | ... |
features/step_definitions/dashboard_steps.rb
| 1 | -Given /^I visit dashboard page$/ do | |
| 2 | - visit dashboard_path | |
| 3 | -end | |
| 4 | - | |
| 5 | 1 | Then /^I should see "(.*?)" link$/ do |arg1| |
| 6 | 2 | page.should have_link(arg1) |
| 7 | 3 | end |
| ... | ... | @@ -51,10 +47,10 @@ Then /^I click "(.*?)" link$/ do |arg1| |
| 51 | 47 | end |
| 52 | 48 | |
| 53 | 49 | Then /^I see prefilled new Merge Request page$/ do |
| 54 | - current_path.should == new_project_merge_request_path(@project) | |
| 55 | - find("#merge_request_source_branch").value.should == "new_design" | |
| 56 | - find("#merge_request_target_branch").value.should == "master" | |
| 57 | - find("#merge_request_title").value.should == "New Design" | |
| 50 | + current_path.should == new_project_merge_request_path(@project) | |
| 51 | + find("#merge_request_source_branch").value.should == "new_design" | |
| 52 | + find("#merge_request_target_branch").value.should == "master" | |
| 53 | + find("#merge_request_title").value.should == "New Design" | |
| 58 | 54 | end |
| 59 | 55 | |
| 60 | 56 | Given /^I visit dashboard search page$/ do |
| ... | ... | @@ -66,10 +62,6 @@ Given /^I search for "(.*?)"$/ do |arg1| |
| 66 | 62 | click_button "Search" |
| 67 | 63 | end |
| 68 | 64 | |
| 69 | -Given /^I visit dashboard issues page$/ do | |
| 70 | - visit dashboard_issues_path | |
| 71 | -end | |
| 72 | - | |
| 73 | 65 | Then /^I should see issues assigned to me$/ do |
| 74 | 66 | issues = @user.issues |
| 75 | 67 | issues.each do |issue| |
| ... | ... | @@ -78,10 +70,6 @@ Then /^I should see issues assigned to me$/ do |
| 78 | 70 | end |
| 79 | 71 | end |
| 80 | 72 | |
| 81 | -Given /^I visit dashboard merge requests page$/ do | |
| 82 | - visit dashboard_merge_requests_path | |
| 83 | -end | |
| 84 | - | |
| 85 | 73 | Then /^I should see my merge requests$/ do |
| 86 | 74 | merge_requests = @user.merge_requests |
| 87 | 75 | merge_requests.each do |mr| | ... | ... |
features/step_definitions/profile/profile_steps.rb
| 1 | -Given /^I visit profile page$/ do | |
| 2 | - visit profile_path | |
| 3 | -end | |
| 4 | - | |
| 5 | 1 | Then /^I should see my profile info$/ do |
| 6 | 2 | page.should have_content "Profile" |
| 7 | 3 | page.should have_content @user.name |
| 8 | 4 | page.should have_content @user.email |
| 9 | 5 | end |
| 10 | 6 | |
| 11 | -Given /^I visit profile password page$/ do | |
| 12 | - visit profile_password_path | |
| 13 | -end | |
| 14 | - | |
| 15 | 7 | Then /^I change my password$/ do |
| 16 | 8 | fill_in "user_password", :with => "222333" |
| 17 | 9 | fill_in "user_password_confirmation", :with => "222333" |
| ... | ... | @@ -22,10 +14,6 @@ Then /^I should be redirected to sign in page$/ do |
| 22 | 14 | current_path.should == new_user_session_path |
| 23 | 15 | end |
| 24 | 16 | |
| 25 | -Given /^I visit profile token page$/ do | |
| 26 | - visit profile_token_path | |
| 27 | -end | |
| 28 | - | |
| 29 | 17 | Then /^I reset my token$/ do |
| 30 | 18 | @old_token = @user.private_token |
| 31 | 19 | click_button "Reset" | ... | ... |
features/step_definitions/project/browse_code_steps.rb
| 1 | -Given /^I visit project source page$/ do | |
| 2 | - visit tree_project_ref_path(@project, @project.root_ref) | |
| 3 | -end | |
| 4 | - | |
| 5 | 1 | Then /^I should see files from repository$/ do |
| 6 | 2 | page.should have_content("app") |
| 7 | 3 | page.should have_content("History") |
| 8 | 4 | page.should have_content("Gemfile") |
| 9 | 5 | end |
| 10 | 6 | |
| 11 | -Given /^I visit project source page for "(.*?)"$/ do |arg1| | |
| 12 | - visit tree_project_ref_path(@project, arg1) | |
| 13 | -end | |
| 14 | - | |
| 15 | 7 | Then /^I should see files from repository for "(.*?)"$/ do |arg1| |
| 16 | 8 | current_path.should == tree_project_ref_path(@project, arg1) |
| 17 | 9 | page.should have_content("app") |
| ... | ... | @@ -31,10 +23,6 @@ Given /^I click on raw button$/ do |
| 31 | 23 | click_link "raw" |
| 32 | 24 | end |
| 33 | 25 | |
| 34 | -Given /^I visit blob file from repo$/ do | |
| 35 | - visit tree_project_ref_path(@project, ValidCommit::ID, :path => ValidCommit::BLOB_FILE_PATH) | |
| 36 | -end | |
| 37 | - | |
| 38 | 26 | Then /^I should see raw file content$/ do |
| 39 | 27 | page.source.should == ValidCommit::BLOB_FILE |
| 40 | 28 | end | ... | ... |
features/step_definitions/project/project_commits_steps.rb
| 1 | -Given /^I visit project commits page$/ do | |
| 2 | - visit project_commits_path(@project) | |
| 3 | -end | |
| 4 | - | |
| 5 | 1 | Then /^I see project commits$/ do |
| 6 | 2 | current_path.should == project_commits_path(@project) |
| 7 | 3 | |
| ... | ... | @@ -23,19 +19,11 @@ Then /^I see commits atom feed$/ do |
| 23 | 19 | page.body.should have_selector("entry summary", :text => commit.description) |
| 24 | 20 | end |
| 25 | 21 | |
| 26 | -Given /^I click on commit link$/ do | |
| 27 | - visit project_commit_path(@project, ValidCommit::ID) | |
| 28 | -end | |
| 29 | - | |
| 30 | 22 | Then /^I see commit info$/ do |
| 31 | 23 | page.should have_content ValidCommit::MESSAGE |
| 32 | 24 | page.should have_content "Showing 1 changed file" |
| 33 | 25 | end |
| 34 | 26 | |
| 35 | -Given /^I visit compare refs page$/ do | |
| 36 | - visit compare_project_commits_path(@project) | |
| 37 | -end | |
| 38 | - | |
| 39 | 27 | Given /^I fill compare fields with refs$/ do |
| 40 | 28 | fill_in "from", :with => "master" |
| 41 | 29 | fill_in "to", :with => "stable" |
| ... | ... | @@ -48,18 +36,6 @@ Given /^I see compared refs$/ do |
| 48 | 36 | page.should have_content "Showing 73 changed files" |
| 49 | 37 | end |
| 50 | 38 | |
| 51 | -Given /^I visit project branches page$/ do | |
| 52 | - visit branches_project_repository_path(@project) | |
| 53 | -end | |
| 54 | - | |
| 55 | -Given /^I visit project commit page$/ do | |
| 56 | - visit project_commit_path(@project, ValidCommit::ID) | |
| 57 | -end | |
| 58 | - | |
| 59 | -Given /^I visit project tags page$/ do | |
| 60 | - visit tags_project_repository_path(@project) | |
| 61 | -end | |
| 62 | - | |
| 63 | 39 | Then /^I should see "(.*?)" recent branches list$/ do |arg1| |
| 64 | 40 | page.should have_content("Branches") |
| 65 | 41 | page.should have_content("master") |
| ... | ... | @@ -76,7 +52,7 @@ Then /^I should see "(.*?)" all tags list$/ do |arg1| |
| 76 | 52 | end |
| 77 | 53 | |
| 78 | 54 | Then /^I should see "(.*?)" protected branches list$/ do |arg1| |
| 79 | - within "table" do | |
| 55 | + within "table" do | |
| 80 | 56 | page.should have_content "stable" |
| 81 | 57 | page.should_not have_content "master" |
| 82 | 58 | end | ... | ... |
features/step_definitions/project/project_issues_steps.rb
| ... | ... | @@ -8,16 +8,12 @@ Given /^project "(.*?)" have "(.*?)" closed issue$/ do |arg1, arg2| |
| 8 | 8 | Factory.create(:issue, :title => arg2, :project => project, :author => project.users.first, :closed => true) |
| 9 | 9 | end |
| 10 | 10 | |
| 11 | -Given /^I visit project "(.*?)" issues page$/ do |arg1| | |
| 12 | - visit project_issues_path(Project.find_by_name(arg1)) | |
| 13 | -end | |
| 14 | - | |
| 15 | 11 | Given /^I should see "(.*?)" in issues$/ do |arg1| |
| 16 | - page.should have_content arg1 | |
| 12 | + page.should have_content arg1 | |
| 17 | 13 | end |
| 18 | 14 | |
| 19 | 15 | Given /^I should not see "(.*?)" in issues$/ do |arg1| |
| 20 | - page.should_not have_content arg1 | |
| 16 | + page.should_not have_content arg1 | |
| 21 | 17 | end |
| 22 | 18 | |
| 23 | 19 | Then /^I should see issue "(.*?)"$/ do |arg1| |
| ... | ... | @@ -27,11 +23,6 @@ Then /^I should see issue "(.*?)"$/ do |arg1| |
| 27 | 23 | page.should have_content issue.project.name |
| 28 | 24 | end |
| 29 | 25 | |
| 30 | -Given /^I visit issue page "(.*?)"$/ do |arg1| | |
| 31 | - issue = Issue.find_by_title(arg1) | |
| 32 | - visit project_issue_path(issue.project, issue) | |
| 33 | -end | |
| 34 | - | |
| 35 | 26 | Given /^I submit new issue "(.*?)"$/ do |arg1| |
| 36 | 27 | fill_in "issue_title", with: arg1 |
| 37 | 28 | click_button "Submit new issue" |
| ... | ... | @@ -51,7 +42,16 @@ Given /^I visit project "(.*?)" labels page$/ do |arg1| |
| 51 | 42 | end |
| 52 | 43 | |
| 53 | 44 | Then /^I should see label "(.*?)"$/ do |arg1| |
| 54 | - within ".labels-table" do | |
| 45 | + within ".labels-table" do | |
| 55 | 46 | page.should have_content arg1 |
| 56 | 47 | end |
| 57 | 48 | end |
| 49 | + | |
| 50 | +Given /^I fill in issue search with "(.*?)"$/ do |arg1| | |
| 51 | + # Because fill_in, with: "" triggers nothing | |
| 52 | + # we need to trigger a keyup event | |
| 53 | + if arg1 == '' | |
| 54 | + page.execute_script("$('.issue_search').val('').keyup();"); | |
| 55 | + end | |
| 56 | + fill_in 'issue_search', with: arg1 | |
| 57 | +end | ... | ... |
features/step_definitions/project/project_merge_requests_steps.rb
| ... | ... | @@ -8,21 +8,17 @@ Given /^project "(.*?)" have "(.*?)" closed merge request$/ do |arg1, arg2| |
| 8 | 8 | Factory.create(:merge_request, :title => arg2, :project => project, :author => project.users.first, :closed => true) |
| 9 | 9 | end |
| 10 | 10 | |
| 11 | -Given /^I visit project "(.*?)" merge requests page$/ do |arg1| | |
| 12 | - visit project_merge_requests_path(Project.find_by_name(arg1)) | |
| 13 | -end | |
| 14 | - | |
| 15 | 11 | Then /^I should see "(.*?)" in merge requests$/ do |arg1| |
| 16 | - page.should have_content arg1 | |
| 12 | + page.should have_content arg1 | |
| 17 | 13 | end |
| 18 | 14 | |
| 19 | 15 | Then /^I should not see "(.*?)" in merge requests$/ do |arg1| |
| 20 | - page.should_not have_content arg1 | |
| 16 | + page.should_not have_content arg1 | |
| 21 | 17 | end |
| 22 | 18 | |
| 23 | 19 | Then /^I should see merge request "(.*?)"$/ do |arg1| |
| 24 | 20 | merge_request = MergeRequest.find_by_title(arg1) |
| 25 | - page.should have_content(merge_request.title[0..10]) | |
| 21 | + page.should have_content(merge_request.title[0..10]) | |
| 26 | 22 | page.should have_content(merge_request.target_branch) |
| 27 | 23 | page.should have_content(merge_request.source_branch) |
| 28 | 24 | end |
| ... | ... | @@ -34,11 +30,6 @@ Given /^I submit new merge request "(.*?)"$/ do |arg1| |
| 34 | 30 | click_button "Save" |
| 35 | 31 | end |
| 36 | 32 | |
| 37 | -Given /^I visit merge request page "(.*?)"$/ do |arg1| | |
| 38 | - mr = MergeRequest.find_by_title(arg1) | |
| 39 | - visit project_merge_request_path(mr.project, mr) | |
| 40 | -end | |
| 41 | - | |
| 42 | 33 | Then /^I should see closed merge request "(.*?)"$/ do |arg1| |
| 43 | 34 | mr = MergeRequest.find_by_title(arg1) |
| 44 | 35 | mr.closed.should be_true | ... | ... |
features/step_definitions/project/project_milestones_steps.rb
| ... | ... | @@ -12,11 +12,6 @@ Given /^project "(.*?)" has milestone "(.*?)"$/ do |arg1, arg2| |
| 12 | 12 | end |
| 13 | 13 | end |
| 14 | 14 | |
| 15 | -Given /^I visit project "(.*?)" milestones page$/ do |arg1| | |
| 16 | - @project = Project.find_by_name(arg1) | |
| 17 | - visit project_milestones_path(@project) | |
| 18 | -end | |
| 19 | - | |
| 20 | 15 | Then /^I should see active milestones$/ do |
| 21 | 16 | milestone = @project.milestones.first |
| 22 | 17 | page.should have_content(milestone.title[0..10]) | ... | ... |
features/step_definitions/project/project_team_steps.rb
| ... | ... | @@ -8,10 +8,6 @@ Given /^"(.*?)" is "(.*?)" developer$/ do |arg1, arg2| |
| 8 | 8 | project.add_access(user, :write) |
| 9 | 9 | end |
| 10 | 10 | |
| 11 | -Given /^I visit project "(.*?)" team page$/ do |arg1| | |
| 12 | - visit team_project_path(Project.find_by_name(arg1)) | |
| 13 | -end | |
| 14 | - | |
| 15 | 11 | Then /^I should be able to see myself in team$/ do |
| 16 | 12 | page.should have_content(@user.name) |
| 17 | 13 | page.should have_content(@user.email) |
| ... | ... | @@ -23,13 +19,9 @@ Then /^I should see "(.*?)" in team list$/ do |arg1| |
| 23 | 19 | page.should have_content(user.email) |
| 24 | 20 | end |
| 25 | 21 | |
| 26 | -Given /^I click link "(.*?)"$/ do |arg1| | |
| 27 | - click_link arg1 | |
| 28 | -end | |
| 29 | - | |
| 30 | 22 | Given /^I select "(.*?)" as "(.*?)"$/ do |arg1, arg2| |
| 31 | 23 | user = User.find_by_name(arg1) |
| 32 | - within "#new_team_member" do | |
| 24 | + within "#new_team_member" do | |
| 33 | 25 | select user.name, :from => "team_member_user_id" |
| 34 | 26 | select arg2, :from => "team_member_project_access" |
| 35 | 27 | end |
| ... | ... | @@ -44,7 +36,7 @@ end |
| 44 | 36 | |
| 45 | 37 | Given /^I change "(.*?)" role to "(.*?)"$/ do |arg1, arg2| |
| 46 | 38 | user = User.find_by_name(arg1) |
| 47 | - within ".user_#{user.id}" do | |
| 39 | + within ".user_#{user.id}" do | |
| 48 | 40 | select arg2, :from => "team_member_project_access" |
| 49 | 41 | end |
| 50 | 42 | end | ... | ... |
features/step_definitions/project/project_wiki_steps.rb
features/step_definitions/project/projects_steps.rb
| 1 | -include LoginHelpers | |
| 2 | - | |
| 3 | -Given /^I signin as a user$/ do | |
| 4 | - login_as :user | |
| 5 | -end | |
| 6 | - | |
| 7 | 1 | When /^I visit new project page$/ do |
| 8 | 2 | visit new_project_path |
| 9 | 3 | end |
| ... | ... | @@ -65,10 +59,6 @@ Given /^I visit project "(.*?)" network page$/ do |arg1| |
| 65 | 59 | visit graph_project_path(project) |
| 66 | 60 | end |
| 67 | 61 | |
| 68 | -Given /^show me page$/ do | |
| 69 | - save_and_open_page | |
| 70 | -end | |
| 71 | - | |
| 72 | 62 | Given /^page should have network graph$/ do |
| 73 | 63 | page.should have_content "Project Network Graph" |
| 74 | 64 | within ".graph" do | ... | ... |
| ... | ... | @@ -0,0 +1,91 @@ |
| 1 | +Given /^I visit project "(.*?)" issues page$/ do |arg1| | |
| 2 | + visit project_issues_path(Project.find_by_name(arg1)) | |
| 3 | +end | |
| 4 | + | |
| 5 | +Given /^I visit issue page "(.*?)"$/ do |arg1| | |
| 6 | + issue = Issue.find_by_title(arg1) | |
| 7 | + visit project_issue_path(issue.project, issue) | |
| 8 | +end | |
| 9 | + | |
| 10 | +Given /^I visit project "(.*?)" merge requests page$/ do |arg1| | |
| 11 | + visit project_merge_requests_path(Project.find_by_name(arg1)) | |
| 12 | +end | |
| 13 | + | |
| 14 | +Given /^I visit merge request page "(.*?)"$/ do |arg1| | |
| 15 | + mr = MergeRequest.find_by_title(arg1) | |
| 16 | + visit project_merge_request_path(mr.project, mr) | |
| 17 | +end | |
| 18 | + | |
| 19 | +Given /^I visit project "(.*?)" milestones page$/ do |arg1| | |
| 20 | + @project = Project.find_by_name(arg1) | |
| 21 | + visit project_milestones_path(@project) | |
| 22 | +end | |
| 23 | + | |
| 24 | +Given /^I visit project commits page$/ do | |
| 25 | + visit project_commits_path(@project) | |
| 26 | +end | |
| 27 | + | |
| 28 | +Given /^I visit compare refs page$/ do | |
| 29 | + visit compare_project_commits_path(@project) | |
| 30 | +end | |
| 31 | + | |
| 32 | +Given /^I visit project branches page$/ do | |
| 33 | + visit branches_project_repository_path(@project) | |
| 34 | +end | |
| 35 | + | |
| 36 | +Given /^I visit project commit page$/ do | |
| 37 | + visit project_commit_path(@project, ValidCommit::ID) | |
| 38 | +end | |
| 39 | + | |
| 40 | +Given /^I visit project tags page$/ do | |
| 41 | + visit tags_project_repository_path(@project) | |
| 42 | +end | |
| 43 | + | |
| 44 | +Given /^I click on commit link$/ do | |
| 45 | + visit project_commit_path(@project, ValidCommit::ID) | |
| 46 | +end | |
| 47 | + | |
| 48 | +Given /^I visit project source page$/ do | |
| 49 | + visit tree_project_ref_path(@project, @project.root_ref) | |
| 50 | +end | |
| 51 | + | |
| 52 | +Given /^I visit project source page for "(.*?)"$/ do |arg1| | |
| 53 | + visit tree_project_ref_path(@project, arg1) | |
| 54 | +end | |
| 55 | + | |
| 56 | +Given /^I visit blob file from repo$/ do | |
| 57 | + visit tree_project_ref_path(@project, ValidCommit::ID, :path => ValidCommit::BLOB_FILE_PATH) | |
| 58 | +end | |
| 59 | + | |
| 60 | +Given /^I visit project "(.*?)" team page$/ do |arg1| | |
| 61 | + visit team_project_path(Project.find_by_name(arg1)) | |
| 62 | +end | |
| 63 | + | |
| 64 | +Given /^I visit project wiki page$/ do | |
| 65 | + visit project_wiki_path(@project, :index) | |
| 66 | +end | |
| 67 | + | |
| 68 | +Given /^I visit profile page$/ do | |
| 69 | + visit profile_path | |
| 70 | +end | |
| 71 | + | |
| 72 | +Given /^I visit profile token page$/ do | |
| 73 | + visit profile_token_path | |
| 74 | +end | |
| 75 | + | |
| 76 | +Given /^I visit profile password page$/ do | |
| 77 | + visit profile_password_path | |
| 78 | +end | |
| 79 | + | |
| 80 | +Given /^I visit dashboard page$/ do | |
| 81 | + visit dashboard_path | |
| 82 | +end | |
| 83 | + | |
| 84 | +Given /^I visit dashboard issues page$/ do | |
| 85 | + visit dashboard_issues_path | |
| 86 | +end | |
| 87 | + | |
| 88 | +Given /^I visit dashboard merge requests page$/ do | |
| 89 | + visit dashboard_merge_requests_path | |
| 90 | +end | |
| 91 | + | ... | ... |