Commit 22d6dc2b3b1392341c765932b706bd867c66c5f9

Authored by randx
1 parent eb00cb69

Cucumber features: Team, SSH keys

app/views/team_members/_show.html.haml
1 1 - user = member.user
2 2 - allow_admin = can? current_user, :admin_project, @project
3   -%tr{:id => dom_id(member), :class => "team_member_row"}
  3 +%tr{:id => dom_id(member), :class => "team_member_row user_#{user.id}"}
4 4 %td
5 5 .right
6 6 - if @project.owner == user
... ...
features/profile/ssh_keys.feature
... ... @@ -0,0 +1,22 @@
  1 +Feature: SSH Keys
  2 + Background:
  3 + Given I signin as a user
  4 + And I have ssh keys:
  5 + | title |
  6 + | Work |
  7 + | Home |
  8 + And I visit profile keys page
  9 +
  10 + Scenario: I should see SSH keys
  11 + Then I should see my ssh keys
  12 +
  13 + Scenario: Add new ssh key
  14 + Given I click link "Add new"
  15 + And I submit new ssh key "Laptop"
  16 + Then I should see new ssh key "Laptop"
  17 +
  18 + Scenario: Remove ssh key
  19 + Given I click link "Work"
  20 + And I click link "Remove"
  21 + Then I visit profile keys page
  22 + And I should not see "Work" ssh key
... ...
features/projects/team_management.feature
... ... @@ -0,0 +1,35 @@
  1 +Feature: Project Team management
  2 + Background:
  3 + Given I signin as a user
  4 + And I own project "Shop"
  5 + And gitlab user "Mike"
  6 + And gitlab user "Sam"
  7 + And "Sam" is "Shop" developer
  8 + And I visit project "Shop" team page
  9 +
  10 + Scenario: See all team members
  11 + Then I should be able to see myself in team
  12 + And I should see "Sam" in team list
  13 +
  14 + Scenario: Add user to project
  15 + Given I click link "New Team Member"
  16 + And I select "Mike" as "Reporter"
  17 + Then I should see "Mike" in team list as "Reporter"
  18 +
  19 + @javascript
  20 + Scenario: Update user access
  21 + Given I should see "Sam" in team list as "Developer"
  22 + And I change "Sam" role to "Reporter"
  23 + Then I visit project "Shop" team page
  24 + And I should see "Sam" in team list as "Reporter"
  25 +
  26 + Scenario: View team member profile
  27 + Given I click link "Sam"
  28 + Then I should see "Sam" team profile
  29 +
  30 + Scenario: Cancel team member
  31 + Given I click link "Sam"
  32 + And I click link "Remove from team"
  33 + Then I visit project "Shop" team page
  34 + And I should not see "Sam" in team list
  35 +
... ...
features/step_definitions/commits_steps.rb
... ... @@ -1,61 +0,0 @@
1   -Given /^I visit project commits page$/ do
2   - visit project_commits_path(@project)
3   -end
4   -
5   -Then /^I see project commits$/ do
6   - current_path.should == project_commits_path(@project)
7   -
8   - commit = @project.commit
9   - page.should have_content(@project.name)
10   - page.should have_content(commit.message)
11   - page.should have_content(commit.id.to_s[0..5])
12   -end
13   -
14   -Given /^I click atom feed link$/ do
15   - click_link "Feed"
16   -end
17   -
18   -Then /^I see commits atom feed$/ do
19   - commit = @project.commit
20   - page.response_headers['Content-Type'].should have_content("application/atom+xml")
21   - page.body.should have_selector("title", :text => "Recent commits to #{@project.name}")
22   - page.body.should have_selector("author email", :text => commit.author_email)
23   - page.body.should have_selector("entry summary", :text => commit.message)
24   -end
25   -
26   -Given /^I click on commit link$/ do
27   - visit project_commit_path(@project, ValidCommit::ID)
28   -end
29   -
30   -Then /^I see commit info$/ do
31   - page.should have_content ValidCommit::MESSAGE
32   - page.should have_content "Showing 1 changed file"
33   -end
34   -
35   -Given /^I visit compare refs page$/ do
36   - visit compare_project_commits_path(@project)
37   -end
38   -
39   -Given /^I fill compare fields with refs$/ do
40   - fill_in "from", :with => "master"
41   - fill_in "to", :with => "stable"
42   - click_button "Compare"
43   -end
44   -
45   -Given /^I see compared refs$/ do
46   - page.should have_content "Commits (27)"
47   - page.should have_content "Compare View"
48   - page.should have_content "Showing 73 changed files"
49   -end
50   -
51   -Given /^I visit project branches page$/ do
52   - visit branches_project_repository_path(@project)
53   -end
54   -
55   -Given /^I visit project commit page$/ do
56   - visit project_commit_path(@project, ValidCommit::ID)
57   -end
58   -
59   -Given /^I visit project tags page$/ do
60   - visit tags_project_repository_path(@project)
61   -end
features/step_definitions/dashboard_steps.rb
... ... @@ -47,7 +47,7 @@ Then /^I should see last push widget$/ do
47 47 end
48 48  
49 49 Then /^I click "(.*?)" link$/ do |arg1|
50   - click_link "Create Merge Request"
  50 + click_link arg1 #Create Merge Request"
