fix #1052 based on the work of Tim Madden. Thanks Tim!

This commit is contained in:
Reinier Balt 2011-02-26 11:38:39 +01:00
parent e9d92438d6
commit b53fbc64dc
8 changed files with 78 additions and 28 deletions

View file

@ -17,3 +17,7 @@ Then /the badge should show (.*)/ do |number|
badge.should == number.to_i
end
Given /^I am working on the mobile interface$/ do
@mobile_interface = true
end

View file

@ -1,5 +1,5 @@
Given /^I have logged in as "(.*)" with password "(.*)"$/ do |username, password|
visit login_path
When "I go to the login page"
fill_in "Login", :with => username
fill_in "Password", :with => password
uncheck "Stay logged in:"
@ -7,7 +7,8 @@ Given /^I have logged in as "(.*)" with password "(.*)"$/ do |username, password
if response.respond_to? :selenium
selenium.wait_for_page_to_load(5000)
end
response.should contain(/Logout \(#{username}\)/)
logout_string = @mobile_interface ? "Logout" : "Logout \(#{username}\)"
response.should contain(/#{logout_string}/)
@current_user = User.find_by_login(username)
end

View file

@ -24,6 +24,13 @@ Given /^I have a project called "([^"]*)"$/ do |project_name|
Given "there exists a project \"#{project_name}\" for user \"#{@current_user.login}\""
end
Given /^I have a project "([^"]*)" with a default context of "([^"]*)"$/ do |project_name, context_name|
Given "there exists a project \"#{project_name}\" for user \"#{@current_user.login}\""
context = @current_user.contexts.create!(:name => context_name)
@project.default_context = context
@project.save!
end
Given /^I have the following projects:$/ do |table|
table.hashes.each do |project|
Given 'I have a project called "'+project[:project_name]+'"'
@ -189,4 +196,4 @@ end
Then /^I should see the project name is "([^"]*)"$/ do |project_name|
Then "the project title should be \"#{project_name}\""
end
end

View file

@ -271,3 +271,13 @@ Then /^I should not see "([^"]*)" in the deferred container$/ do |todo_descripti
selenium.is_element_present(xpath).should be_false
end
Then /^the selected project should be "([^"]*)"$/ do |content|
# Works for mobile. TODO: make it work for both mobile and non-mobile
field_labeled("Project").element.search(".//option[@selected = 'selected']").inner_html.should =~ /#{content}/
end
Then /^the selected context should be "([^"]*)"$/ do |content|
# Works for mobile. TODO: make it work for both mobile and non-mobile
field_labeled("Context").element.search(".//option[@selected = 'selected']").inner_html.should =~ /#{content}/
end