Commit ef6e94e3 authored by Ciro Santilli's avatar Ciro Santilli

Replace old spinach step definitions with step.

parent fda61a04
......@@ -3,35 +3,35 @@ class AdminActiveTab < Spinach::FeatureSteps
include SharedPaths
include SharedActiveTab
Then 'the active main tab should be Home' do
step 'the active main tab should be Home' do
ensure_active_main_tab('Overview')
end
Then 'the active main tab should be Projects' do
step 'the active main tab should be Projects' do
ensure_active_main_tab('Projects')
end
Then 'the active main tab should be Groups' do
step 'the active main tab should be Groups' do
ensure_active_main_tab('Groups')
end
Then 'the active main tab should be Users' do
step 'the active main tab should be Users' do
ensure_active_main_tab('Users')
end
Then 'the active main tab should be Logs' do
step 'the active main tab should be Logs' do
ensure_active_main_tab('Logs')
end
Then 'the active main tab should be Hooks' do
step 'the active main tab should be Hooks' do
ensure_active_main_tab('Hooks')
end
Then 'the active main tab should be Resque' do
step 'the active main tab should be Resque' do
ensure_active_main_tab('Background Jobs')
end
Then 'the active main tab should be Messages' do
step 'the active main tab should be Messages' do
ensure_active_main_tab('Messages')
end
end
......@@ -13,7 +13,7 @@ class AdminGroups < Spinach::FeatureSteps
click_link "New Group"
end
And 'I have group with projects' do
step 'I have group with projects' do
@group = create(:group)
@project = create(:project, group: @group)
@event = create(:closed_issue_event, project: @project)
......@@ -21,18 +21,18 @@ class AdminGroups < Spinach::FeatureSteps
@project.team << [current_user, :master]
end
And 'submit form with new group info' do
step 'submit form with new group info' do
fill_in 'group_name', with: 'gitlab'
fill_in 'group_description', with: 'Group description'
click_button "Create group"
end
Then 'I should see newly created group' do
step 'I should see newly created group' do
page.should have_content "Group: gitlab"
page.should have_content "Group description"
end
Then 'I should be redirected to group page' do
step 'I should be redirected to group page' do
current_path.should == admin_group_path(Group.last)
end
......@@ -45,7 +45,7 @@ class AdminGroups < Spinach::FeatureSteps
click_button "Add users into group"
end
Then 'I should see "John Doe" in team list in every project as "Reporter"' do
step 'I should see "John Doe" in team list in every project as "Reporter"' do
within ".group-users-list" do
page.should have_content "John Doe"
page.should have_content "Reporter"
......
......@@ -3,7 +3,7 @@ class AdminLogs < Spinach::FeatureSteps
include SharedPaths
include SharedAdmin
Then 'I should see tabs with available logs' do
step 'I should see tabs with available logs' do
page.should have_content 'production.log'
page.should have_content 'githost.log'
page.should have_content 'application.log'
......
......@@ -3,17 +3,17 @@ class AdminProjects < Spinach::FeatureSteps
include SharedPaths
include SharedAdmin
And 'I should see all projects' do
step 'I should see all projects' do
Project.all.each do |p|
page.should have_content p.name_with_namespace
end
end
And 'I click on first project' do
step 'I click on first project' do
click_link Project.first.name_with_namespace
end
Then 'I should see project details' do
step 'I should see project details' do
project = Project.first
current_path.should == admin_project_path(project)
page.should have_content(project.name_with_namespace)
......
......@@ -3,32 +3,32 @@ class AdminUsers < Spinach::FeatureSteps
include SharedPaths
include SharedAdmin
Then 'I should see all users' do
step 'I should see all users' do
User.all.each do |user|
page.should have_content user.name
end
end
And 'Click edit' do
step 'Click edit' do
@user = User.first
find("#edit_user_#{@user.id}").click
end
And 'Input non ascii char in username' do
step 'Input non ascii char in username' do
fill_in 'user_username', with: "\u3042\u3044"
end
And 'Click save' do
step 'Click save' do
click_button("Save")
end
Then 'See username error message' do
step 'See username error message' do
within "#error_explanation" do
page.should have_content "Username"
end
end
And 'Not changed form action url' do
step 'Not changed form action url' do
page.should have_selector %(form[action="/admin/users/#{@user.username}"])
end
......
......@@ -3,31 +3,31 @@ class Dashboard < Spinach::FeatureSteps
include SharedPaths
include SharedProject
Then 'I should see "New Project" link' do
step 'I should see "New Project" link' do
page.should have_link "New project"
end
Then 'I should see "Shop" project link' do
step 'I should see "Shop" project link' do
page.should have_link "Shop"
end
Then 'I should see last push widget' do
step 'I should see last push widget' do
page.should have_content "You pushed to fix"
page.should have_link "Create Merge Request"
end
And 'I click "Create Merge Request" link' do
step 'I click "Create Merge Request" link' do
click_link "Create Merge Request"
end
Then 'I see prefilled new Merge Request page' do
step 'I see prefilled new Merge Request page' do
current_path.should == new_project_merge_request_path(@project)
find("#merge_request_target_project_id").value.should == @project.id.to_s
find("#merge_request_source_branch").value.should == "fix"
find("#merge_request_target_branch").value.should == "master"
end
Given 'user with name "John Doe" joined project "Shop"' do
step 'user with name "John Doe" joined project "Shop"' do
user = create(:user, {name: "John Doe"})
project.team << [user, :master]
Event.create(
......@@ -37,11 +37,11 @@ class Dashboard < Spinach::FeatureSteps
)
end
Then 'I should see "John Doe joined project at Shop" event' do
step 'I should see "John Doe joined project at Shop" event' do
page.should have_content "John Doe joined project at #{project.name_with_namespace}"
end
And 'user with name "John Doe" left project "Shop"' do
step 'user with name "John Doe" left project "Shop"' do
user = User.find_by(name: "John Doe")
Event.create(
project: project,
......@@ -50,11 +50,11 @@ class Dashboard < Spinach::FeatureSteps
)
end
Then 'I should see "John Doe left project at Shop" event' do
step 'I should see "John Doe left project at Shop" event' do
page.should have_content "John Doe left project at #{project.name_with_namespace}"
end
And 'I have group with projects' do
step 'I have group with projects' do
@group = create(:group)
@project = create(:project, namespace: @group)
@event = create(:closed_issue_event, project: @project)
......@@ -62,24 +62,24 @@ class Dashboard < Spinach::FeatureSteps
@project.team << [current_user, :master]
end
Then 'I should see projects list' do
step 'I should see projects list' do
@user.authorized_projects.all.each do |project|
page.should have_link project.name_with_namespace
end
end
Then 'I should see groups list' do
step 'I should see groups list' do
Group.all.each do |group|
page.should have_link group.name
end
end
And 'group has a projects that does not belongs to me' do
step 'group has a projects that does not belongs to me' do
@forbidden_project1 = create(:project, group: @group)
@forbidden_project2 = create(:project, group: @group)
end
Then 'I should see 1 project at group list' do
step 'I should see 1 project at group list' do
page.find('span.last_activity/span').should have_content('1')
end
......
......@@ -3,31 +3,31 @@ class EventFilters < Spinach::FeatureSteps
include SharedPaths
include SharedProject
Then 'I should see push event' do
step 'I should see push event' do
page.should have_selector('span.pushed')
end
Then 'I should not see push event' do
step 'I should not see push event' do
page.should_not have_selector('span.pushed')
end
Then 'I should see new member event' do
step 'I should see new member event' do
page.should have_selector('span.joined')
end
And 'I should not see new member event' do
step 'I should not see new member event' do
page.should_not have_selector('span.joined')
end
Then 'I should see merge request event' do
step 'I should see merge request event' do
page.should have_selector('span.accepted')
end
And 'I should not see merge request event' do
step 'I should not see merge request event' do
page.should_not have_selector('span.accepted')
end
And 'this project has push event' do
step 'this project has push event' do
data = {
before: "0000000000000000000000000000000000000000",
after: "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e",
......@@ -51,7 +51,7 @@ class EventFilters < Spinach::FeatureSteps
)
end
And 'this project has new member event' do
step 'this project has new member event' do
user = create(:user, {name: "John Doe"})
Event.create(
project: @project,
......@@ -60,7 +60,7 @@ class EventFilters < Spinach::FeatureSteps
)
end
And 'this project has merge request event' do
step 'this project has merge request event' do
merge_request = create :merge_request, author: @user, source_project: @project, target_project: @project
Event.create(
project: @project,
......
......@@ -3,7 +3,7 @@ class DashboardProjects < Spinach::FeatureSteps
include SharedPaths
include SharedProject
Then 'I should see projects list' do
step 'I should see projects list' do
@user.authorized_projects.all.each do |project|
page.should have_link project.name_with_namespace
end
......
......@@ -8,15 +8,15 @@ class DashboardWithArchivedProjects < Spinach::FeatureSteps
project.update_attribute(:archived, true)
end
Then 'I should see "Shop" project link' do
step 'I should see "Shop" project link' do
page.should have_link "Shop"
end
Then 'I should not see "Forum" project link' do
step 'I should not see "Forum" project link' do
page.should_not have_link "Forum"
end
Then 'I should see "Forum" project link' do
step 'I should see "Forum" project link' do
page.should have_link "Forum"
end
end
......@@ -5,29 +5,29 @@ class Groups < Spinach::FeatureSteps
include SharedUser
include Select2Helper
Then 'I should see group "Owned" projects list' do
step 'I should see group "Owned" projects list' do
Group.find_by(name: "Owned").projects.each do |project|
page.should have_link project.name
end
end
And 'I should see projects activity feed' do
step 'I should see projects activity feed' do
page.should have_content 'closed issue'
end
Then 'I should see issues from group "Owned" assigned to me' do
step 'I should see issues from group "Owned" assigned to me' do
assigned_to_me(:issues).each do |issue|
page.should have_content issue.title
end
end
Then 'I should see merge requests from group "Owned" assigned to me' do
step 'I should see merge requests from group "Owned" assigned to me' do
assigned_to_me(:merge_requests).each do |issue|
page.should have_content issue.title[0..80]
end
end
And 'I select user "Mary Jane" from list with role "Reporter"' do
step 'I select user "Mary Jane" from list with role "Reporter"' do
user = User.find_by(name: "Mary Jane") || create(:user, name: "Mary Jane")
click_link 'Add members'
within ".users-group-form" do
......@@ -37,34 +37,34 @@ class Groups < Spinach::FeatureSteps
click_button "Add users into group"
end
Then 'I should see user "John Doe" in team list' do
step 'I should see user "John Doe" in team list' do
projects_with_access = find(".panel .well-list")
projects_with_access.should have_content("John Doe")
end
Then 'I should not see user "John Doe" in team list' do
step 'I should not see user "John Doe" in team list' do
projects_with_access = find(".panel .well-list")
projects_with_access.should_not have_content("John Doe")
end
Then 'I should see user "Mary Jane" in team list' do
step 'I should see user "Mary Jane" in team list' do
projects_with_access = find(".panel .well-list")
projects_with_access.should have_content("Mary Jane")
end
Then 'I should not see user "Mary Jane" in team list' do
step 'I should not see user "Mary Jane" in team list' do
projects_with_access = find(".panel .well-list")
projects_with_access.should_not have_content("Mary Jane")
end
Given 'project from group "Owned" has issues assigned to me' do
step 'project from group "Owned" has issues assigned to me' do
create :issue,
project: project,
assignee: current_user,
author: current_user
end
Given 'project from group "Owned" has merge requests assigned to me' do
step 'project from group "Owned" has merge requests assigned to me' do
create :merge_request,
source_project: project,
target_project: project,
......@@ -76,28 +76,28 @@ class Groups < Spinach::FeatureSteps
click_link "New group"
end
And 'submit form with new group "Samurai" info' do
step 'submit form with new group "Samurai" info' do
fill_in 'group_name', with: 'Samurai'
fill_in 'group_description', with: 'Tokugawa Shogunate'
click_button "Create group"
end
Then 'I should be redirected to group "Samurai" page' do
step 'I should be redirected to group "Samurai" page' do
current_path.should == group_path(Group.last)
end
Then 'I should see newly created group "Samurai"' do
step 'I should see newly created group "Samurai"' do
page.should have_content "Samurai"
page.should have_content "Tokugawa Shogunate"
page.should have_content "Currently you are only seeing events from the"
end
And 'I change group "Owned" name to "new-name"' do
step 'I change group "Owned" name to "new-name"' do
fill_in 'group_name', with: 'new-name'
click_button "Save group"
end
Then 'I should see new group "Owned" name' do
step 'I should see new group "Owned" name' do
within ".navbar-gitlab" do
page.should have_content "group: new-name"
end
......
......@@ -3,23 +3,23 @@ class ProfileActiveTab < Spinach::FeatureSteps
include SharedPaths
include SharedActiveTab
Then 'the active main tab should be Home' do
step 'the active main tab should be Home' do
ensure_active_main_tab('Profile')
end
Then 'the active main tab should be Account' do
step 'the active main tab should be Account' do
ensure_active_main_tab('Account')
end
Then 'the active main tab should be SSH Keys' do
step 'the active main tab should be SSH Keys' do
ensure_active_main_tab('SSH Keys')
end
Then 'the active main tab should be Design' do
step 'the active main tab should be Design' do
ensure_active_main_tab('Design')
end
Then 'the active main tab should be History' do
step 'the active main tab should be History' do
ensure_active_main_tab('History')
end
end
class ProfileEmails < Spinach::FeatureSteps
include SharedAuthentication
Then 'I visit profile emails page' do
step 'I visit profile emails page' do
visit profile_emails_path
end
Then 'I should see my emails' do
step 'I should see my emails' do
page.should have_content(@user.email)
@user.emails.each do |email|
page.should have_content(email.email)
end
end
And 'I submit new email "my@email.com"' do
step 'I submit new email "my@email.com"' do
fill_in "email_email", with: "my@email.com"
click_button "Add"
end
Then 'I should see new email "my@email.com"' do
step 'I should see new email "my@email.com"' do
email = @user.emails.find_by(email: "my@email.com")
email.should_not be_nil
page.should have_content("my@email.com")
end
Then 'I should not see email "my@email.com"' do
step 'I should not see email "my@email.com"' do
email = @user.emails.find_by(email: "my@email.com")
email.should be_nil
page.should_not have_content("my@email.com")
end
Then 'I click link "Remove" for "my@email.com"' do
step 'I click link "Remove" for "my@email.com"' do
# there should only be one remove button at this time
click_link "Remove"
# force these to reload as they have been cached
@user.emails.reload
end
And 'I submit duplicate email @user.email' do
step 'I submit duplicate email @user.email' do
fill_in "email_email", with: @user.email
click_button "Add"
end
Then 'I should not have @user.email added' do
step 'I should not have @user.email added' do
email = @user.emails.find_by(email: @user.email)
email.should be_nil
end
......
class ProfileSshKeys < Spinach::FeatureSteps
include SharedAuthentication
Then 'I should see my ssh keys' do
step 'I should see my ssh keys' do
@user.keys.each do |key|
page.should have_content(key.title)
end
end
Given 'I click link "Add new"' do
step 'I click link "Add new"' do
click_link "Add SSH Key"
end
And 'I submit new ssh key "Laptop"' do
step 'I submit new ssh key "Laptop"' do
fill_in "key_title", with: "Laptop"
fill_in "key_key", with: "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzrEJUIR6Y03TCE9rIJ+GqTBvgb8t1jI9h5UBzCLuK4VawOmkLornPqLDrGbm6tcwM/wBrrLvVOqi2HwmkKEIecVO0a64A4rIYScVsXIniHRS6w5twyn1MD3sIbN+socBDcaldECQa2u1dI3tnNVcs8wi77fiRe7RSxePsJceGoheRQgC8AZ510UdIlO+9rjIHUdVN7LLyz512auAfYsgx1OfablkQ/XJcdEwDNgi9imI6nAXhmoKUm1IPLT2yKajTIC64AjLOnE0YyCh6+7RFMpiMyu1qiOCpdjYwTgBRiciNRZCH8xIedyCoAmiUgkUT40XYHwLuwiPJICpkAzp7Q== user@laptop"
click_button "Add key"
end
Then 'I should see new ssh key "Laptop"' do
step 'I should see new ssh key "Laptop"' do
key = Key.find_by(title: "Laptop")
page.should have_content(key.title)
page.should have_content(key.key)
current_path.should == profile_key_path(key)
end
Given 'I click link "Work"' do
step 'I click link "Work"' do
click_link "Work"
end
And 'I click link "Remove"' do
step 'I click link "Remove"' do
click_link "Remove"
end
Then 'I visit profile keys page' do
step 'I visit profile keys page' do
visit profile_keys_path
end
And 'I should not see "Work" ssh key' do
step 'I should not see "Work" ssh key' do
within "#keys-table" do
page.should_not have_content "Work"
end
end
And 'I have ssh key "ssh-rsa Work"' do
step 'I have ssh key "ssh-rsa Work"' do
create(:key, user: @user, title: "ssh-rsa Work", key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+L3TbFegm3k8QjejSwemk4HhlRh+DuN679Pc5ckqE/MPhVtE/+kZQDYCTB284GiT2aIoGzmZ8ee9TkaoejAsBwlA+Wz2Q3vhz65X6sMgalRwpdJx8kSEUYV8ZPV3MZvPo8KdNg993o4jL6G36GDW4BPIyO6FPZhfsawdf6liVD0Xo5kibIK7B9VoE178cdLQtLpS2YolRwf5yy6XR6hbbBGQR+6xrGOdP16eGZDb1CE2bMvvJijjloFqPscGktWOqW+nfh5txwFfBzlfARDTBsS8WZtg3Yoj1kn33kPsWRlgHfNutFRAIynDuDdQzQq8tTtVwm+Yi75RfcPHW8y3P Work")
end
end
......@@ -7,97 +7,97 @@ class ProjectActiveTab < Spinach::FeatureSteps
# Sub Tabs: Home
Given 'I click the "Team" tab' do
step 'I click the "Team" tab' do
click_link('Members')
end
Given 'I click the "Attachments" tab' do
step 'I click the "Attachments" tab' do
click_link('Attachments')
end
Given 'I click the "Snippets" tab' do
step 'I click the "Snippets" tab' do
click_link('Snippets')
end
Given 'I click the "Edit" tab' do
step 'I click the "Edit" tab' do
within '.project-settings-nav' do
click_link('Project')
end
end
Given 'I click the "Hooks" tab' do
step 'I click the "Hooks" tab' do
click_link('Web Hooks')
end
Given 'I click the "Deploy Keys" tab' do
step 'I click the "Deploy Keys" tab' do
click_link('Deploy Keys')
end
Then 'the active sub nav should be Team' do
step 'the active sub nav should be Team' do
ensure_active_sub_nav('Members')
end
Then 'the active sub nav should be Edit' do
step 'the active sub nav should be Edit' do
ensure_active_sub_nav('Project')
end
Then 'the active sub nav should be Hooks' do
step 'the active sub nav should be Hooks' do
ensure_active_sub_nav('Web Hooks')
end
Then 'the active sub nav should be Deploy Keys' do
step 'the active sub nav should be Deploy Keys' do
ensure_active_sub_nav('Deploy Keys')
end
# Sub Tabs: Commits
Given 'I click the "Compare" tab' do
step 'I click the "Compare" tab' do
click_link('Compare')
end
Given 'I click the "Branches" tab' do
step 'I click the "Branches" tab' do
click_link('Branches')
end
Given 'I click the "Tags" tab' do
step 'I click the "Tags" tab' do
click_link('Tags')
end
Then 'the active sub tab should be Commits' do
step 'the active sub tab should be Commits' do
ensure_active_sub_tab('Commits')
end
Then 'the active sub tab should be Compare' do
step 'the active sub tab should be Compare' do
ensure_active_sub_tab('Compare')
end
Then 'the active sub tab should be Branches' do
step 'the active sub tab should be Branches' do
ensure_active_sub_tab('Branches')
end
Then 'the active sub tab should be Tags' do
step 'the active sub tab should be Tags' do
ensure_active_sub_tab('Tags')
end
# Sub Tabs: Issues
Given 'I click the "Milestones" tab' do
step 'I click the "Milestones" tab' do
click_link('Milestones')
end
Given 'I click the "Labels" tab' do
step 'I click the "Labels" tab' do
click_link('Labels')
end
Then 'the active sub tab should be Browse Issues' do
step 'the active sub tab should be Browse Issues' do
ensure_active_sub_tab('Browse Issues')
end
Then 'the active sub tab should be Milestones' do
step 'the active sub tab should be Milestones' do
ensure_active_sub_tab('Milestones')
end
Then 'the active sub tab should be Labels' do
step 'the active sub tab should be Labels' do
ensure_active_sub_tab('Labels')
end
end
......@@ -18,11 +18,11 @@ class ProjectArchived < Spinach::FeatureSteps
visit project_path(project)
end
Then 'I should not see "Archived"' do
step 'I should not see "Archived"' do
page.should_not have_content "Archived"
end
Then 'I should see "Archived"' do
step 'I should see "Archived"' do
page.should have_content "Archived"
end
......
......@@ -4,18 +4,18 @@ class ProjectBrowseCommits < Spinach::FeatureSteps
include SharedPaths
include RepoHelpers
Then 'I see project commits' do
step 'I see project commits' do
commit = @project.repository.commit
page.should have_content(@project.name)
page.should have_content(commit.message[0..20])
page.should have_content(commit.id.to_s[0..5])
end
Given 'I click atom feed link' do
step 'I click atom feed link' do
click_link "Feed"
end
Then 'I see commits atom feed' do
step 'I see commits atom feed' do
commit = @project.repository.commit
page.response_headers['Content-Type'].should have_content("application/atom+xml")
page.body.should have_selector("title", text: "Recent commits to #{@project.name}")
......@@ -23,69 +23,69 @@ class ProjectBrowseCommits < Spinach::FeatureSteps
page.body.should have_selector("entry summary", text: commit.description[0..10])
end
Given 'I click on commit link' do
step 'I click on commit link' do
visit project_commit_path(@project, sample_commit.id)
end
Then 'I see commit info' do
step 'I see commit info' do
page.should have_content sample_commit.message
page.should have_content "Showing #{sample_commit.files_changed_count} changed files"
end
And 'I fill compare fields with refs' do
step 'I fill compare fields with refs' do
fill_in "from", with: sample_commit.parent_id
fill_in "to", with: sample_commit.id
click_button "Compare"
end
Then 'I see compared refs' do
step 'I see compared refs' do
page.should have_content "Compare View"
page.should have_content "Commits (1)"
page.should have_content "Showing 2 changed files"
end
Then 'I see breadcrumb links' do
step 'I see breadcrumb links' do
page.should have_selector('ul.breadcrumb')
page.should have_selector('ul.breadcrumb a', count: 4)
end
Then 'I see commits stats' do
step 'I see commits stats' do
page.should have_content 'Top 50 Committers'
page.should have_content 'Committers'
page.should have_content 'Total commits'
page.should have_content 'Authors'
end
Given 'I visit big commit page' do
step 'I visit big commit page' do
Commit::DIFF_SAFE_FILES = 20
visit project_commit_path(@project, sample_big_commit.id)
end
Then 'I see big commit warning' do
step 'I see big commit warning' do
page.should have_content sample_big_commit.message
page.should have_content "Too many changes"
Commit::DIFF_SAFE_FILES = 100
end
Given 'I visit a commit with an image that changed' do
step 'I visit a commit with an image that changed' do
visit project_commit_path(@project, sample_image_commit.id)
end
Then 'The diff links to both the previous and current image' do
step 'The diff links to both the previous and current image' do
links = page.all('.two-up span div a')
links[0]['href'].should =~ %r{blob/#{sample_image_commit.old_blob_id}}
links[1]['href'].should =~ %r{blob/#{sample_image_commit.new_blob_id}}
end
Given 'I click side-by-side diff button' do
step 'I click side-by-side diff button' do
click_link "Side-by-side Diff"
end
Then 'I see side-by-side diff button' do
step 'I see side-by-side diff button' do
page.should have_content "Side-by-side Diff"
end
Then 'I see inline diff button' do
step 'I see inline diff button' do
page.should have_content "Inline Diff"
end
end
......@@ -3,11 +3,11 @@ class ProjectBrowseCommitsUserLookup < Spinach::FeatureSteps
include SharedProject
include SharedPaths
Given 'I click on commit link' do
step 'I click on commit link' do
visit project_commit_path(@project, sample_commit.id)
end
Given 'I click on another commit link' do
step 'I click on another commit link' do
visit project_commit_path(@project, sample_commit.parent_id)
end
......
......@@ -3,15 +3,15 @@ class ProjectBrowseGitRepo < Spinach::FeatureSteps
include SharedProject
include SharedPaths
Given 'I click on ".gitignore" file in repo' do
step 'I click on ".gitignore" file in repo' do
click_link ".gitignore"
end
And 'I click blame button' do
step 'I click blame button' do
click_link "blame"
end
Then 'I should see git file blame' do
step 'I should see git file blame' do
page.should have_content "*.rb"
page.should have_content "Dmitriy Zaporozhets"
page.should have_content "Initial commit"
......
......@@ -2,41 +2,41 @@ class CreateProject < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
And 'fill project form with valid data' do
step 'fill project form with valid data' do
fill_in 'project_name', with: 'Empty'
click_button "Create project"
end
Then 'I should see project page' do
step 'I should see project page' do
page.should have_content "Empty"
current_path.should == project_path(Project.last)
end
And 'I should see empty project instuctions' do
step '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
Then 'I see empty project instuctions' do
step 'I 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
And 'I click on HTTP' do
step 'I click on HTTP' do
click_button 'HTTP'
end
Then 'Remote url should update to http link' do
step 'Remote url should update to http link' do
page.should have_content "git remote add origin #{Project.last.http_url_to_repo}"
end
And 'If I click on SSH' do
step 'If I click on SSH' do
click_button 'SSH'
end
Then 'Remote url should update to ssh link' do
step 'Remote url should update to ssh link' do
page.should have_content "git remote add origin #{Project.last.url_to_repo}"
end
end
......@@ -2,7 +2,7 @@ class ProjectGraph < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
Then 'page should have graphs' do
step 'page should have graphs' do
page.should have_selector ".stat-graph"
end
......
......@@ -25,7 +25,7 @@ class ProjectIssueTracker < Spinach::FeatureSteps
find_field('project_issues_tracker').value.should == 'redmine'
end
And 'I save project' do
step 'I save project' do
click_button 'Save changes'
end
end
......@@ -5,47 +5,47 @@ class ProjectIssues < Spinach::FeatureSteps
include SharedPaths
include SharedMarkdown
Given 'I should see "Release 0.4" in issues' do
step 'I should see "Release 0.4" in issues' do
page.should have_content "Release 0.4"
end
And 'I should not see "Release 0.3" in issues' do
step 'I should not see "Release 0.3" in issues' do
page.should_not have_content "Release 0.3"
end
And 'I should not see "Tweet control" in issues' do
step 'I should not see "Tweet control" in issues' do
page.should_not have_content "Tweet control"
end
Given 'I click link "Closed"' do
step 'I click link "Closed"' do
click_link "Closed"
end
Then 'I should see "Release 0.3" in issues' do
step 'I should see "Release 0.3" in issues' do
page.should have_content "Release 0.3"
end
And 'I should not see "Release 0.4" in issues' do
step 'I should not see "Release 0.4" in issues' do
page.should_not have_content "Release 0.4"
end
Given 'I click link "All"' do
step 'I click link "All"' do
click_link "All"
end
Given 'I click link "Release 0.4"' do
step 'I click link "Release 0.4"' do
click_link "Release 0.4"
end
Then 'I should see issue "Release 0.4"' do
step 'I should see issue "Release 0.4"' do
page.should have_content "Release 0.4"
end
Given 'I click link "New Issue"' do
step 'I click link "New Issue"' do
click_link "New Issue"
end
And 'I submit new issue "500 error on profile"' do
step 'I submit new issue "500 error on profile"' do
fill_in "issue_title", with: "500 error on profile"
click_button "Submit new issue"
end
......@@ -56,7 +56,7 @@ class ProjectIssues < Spinach::FeatureSteps
click_button "Submit new issue"
end
Given 'I click link "500 error on profile"' do
step 'I click link "500 error on profile"' do
click_link "500 error on profile"
end
......@@ -66,41 +66,41 @@ class ProjectIssues < Spinach::FeatureSteps
end
end
Then 'I should see issue "500 error on profile"' do
step 'I should see issue "500 error on profile"' do
issue = Issue.find_by(title: "500 error on profile")
page.should have_content issue.title
page.should have_content issue.author_name
page.should have_content issue.project.name
end
Given 'I fill in issue search with "Re"' do
step 'I fill in issue search with "Re"' do
filter_issue "Re"
end
Given 'I fill in issue search with "Bu"' do
step 'I fill in issue search with "Bu"' do
filter_issue "Bu"
end
And 'I fill in issue search with ".3"' do
step 'I fill in issue search with ".3"' do
filter_issue ".3"
end
And 'I fill in issue search with "Something"' do
step 'I fill in issue search with "Something"' do
filter_issue "Something"
end
And 'I fill in issue search with ""' do
step 'I fill in issue search with ""' do
filter_issue ""
end
Given 'project "Shop" has milestone "v2.2"' do
step 'project "Shop" has milestone "v2.2"' do
milestone = create(:milestone, title: "v2.2", project: project)
3.times { create(:issue, project: project, milestone: milestone) }
end
And 'project "Shop" has milestone "v3.0"' do
step 'project "Shop" has milestone "v3.0"' do
milestone = create(:milestone, title: "v3.0", project: project)
......@@ -111,7 +111,7 @@ class ProjectIssues < Spinach::FeatureSteps
select "v3.0", from: "milestone_id"
end
Then 'I should see selected milestone with title "v3.0"' do
step 'I should see selected milestone with title "v3.0"' do
issues_milestone_selector = "#issue_milestone_id_chzn > a"
page.find(issues_milestone_selector).should have_content("v3.0")
end
......@@ -122,14 +122,14 @@ class ProjectIssues < Spinach::FeatureSteps
select first_assignee.name, from: "assignee_id"
end
Then 'I should see first assignee from "Shop" as selected assignee' do
step 'I should see first assignee from "Shop" as selected assignee' do
issues_assignee_selector = "#issue_assignee_id_chzn > a"
assignee_name = project.users.first.name
page.find(issues_assignee_selector).should have_content(assignee_name)
end
And 'project "Shop" have "Release 0.4" open issue' do
step 'project "Shop" have "Release 0.4" open issue' do
create(:issue,
title: "Release 0.4",
......@@ -139,21 +139,21 @@ class ProjectIssues < Spinach::FeatureSteps
)
end
And 'project "Shop" have "Tweet control" open issue' do
step 'project "Shop" have "Tweet control" open issue' do
create(:issue,
title: "Tweet control",
project: project,
author: project.users.first)
end
And 'project "Shop" have "Release 0.3" closed issue' do
step 'project "Shop" have "Release 0.3" closed issue' do
create(:closed_issue,
title: "Release 0.3",
project: project,
author: project.users.first)
end
Given 'empty project "Empty Project"' do
step 'empty project "Empty Project"' do
create :empty_project, name: 'Empty Project', namespace: @user.namespace
end
......@@ -162,7 +162,7 @@ class ProjectIssues < Spinach::FeatureSteps
visit project_path(project)
end
And 'I see empty project details with ssh clone info' do
step 'I see empty project details with ssh clone info' do
project = Project.find_by(name: 'Empty Project')
page.all(:css, '.git-empty .clone').each do |element|
element.text.should include(project.url_to_repo)
......
......@@ -6,19 +6,19 @@ class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps
include SharedPaths
include SharedMarkdown
And 'I own project "Delta"' do
step 'I own project "Delta"' do
@project = Project.find_by(name: "Delta")
@project ||= create(:project, name: "Delta", namespace: @user.namespace)
@project.team << [@user, :master]
end
Then 'I should see files from repository in markdown' do
step 'I should see files from repository in markdown' do
current_path.should == project_tree_path(@project, "markdown")
page.should have_content "README.md"
page.should have_content "CHANGELOG"
end
And 'I should see rendered README which contains correct links' do
step 'I should see rendered README which contains correct links' do
page.should have_content "Welcome to GitLab GitLab is a free project and repository management application"
page.should have_link "GitLab API doc"
page.should have_link "GitLab API website"
......@@ -28,79 +28,79 @@ class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps
page.should have_link "Maintenance"
end
And 'I click on Gitlab API in README' do
step 'I click on Gitlab API in README' do
click_link "GitLab API doc"
end
Then 'I should see correct document rendered' do
step 'I should see correct document rendered' do
current_path.should == project_blob_path(@project, "markdown/doc/api/README.md")
page.should have_content "All API requests require authentication"
end
And 'I click on Rake tasks in README' do
step 'I click on Rake tasks in README' do
click_link "Rake tasks"
end
Then 'I should see correct directory rendered' do
step 'I should see correct directory rendered' do
current_path.should == project_tree_path(@project, "markdown/doc/raketasks")
page.should have_content "backup_restore.md"
page.should have_content "maintenance.md"
end
And 'I click on GitLab API doc directory in README' do
step 'I click on GitLab API doc directory in README' do
click_link "GitLab API doc directory"
end
Then 'I should see correct doc/api directory rendered' do
step 'I should see correct doc/api directory rendered' do
current_path.should == project_tree_path(@project, "markdown/doc/api")
page.should have_content "README.md"
page.should have_content "users.md"
end
And 'I click on Maintenance in README' do
step 'I click on Maintenance in README' do
click_link "Maintenance"
end
Then 'I should see correct maintenance file rendered' do
step 'I should see correct maintenance file rendered' do
current_path.should == project_blob_path(@project, "markdown/doc/raketasks/maintenance.md")
page.should have_content "bundle exec rake gitlab:env:info RAILS_ENV=production"
end
And 'I click on link "empty" in the README' do
step 'I click on link "empty" in the README' do
within('.readme-holder') do
click_link "empty"
end
end
And 'I click on link "id" in the README' do
step 'I click on link "id" in the README' do
within('.readme-holder') do
click_link "#id"
end
end
And 'I navigate to the doc/api/README' do
step 'I navigate to the doc/api/README' do
click_link "doc"
click_link "api"
click_link "README.md"
end
And 'I see correct file rendered' do
step 'I see correct file rendered' do
current_path.should == project_blob_path(@project, "markdown/doc/api/README.md")
page.should have_content "Contents"
page.should have_link "Users"
page.should have_link "Rake tasks"
end
And 'I click on users in doc/api/README' do
step 'I click on users in doc/api/README' do
click_link "Users"
end
Then 'I should see the correct document file' do
step 'I should see the correct document file' do
current_path.should == project_blob_path(@project, "markdown/doc/api/users.md")
page.should have_content "Get a list of users."
end
And 'I click on raketasks in doc/api/README' do
step 'I click on raketasks in doc/api/README' do
click_link "Rake tasks"
end
......@@ -122,91 +122,94 @@ class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps
visit project_blob_path(@project, "markdown/d/README.md")
end
Then 'I should see files from repository in markdown branch' do
step 'I should see files from repository in markdown branch' do
current_path.should == project_tree_path(@project, "markdown")
page.should have_content "README.md"
page.should have_content "CHANGELOG"
end
And 'I see correct file rendered in markdown branch' do
step 'I see correct file rendered in markdown branch' do
current_path.should == project_blob_path(@project, "markdown/doc/api/README.md")
page.should have_content "Contents"
page.should have_link "Users"
page.should have_link "Rake tasks"
end
Then 'I should see correct document rendered for markdown branch' do
step 'I should see correct document rendered for markdown branch' do
current_path.should == project_blob_path(@project, "markdown/doc/api/README.md")
page.should have_content "All API requests require authentication"
end
Then 'I should see correct directory rendered for markdown branch' do
step 'I should see correct directory rendered for markdown branch' do
current_path.should == project_tree_path(@project, "markdown/doc/raketasks")
page.should have_content "backup_restore.md"
page.should have_content "maintenance.md"
end
Then 'I should see the users document file in markdown branch' do
step 'I should see the users document file in markdown branch' do
current_path.should == project_blob_path(@project, "markdown/doc/api/users.md")
page.should have_content "Get a list of users."
end
# Expected link contents
Then 'The link with text "empty" should have url "tree/markdown"' do
step 'The link with text "empty" should have url "tree/markdown"' do
find('a', text: /^empty$/)['href'] == current_host + project_tree_path(@project, "markdown")
end
Then 'The link with text "empty" should have url "blob/markdown/README.md"' do
step 'The link with text "empty" should have url "blob/markdown/README.md"' do
find('a', text: /^empty$/)['href'] == current_host + project_blob_path(@project, "markdown/README.md")
end
Then 'The link with text "empty" should have url "tree/markdown/d"' do
step 'The link with text "empty" should have url "tree/markdown/d"' do
find('a', text: /^empty$/)['href'] == current_host + project_tree_path(@project, "markdown/d")
end
Then 'The link with text "empty" should have url "blob/markdown/d/README.md"' do
step 'The link with text "empty" should have '\
'url "blob/markdown/d/README.md"' do
find('a', text: /^empty$/)['href'] == current_host + project_blob_path(@project, "markdown/d/README.md")
end
Then 'The link with text "ID" should have url "tree/markdownID"' do
step 'The link with text "ID" should have url "tree/markdownID"' do
find('a', text: /^#id$/)['href'] == current_host + project_tree_path(@project, "markdown") + '#id'
end
Then 'The link with text "/ID" should have url "tree/markdownID"' do
step 'The link with text "/ID" should have url "tree/markdownID"' do
find('a', text: /^\/#id$/)['href'] == current_host + project_tree_path(@project, "markdown") + '#id'
end
Then 'The link with text "README.mdID" should have url "blob/markdown/README.mdID"' do
step 'The link with text "README.mdID" '\
'should have url "blob/markdown/README.mdID"' do
find('a', text: /^README.md#id$/)['href'] == current_host + project_blob_path(@project, "markdown/README.md") + '#id'
end
Then 'The link with text "d/README.mdID" should have url "blob/markdown/d/README.mdID"' do
step 'The link with text "d/README.mdID" should have '\
'url "blob/markdown/d/README.mdID"' do
find('a', text: /^d\/README.md#id$/)['href'] == current_host + project_blob_path(@project, "d/markdown/README.md") + '#id'
end
Then 'The link with text "ID" should have url "blob/markdown/README.mdID"' do
step 'The link with text "ID" should have url "blob/markdown/README.mdID"' do
find('a', text: /^#id$/)['href'] == current_host + project_blob_path(@project, "markdown/README.md") + '#id'
end
Then 'The link with text "/ID" should have url "blob/markdown/README.mdID"' do
step 'The link with text "/ID" should have url "blob/markdown/README.mdID"' do
find('a', text: /^\/#id$/)['href'] == current_host + project_blob_path(@project, "markdown/README.md") + '#id'
end
# Wiki
Given 'I go to wiki page' do
step 'I go to wiki page' do
click_link "Wiki"
current_path.should == project_wiki_path(@project, "home")
end
And 'I add various links to the wiki page' do
step 'I add various links to the wiki page' do
fill_in "wiki[content]", with: "[test](test)\n[GitLab API doc](api)\n[Rake tasks](raketasks)\n"
fill_in "wiki[message]", with: "Adding links to wiki"
click_button "Create page"
end
Then 'Wiki page should have added links' do
step 'Wiki page should have added links' do
current_path.should == project_wiki_path(@project, "home")
page.should have_content "test GitLab API doc Rake tasks"
end
......@@ -221,11 +224,11 @@ class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps
header_should_have_correct_id_and_link(1, 'Wiki header', 'wiki-header')
end
And 'I click on test link' do
step 'I click on test link' do
click_link "test"
end
Then 'I see new wiki page named test' do
step 'I see new wiki page named test' do
current_path.should == project_wiki_path(@project, "test")
page.should have_content "Editing"
end
......@@ -235,34 +238,34 @@ class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps
current_path.should == project_wiki_path(@project, "home")
end
And 'I click on GitLab API doc link' do
step 'I click on GitLab API doc link' do
click_link "GitLab API"
end
Then 'I see Gitlab API document' do
step 'I see Gitlab API document' do
current_path.should == project_wiki_path(@project, "api")
page.should have_content "Editing"
end
And 'I click on Rake tasks link' do
step 'I click on Rake tasks link' do
click_link "Rake tasks"
end
Then 'I see Rake tasks directory' do
step 'I see Rake tasks directory' do
current_path.should == project_wiki_path(@project, "raketasks")
page.should have_content "Editing"
end
Given 'I go directory which contains README file' do
step 'I go directory which contains README file' do
visit project_tree_path(@project, "markdown/doc/api")
current_path.should == project_tree_path(@project, "markdown/doc/api")
end
And 'I click on a relative link in README' do
step 'I click on a relative link in README' do
click_link "Users"
end
Then 'I should see the correct markdown' do
step 'I should see the correct markdown' do
current_path.should == project_blob_path(@project, "markdown/doc/api/users.md")
page.should have_content "List users"
end
......
......@@ -4,34 +4,34 @@ class ProjectMilestones < Spinach::FeatureSteps
include SharedPaths
include SharedMarkdown
Then 'I should see milestone "v2.2"' do
step 'I should see milestone "v2.2"' do
milestone = @project.milestones.find_by(title: "v2.2")
page.should have_content(milestone.title[0..10])
page.should have_content(milestone.expires_at)
page.should have_content("Browse Issues")
end
Given 'I click link "v2.2"' do
step 'I click link "v2.2"' do
click_link "v2.2"
end
Given 'I click link "New Milestone"' do
step 'I click link "New Milestone"' do
click_link "New Milestone"
end
And 'I submit new milestone "v2.3"' do
step 'I submit new milestone "v2.3"' do
fill_in "milestone_title", with: "v2.3"
click_button "Create milestone"
end
Then 'I should see milestone "v2.3"' do
step 'I should see milestone "v2.3"' do
milestone = @project.milestones.find_by(title: "v2.3")
page.should have_content(milestone.title[0..10])
page.should have_content(milestone.expires_at)
page.should have_content("Browse Issues")
end
And 'project "Shop" has milestone "v2.2"' do
step 'project "Shop" has milestone "v2.2"' do
project = Project.find_by(name: "Shop")
milestone = create(:milestone,
title: "v2.2",
......@@ -41,7 +41,7 @@ class ProjectMilestones < Spinach::FeatureSteps
3.times { create(:issue, project: project, milestone: milestone) }
end
Given 'the milestone has open and closed issues' do
step 'the milestone has open and closed issues' do
project = Project.find_by(name: "Shop")
milestone = project.milestones.find_by(title: 'v2.2')
......@@ -53,7 +53,7 @@ class ProjectMilestones < Spinach::FeatureSteps
click_link 'All Issues'
end
Then "I should see 3 issues" do
step 'I should see 3 issues' do
page.should have_selector('#tab-issues li.issue-row', count: 4)
end
end
......@@ -3,7 +3,7 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
include SharedPaths
include SharedProject
Then 'page should have network graph' do
step 'page should have network graph' do
page.should have_selector ".network-graph"
end
......@@ -15,15 +15,15 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
visit project_network_path(project, "master")
end
And 'page should select "master" in select box' do
step 'page should select "master" in select box' do
page.should have_selector '.select2-chosen', text: "master"
end
And 'page should select "v1.0.0" in select box' do
step 'page should select "v1.0.0" in select box' do
page.should have_selector '.select2-chosen', text: "v1.0.0"
end
And 'page should have "master" on graph' do
step 'page should have "master" on graph' do
within '.network-graph' do
page.should have_content 'master'
end
......@@ -44,27 +44,27 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
sleep 2
end
Then 'page should have content not containing "v1.0.0"' do
step 'page should have content not containing "v1.0.0"' do
within '.network-graph' do
page.should have_content 'Change some files'
end
end
Then 'page should not have content not containing "v1.0.0"' do
step 'page should not have content not containing "v1.0.0"' do
within '.network-graph' do
page.should_not have_content 'Change some files'
end
end
And 'page should select "feature" in select box' do
step 'page should select "feature" in select box' do
page.should have_selector '.select2-chosen', text: "feature"
end
And 'page should select "v1.0.0" in select box' do
step 'page should select "v1.0.0" in select box' do
page.should have_selector '.select2-chosen', text: "v1.0.0"
end
And 'page should have "feature" on graph' do
step 'page should have "feature" on graph' do
within '.network-graph' do
page.should have_content 'feature'
end
......@@ -78,7 +78,7 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
sleep 2
end
And 'page should have "v1.0.0" on graph' do
step 'page should have "v1.0.0" on graph' do
within '.network-graph' do
page.should have_content 'v1.0.0'
end
......
......@@ -4,7 +4,7 @@ class ProjectSnippets < Spinach::FeatureSteps
include SharedNote
include SharedPaths
And 'project "Shop" have "Snippet one" snippet' do
step 'project "Shop" have "Snippet one" snippet' do
create(:project_snippet,
title: "Snippet one",
content: "Test content",
......@@ -13,7 +13,7 @@ class ProjectSnippets < Spinach::FeatureSteps
author: project.users.first)
end
And 'project "Shop" have no "Snippet two" snippet' do
step 'project "Shop" have no "Snippet two" snippet' do
create(:snippet,
title: "Snippet two",
content: "Test content",
......@@ -21,37 +21,37 @@ class ProjectSnippets < Spinach::FeatureSteps
author: project.users.first)
end
Given 'I click link "New Snippet"' do
step 'I click link "New Snippet"' do
click_link "Add new snippet"
end
Given 'I click link "Snippet one"' do
step 'I click link "Snippet one"' do
click_link "Snippet one"
end
Then 'I should see "Snippet one" in snippets' do
step 'I should see "Snippet one" in snippets' do
page.should have_content "Snippet one"
end
And 'I should not see "Snippet two" in snippets' do
step 'I should not see "Snippet two" in snippets' do
page.should_not have_content "Snippet two"
end
And 'I should not see "Snippet one" in snippets' do
step 'I should not see "Snippet one" in snippets' do
page.should_not have_content "Snippet one"
end
And 'I click link "Edit"' do
step 'I click link "Edit"' do
within ".file-title" do
click_link "Edit"
end
end
And 'I click link "Remove Snippet"' do
step 'I click link "Remove Snippet"' do
click_link "remove"
end
And 'I submit new snippet "Snippet three"' do
step 'I submit new snippet "Snippet three"' do
fill_in "project_snippet_title", :with => "Snippet three"
fill_in "project_snippet_file_name", :with => "my_snippet.rb"
within('.file-editor') do
......@@ -60,32 +60,32 @@ class ProjectSnippets < Spinach::FeatureSteps
click_button "Create snippet"
end
Then 'I should see snippet "Snippet three"' do
step 'I should see snippet "Snippet three"' do
page.should have_content "Snippet three"
page.should have_content "Content of snippet three"
end
And 'I submit new title "Snippet new title"' do
step 'I submit new title "Snippet new title"' do
fill_in "project_snippet_title", :with => "Snippet new title"
click_button "Save"
end
Then 'I should see "Snippet new title"' do
step 'I should see "Snippet new title"' do
page.should have_content "Snippet new title"
end
And 'I leave a comment like "Good snippet!"' do
step 'I leave a comment like "Good snippet!"' do
within('.js-main-target-form') do
fill_in "note_note", with: "Good snippet!"
click_button "Add Comment"
end
end
Then 'I should see comment "Good snippet!"' do
step 'I should see comment "Good snippet!"' do
page.should have_content "Good snippet!"
end
And 'I visit snippet page "Snippet one"' do
step 'I visit snippet page "Snippet one"' do
visit project_snippet_path(project, project_snippet)
end
......
......@@ -4,22 +4,22 @@ class ProjectTeamManagement < Spinach::FeatureSteps
include SharedPaths
include Select2Helper
Then 'I should be able to see myself in team' do
step 'I should be able to see myself in team' do
page.should have_content(@user.name)
page.should have_content(@user.username)
end
And 'I should see "Sam" in team list' do
step '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.username)
end
Given 'I click link "New Team Member"' do
step 'I click link "New Team Member"' do
click_link "New project member"
end
And 'I select "Mike" as "Reporter"' do
step 'I select "Mike" as "Reporter"' do
user = User.find_by(name: "Mike")
select2(user.id, from: "#user_ids", multiple: true)
......@@ -29,67 +29,67 @@ class ProjectTeamManagement < Spinach::FeatureSteps
click_button "Add users"
end
Then 'I should see "Mike" in team list as "Reporter"' do
step 'I should see "Mike" in team list as "Reporter"' do
within ".access-reporter" do
page.should have_content('Mike')
end
end
Given 'I should see "Sam" in team list as "Developer"' do
step 'I should see "Sam" in team list as "Developer"' do
within ".access-developer" do
page.should have_content('Sam')
end
end
And 'I change "Sam" role to "Reporter"' do
step '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
And 'I should see "Sam" in team list as "Reporter"' do
step 'I should see "Sam" in team list as "Reporter"' do
within ".access-reporter" do
page.should have_content('Sam')
end
end
And 'I click link "Remove from team"' do
step 'I click link "Remove from team"' do
click_link "Remove from team"
end
And 'I should not see "Sam" in team list' do
step '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.username)
end
And 'gitlab user "Mike"' do
step 'gitlab user "Mike"' do
create(:user, name: "Mike")
end
And 'gitlab user "Sam"' do
step 'gitlab user "Sam"' do
create(:user, name: "Sam")
end
And '"Sam" is "Shop" developer' do
step '"Sam" is "Shop" developer' do
user = User.find_by(name: "Sam")
project = Project.find_by(name: "Shop")
project.team << [user, :developer]
end
Given 'I own project "Website"' do
step 'I own project "Website"' do
@project = create(:empty_project, name: "Website", namespace: @user.namespace)
@project.team << [@user, :master]
end
And '"Mike" is "Website" reporter' do
step '"Mike" is "Website" reporter' do
user = User.find_by(name: "Mike")
project = Project.find_by(name: "Website")
project.team << [user, :reporter]
end
And 'I click link "Import team from another project"' do
step 'I click link "Import team from another project"' do
click_link "Import members from another project"
end
......
......@@ -4,23 +4,23 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
include SharedNote
include SharedPaths
Given 'I click on the Cancel button' do
step 'I click on the Cancel button' do
within(:css, ".form-actions") do
click_on "Cancel"
end
end
Then 'I should be redirected back to the Edit Home Wiki page' do
step 'I should be redirected back to the Edit Home Wiki page' do
url = URI.parse(current_url)
url.path.should == project_wiki_path(project, :home)
end
Given 'I create the Wiki Home page' do
step 'I create the Wiki Home page' do
fill_in "wiki_content", with: '[link test](test)'
click_on "Create page"
end
Then 'I should see the newly created wiki page' do
step 'I should see the newly created wiki page' do
page.should have_content "Home"
page.should have_content "link test"
......@@ -28,74 +28,74 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
page.should have_content "Editing"
end
Given 'I have an existing Wiki page' do
step 'I have an existing Wiki page' do
wiki.create_page("existing", "content", :markdown, "first commit")
@page = wiki.find_page("existing")
end
And 'I browse to that Wiki page' do
step 'I browse to that Wiki page' do
visit project_wiki_path(project, @page)
end
And 'I click on the Edit button' do
step 'I click on the Edit button' do
click_on "Edit"
end
And 'I change the content' do
step 'I change the content' do
fill_in "Content", with: 'Updated Wiki Content'
click_on "Save changes"
end
Then 'I should see the updated content' do
step 'I should see the updated content' do
page.should have_content "Updated Wiki Content"
end
Then 'I should be redirected back to that Wiki page' do
step 'I should be redirected back to that Wiki page' do
url = URI.parse(current_url)
url.path.should == project_wiki_path(project, @page)
end
And 'That page has two revisions' do
step 'That page has two revisions' do
@page.update("new content", :markdown, "second commit")
end
And 'I click the History button' do
step 'I click the History button' do
click_on "History"
end
Then 'I should see both revisions' do
step 'I should see both revisions' do
page.should have_content current_user.name
page.should have_content "first commit"
page.should have_content "second commit"
end
And 'I click on the "Delete this page" button' do
step 'I click on the "Delete this page" button' do
click_on "Delete this page"
end
Then 'The page should be deleted' do
step 'The page should be deleted' do
page.should have_content "Page was successfully deleted"
end
And 'I click on the "Pages" button' do
step 'I click on the "Pages" button' do
click_on "Pages"
end
Then 'I should see the existing page in the pages list' do
step 'I should see the existing page in the pages list' do
page.should have_content current_user.name
page.should have_content @page.title
end
Given 'I have an existing Wiki page with images linked on page' do
step 'I have an existing Wiki page with images linked on page' do
wiki.create_page("pictures", "Look at this [image](image.jpg)\n\n ![image](image.jpg)", :markdown, "first commit")
@wiki_page = wiki.find_page("pictures")
end
And 'I browse to wiki page with images' do
step 'I browse to wiki page with images' do
visit project_wiki_path(project, @wiki_page)
end
And 'I click on existing image link' do
step 'I click on existing image link' do
file = Gollum::File.new(wiki.wiki)
Gollum::Wiki.any_instance.stub(:file).with("image.jpg", "master", true).and_return(file)
Gollum::File.any_instance.stub(:mime_type).and_return("image/jpeg")
......@@ -103,7 +103,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
click_on "image"
end
Then 'I should see the image from wiki repo' do
step 'I should see the image from wiki repo' do
url = URI.parse(current_url)
url.path.should match("wikis/image.jpg")
page.should_not have_xpath('/html') # Page should render the image which means there is no html involved
......@@ -111,16 +111,16 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
Gollum::File.any_instance.unstub(:mime_type)
end
Then 'Image should be shown on the page' do
step 'Image should be shown on the page' do
page.should have_xpath("//img[@src=\"image.jpg\"]")
end
And 'I click on image link' do
step 'I click on image link' do
page.should have_link('image', href: "image.jpg")
click_on "image"
end
Then 'I should see the new wiki page form' do
step 'I should see the new wiki page form' do
url = URI.parse(current_url)
url.path.should match("wikis/image.jpg")
page.should have_content('New Wiki Page')
......
......@@ -13,15 +13,15 @@ module SharedActiveTab
page.find('div.content ul.nav-stacked-menu li.active').should have_content(content)
end
And 'no other main tabs should be active' do
step 'no other main tabs should be active' do
page.should have_selector('.main-nav li.active', count: 1)
end
And 'no other sub tabs should be active' do
step 'no other sub tabs should be active' do
page.should have_selector('div.content ul.nav-tabs li.active', count: 1)
end
And 'no other sub navs should be active' do
step 'no other sub navs should be active' do
page.should have_selector('div.content ul.nav-stacked-menu li.active', count: 1)
end
......
module SharedAdmin
include Spinach::DSL
And 'there are projects in system' do
step 'there are projects in system' do
2.times { create(:project) }
end
And 'system has users' do
step 'system has users' do
2.times { create(:user) }
end
end
......
......@@ -4,11 +4,11 @@ module SharedAuthentication
include Spinach::DSL
include LoginHelpers
Given 'I sign in as a user' do
step 'I sign in as a user' do
login_as :user
end
Given 'I sign in as an admin' do
step 'I sign in as an admin' do
login_as :admin
end
......
......@@ -2,24 +2,24 @@ module SharedDiffNote
include Spinach::DSL
include RepoHelpers
Given 'I cancel the diff comment' do
step 'I cancel the diff comment' do
within(diff_file_selector) do
find(".js-close-discussion-note-form").click
end
end
Given 'I delete a diff comment' do
step 'I delete a diff comment' do
find('.note').hover
find(".js-note-delete").click
end
Given 'I haven\'t written any diff comment text' do
step 'I haven\'t written any diff comment text' do
within(diff_file_selector) do
fill_in "note[note]", with: ""
end
end
Given 'I leave a diff comment like "Typo, please fix"' do
step 'I leave a diff comment like "Typo, please fix"' do
click_diff_line(sample_commit.line_code)
within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do
fill_in "note[note]", with: "Typo, please fix"
......@@ -28,7 +28,7 @@ module SharedDiffNote
end
end
Given 'I preview a diff comment text like "Should fix it :smile:"' do
step 'I preview a diff comment text like "Should fix it :smile:"' do
click_diff_line(sample_commit.line_code)
within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do
fill_in "note[note]", with: "Should fix it :smile:"
......@@ -36,7 +36,7 @@ module SharedDiffNote
end
end
Given 'I preview another diff comment text like "DRY this up"' do
step 'I preview another diff comment text like "DRY this up"' do
click_diff_line(sample_commit.del_line_code)
within("#{diff_file_selector} form[rel$='#{sample_commit.del_line_code}']") do
......@@ -45,109 +45,109 @@ module SharedDiffNote
end
end
Given 'I open a diff comment form' do
step 'I open a diff comment form' do
click_diff_line(sample_commit.line_code)
end
Given 'I open another diff comment form' do
step 'I open another diff comment form' do
click_diff_line(sample_commit.del_line_code)
end
Given 'I write a diff comment like ":-1: I don\'t like this"' do
step 'I write a diff comment like ":-1: I don\'t like this"' do
within(diff_file_selector) do
fill_in "note[note]", with: ":-1: I don\'t like this"
end
end
Given 'I submit the diff comment' do
step 'I submit the diff comment' do
within(diff_file_selector) do
click_button("Add Comment")
end
end
Then 'I should not see the diff comment form' do
step 'I should not see the diff comment form' do
within(diff_file_selector) do
page.should_not have_css("form.new_note")
end
end
Then 'I should not see the diff comment preview button' do
step 'I should not see the diff comment preview button' do
within(diff_file_selector) do
page.should have_css(".js-note-preview-button", visible: false)
end
end
Then 'I should not see the diff comment text field' do
step 'I should not see the diff comment text field' do
within(diff_file_selector) do
page.should have_css(".js-note-text", visible: false)
end
end
Then 'I should only see one diff form' do
step 'I should only see one diff form' do
within(diff_file_selector) do
page.should have_css("form.new_note", count: 1)
end
end
Then 'I should see a diff comment form with ":-1: I don\'t like this"' do
step 'I should see a diff comment form with ":-1: I don\'t like this"' do
within(diff_file_selector) do
page.should have_field("note[note]", with: ":-1: I don\'t like this")
end
end
Then 'I should see a diff comment saying "Typo, please fix"' do
step 'I should see a diff comment saying "Typo, please fix"' do
within("#{diff_file_selector} .note") do
page.should have_content("Typo, please fix")
end
end
Then 'I should see a discussion reply button' do
step 'I should see a discussion reply button' do
within(diff_file_selector) do
page.should have_link("Reply")
end
end
Then 'I should see a temporary diff comment form' do
step 'I should see a temporary diff comment form' do
within(diff_file_selector) do
page.should have_css(".js-temp-notes-holder form.new_note")
end
end
Then 'I should see add a diff comment button' do
step 'I should see add a diff comment button' do
page.should have_css(".js-add-diff-note-button", visible: false)
end
Then 'I should see an empty diff comment form' do
step 'I should see an empty diff comment form' do
within(diff_file_selector) do
page.should have_field("note[note]", with: "")
end
end
Then 'I should see the cancel comment button' do
step 'I should see the cancel comment button' do
within("#{diff_file_selector} form") do
page.should have_css(".js-close-discussion-note-form", text: "Cancel")
end
end
Then 'I should see the diff comment preview' do
step 'I should see the diff comment preview' do
within("#{diff_file_selector} form") do
page.should have_css(".js-note-preview", visible: false)
end
end
Then 'I should see the diff comment edit button' do
step 'I should see the diff comment edit button' do
within(diff_file_selector) do
page.should have_css(".js-note-write-button", visible: true)
end
end
Then 'I should see the diff comment preview button' do
step 'I should see the diff comment preview button' do
within(diff_file_selector) do
page.should have_css(".js-note-preview-button", visible: true)
end
end
Then 'I should see two separate previews' do
step 'I should see two separate previews' do
within(diff_file_selector) do
page.should have_css(".js-note-preview", visible: true, count: 2)
page.should have_content("Should fix it")
......
module SharedNote
include Spinach::DSL
Given 'I delete a comment' do
step 'I delete a comment' do
find('.note').hover
find(".js-note-delete").click
end
Given 'I haven\'t written any comment text' do
step 'I haven\'t written any comment text' do
within(".js-main-target-form") do
fill_in "note[note]", with: ""
end
end
Given 'I leave a comment like "XML attached"' do
step 'I leave a comment like "XML attached"' do
within(".js-main-target-form") do
fill_in "note[note]", with: "XML attached"
click_button "Add Comment"
......@@ -20,84 +20,84 @@ module SharedNote
end
end
Given 'I preview a comment text like "Bug fixed :smile:"' do
step 'I preview a comment text like "Bug fixed :smile:"' do
within(".js-main-target-form") do
fill_in "note[note]", with: "Bug fixed :smile:"
find(".js-note-preview-button").trigger("click")
end
end
Given 'I submit the comment' do
step 'I submit the comment' do
within(".js-main-target-form") do
click_button "Add Comment"
end
end
Given 'I write a comment like "Nice"' do
step 'I write a comment like "Nice"' do
within(".js-main-target-form") do
fill_in "note[note]", with: "Nice"
end
end
Then 'I should not see a comment saying "XML attached"' do
step 'I should not see a comment saying "XML attached"' do
page.should_not have_css(".note")
end
Then 'I should not see the cancel comment button' do
step 'I should not see the cancel comment button' do
within(".js-main-target-form") do
should_not have_link("Cancel")
end
end
Then 'I should not see the comment preview' do
step 'I should not see the comment preview' do
within(".js-main-target-form") do
page.should have_css(".js-note-preview", visible: false)
end
end
Then 'I should not see the comment preview button' do
step 'I should not see the comment preview button' do
within(".js-main-target-form") do
page.should have_css(".js-note-preview-button", visible: false)
end
end
Then 'I should not see the comment text field' do
step 'I should not see the comment text field' do
within(".js-main-target-form") do
page.should have_css(".js-note-text", visible: false)
end
end
Then 'I should see a comment saying "XML attached"' do
step 'I should see a comment saying "XML attached"' do
within(".note") do
page.should have_content("XML attached")
end
end
Then 'I should see an empty comment text field' do
step 'I should see an empty comment text field' do
within(".js-main-target-form") do
page.should have_field("note[note]", with: "")
end
end
Then 'I should see the comment edit button' do
step 'I should see the comment edit button' do
within(".js-main-target-form") do
page.should have_css(".js-note-write-button", visible: true)
end
end
Then 'I should see the comment preview' do
step 'I should see the comment preview' do
within(".js-main-target-form") do
page.should have_css(".js-note-preview", visible: true)
end
end
Then 'I should see the comment preview button' do
step 'I should see the comment preview button' do
within(".js-main-target-form") do
page.should have_css(".js-note-preview-button", visible: true)
end
end
Then 'I should see comment "XML attached"' do
step 'I should see comment "XML attached"' do
within(".note") do
page.should have_content("XML attached")
end
......
......@@ -394,15 +394,15 @@ module SharedPaths
# Snippets
# ----------------------------------------
Given 'I visit project "Shop" snippets page' do
step 'I visit project "Shop" snippets page' do
visit project_snippets_path(project)
end
Given 'I visit snippets page' do
step 'I visit snippets page' do
visit snippets_path
end
Given 'I visit new snippet page' do
step 'I visit new snippet page' do
visit new_snippet_path
end
......@@ -418,7 +418,7 @@ module SharedPaths
# Errors
# ----------------------------------------
Then 'page status code should be 404' do
step 'page status code should be 404' do
page.status_code.should == 404
end
end
......@@ -2,33 +2,33 @@ module SharedProject
include Spinach::DSL
# Create a project without caring about what it's called
And "I own a project" do
step "I own a project" do
@project = create(:project, namespace: @user.namespace)
@project.team << [@user, :master]
end
# Create a specific project called "Shop"
And 'I own project "Shop"' do
step 'I own project "Shop"' do
@project = Project.find_by(name: "Shop")
@project ||= create(:project, name: "Shop", namespace: @user.namespace, snippets_enabled: true)
@project.team << [@user, :master]
end
# Create another specific project called "Forum"
And 'I own project "Forum"' do
step 'I own project "Forum"' do
@project = Project.find_by(name: "Forum")
@project ||= create(:project, name: "Forum", namespace: @user.namespace, path: 'forum_project')
@project.team << [@user, :master]
end
# Create an empty project without caring about the name
And 'I own an empty project' do
step 'I own an empty project' do
@project = create(:empty_project,
name: 'Empty Project', namespace: @user.namespace)
@project.team << [@user, :master]
end
And 'project "Shop" has push event' do
step 'project "Shop" has push event' do
@project = Project.find_by(name: "Shop")
data = {
......@@ -54,12 +54,12 @@ module SharedProject
)
end
Then 'I should see project "Shop" activity feed' do
step 'I should see project "Shop" activity feed' do
project = Project.find_by(name: "Shop")
page.should have_content "#{@user.name} pushed new branch fix at #{project.name_with_namespace}"
end
Then 'I should see project settings' do
step 'I should see project settings' do
current_path.should == edit_project_path(@project)
page.should have_content("Project name")
page.should have_content("Features:")
......
module SharedSnippet
include Spinach::DSL
And 'I have public "Personal snippet one" snippet' do
step 'I have public "Personal snippet one" snippet' do
create(:personal_snippet,
title: "Personal snippet one",
content: "Test content",
......@@ -10,7 +10,7 @@ module SharedSnippet
author: current_user)
end
And 'I have private "Personal snippet private" snippet' do
step 'I have private "Personal snippet private" snippet' do
create(:personal_snippet,
title: "Personal snippet private",
content: "Provate content",
......@@ -18,7 +18,7 @@ module SharedSnippet
private: true,
author: current_user)
end
And 'I have a public many lined snippet' do
step 'I have a public many lined snippet' do
create(:personal_snippet,
title: 'Many lined snippet',
content: <<-END.gsub(/^\s+\|/, ''),
......
......@@ -37,19 +37,19 @@ class Spinach::Features::SnippetSearch < Spinach::FeatureSteps
page.should_not have_content 'line three'
end
Then 'I should see "Personal snippet one" in results' do
step 'I should see "Personal snippet one" in results' do
page.should have_content 'Personal snippet one'
end
And 'I should see "Personal snippet private" in results' do
step 'I should see "Personal snippet private" in results' do
page.should have_content 'Personal snippet private'
end
Then 'I should not see "Personal snippet one" in results' do
step 'I should not see "Personal snippet one" in results' do
page.should_not have_content 'Personal snippet one'
end
And 'I should not see "Personal snippet private" in results' do
step 'I should not see "Personal snippet private" in results' do
page.should_not have_content 'Personal snippet private'
end
......
......@@ -3,11 +3,11 @@ class DiscoverSnippets < Spinach::FeatureSteps
include SharedPaths
include SharedSnippet
Then 'I should see "Personal snippet one" in snippets' do
step 'I should see "Personal snippet one" in snippets' do
page.should have_content "Personal snippet one"
end
And 'I should not see "Personal snippet private" in snippets' do
step 'I should not see "Personal snippet private" in snippets' do
page.should_not have_content "Personal snippet private"
end
......
......@@ -4,25 +4,25 @@ class SnippetsFeature < Spinach::FeatureSteps
include SharedProject
include SharedSnippet
Given 'I click link "Personal snippet one"' do
step 'I click link "Personal snippet one"' do
click_link "Personal snippet one"
end
And 'I should not see "Personal snippet one" in snippets' do
step 'I should not see "Personal snippet one" in snippets' do
page.should_not have_content "Personal snippet one"
end
And 'I click link "Edit"' do
step 'I click link "Edit"' do
within ".file-title" do
click_link "Edit"
end
end
And 'I click link "Destroy"' do
step 'I click link "Destroy"' do
click_link "remove"
end
And 'I submit new snippet "Personal snippet three"' do
step 'I submit new snippet "Personal snippet three"' do
fill_in "personal_snippet_title", :with => "Personal snippet three"
fill_in "personal_snippet_file_name", :with => "my_snippet.rb"
within('.file-editor') do
......@@ -31,30 +31,30 @@ class SnippetsFeature < Spinach::FeatureSteps
click_button "Create snippet"
end
Then 'I should see snippet "Personal snippet three"' do
step 'I should see snippet "Personal snippet three"' do
page.should have_content "Personal snippet three"
page.should have_content "Content of snippet three"
end
And 'I submit new title "Personal snippet new title"' do
step 'I submit new title "Personal snippet new title"' do
fill_in "personal_snippet_title", :with => "Personal snippet new title"
click_button "Save"
end
Then 'I should see "Personal snippet new title"' do
step 'I should see "Personal snippet new title"' do
page.should have_content "Personal snippet new title"
end
And 'I uncheck "Private" checkbox' do
step 'I uncheck "Private" checkbox' do
choose "Public"
click_button "Save"
end
Then 'I should see "Personal snippet one" public' do
step 'I should see "Personal snippet one" public' do
page.should have_no_xpath("//i[@class='public-snippet']")
end
And 'I visit snippet page "Personal snippet one"' do
step 'I visit snippet page "Personal snippet one"' do
visit snippet_path(snippet)
end
......
......@@ -3,33 +3,33 @@ class UserSnippets < Spinach::FeatureSteps
include SharedPaths
include SharedSnippet
Given 'I visit my snippets page' do
step 'I visit my snippets page' do
visit user_snippets_path(current_user)
end
Then 'I should see "Personal snippet one" in snippets' do
step 'I should see "Personal snippet one" in snippets' do
page.should have_content "Personal snippet one"
end
And 'I should see "Personal snippet private" in snippets' do
step 'I should see "Personal snippet private" in snippets' do
page.should have_content "Personal snippet private"
end
Then 'I should not see "Personal snippet one" in snippets' do
step 'I should not see "Personal snippet one" in snippets' do
page.should_not have_content "Personal snippet one"
end
And 'I should not see "Personal snippet private" in snippets' do
step 'I should not see "Personal snippet private" in snippets' do
page.should_not have_content "Personal snippet private"
end
Given 'I click "Public" filter' do
step 'I click "Public" filter' do
within('.nav-stacked') do
click_link "Public"
end
end
Given 'I click "Private" filter' do
step 'I click "Private" filter' do
within('.nav-stacked') do
click_link "Private"
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