51 51 end
52 52  
53 53 Then /^I see prefilled new Merge Request page$/ do
... ...
features/step_definitions/profile_keys_steps.rb 0 → 100644
... ... @@ -0,0 +1,34 @@
  1 +Given /^I visit profile keys page$/ do
  2 + visit keys_path
  3 +end
  4 +
  5 +Then /^I should see my ssh keys$/ do
  6 + @user.keys.each do |key|
  7 + page.should have_content(key.title)
  8 + end
  9 +end
  10 +
  11 +Given /^I have ssh keys:$/ do |table|
  12 + table.hashes.each do |row|
  13 + Factory :key, :user => @user, :title => row[:title], :key => "jfKLJDFKSFJSHFJ#{row[:title]}"
  14 + end
  15 +end
  16 +
  17 +Given /^I submit new ssh key "(.*?)"$/ do |arg1|
  18 + fill_in "key_title", :with => arg1
  19 + fill_in "key_key", :with => "publickey234="
  20 + click_button "Save"
  21 +end
  22 +
  23 +Then /^I should see new ssh key "(.*?)"$/ do |arg1|
  24 + key = Key.find_by_title(arg1)
  25 + page.should have_content(key.title)
  26 + page.should have_content(key.key)
  27 + current_path.should == key_path(key)
  28 +end
  29 +
  30 +Then /^I should not see "(.*?)" ssh key$/ do |arg1|
  31 + within "#keys-table" do
  32 + page.should_not have_content(arg1)
  33 + end
  34 +end
... ...
features/step_definitions/project_commits_steps.rb 0 → 100644
... ... @@ -0,0 +1,61 @@
  1 +Given /^I visit project commits page$/ do
  2 + visit project_commits_path(@project)
  3 +end
  4 +
  5 +Then /^I see project commits$/ do
  6 + current_path.should == project_commits_path(@project)
  7 +
  8 + commit = @project.commit
  9 + page.should have_content(@project.name)
  10 + page.should have_content(commit.message)
  11 + page.should have_content(commit.id.to_s[0..5])
  12 +end
  13 +
  14 +Given /^I click atom feed link$/ do
  15 + click_link "Feed"
  16 +end
  17 +
  18 +Then /^I see commits atom feed$/ do
  19 + commit = @project.commit
  20 + page.response_headers['Content-Type'].should have_content("application/atom+xml")
  21 + page.body.should have_selector("title", :text => "Recent commits to #{@project.name}")
  22 + page.body.should have_selector("author email", :text => commit.author_email)
  23 + page.body.should have_selector("entry summary", :text => commit.message)
  24 +end
  25 +
  26 +Given /^I click on commit link$/ do
  27 + visit project_commit_path(@project, ValidCommit::ID)
  28 +end
  29 +
  30 +Then /^I see commit info$/ do
  31 + page.should have_content ValidCommit::MESSAGE
  32 + page.should have_content "Showing 1 changed file"
  33 +end
  34 +
  35 +Given /^I visit compare refs page$/ do
  36 + visit compare_project_commits_path(@project)
  37 +end
  38 +
  39 +Given /^I fill compare fields with refs$/ do
  40 + fill_in "from", :with => "master"
  41 + fill_in "to", :with => "stable"
  42 + click_button "Compare"
  43 +end
  44 +
  45 +Given /^I see compared refs$/ do
  46 + page.should have_content "Commits (27)"
  47 + page.should have_content "Compare View"
  48 + page.should have_content "Showing 73 changed files"
  49 +end
  50 +
  51 +Given /^I visit project branches page$/ do
  52 + visit branches_project_repository_path(@project)
  53 +end
  54 +
  55 +Given /^I visit project commit page$/ do
  56 + visit project_commit_path(@project, ValidCommit::ID)
  57 +end
  58 +
  59 +Given /^I visit project tags page$/ do
  60 + visit tags_project_repository_path(@project)
  61 +end
