Commit b5815511 authored by Nihad Abbasov's avatar Nihad Abbasov

add spinach steps for remaining features

parent 698500dd
Feature: Merge Requests Feature: Project Merge Requests
Background: Background:
Given I signin as a user Given I sign in as a user
And I own project "Shop" And I own project "Shop"
And project "Shop" have "Bug NS-04" open merge request And project "Shop" have "Bug NS-04" open merge request
And project "Shop" have "Feature NS-03" closed merge request And project "Shop" have "Feature NS-03" closed merge request
......
@javascript
Feature: Project Network Graph Feature: Project Network Graph
Background: Background:
Given I signin as a user Given I sign in as a user
And I own project "Shop" And I own project "Shop"
And I visit project "Shop" network page And I visit project "Shop" network page
@javascript
Scenario: I should see project network Scenario: I should see project network
Then page should have network graph Then page should have network graph
Feature: Project Feature: Projects
Background: Background:
Given I signin as a user Given I signin as a user
And I own project "Shop" And I own project "Shop"
And I visit project "Shop" page 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
Feature: Project Team management Feature: Project Team management
Background: Background:
Given I signin as a user Given I sign in as a user
And I own project "Shop" And I own project "Shop"
And gitlab user "Mike" And gitlab user "Mike"
And gitlab user "Sam" And gitlab user "Sam"
...@@ -32,4 +32,3 @@ Feature: Project Team management ...@@ -32,4 +32,3 @@ Feature: Project Team management
And I click link "Remove from team" And I click link "Remove from team"
Then I visit project "Shop" team page Then I visit project "Shop" team page
And I should not see "Sam" in team list And I should not see "Sam" in team list
...@@ -9,6 +9,7 @@ Feature: Project Wall ...@@ -9,6 +9,7 @@ Feature: Project Wall
And I own project "Shop" And I own project "Shop"
And I visit project "Shop" wall page And I visit project "Shop" wall page
@javascript
Scenario: Write comment Scenario: Write comment
Given I write new comment "my special test message" Given I write new comment "my special test message"
Then I should see project wall note "my special test message" Then I should see project wall note "my special test message"
......
Feature: Wiki Feature: Project Wiki
Background: Background:
Given I signin as a user Given I sign in as a user
And I own project "Shop" And I own project "Shop"
Given I visit project wiki page Given I visit project wiki page
......
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
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
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
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
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
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
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
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