diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-05-06 16:09:41 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-05-06 16:09:41 +0400 |
commit | b7f1cf9f491f6cefdfc5f651f724331f07cfd6f5 (patch) | |
tree | d54474013641957e151788795e172f6e741c0b66 /features | |
parent | 42b86b79d0547d8d6f9f3fc8bc3414f7eb4a3964 (diff) |
Feature tests for deploy keys
Diffstat (limited to 'features')
-rw-r--r-- | features/project/deploy_keys.feature | 23 | ||||
-rw-r--r-- | features/steps/project/deploy_keys.rb | 52 | ||||
-rw-r--r-- | features/steps/shared/paths.rb | 122 |
3 files changed, 138 insertions, 59 deletions
diff --git a/features/project/deploy_keys.feature b/features/project/deploy_keys.feature new file mode 100644 index 00000000000..13e3b9bbd2e --- /dev/null +++ b/features/project/deploy_keys.feature @@ -0,0 +1,23 @@ +Feature: Project Deploy Keys + Background: + Given I sign in as a user + And I own project "Shop" + + Scenario: I should see deploy keys list + Given project has deploy key + When I visit project deploy keys page + Then I should see project deploy keys + + Scenario: I add new deploy key + Given I visit project deploy keys page + When I click 'New Deploy Key' + And I submit new deploy key + Then I should be on deploy keys page + And I should see newly created deploy key + + Scenario: I attach deploy key to project + Given other project has deploy key + And I visit project deploy keys page + When I click attach deploy key + Then I should be on deploy keys page + And I should see newly created deploy key diff --git a/features/steps/project/deploy_keys.rb b/features/steps/project/deploy_keys.rb new file mode 100644 index 00000000000..fd9dce7fe30 --- /dev/null +++ b/features/steps/project/deploy_keys.rb @@ -0,0 +1,52 @@ +class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + + step 'project has deploy key' do + create(:deploy_keys_project, project: @project) + end + + step 'I should see project deploy keys' do + within '.enabled-keys' do + page.should have_content deploy_key.title + end + end + + step 'I click \'New Deploy Key\'' do + click_link 'New Deploy Key' + end + + step 'I submit new deploy key' do + fill_in "deploy_key_title", with: "laptop" + fill_in "deploy_key_key", with: "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzrEJUIR6Y03TCE9rIJ+GqTBvgb8t1jI9h5UBzCLuK4VawOmkLornPqLDrGbm6tcwM/wBrrLvVOqi2HwmkKEIecVO0a64A4rIYScVsXIniHRS6w5twyn1MD3sIbN+socBDcaldECQa2u1dI3tnNVcs8wi77fiRe7RSxePsJceGoheRQgC8AZ510UdIlO+9rjIHUdVN7LLyz512auAfYsgx1OfablkQ/XJcdEwDNgi9imI6nAXhmoKUm1IPLT2yKajTIC64AjLOnE0YyCh6+7RFMpiMyu1qiOCpdjYwTgBRiciNRZCH8xIedyCoAmiUgkUT40XYHwLuwiPJICpkAzp7Q== user@laptop" + click_button "Create" + end + + step 'I should be on deploy keys page' do + current_path.should == project_deploy_keys_path(@project) + end + + step 'I should see newly created deploy key' do + within '.enabled-keys' do + page.should have_content(deploy_key.title) + end + end + + step 'other project has deploy key' do + @second_project = create :project, namespace: current_user.namespace + create(:deploy_keys_project, project: @second_project) + end + + step 'I click attach deploy key' do + within '.available-keys' do + click_link 'Enable' + end + end + + protected + + def deploy_key + @project.deploy_keys.last + end +end diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb index 38730cc2cd6..b0d3b0f2a03 100644 --- a/features/steps/shared/paths.rb +++ b/features/steps/shared/paths.rb @@ -1,7 +1,7 @@ module SharedPaths include Spinach::DSL - When 'I visit new project page' do + step 'I visit new project page' do visit new_project_path end @@ -9,23 +9,23 @@ module SharedPaths # Group # ---------------------------------------- - When 'I visit group page' do + step 'I visit group page' do visit group_path(current_group) end - When 'I visit group issues page' do + step 'I visit group issues page' do visit issues_group_path(current_group) end - When 'I visit group merge requests page' do + step 'I visit group merge requests page' do visit merge_requests_group_path(current_group) end - When 'I visit group people page' do + step 'I visit group people page' do visit people_group_path(current_group) end - When 'I visit group settings page' do + step 'I visit group settings page' do visit edit_group_path(current_group) end @@ -33,27 +33,27 @@ module SharedPaths # Dashboard # ---------------------------------------- - Given 'I visit dashboard page' do + step 'I visit dashboard page' do visit dashboard_path end - Given 'I visit dashboard projects page' do + step 'I visit dashboard projects page' do visit projects_dashboard_path end - Given 'I visit dashboard issues page' do + step 'I visit dashboard issues page' do visit issues_dashboard_path end - Given 'I visit dashboard merge requests page' do + step 'I visit dashboard merge requests page' do visit merge_requests_dashboard_path end - Given 'I visit dashboard search page' do + step 'I visit dashboard search page' do visit search_path end - Given 'I visit dashboard help page' do + step 'I visit dashboard help page' do visit help_path end @@ -61,23 +61,23 @@ module SharedPaths # Profile # ---------------------------------------- - Given 'I visit profile page' do + step 'I visit profile page' do visit profile_path end - Given 'I visit profile account page' do + step 'I visit profile account page' do visit account_profile_path end - Given 'I visit profile SSH keys page' do + step 'I visit profile SSH keys page' do visit keys_path end - Given 'I visit profile design page' do + step 'I visit profile design page' do visit design_profile_path end - Given 'I visit profile history page' do + step 'I visit profile history page' do visit history_profile_path end @@ -85,35 +85,35 @@ module SharedPaths # Admin # ---------------------------------------- - Given 'I visit admin page' do + step 'I visit admin page' do visit admin_root_path end - Given 'I visit admin projects page' do + step 'I visit admin projects page' do visit admin_projects_path end - Given 'I visit admin users page' do + step 'I visit admin users page' do visit admin_users_path end - Given 'I visit admin logs page' do + step 'I visit admin logs page' do visit admin_logs_path end - Given 'I visit admin hooks page' do + step 'I visit admin hooks page' do visit admin_hooks_path end - Given 'I visit admin Resque page' do + step 'I visit admin Resque page' do visit admin_resque_path end - And 'I visit admin groups page' do + step 'I visit admin groups page' do visit admin_groups_path end - When 'I visit admin teams page' do + step 'I visit admin teams page' do visit admin_teams_path end @@ -121,145 +121,149 @@ module SharedPaths # Generic Project # ---------------------------------------- - Given "I visit my project's home page" do + step "I visit my project's home page" do visit project_path(@project) end - Given "I visit my project's settings page" do + step "I visit my project's settings page" do visit edit_project_path(@project) end - Given "I visit my project's files page" do + step "I visit my project's files page" do visit project_tree_path(@project, root_ref) end - Given "I visit my project's commits page" do + step "I visit my project's commits page" do visit project_commits_path(@project, root_ref, {limit: 5}) end - Given "I visit my project's commits page for a specific path" do + step "I visit my project's commits page for a specific path" do visit project_commits_path(@project, root_ref + "/app/models/project.rb", {limit: 5}) end - Given 'I visit my project\'s commits stats page' do + step 'I visit my project\'s commits stats page' do visit stats_project_repository_path(@project) end - Given "I visit my project's network page" do + step "I visit my project's network page" do # Stub Graph max_size to speed up test (10 commits vs. 650) Network::Graph.stub(max_count: 10) visit project_graph_path(@project, root_ref) end - Given "I visit my project's issues page" do + step "I visit my project's issues page" do visit project_issues_path(@project) end - Given "I visit my project's merge requests page" do + step "I visit my project's merge requests page" do visit project_merge_requests_path(@project) end - Given "I visit my project's wall page" do + step "I visit my project's wall page" do visit project_wall_path(@project) end - Given "I visit my project's wiki page" do + step "I visit my project's wiki page" do visit project_wiki_path(@project, :home) end - When 'I visit project hooks page' do + step 'I visit project hooks page' do visit project_hooks_path(@project) end + step 'I visit project deploy keys page' do + visit project_deploy_keys_path(@project) + end + # ---------------------------------------- # "Shop" Project # ---------------------------------------- - And 'I visit project "Shop" page' do + step 'I visit project "Shop" page' do visit project_path(project) end - When 'I visit edit project "Shop" page' do + step 'I visit edit project "Shop" page' do visit edit_project_path(project) end - Given 'I visit project branches page' do + step 'I visit project branches page' do visit branches_project_repository_path(@project) end - Given 'I visit compare refs page' do + step 'I visit compare refs page' do visit project_compare_index_path(@project) end - Given 'I visit project commits page' do + step 'I visit project commits page' do visit project_commits_path(@project, root_ref, {limit: 5}) end - Given 'I visit project commits page for stable branch' do + step 'I visit project commits page for stable branch' do visit project_commits_path(@project, 'stable', {limit: 5}) end - Given 'I visit project source page' do + step 'I visit project source page' do visit project_tree_path(@project, root_ref) end - Given 'I visit blob file from repo' do + step 'I visit blob file from repo' do visit project_blob_path(@project, File.join(ValidCommit::ID, ValidCommit::BLOB_FILE_PATH)) end - Given 'I visit project source page for "8470d70"' do + step 'I visit project source page for "8470d70"' do visit project_tree_path(@project, "8470d70") end - Given 'I visit project tags page' do + step 'I visit project tags page' do visit tags_project_repository_path(@project) end - Given 'I visit project commit page' do + step 'I visit project commit page' do visit project_commit_path(@project, ValidCommit::ID) end - And 'I visit project "Shop" issues page' do + step 'I visit project "Shop" issues page' do visit project_issues_path(project) end - Given 'I visit issue page "Release 0.4"' do + step 'I visit issue page "Release 0.4"' do issue = Issue.find_by_title("Release 0.4") visit project_issue_path(issue.project, issue) end - Given 'I visit project "Shop" labels page' do + step 'I visit project "Shop" labels page' do visit project_labels_path(project) end - Given 'I visit merge request page "Bug NS-04"' do + step 'I visit merge request page "Bug NS-04"' do mr = MergeRequest.find_by_title("Bug NS-04") visit project_merge_request_path(mr.project, mr) end - Given 'I visit merge request page "Bug NS-05"' do + step 'I visit merge request page "Bug NS-05"' do mr = MergeRequest.find_by_title("Bug NS-05") visit project_merge_request_path(mr.project, mr) end - And 'I visit project "Shop" merge requests page' do + step 'I visit project "Shop" merge requests page' do visit project_merge_requests_path(project) end - Given 'I visit project "Shop" milestones page' do + step 'I visit project "Shop" milestones page' do visit project_milestones_path(project) end - Then 'I visit project "Shop" team page' do + step 'I visit project "Shop" team page' do visit project_team_index_path(project) end - Then 'I visit project "Shop" wall page' do + step 'I visit project "Shop" wall page' do visit project_wall_path(project) end - Given 'I visit project wiki page' do + step 'I visit project wiki page' do visit project_wiki_path(@project, :home) end @@ -267,7 +271,7 @@ module SharedPaths # Public Projects # ---------------------------------------- - Given 'I visit the public projects area' do + step 'I visit the public projects area' do visit public_root_path end |