... ...
features/step_definitions/project_team_steps.rb 0 → 100644
... ... @@ -0,0 +1,63 @@
  1 +Given /^gitlab user "(.*?)"$/ do |arg1|
  2 + Factory :user, :name => arg1
  3 +end
  4 +
  5 +Given /^"(.*?)" is "(.*?)" developer$/ do |arg1, arg2|
  6 + user = User.find_by_name(arg1)
  7 + project = Project.find_by_name(arg2)
  8 + project.add_access(user, :write)
  9 +end
  10 +
  11 +Given /^I visit project "(.*?)" team page$/ do |arg1|
  12 + visit team_project_path(Project.find_by_name(arg1))
  13 +end
  14 +
  15 +Then /^I should be able to see myself in team$/ do
  16 + page.should have_content(@user.name)
  17 + page.should have_content(@user.email)
  18 +end
  19 +
  20 +Then /^I should see "(.*?)" in team list$/ do |arg1|
  21 + user = User.find_by_name(arg1)
  22 + page.should have_content(user.name)
  23 + page.should have_content(user.email)
  24 +end
  25 +
  26 +Given /^I click link "(.*?)"$/ do |arg1|
  27 + click_link arg1
  28 +end
  29 +
  30 +Given /^I select "(.*?)" as "(.*?)"$/ do |arg1, arg2|
  31 + user = User.find_by_name(arg1)
  32 + within "#new_team_member" do
  33 + select user.name, :from => "team_member_user_id"
  34 + select arg2, :from => "team_member_project_access"
  35 + end
  36 + click_button "Save"
  37 +end
  38 +
  39 +Then /^I should see "(.*?)" in team list as "(.*?)"$/ do |arg1, arg2|
  40 + user = User.find_by_name(arg1)
  41 + role_id = find(".user_#{user.id} #team_member_project_access").value
  42 + role_id.should == UsersProject.access_roles[arg2].to_s
  43 +end
  44 +
  45 +Given /^I change "(.*?)" role to "(.*?)"$/ do |arg1, arg2|
  46 + user = User.find_by_name(arg1)
  47 + within ".user_#{user.id}" do
  48 + select arg2, :from => "team_member_project_access"
  49 + end
  50 +end
  51 +
  52 +Then /^I should see "(.*?)" team profile$/ do |arg1|
  53 + user = User.find_by_name(arg1)
  54 + page.should have_content(user.name)
  55 + page.should have_content(user.email)
  56 + page.should have_content("To team list")
  57 +end
  58 +
  59 +Then /^I should not see "(.*?)" in team list$/ do |arg1|
  60 + user = User.find_by_name(arg1)
  61 + page.should_not have_content(user.name)
  62 + page.should_not have_content(user.email)
  63 +end
... ...
features/step_definitions/project_wiki_steps.rb 0 → 100644
... ... @@ -0,0 +1,18 @@
  1 +Given /^I visit project wiki page$/ do
  2 + visit project_wiki_path(@project, :index)
  3 +end
  4 +
  5 +Given /^I create Wiki page$/ do
  6 + fill_in "Title", :with => 'Test title'
  7 + fill_in "Content", :with => '[link test](test)'
  8 + click_on "Save"
  9 +end
  10 +
  11 +Then /^I should see newly created wiki page$/ do
  12 + page.should have_content("Test title")
  13 + page.should have_content("link test")
  14 +
  15 + click_link "link test"
  16 +
  17 + page.should have_content("Editing page")
  18 +end
... ...
features/step_definitions/projects_steps.rb
... ... @@ -28,7 +28,7 @@ end
28 28  
29 29 Given /^I own project "(.*?)"$/ do |arg1|
30 30 @project = Factory :project, :name => arg1
31   - @project.add_access(@user, :read, :write)
  31 + @project.add_access(@user, :admin)
32 32 end
33 33  
34 34 Given /^I visit project "(.*?)" wall page$/ do |arg1|
... ... @@ -60,9 +60,9 @@ Given /^show me page$/ do
60 60 end
61 61  
62 62 Given /^page should have network graph$/ do
63   - #page.should have_content "Project Network Graph"
64   - #within ".graph" do
65   - #page.should have_content "stable"
66   - #page.should have_content "notes_refacto..."
67   - #end
  63 + page.should have_content "Project Network Graph"
  64 + within ".graph" do
  65 + page.should have_content "stable"
  66 + page.should have_content "notes_refacto..."
  67 + end
68 68 end
... ...
features/step_definitions/wiki_steps.rb
... ... @@ -1,18 +0,0 @@
1   -Given /^I visit project wiki page$/ do
2   - visit project_wiki_path(@project, :index)
3   -end
4   -
5   -Given /^I create Wiki page$/ do
6   - fill_in "Title", :with => 'Test title'
7   - fill_in "Content", :with => '[link test](test)'
8   - click_on "Save"
9   -end
10   -
11   -Then /^I should see newly created wiki page$/ do
12   - page.should have_content("Test title")
13   - page.should have_content("link test")
14   -
15   - click_link "link test"
16   -
17   - page.should have_content("Editing page")
18   -end