Commit ef6e94e3 authored by Ciro Santilli's avatar Ciro Santilli
Browse files

Replace old spinach step definitions with step.

parent 49b5cd4e34ec
......@@ -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')