diff options
author | Dmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com> | 2012-06-15 08:15:28 +0400 |
---|---|---|
committer | randx <dmitriy.zaporozhets@gmail.com> | 2012-06-15 08:15:28 +0400 |
commit | 5bbf3ccf0559ac4d8528f48721a2816fa0c72985 (patch) | |
tree | 904be11f0f74f5e6c5852940c0d6ce20838df6ff /features | |
parent | 6ff99fe9457fcfe831fbe3d3a1ef477d9a327330 (diff) |
Cucumber:
* Profile
* Browse code
* Sceleton for main features
* Wiki
* Commits
Diffstat (limited to 'features')
27 files changed, 396 insertions, 0 deletions
diff --git a/features/dashboard/dashboard.feature b/features/dashboard/dashboard.feature new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/features/dashboard/dashboard.feature diff --git a/features/dashboard/search.feature b/features/dashboard/search.feature new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/features/dashboard/search.feature diff --git a/features/profile/profile.feature b/features/profile/profile.feature new file mode 100644 index 00000000000..e3d71abc746 --- /dev/null +++ b/features/profile/profile.feature @@ -0,0 +1,18 @@ +Feature: Profile + Background: + Given I signin as a user + + Scenario: I look at my profile + Given I visit profile page + Then I should see my profile info + + Scenario: I change my password + Given I visit profile password page + Then I change my password + And I should be redirected to sign in page + + Scenario: I reset my token + Given I visit profile token page + Then I reset my token + And I should see new token + diff --git a/features/profile/ssh_keys.feature b/features/profile/ssh_keys.feature new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/features/profile/ssh_keys.feature diff --git a/features/projects/commits/branches.feature b/features/projects/commits/branches.feature new file mode 100644 index 00000000000..2b136e1b582 --- /dev/null +++ b/features/projects/commits/branches.feature @@ -0,0 +1,13 @@ +Feature: Browse branches + Background: + Given I signin as a user + And I own project "Shop" + Given I visit project branches page + + Scenario: I can see all git branches + + Scenario: I can download project by branch + + Scenario: I can view protected branches + + Scenario: I can manage protected branches diff --git a/features/projects/commits/commit_comments.feature b/features/projects/commits/commit_comments.feature new file mode 100644 index 00000000000..bdf47b88fc3 --- /dev/null +++ b/features/projects/commits/commit_comments.feature @@ -0,0 +1,7 @@ +Feature: Comment commit + Background: + Given I signin as a user + And I own project "Shop" + Given I visit project commit page + + Scenario: I leave a comment for commit diff --git a/features/projects/commits/commits.feature b/features/projects/commits/commits.feature new file mode 100644 index 00000000000..69d39d78f89 --- /dev/null +++ b/features/projects/commits/commits.feature @@ -0,0 +1,22 @@ +Feature: Browse commits + Background: + Given I signin as a user + And I own project "Shop" + Given I visit project commits page + + Scenario: I browse commits list for master branch + Then I see project commits + + Scenario: I browse atom feed of commits list for master branch + Given I click atom feed link + Then I see commits atom feed + + Scenario: I browse commit from list + Given I click on commit link + Then I see commit info + + Scenario: I compare refs + Given I visit compare refs page + And I fill compare fields with refs + And I see compared refs + diff --git a/features/projects/commits/tags.feature b/features/projects/commits/tags.feature new file mode 100644 index 00000000000..81221748500 --- /dev/null +++ b/features/projects/commits/tags.feature @@ -0,0 +1,11 @@ +Feature: Browse tags + Background: + Given I signin as a user + And I own project "Shop" + Given I visit project tags page + + Scenario: I can see all git tags + + Scenario: I can download project by tag + + diff --git a/features/projects/create_project.feature b/features/projects/create_project.feature new file mode 100644 index 00000000000..42d25b3f331 --- /dev/null +++ b/features/projects/create_project.feature @@ -0,0 +1,11 @@ +Feature: Create Project + In order to get access to project sections + A user with ability to create a project + Should be able to create a new one + + Scenario: User create a project + Given I signin as a user + When I visit new project page + And fill project form with valid data + Then I should see project page + And I should see empty project instuctions diff --git a/features/projects/deploy_keys.feature b/features/projects/deploy_keys.feature new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/features/projects/deploy_keys.feature diff --git a/features/projects/issues/issues.feature b/features/projects/issues/issues.feature new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/features/projects/issues/issues.feature diff --git a/features/projects/issues/milestones.feature b/features/projects/issues/milestones.feature new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/features/projects/issues/milestones.feature diff --git a/features/projects/merge_requests.feature b/features/projects/merge_requests.feature new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/features/projects/merge_requests.feature diff --git a/features/projects/network.feature b/features/projects/network.feature new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/features/projects/network.feature diff --git a/features/projects/snippets.feature b/features/projects/snippets.feature new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/features/projects/snippets.feature diff --git a/features/projects/source/browse_files.feature b/features/projects/source/browse_files.feature new file mode 100644 index 00000000000..04aebc19732 --- /dev/null +++ b/features/projects/source/browse_files.feature @@ -0,0 +1,23 @@ +Feature: Browse git repo + Background: + Given I signin as a user + And I own project "Shop" + Given I visit project source page + + Scenario: I browse files from master branch + Then I should see files from repository + + Scenario: I browse files for specific ref + Given I visit project source page for "8470d70" + Then I should see files from repository for "8470d70" + + Scenario: I browse file content + Given I click on file from 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 + Then I should see raw file content + + diff --git a/features/projects/source/git_blame.feature b/features/projects/source/git_blame.feature new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/features/projects/source/git_blame.feature diff --git a/features/projects/team_management.feature b/features/projects/team_management.feature new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/features/projects/team_management.feature diff --git a/features/projects/wall.feature b/features/projects/wall.feature new file mode 100644 index 00000000000..ed675e2c477 --- /dev/null +++ b/features/projects/wall.feature @@ -0,0 +1,17 @@ +@javascript +Feature: Project Wall + In order to use Project Wall + A user + Should be able to read & write messages + + Background: + Given I signin as a user + And I own project "Shop" + And I visit project "Shop" wall page + + Scenario: Write comment + Given I write new comment "my special test message" + Then I should see project wall note "my special test message" + + Then I visit project "Shop" wall page + And I should see project wall note "my special test message" diff --git a/features/projects/web_hooks.feature b/features/projects/web_hooks.feature new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/features/projects/web_hooks.feature diff --git a/features/projects/wiki.feature b/features/projects/wiki.feature new file mode 100644 index 00000000000..ed69e87c91a --- /dev/null +++ b/features/projects/wiki.feature @@ -0,0 +1,9 @@ +Feature: Wiki + Background: + Given I signin as a user + And I own project "Shop" + Given I visit project wiki page + + Scenario: Add new page + Given I create Wiki page + Then I should see newly created wiki page diff --git a/features/step_definitions/browse_code_steps.rb b/features/step_definitions/browse_code_steps.rb new file mode 100644 index 00000000000..fc3cf56a83b --- /dev/null +++ b/features/step_definitions/browse_code_steps.rb @@ -0,0 +1,40 @@ +Given /^I visit project source page$/ do + visit tree_project_ref_path(@project, @project.root_ref) +end + +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 "(.*?)"$/ do |arg1| + visit tree_project_ref_path(@project, arg1) +end + +Then /^I should see files from repository for "(.*?)"$/ do |arg1| + current_path.should == tree_project_ref_path(@project, arg1) + page.should have_content("app") + page.should have_content("History") + page.should have_content("Gemfile") +end + +Given /^I click on file from repo$/ do + click_link "Gemfile" +end + +Then /^I should see it content$/ do + page.should have_content("rubygems.org") +end + +Given /^I click on raw button$/ do + click_link "raw" +end + +Given /^I visit blob file from repo$/ do + visit tree_project_ref_path(@project, ValidCommit::ID, :path => ValidCommit::BLOB_FILE_PATH) +end + +Then /^I should see raw file content$/ do + page.source.should == ValidCommit::BLOB_FILE +end diff --git a/features/step_definitions/commits_steps.rb b/features/step_definitions/commits_steps.rb new file mode 100644 index 00000000000..9f7b2a16361 --- /dev/null +++ b/features/step_definitions/commits_steps.rb @@ -0,0 +1,50 @@ +Given /^I visit project commits page$/ do + visit project_commits_path(@project) +end + +Then /^I see project commits$/ do + current_path.should == project_commits_path(@project) + + commit = @project.commit + page.should have_content(@project.name) + page.should have_content(commit.message) + page.should have_content(commit.id.to_s[0..5]) +end + +Given /^I click atom feed link$/ do + click_link "Feed" +end + +Then /^I see commits atom feed$/ do + commit = @project.commit + page.response_headers['Content-Type'].should have_content("application/atom+xml") + page.body.should have_selector("title", :text => "Recent commits to #{@project.name}") + page.body.should have_selector("author email", :text => commit.author_email) + page.body.should have_selector("entry summary", :text => commit.message) +end + +Given /^I click on commit link$/ do + visit project_commit_path(@project, ValidCommit::ID) +end + +Then /^I see commit info$/ do + page.should have_content ValidCommit::MESSAGE + page.should have_content "Showing 1 changed file" +end + +Given /^I visit compare refs page$/ do + visit compare_project_commits_path(@project) +end + +Given /^I fill compare fields with refs$/ do + fill_in "from", :with => "master" + fill_in "to", :with => "stable" + click_button "Compare" +end + +Given /^I see compared refs$/ do + page.should have_content "Commits (27)" + page.should have_content "Compare View" + page.should have_content "Showing 73 changed files" +end + diff --git a/features/step_definitions/profile_steps.rb b/features/step_definitions/profile_steps.rb new file mode 100644 index 00000000000..7510c5365e1 --- /dev/null +++ b/features/step_definitions/profile_steps.rb @@ -0,0 +1,38 @@ +Given /^I visit profile page$/ do + visit profile_path +end + +Then /^I should see my profile info$/ do + page.should have_content "Profile" + page.should have_content @user.name + page.should have_content @user.email +end + +Given /^I visit profile password page$/ do + visit profile_password_path +end + +Then /^I change my password$/ do + fill_in "user_password", :with => "222333" + fill_in "user_password_confirmation", :with => "222333" + click_button "Save" +end + +Then /^I should be redirected to sign in page$/ do + current_path.should == new_user_session_path +end + +Given /^I visit profile token page$/ do + visit profile_token_path +end + +Then /^I reset my token$/ do + @old_token = @user.private_token + click_button "Reset" +end + +Then /^I should see new token$/ do + find("#token").value.should_not == @old_token + find("#token").value.should == @user.reload.private_token +end + diff --git a/features/step_definitions/projects_steps.rb b/features/step_definitions/projects_steps.rb new file mode 100644 index 00000000000..b3bb24b9b1f --- /dev/null +++ b/features/step_definitions/projects_steps.rb @@ -0,0 +1,52 @@ +include LoginMacros + +Given /^I signin as a user$/ do + login_as :user +end + +When /^I visit new project page$/ do + visit new_project_path +end + +When /^fill project form with valid data$/ do + fill_in 'project_name', :with => 'NewProject' + fill_in 'project_code', :with => 'NPR' + fill_in 'project_path', :with => 'newproject' + click_button "Create project" +end + +Then /^I should see project page$/ do + current_path.should == project_path(Project.last) + page.should have_content('NewProject') +end + +Then /^I should see empty project instuctions$/ do + page.should have_content("git init") + page.should have_content("git remote") + page.should have_content(Project.last.url_to_repo) +end + +Given /^I own project "(.*?)"$/ do |arg1| + @project = Factory :project, :name => arg1 + @project.add_access(@user, :read, :write) +end + +Given /^I visit project "(.*?)" wall page$/ do |arg1| + project = Project.find_by_name(arg1) + visit wall_project_path(project) +end + +Then /^I should see project wall note "(.*?)"$/ do |arg1| + page.should have_content arg1 +end + +Given /^project "(.*?)" has comment "(.*?)"$/ do |arg1, arg2| + project = Project.find_by_name(arg1) + project.notes.create(:note => arg1, :author => project.users.first) +end + +Given /^I write new comment "(.*?)"$/ do |arg1| + fill_in "note_note", :with => arg1 + click_button "Add Comment" +end + diff --git a/features/step_definitions/wiki_steps.rb b/features/step_definitions/wiki_steps.rb new file mode 100644 index 00000000000..10de38d9ae3 --- /dev/null +++ b/features/step_definitions/wiki_steps.rb @@ -0,0 +1,18 @@ +Given /^I visit project wiki page$/ do + visit project_wiki_path(@project, :index) +end + +Given /^I create Wiki page$/ do + fill_in "Title", :with => 'Test title' + fill_in "Content", :with => '[link test](test)' + click_on "Save" +end + +Then /^I should see newly created wiki page$/ do + page.should have_content("Test title") + page.should have_content("link test") + + click_link "link test" + + page.should have_content("Editing page") +end diff --git a/features/support/env.rb b/features/support/env.rb new file mode 100644 index 00000000000..ce68081b739 --- /dev/null +++ b/features/support/env.rb @@ -0,0 +1,67 @@ +# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. +# It is recommended to regenerate this file in the future when you upgrade to a +# newer version of cucumber-rails. Consider adding your own code to a new file +# instead of editing this one. Cucumber will automatically load all features/**/*.rb +# files. + +require "selenium-webdriver" +require 'cucumber/rails' +require 'webmock/cucumber' +WebMock.allow_net_connect! + +require Rails.root.join 'spec/monkeypatch' +require Rails.root.join 'spec/factories' +require Rails.root.join 'spec/support/login' +require Rails.root.join 'spec/support/valid_commit' + +# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In +# order to ease the transition to Capybara we set the default here. If you'd +# prefer to use XPath just remove this line and adjust any selectors in your +# steps to use the XPath syntax. +Capybara.default_selector = :css + +# By default, any exception happening in your Rails application will bubble up +# to Cucumber so that your scenario will fail. This is a different from how +# your application behaves in the production environment, where an error page will +# be rendered instead. +# +# Sometimes we want to override this default behaviour and allow Rails to rescue +# exceptions and display an error page (just like when the app is running in production). +# Typical scenarios where you want to do this is when you test your error pages. +# There are two ways to allow Rails to rescue exceptions: +# +# 1) Tag your scenario (or feature) with @allow-rescue +# +# 2) Set the value below to true. Beware that doing this globally is not +# recommended as it will mask a lot of errors for you! +# +ActionController::Base.allow_rescue = false + +# Remove/comment out the lines below if your app doesn't have a database. +# For some databases (like MongoDB and CouchDB) you may need to use :truncation instead. +begin + DatabaseCleaner.strategy = :transaction +rescue NameError + raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it." +end + +# You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios. +# See the DatabaseCleaner documentation for details. Example: +# +# Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do +# # { :except => [:widgets] } may not do what you expect here +# # as tCucumber::Rails::Database.javascript_strategy overrides +# # this setting. +# DatabaseCleaner.strategy = :truncation +# end +# +# Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do +# DatabaseCleaner.strategy = :transaction +# end +# + +# Possible values are :truncation and :transaction +# The :transaction strategy is faster, but might give you threading problems. +# See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature +Cucumber::Rails::Database.javascript_strategy = :truncation + |