diff options
Diffstat (limited to 'features')
-rw-r--r-- | features/project/issues/issues.feature | 5 | ||||
-rw-r--r-- | features/project/issues/labels.feature | 11 | ||||
-rw-r--r-- | features/project/issues/milestones.feature | 6 | ||||
-rw-r--r-- | features/project/source/browse_files.feature | 14 | ||||
-rw-r--r-- | features/project/source/git_blame.feature | 10 | ||||
-rw-r--r-- | features/steps/project_browse_files.rb | 51 | ||||
-rw-r--r-- | features/steps/project_browse_git_repo.rb | 28 | ||||
-rw-r--r-- | features/steps/project_issues.rb | 160 | ||||
-rw-r--r-- | features/steps/project_labels.rb | 33 | ||||
-rw-r--r-- | features/steps/project_milestones.rb | 51 | ||||
-rw-r--r-- | features/support/env.rb | 2 |
11 files changed, 345 insertions, 26 deletions
diff --git a/features/project/issues/issues.feature b/features/project/issues/issues.feature index b2301b3f1ff..596e8bd7d41 100644 --- a/features/project/issues/issues.feature +++ b/features/project/issues/issues.feature @@ -1,6 +1,6 @@ -Feature: Issues +Feature: Project Issues Background: - Given I signin as a user + 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 "Release 0.3" closed issue @@ -79,4 +79,3 @@ Feature: Issues When I select first assignee from "Shop" project And I click link "New Issue" Then I should see first assignee from "Shop" as selected assignee - diff --git a/features/project/issues/labels.feature b/features/project/issues/labels.feature index 5a20bfd6d14..e601a41bfc4 100644 --- a/features/project/issues/labels.feature +++ b/features/project/issues/labels.feature @@ -1,12 +1,9 @@ -Feature: Labels +Feature: Project Labels Background: - Given I signin as a user + Given I sign in as a user And I own project "Shop" - And project "Shop" have issues tags: - | name | - | bug | - | feature | - Given I visit project "Shop" labels page + And project "Shop" have issues tags: "bug", "feature" + Given I visit project "Shop" labels page Scenario: I should see active milestones Then I should see label "bug" diff --git a/features/project/issues/milestones.feature b/features/project/issues/milestones.feature index d78096a4f16..a57f67d6815 100644 --- a/features/project/issues/milestones.feature +++ b/features/project/issues/milestones.feature @@ -1,9 +1,9 @@ -Feature: Milestones +Feature: Project Milestones Background: - Given I signin as a user + Given I sign in as a user And I own project "Shop" And project "Shop" has milestone "v2.2" - Given I visit project "Shop" milestones page + Given I visit project "Shop" milestones page Scenario: I should see active milestones Then I should see milestone "v2.2" diff --git a/features/project/source/browse_files.feature b/features/project/source/browse_files.feature index 04aebc19732..b12b0ee3e36 100644 --- a/features/project/source/browse_files.feature +++ b/features/project/source/browse_files.feature @@ -1,6 +1,6 @@ -Feature: Browse git repo - Background: - Given I signin as a user +Feature: Project Browse files + Background: + Given I sign in as a user And I own project "Shop" Given I visit project source page @@ -12,12 +12,10 @@ Feature: Browse git repo Then I should see files from repository for "8470d70" Scenario: I browse file content - Given I click on file from repo + Given I click on "Gemfile" file in repo Then I should see it content Scenario: I browse raw file - Given I visit blob file from repo - And I click on raw button + Given I visit blob file from repo + And I click link "raw" Then I should see raw file content - - diff --git a/features/project/source/git_blame.feature b/features/project/source/git_blame.feature index 6aa6be47deb..93ed20a8c42 100644 --- a/features/project/source/git_blame.feature +++ b/features/project/source/git_blame.feature @@ -1,10 +1,10 @@ -Feature: Browse git repo - Background: - Given I signin as a user +Feature: Project Browse git repo + Background: + Given I sign in as a user And I own project "Shop" Given I visit project source page Scenario: I blame file - Given I click on file from repo + Given I click on "Gemfile" file in repo And I click blame button - Then I should see git file blame + Then I should see git file blame diff --git a/features/steps/project_browse_files.rb b/features/steps/project_browse_files.rb new file mode 100644 index 00000000000..ad320584567 --- /dev/null +++ b/features/steps/project_browse_files.rb @@ -0,0 +1,51 @@ +class ProjectBrowseFiles < Spinach::FeatureSteps + Then 'I should see files from repository' do + page.should have_content "app" + page.should have_content "History" + page.should have_content "Gemfile" + end + + Given 'I visit project source page for "8470d70"' do + visit tree_project_ref_path(@project, "8470d70") + end + + Then 'I should see files from repository for "8470d70"' do + current_path.should == tree_project_ref_path(@project, "8470d70") + page.should have_content "app" + page.should have_content "History" + page.should have_content "Gemfile" + end + + Given 'I click on "Gemfile" file in repo' do + click_link "Gemfile" + end + + Then 'I should see it content' do + page.should have_content "rubygems.org" + end + + Given 'I visit blob file from repo' do + visit tree_project_ref_path(@project, ValidCommit::ID, :path => ValidCommit::BLOB_FILE_PATH) + end + + And 'I click link "raw"' do + click_link "raw" + end + + Then 'I should see raw file content' do + page.source.should == ValidCommit::BLOB_FILE + end + + Given 'I sign in as a user' do + login_as :user + end + + And 'I own project "Shop"' do + @project = Factory :project, :name => "Shop" + @project.add_access(@user, :admin) + end + + Given 'I visit project source page' do + visit tree_project_ref_path(@project, @project.root_ref) + end +end diff --git a/features/steps/project_browse_git_repo.rb b/features/steps/project_browse_git_repo.rb new file mode 100644 index 00000000000..56b33a908a9 --- /dev/null +++ b/features/steps/project_browse_git_repo.rb @@ -0,0 +1,28 @@ +class ProjectBrowseGitRepo < Spinach::FeatureSteps + Given 'I click on "Gemfile" file in repo' do + click_link "Gemfile" + end + + And 'I click blame button' do + click_link "blame" + end + + Then 'I should see git file blame' do + page.should have_content "rubygems.org" + page.should have_content "Dmitriy Zaporozhets" + page.should have_content "bc3735004cb Moving to rails 3.2" + end + + Given 'I sign in as a user' do + login_as :user + end + + And 'I own project "Shop"' do + @project = Factory :project, :name => "Shop" + @project.add_access(@user, :admin) + end + + Given 'I visit project source page' do + visit tree_project_ref_path(@project, @project.root_ref) + end +end diff --git a/features/steps/project_issues.rb b/features/steps/project_issues.rb new file mode 100644 index 00000000000..c3fca0c68b3 --- /dev/null +++ b/features/steps/project_issues.rb @@ -0,0 +1,160 @@ +class ProjectIssues < Spinach::FeatureSteps + Given 'I should see "Release 0.4" in issues' do + page.should have_content "Release 0.4" + end + + And 'I should not see "Release 0.3" in issues' do + page.should_not have_content "Release 0.3" + end + + Given 'I click link "Closed"' do + click_link "Closed" + end + + Then 'I should see "Release 0.3" in issues' do + page.should have_content "Release 0.3" + end + + And 'I should not see "Release 0.4" in issues' do + page.should_not have_content "Release 0.4" + end + + Given 'I click link "All"' do + click_link "All" + end + + Given 'I click link "Release 0.4"' do + click_link "Release 0.4" + end + + Then 'I should see issue "Release 0.4"' do + page.should have_content "Release 0.4" + end + + Given 'I click link "New Issue"' do + click_link "New Issue" + end + + And 'I submit new issue "500 error on profile"' do + fill_in "issue_title", :with => "500 error on profile" + click_button "Submit new issue" + end + + Given 'I click link "500 error on profile"' do + click_link "500 error on profile" + end + + Then '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 + + Given 'I visit issue page "Release 0.4"' do + issue = Issue.find_by_title("Release 0.4") + visit project_issue_path(issue.project, issue) + end + + And 'I leave a comment like "XML attached"' do + fill_in "note_note", :with => "XML attached" + click_button "Add Comment" + end + + Then 'I should see comment "XML attached"' do + page.should have_content "XML attached" + end + + Given 'I fill in issue search with "Release"' do + fill_in 'issue_search', with: "Release" + end + + Given 'I fill in issue search with "Bug"' do + fill_in 'issue_search', with: "Bug" + end + + And 'I fill in issue search with "0.3"' do + fill_in 'issue_search', with: "0.3" + end + + And 'I fill in issue search with "Something"' do + fill_in 'issue_search', with: "Something" + end + + And 'I fill in issue search with ""' do + page.execute_script("$('.issue_search').val('').keyup();"); + fill_in 'issue_search', with: "" + end + + Given 'project "Shop" has milestone "v2.2"' do + project = Project.find_by_name("Shop") + milestone = Factory :milestone, :title => "v2.2", :project => project + + 3.times do + issue = Factory :issue, :project => project, :milestone => milestone + end + end + + And 'project "Shop" has milestone "v3.0"' do + project = Project.find_by_name("Shop") + milestone = Factory :milestone, :title => "v3.0", :project => project + + 3.times do + issue = Factory :issue, :project => project, :milestone => milestone + end + end + + And 'I visit project "Shop" issues page' do + visit project_issues_path(Project.find_by_name("Shop")) + end + + When 'I select milestone "v3.0"' do + select "v3.0", from: "milestone_id" + end + + Then 'I should see selected milestone with title "v3.0"' do + issues_milestone_selector = "#issue_milestone_id_chzn/a" + wait_until { page.has_content?("Details") } + page.find(issues_milestone_selector).should have_content("v3.0") + end + + When 'I select first assignee from "Shop" project' do + project = Project.find_by_name "Shop" + first_assignee = project.users.first + select first_assignee.name, from: "assignee_id" + end + + Then 'I should see first assignee from "Shop" as selected assignee' do + issues_assignee_selector = "#issue_assignee_id_chzn/a" + wait_until { page.has_content?("Details") } + project = Project.find_by_name "Shop" + assignee_name = project.users.first.name + page.find(issues_assignee_selector).should have_content(assignee_name) + end + + Given 'I sign in as a user' do + login_as :user + end + + And 'I own project "Shop"' do + @project = Factory :project, :name => "Shop" + @project.add_access(@user, :admin) + end + + And 'project "Shop" have "Release 0.4" open issue' do + project = Project.find_by_name("Shop") + Factory.create(:issue, + :title => "Release 0.4", + :project => project, + :author => project.users.first) + end + + And 'project "Shop" have "Release 0.3" closed issue' do + project = Project.find_by_name("Shop") + Factory.create(:issue, + :title => "Release 0.3", + :project => project, + :author => project.users.first, + :closed => true) + end +end diff --git a/features/steps/project_labels.rb b/features/steps/project_labels.rb new file mode 100644 index 00000000000..2e83824fc20 --- /dev/null +++ b/features/steps/project_labels.rb @@ -0,0 +1,33 @@ +class ProjectLabels < Spinach::FeatureSteps + Then 'I should see label "bug"' do + within ".labels-table" do + page.should have_content "bug" + end + end + + And 'I should see label "feature"' do + within ".labels-table" do + page.should have_content "feature" + end + end + + Given 'I sign in as a user' do + login_as :user + end + + And 'I own project "Shop"' do + @project = Factory :project, :name => "Shop" + @project.add_access(@user, :admin) + end + + And 'project "Shop" have issues tags: "bug", "feature"' do + project = Project.find_by_name("Shop") + ['bug', 'feature'].each do |label| + Factory :issue, project: project, label_list: label + end + end + + Given 'I visit project "Shop" labels page' do + visit project_labels_path(Project.find_by_name("Shop")) + end +end diff --git a/features/steps/project_milestones.rb b/features/steps/project_milestones.rb new file mode 100644 index 00000000000..97574d1c34d --- /dev/null +++ b/features/steps/project_milestones.rb @@ -0,0 +1,51 @@ +class ProjectMilestones < Spinach::FeatureSteps + Then '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 + + Given 'I click link "v2.2"' do + click_link "v2.2" + end + + Given 'I click link "New Milestone"' do + click_link "New Milestone" + end + + And 'I submit new milestone "v2.3"' do + fill_in "milestone_title", :with => "v2.3" + click_button "Create milestone" + end + + Then '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 + + Given 'I sign in as a user' do + login_as :user + end + + And 'I own project "Shop"' do + @project = Factory :project, :name => "Shop" + @project.add_access(@user, :admin) + end + + And 'project "Shop" has milestone "v2.2"' do + project = Project.find_by_name("Shop") + milestone = Factory :milestone, :title => "v2.2", :project => project + + 3.times do + issue = Factory :issue, :project => project, :milestone => milestone + end + end + + Given 'I visit project "Shop" milestones page' do + @project = Project.find_by_name("Shop") + visit project_milestones_path(@project) + end +end diff --git a/features/support/env.rb b/features/support/env.rb index 38d828a2a51..7bd89801da1 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -3,6 +3,7 @@ require './config/environment' require 'rspec' require 'database_cleaner' +require 'spinach/capybara' %w(gitolite_stub login_helpers stubbed_repository valid_commit).each do |f| require Rails.root.join('spec', 'support', f) @@ -12,6 +13,7 @@ include LoginHelpers include GitoliteStub WebMock.allow_net_connect! +Capybara.javascript_driver = :webkit DatabaseCleaner.strategy = :truncation Spinach.hooks.before_scenario { DatabaseCleaner.start } |