Cucumber features: Team, SSH keys
This commit is contained in:
parent
eb00cb69dd
commit
22d6dc2b3b
9 changed files with 162 additions and 8 deletions
|
@ -1,6 +1,6 @@
|
||||||
- user = member.user
|
- user = member.user
|
||||||
- allow_admin = can? current_user, :admin_project, @project
|
- allow_admin = can? current_user, :admin_project, @project
|
||||||
%tr{:id => dom_id(member), :class => "team_member_row"}
|
%tr{:id => dom_id(member), :class => "team_member_row user_#{user.id}"}
|
||||||
%td
|
%td
|
||||||
.right
|
.right
|
||||||
- if @project.owner == user
|
- if @project.owner == user
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
Feature: SSH Keys
|
||||||
|
Background:
|
||||||
|
Given I signin as a user
|
||||||
|
And I have ssh keys:
|
||||||
|
| title |
|
||||||
|
| Work |
|
||||||
|
| Home |
|
||||||
|
And I visit profile keys page
|
||||||
|
|
||||||
|
Scenario: I should see SSH keys
|
||||||
|
Then I should see my ssh keys
|
||||||
|
|
||||||
|
Scenario: Add new ssh key
|
||||||
|
Given I click link "Add new"
|
||||||
|
And I submit new ssh key "Laptop"
|
||||||
|
Then I should see new ssh key "Laptop"
|
||||||
|
|
||||||
|
Scenario: Remove ssh key
|
||||||
|
Given I click link "Work"
|
||||||
|
And I click link "Remove"
|
||||||
|
Then I visit profile keys page
|
||||||
|
And I should not see "Work" ssh key
|
|
@ -0,0 +1,35 @@
|
||||||
|
Feature: Project Team management
|
||||||
|
Background:
|
||||||
|
Given I signin as a user
|
||||||
|
And I own project "Shop"
|
||||||
|
And gitlab user "Mike"
|
||||||
|
And gitlab user "Sam"
|
||||||
|
And "Sam" is "Shop" developer
|
||||||
|
And I visit project "Shop" team page
|
||||||
|
|
||||||
|
Scenario: See all team members
|
||||||
|
Then I should be able to see myself in team
|
||||||
|
And I should see "Sam" in team list
|
||||||
|
|
||||||
|
Scenario: Add user to project
|
||||||
|
Given I click link "New Team Member"
|
||||||
|
And I select "Mike" as "Reporter"
|
||||||
|
Then I should see "Mike" in team list as "Reporter"
|
||||||
|
|
||||||
|
@javascript
|
||||||
|
Scenario: Update user access
|
||||||
|
Given I should see "Sam" in team list as "Developer"
|
||||||
|
And I change "Sam" role to "Reporter"
|
||||||
|
Then I visit project "Shop" team page
|
||||||
|
And I should see "Sam" in team list as "Reporter"
|
||||||
|
|
||||||
|
Scenario: View team member profile
|
||||||
|
Given I click link "Sam"
|
||||||
|
Then I should see "Sam" team profile
|
||||||
|
|
||||||
|
Scenario: Cancel team member
|
||||||
|
Given I click link "Sam"
|
||||||
|
And I click link "Remove from team"
|
||||||
|
Then I visit project "Shop" team page
|
||||||
|
And I should not see "Sam" in team list
|
||||||
|
|
|
@ -47,7 +47,7 @@ Then /^I should see last push widget$/ do
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^I click "(.*?)" link$/ do |arg1|
|
Then /^I click "(.*?)" link$/ do |arg1|
|
||||||
click_link "Create Merge Request"
|
click_link arg1 #Create Merge Request"
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^I see prefilled new Merge Request page$/ do
|
Then /^I see prefilled new Merge Request page$/ do
|
||||||
|
|
34
features/step_definitions/profile_keys_steps.rb
Normal file
34
features/step_definitions/profile_keys_steps.rb
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
Given /^I visit profile keys page$/ do
|
||||||
|
visit keys_path
|
||||||
|
end
|
||||||
|
|
||||||
|
Then /^I should see my ssh keys$/ do
|
||||||
|
@user.keys.each do |key|
|
||||||
|
page.should have_content(key.title)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Given /^I have ssh keys:$/ do |table|
|
||||||
|
table.hashes.each do |row|
|
||||||
|
Factory :key, :user => @user, :title => row[:title], :key => "jfKLJDFKSFJSHFJ#{row[:title]}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Given /^I submit new ssh key "(.*?)"$/ do |arg1|
|
||||||
|
fill_in "key_title", :with => arg1
|
||||||
|
fill_in "key_key", :with => "publickey234="
|
||||||
|
click_button "Save"
|
||||||
|
end
|
||||||
|
|
||||||
|
Then /^I should see new ssh key "(.*?)"$/ do |arg1|
|
||||||
|
key = Key.find_by_title(arg1)
|
||||||
|
page.should have_content(key.title)
|
||||||
|
page.should have_content(key.key)
|
||||||
|
current_path.should == key_path(key)
|
||||||
|
end
|
||||||
|
|
||||||
|
Then /^I should not see "(.*?)" ssh key$/ do |arg1|
|
||||||
|
within "#keys-table" do
|
||||||
|
page.should_not have_content(arg1)
|
||||||
|
end
|
||||||
|
end
|
63
features/step_definitions/project_team_steps.rb
Normal file
63
features/step_definitions/project_team_steps.rb
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
Given /^gitlab user "(.*?)"$/ do |arg1|
|
||||||
|
Factory :user, :name => arg1
|
||||||
|
end
|
||||||
|
|
||||||
|
Given /^"(.*?)" is "(.*?)" developer$/ do |arg1, arg2|
|
||||||
|
user = User.find_by_name(arg1)
|
||||||
|
project = Project.find_by_name(arg2)
|
||||||
|
project.add_access(user, :write)
|
||||||
|
end
|
||||||
|
|
||||||
|
Given /^I visit project "(.*?)" team page$/ do |arg1|
|
||||||
|
visit team_project_path(Project.find_by_name(arg1))
|
||||||
|
end
|
||||||
|
|
||||||
|
Then /^I should be able to see myself in team$/ do
|
||||||
|
page.should have_content(@user.name)
|
||||||
|
page.should have_content(@user.email)
|
||||||
|
end
|
||||||
|
|
||||||
|
Then /^I should see "(.*?)" in team list$/ do |arg1|
|
||||||
|
user = User.find_by_name(arg1)
|
||||||
|
page.should have_content(user.name)
|
||||||
|
page.should have_content(user.email)
|
||||||
|
end
|
||||||
|
|
||||||
|
Given /^I click link "(.*?)"$/ do |arg1|
|
||||||
|
click_link arg1
|
||||||
|
end
|
||||||
|
|
||||||
|
Given /^I select "(.*?)" as "(.*?)"$/ do |arg1, arg2|
|
||||||
|
user = User.find_by_name(arg1)
|
||||||
|
within "#new_team_member" do
|
||||||
|
select user.name, :from => "team_member_user_id"
|
||||||
|
select arg2, :from => "team_member_project_access"
|
||||||
|
end
|
||||||
|
click_button "Save"
|
||||||
|
end
|
||||||
|
|
||||||
|
Then /^I should see "(.*?)" in team list as "(.*?)"$/ do |arg1, arg2|
|
||||||
|
user = User.find_by_name(arg1)
|
||||||
|
role_id = find(".user_#{user.id} #team_member_project_access").value
|
||||||
|
role_id.should == UsersProject.access_roles[arg2].to_s
|
||||||
|
end
|
||||||
|
|
||||||
|
Given /^I change "(.*?)" role to "(.*?)"$/ do |arg1, arg2|
|
||||||
|
user = User.find_by_name(arg1)
|
||||||
|
within ".user_#{user.id}" do
|
||||||
|
select arg2, :from => "team_member_project_access"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Then /^I should see "(.*?)" team profile$/ do |arg1|
|
||||||
|
user = User.find_by_name(arg1)
|
||||||
|
page.should have_content(user.name)
|
||||||
|
page.should have_content(user.email)
|
||||||
|
page.should have_content("To team list")
|
||||||
|
end
|
||||||
|
|
||||||
|
Then /^I should not see "(.*?)" in team list$/ do |arg1|
|
||||||
|
user = User.find_by_name(arg1)
|
||||||
|
page.should_not have_content(user.name)
|
||||||
|
page.should_not have_content(user.email)
|
||||||
|
end
|
|
@ -28,7 +28,7 @@ end
|
||||||
|
|
||||||
Given /^I own project "(.*?)"$/ do |arg1|
|
Given /^I own project "(.*?)"$/ do |arg1|
|
||||||
@project = Factory :project, :name => arg1
|
@project = Factory :project, :name => arg1
|
||||||
@project.add_access(@user, :read, :write)
|
@project.add_access(@user, :admin)
|
||||||
end
|
end
|
||||||
|
|
||||||
Given /^I visit project "(.*?)" wall page$/ do |arg1|
|
Given /^I visit project "(.*?)" wall page$/ do |arg1|
|
||||||
|
@ -60,9 +60,9 @@ Given /^show me page$/ do
|
||||||
end
|
end
|
||||||
|
|
||||||
Given /^page should have network graph$/ do
|
Given /^page should have network graph$/ do
|
||||||
#page.should have_content "Project Network Graph"
|
page.should have_content "Project Network Graph"
|
||||||
#within ".graph" do
|
within ".graph" do
|
||||||
#page.should have_content "stable"
|
page.should have_content "stable"
|
||||||
#page.should have_content "notes_refacto..."
|
page.should have_content "notes_refacto..."
|
||||||
#end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue