Commit b7f1cf9f authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Feature tests for deploy keys

parent 42b86b79
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
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
module SharedPaths module SharedPaths
include Spinach::DSL include Spinach::DSL
When 'I visit new project page' do step 'I visit new project page' do
visit new_project_path visit new_project_path
end end
...@@ -9,23 +9,23 @@ module SharedPaths ...@@ -9,23 +9,23 @@ module SharedPaths
# Group # Group
# ---------------------------------------- # ----------------------------------------
When 'I visit group page' do step 'I visit group page' do
visit group_path(current_group) visit group_path(current_group)
end end
When 'I visit group issues page' do step 'I visit group issues page' do
visit issues_group_path(current_group) visit issues_group_path(current_group)
end end
When 'I visit group merge requests page' do step 'I visit group merge requests page' do
visit merge_requests_group_path(current_group) visit merge_requests_group_path(current_group)
end end
When 'I visit group people page' do step 'I visit group people page' do
visit people_group_path(current_group) visit people_group_path(current_group)
end end
When 'I visit group settings page' do step 'I visit group settings page' do
visit edit_group_path(current_group) visit edit_group_path(current_group)
end end
...@@ -33,27 +33,27 @@ module SharedPaths ...@@ -33,27 +33,27 @@ module SharedPaths
# Dashboard # Dashboard
# ---------------------------------------- # ----------------------------------------
Given 'I visit dashboard page' do step 'I visit dashboard page' do
visit dashboard_path visit dashboard_path
end end
Given 'I visit dashboard projects page' do step 'I visit dashboard projects page' do
visit projects_dashboard_path visit projects_dashboard_path
end end
Given 'I visit dashboard issues page' do step 'I visit dashboard issues page' do
visit issues_dashboard_path visit issues_dashboard_path
end end
Given 'I visit dashboard merge requests page' do step 'I visit dashboard merge requests page' do
visit merge_requests_dashboard_path visit merge_requests_dashboard_path
end end
Given 'I visit dashboard search page' do step 'I visit dashboard search page' do
visit search_path visit search_path
end end
Given 'I visit dashboard help page' do step 'I visit dashboard help page' do
visit help_path visit help_path
end end
...@@ -61,23 +61,23 @@ module SharedPaths ...@@ -61,23 +61,23 @@ module SharedPaths
# Profile # Profile
# ---------------------------------------- # ----------------------------------------
Given 'I visit profile page' do step 'I visit profile page' do
visit profile_path visit profile_path
end end
Given 'I visit profile account page' do step 'I visit profile account page' do
visit account_profile_path visit account_profile_path
end end
Given 'I visit profile SSH keys page' do step 'I visit profile SSH keys page' do
visit keys_path visit keys_path
end end
Given 'I visit profile design page' do step 'I visit profile design page' do
visit design_profile_path visit design_profile_path
end end
Given 'I visit profile history page' do step 'I visit profile history page' do
visit history_profile_path visit history_profile_path
end end
...@@ -85,35 +85,35 @@ module SharedPaths ...@@ -85,35 +85,35 @@ module SharedPaths
# Admin # Admin
# ---------------------------------------- # ----------------------------------------
Given 'I visit admin page' do step 'I visit admin page' do
visit admin_root_path visit admin_root_path
end end
Given 'I visit admin projects page' do step 'I visit admin projects page' do
visit admin_projects_path visit admin_projects_path
end end
Given 'I visit admin users page' do step 'I visit admin users page' do
visit admin_users_path visit admin_users_path
end end
Given 'I visit admin logs page' do step 'I visit admin logs page' do
visit admin_logs_path visit admin_logs_path
end end
Given 'I visit admin hooks page' do step 'I visit admin hooks page' do
visit admin_hooks_path visit admin_hooks_path
end end
Given 'I visit admin Resque page' do step 'I visit admin Resque page' do
visit admin_resque_path visit admin_resque_path
end end
And 'I visit admin groups page' do step 'I visit admin groups page' do
visit admin_groups_path visit admin_groups_path
end end
When 'I visit admin teams page' do step 'I visit admin teams page' do
visit admin_teams_path visit admin_teams_path
end end
...@@ -121,145 +121,149 @@ module SharedPaths ...@@ -121,145 +121,149 @@ module SharedPaths
# Generic Project # Generic Project
# ---------------------------------------- # ----------------------------------------
Given "I visit my project's home page" do step "I visit my project's home page" do
visit project_path(@project) visit project_path(@project)
end end
Given "I visit my project's settings page" do step "I visit my project's settings page" do
visit edit_project_path(@project) visit edit_project_path(@project)
end 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) visit project_tree_path(@project, root_ref)
end 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}) visit project_commits_path(@project, root_ref, {limit: 5})
end 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}) visit project_commits_path(@project, root_ref + "/app/models/project.rb", {limit: 5})
end 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) visit stats_project_repository_path(@project)
end 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) # Stub Graph max_size to speed up test (10 commits vs. 650)
Network::Graph.stub(max_count: 10) Network::Graph.stub(max_count: 10)
visit project_graph_path(@project, root_ref) visit project_graph_path(@project, root_ref)
end end
Given "I visit my project's issues page" do step "I visit my project's issues page" do
visit project_issues_path(@project) visit project_issues_path(@project)
end 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) visit project_merge_requests_path(@project)
end end
Given "I visit my project's wall page" do step "I visit my project's wall page" do
visit project_wall_path(@project) visit project_wall_path(@project)
end 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) visit project_wiki_path(@project, :home)
end end
When 'I visit project hooks page' do step 'I visit project hooks page' do
visit project_hooks_path(@project) visit project_hooks_path(@project)
end end
step 'I visit project deploy keys page' do
visit project_deploy_keys_path(@project)
end
# ---------------------------------------- # ----------------------------------------
# "Shop" Project # "Shop" Project
# ---------------------------------------- # ----------------------------------------
And 'I visit project "Shop" page' do step 'I visit project "Shop" page' do
visit project_path(project) visit project_path(project)
end end
When 'I visit edit project "Shop" page' do step 'I visit edit project "Shop" page' do
visit edit_project_path(project) visit edit_project_path(project)
end end
Given 'I visit project branches page' do step 'I visit project branches page' do
visit branches_project_repository_path(@project) visit branches_project_repository_path(@project)
end end
Given 'I visit compare refs page' do step 'I visit compare refs page' do
visit project_compare_index_path(@project) visit project_compare_index_path(@project)
end end
Given 'I visit project commits page' do step 'I visit project commits page' do
visit project_commits_path(@project, root_ref, {limit: 5}) visit project_commits_path(@project, root_ref, {limit: 5})
end 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}) visit project_commits_path(@project, 'stable', {limit: 5})
end end
Given 'I visit project source page' do step 'I visit project source page' do
visit project_tree_path(@project, root_ref) visit project_tree_path(@project, root_ref)
end 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)) visit project_blob_path(@project, File.join(ValidCommit::ID, ValidCommit::BLOB_FILE_PATH))
end 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") visit project_tree_path(@project, "8470d70")
end end
Given 'I visit project tags page' do step 'I visit project tags page' do
visit tags_project_repository_path(@project) visit tags_project_repository_path(@project)
end end
Given 'I visit project commit page' do step 'I visit project commit page' do
visit project_commit_path(@project, ValidCommit::ID) visit project_commit_path(@project, ValidCommit::ID)
end end
And 'I visit project "Shop" issues page' do step 'I visit project "Shop" issues page' do
visit project_issues_path(project) visit project_issues_path(project)
end 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") issue = Issue.find_by_title("Release 0.4")
visit project_issue_path(issue.project, issue) visit project_issue_path(issue.project, issue)
end end
Given 'I visit project "Shop" labels page' do step 'I visit project "Shop" labels page' do
visit project_labels_path(project) visit project_labels_path(project)
end 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") mr = MergeRequest.find_by_title("Bug NS-04")
visit project_merge_request_path(mr.project, mr) visit project_merge_request_path(mr.project, mr)
end 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") mr = MergeRequest.find_by_title("Bug NS-05")
visit project_merge_request_path(mr.project, mr) visit project_merge_request_path(mr.project, mr)
end 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) visit project_merge_requests_path(project)
end end
Given 'I visit project "Shop" milestones page' do step 'I visit project "Shop" milestones page' do
visit project_milestones_path(project) visit project_milestones_path(project)
end end
Then 'I visit project "Shop" team page' do step 'I visit project "Shop" team page' do
visit project_team_index_path(project) visit project_team_index_path(project)
end end
Then 'I visit project "Shop" wall page' do step 'I visit project "Shop" wall page' do
visit project_wall_path(project) visit project_wall_path(project)
end end
Given 'I visit project wiki page' do step 'I visit project wiki page' do
visit project_wiki_path(@project, :home) visit project_wiki_path(@project, :home)
end end
...@@ -267,7 +271,7 @@ module SharedPaths ...@@ -267,7 +271,7 @@ module SharedPaths
# Public Projects # Public Projects
# ---------------------------------------- # ----------------------------------------
Given 'I visit the public projects area' do step 'I visit the public projects area' do
visit public_root_path visit public_root_path
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment