add spinach steps for remaining features

This commit is contained in:
Nihad Abbasov 2012-09-10 06:35:23 -07:00
parent 698500dd78
commit b58155113b
16 changed files with 357 additions and 24 deletions

View file

@ -1,4 +1,4 @@
Feature: Merge Requests
Feature: Project Merge Requests
Background:
Given I sign in as a user
And I own project "Shop"

View file

@ -1,10 +1,9 @@
@javascript
Feature: Project Network Graph
Background:
Given I sign in as a user
And I own project "Shop"
And I visit project "Shop" network page
@javascript
Scenario: I should see project network
Then page should have network graph

View file

@ -1,11 +1,14 @@
Feature: Project
Feature: Projects
Background:
Given I signin as a user
And I own project "Shop"
And I visit project "Shop" page
Scenario: I should see project activity
# @wip
# Scenario: I should see project activity
Scenario: I edit project
# @wip
# Scenario: I edit project
Scenario: I visit attachments
# @wip
# Scenario: I visit attachments

View file

@ -32,4 +32,3 @@ Feature: Project Team management
And I click link "Remove from team"
Then I visit project "Shop" team page
And I should not see "Sam" in team list

View file

@ -9,6 +9,7 @@ Feature: Project Wall
And I own project "Shop"
And I visit project "Shop" wall page
@javascript
Scenario: Write comment
Given I write new comment "my special test message"
Then I should see project wall note "my special test message"

View file

@ -1,4 +1,4 @@
Feature: Wiki
Feature: Project Wiki
Background:
Given I sign in as a user
And I own project "Shop"

View file

@ -0,0 +1,27 @@
class CreateProject < Spinach::FeatureSteps
Given 'I signin as a user' do
login_as :user
end
When 'I visit new project page' do
visit new_project_path
end
And '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
And '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
end

15
features/steps/project.rb Normal file
View file

@ -0,0 +1,15 @@
class Projects < Spinach::FeatureSteps
Given 'I sign in as a user' do
login_as :user
end
And 'I own project "Shop"' do
@project = Factory :project, :name => "Shop"
@project.add_access(@user, :admin)
end
And 'I visit project "Shop" page' do
project = Project.find_by_name("Shop")
visit project_path(project)
end
end

View file

@ -0,0 +1,102 @@
class ProjectMergeRequests < Spinach::FeatureSteps
Then 'I should see "Bug NS-04" in merge requests' do
page.should have_content "Bug NS-04"
end
And 'I should not see "Feature NS-03" in merge requests' do
page.should_not have_content "Feature NS-03"
end
Given 'I click link "Closed"' do
click_link "Closed"
end
Then 'I should see "Feature NS-03" in merge requests' do
page.should have_content "Feature NS-03"
end
And 'I should not see "Bug NS-04" in merge requests' do
page.should_not have_content "Bug NS-04"
end
Given 'I click link "All"' do
click_link "All"
end
Given 'I click link "Bug NS-04"' do
click_link "Bug NS-04"
end
Then 'I should see merge request "Bug NS-04"' do
page.should have_content "Bug NS-04"
end
And 'I click link "Close"' do
click_link "Close"
end
Then 'I should see closed merge request "Bug NS-04"' do
mr = MergeRequest.find_by_title("Bug NS-04")
mr.closed.should be_true
page.should have_content "Closed by"
end
Given 'I click link "New Merge Request"' do
click_link "New Merge Request"
end
And 'I submit new merge request "Wiki Feature"' do
fill_in "merge_request_title", :with => "Wiki Feature"
select "master", :from => "merge_request_source_branch"
select "stable", :from => "merge_request_target_branch"
click_button "Save"
end
Then 'I should see merge request "Wiki Feature"' do
page.should have_content "Wiki Feature"
end
Given '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
And 'I leave a comment like "XML attached"' do
fill_in "note_note", :with => "XML attached"
click_button "Add Comment"
end
Then 'I should see comment "XML attached"' do
page.should have_content "XML attached"
end
Given 'I sign in as a user' do
login_as :user
end
And 'I own project "Shop"' do
@project = Factory :project, :name => "Shop"
@project.add_access(@user, :admin)
end
And 'project "Shop" have "Bug NS-04" open merge request' do
project = Project.find_by_name("Shop")
Factory.create(:merge_request,
:title => "Bug NS-04",
:project => project,
:author => project.users.first)
end
And 'project "Shop" have "Feature NS-03" closed merge request' do
project = Project.find_by_name("Shop")
Factory.create(:merge_request,
:title => "Feature NS-03",
:project => project,
:author => project.users.first,
:closed => true)
end
And 'I visit project "Shop" merge requests page' do
visit project_merge_requests_path(Project.find_by_name("Shop"))
end
end

View file

@ -0,0 +1,28 @@
class ProjectNetworkGraph < Spinach::FeatureSteps
Then 'page should have network graph' do
page.should have_content "Project Network Graph"
within ".graph" do
page.should have_content "master"
page.should have_content "scss_refactor..."
end
end
Given 'I sign in as a user' do
login_as :user
end
And 'I own project "Shop"' do
@project = Factory :project, :name => "Shop"
@project.add_access(@user, :admin)
end
And 'I visit project "Shop" network page' do
project = Project.find_by_name("Shop")
# Stub out find_all to speed this up (10 commits vs. 650)
commits = Grit::Commit.find_all(project.repo, nil, {max_count: 10})
Grit::Commit.stub(:find_all).and_return(commits)
visit graph_project_path(project)
end
end

View file

@ -0,0 +1,98 @@
class ProjectTeamManagement < Spinach::FeatureSteps
Then 'I should be able to see myself in team' do
page.should have_content(@user.name)
page.should have_content(@user.email)
end
And 'I should see "Sam" in team list' do
user = User.find_by_name("Sam")
page.should have_content(user.name)
page.should have_content(user.email)
end
Given 'I click link "New Team Member"' do
click_link "New Team Member"
end
And 'I select "Mike" as "Reporter"' do
user = User.find_by_name("Mike")
within "#new_team_member" do
select user.name, :from => "user_ids"
select "Reporter", :from => "project_access"
end
click_button "Save"
end
Then 'I should see "Mike" in team list as "Reporter"' do
user = User.find_by_name("Mike")
role_id = find(".user_#{user.id} #team_member_project_access").value
role_id.should == UsersProject.access_roles["Reporter"].to_s
end
Given 'I should see "Sam" in team list as "Developer"' do
user = User.find_by_name("Sam")
role_id = find(".user_#{user.id} #team_member_project_access").value
role_id.should == UsersProject.access_roles["Developer"].to_s
end
And 'I change "Sam" role to "Reporter"' do
user = User.find_by_name("Sam")
within ".user_#{user.id}" do
select "Reporter", :from => "team_member_project_access"
end
end
Then 'I visit project "Shop" team page' do
visit team_project_path(Project.find_by_name("Shop"))
end
And 'I should see "Sam" in team list as "Reporter"' do
user = User.find_by_name("Sam")
role_id = find(".user_#{user.id} #team_member_project_access").value
role_id.should == UsersProject.access_roles["Reporter"].to_s
end
Given 'I click link "Sam"' do
click_link "Sam"
end
Then 'I should see "Sam" team profile' do
user = User.find_by_name("Sam")
page.should have_content(user.name)
page.should have_content(user.email)
page.should have_content("To team list")
end
And 'I click link "Remove from team"' do
click_link "Remove from team"
end
And 'I should not see "Sam" in team list' do
user = User.find_by_name("Sam")
page.should_not have_content(user.name)
page.should_not have_content(user.email)
end
Given 'I sign in as a user' do
login_as :user
end
And 'I own project "Shop"' do
@project = Factory :project, :name => "Shop"
@project.add_access(@user, :admin)
end
And 'gitlab user "Mike"' do
Factory :user, :name => "Mike"
end
And 'gitlab user "Sam"' do
Factory :user, :name => "Sam"
end
And '"Sam" is "Shop" developer' do
user = User.find_by_name("Sam")
project = Project.find_by_name("Shop")
project.add_access(user, :write)
end
end

View file

@ -0,0 +1,24 @@
class ProjectWall < Spinach::FeatureSteps
Given 'I write new comment "my special test message"' do
fill_in "note_note", :with => "my special test message"
click_button "Add Comment"
end
Then 'I should see project wall note "my special test message"' do
page.should have_content "my special test message"
end
Then 'I visit project "Shop" wall page' do
project = Project.find_by_name("Shop")
visit wall_project_path(project)
end
Given 'I signin as a user' do
login_as :user
end
And 'I own project "Shop"' do
@project = Factory :project, :name => "Shop"
@project.add_access(@user, :admin)
end
end

View file

@ -0,0 +1,37 @@
class ProjectWiki < Spinach::FeatureSteps
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
And 'I leave a comment like "XML attached"' do
fill_in "note_note", :with => "XML attached"
click_button "Add Comment"
end
Then 'I should see comment "XML attached"' do
page.should have_content "XML attached"
end
Given 'I sign in as a user' do
login_as :user
end
And 'I own project "Shop"' do
@project = Factory :project, :name => "Shop"
@project.add_access(@user, :admin)
end
Given 'I visit project wiki page' do
visit project_wiki_path(@project, :index)
end
end