mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-07 16:24:21 +01:00
fix some regressions caused by the newer acts_as_list gem
Signed-off-by: Reinier Balt <lrbalt@gmail.com>
This commit is contained in:
parent
92c8cfe61a
commit
4927f39594
9 changed files with 85 additions and 72 deletions
|
|
@ -11,10 +11,10 @@ Feature: Manage the list of contexts
|
|||
|
||||
Scenario: The list of contexts contain all contexts
|
||||
Given I have the following contexts
|
||||
| name | hide |
|
||||
| @ipad | false |
|
||||
| @home | false |
|
||||
| @boss | false |
|
||||
| context | hide |
|
||||
| @ipad | false |
|
||||
| @home | false |
|
||||
| @boss | false |
|
||||
When I go to the contexts page
|
||||
Then I should see "@ipad"
|
||||
And I should see "@home"
|
||||
|
|
@ -25,7 +25,7 @@ Feature: Manage the list of contexts
|
|||
Given I have a context called "@computer"
|
||||
When I go to the contexts page
|
||||
And I follow "@computer"
|
||||
Then I should be on the context page for "@computer"
|
||||
Then I should be on the context page for "@computer"
|
||||
|
||||
@selenium
|
||||
Scenario: Delete context from context page should update badge
|
||||
|
|
@ -76,9 +76,9 @@ Feature: Manage the list of contexts
|
|||
@selenium
|
||||
Scenario Outline: Add a new context with state
|
||||
Given I have the following contexts
|
||||
| name | hide |
|
||||
| @ipad | true |
|
||||
| @home | false |
|
||||
| context | hide |
|
||||
| @ipad | true |
|
||||
| @home | false |
|
||||
When I go to the contexts page
|
||||
And I add a new <state> context "<name>"
|
||||
Then I should see the context "<name>" under "<state>"
|
||||
|
|
@ -97,10 +97,10 @@ Feature: Manage the list of contexts
|
|||
@selenium
|
||||
Scenario: I can drag and drop to order the contexts
|
||||
Given I have the following contexts
|
||||
| name |
|
||||
| @ipad |
|
||||
| @home |
|
||||
| @boss |
|
||||
| context |
|
||||
| @ipad |
|
||||
| @home |
|
||||
| @boss |
|
||||
When I go to the contexts page
|
||||
Then context "@ipad" should be above context "@home"
|
||||
When I drag context "@ipad" below context "@home"
|
||||
|
|
|
|||
|
|
@ -61,8 +61,9 @@ Then /^I should see "([^"]*)" in the context container for "([^"]*)"$/ do |todo_
|
|||
todo.should_not be_nil
|
||||
|
||||
xpath = "xpath=//div[@id=\"c#{context.id}\"]//div[@id='line_todo_#{todo.id}']"
|
||||
selenium.wait_for_element(xpath, :timeout_in_seconds => 5)
|
||||
selenium.is_visible(xpath).should be_true
|
||||
wait_for :timeout => 5 do
|
||||
selenium.is_visible(xpath)
|
||||
end
|
||||
end
|
||||
|
||||
Then /^I should not see "([^"]*)" in the context container for "([^"]*)"$/ do |todo_description, context_name|
|
||||
|
|
|
|||
|
|
@ -34,9 +34,18 @@ end
|
|||
Given /^I have the following contexts:$/ do |table|
|
||||
table.hashes.each do |context|
|
||||
Given 'I have a context called "'+context[:context]+'"'
|
||||
@context.hide = context[:hide] == "true" unless context[:hide].blank?
|
||||
# acts_as_list puts the last added context at the top, but we want it
|
||||
# at the bottom to be consistent with the table in the scenario
|
||||
@context.move_to_bottom
|
||||
@context.save!
|
||||
end
|
||||
end
|
||||
|
||||
Given /^I have the following contexts$/ do |table|
|
||||
Given("I have the following contexts:", table)
|
||||
end
|
||||
|
||||
Given /^I have a context "([^\"]*)" with (.*) actions$/ do |context_name, number_of_actions|
|
||||
context = @current_user.contexts.create!(:name => context_name)
|
||||
1.upto number_of_actions.to_i do |i|
|
||||
|
|
@ -44,17 +53,6 @@ Given /^I have a context "([^\"]*)" with (.*) actions$/ do |context_name, number
|
|||
end
|
||||
end
|
||||
|
||||
Given /^I have the following contexts$/ do |table|
|
||||
Context.delete_all
|
||||
table.hashes.each do |hash|
|
||||
context = @current_user.contexts.create!(:name => hash[:name])
|
||||
unless hash[:hide].blank?
|
||||
context.hide = hash[:hide] == true
|
||||
context.save!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
When /^I edit the context name in place to be "([^\"]*)"$/ do |new_context_name|
|
||||
selenium.click "context_name"
|
||||
fill_in "value", :with => new_context_name
|
||||
|
|
|
|||
|
|
@ -34,6 +34,10 @@ end
|
|||
Given /^I have the following projects:$/ do |table|
|
||||
table.hashes.each do |project|
|
||||
Given 'I have a project called "'+project[:project_name]+'"'
|
||||
# acts_as_list puts the last added project at the top, but we want it
|
||||
# at the bottom to be consistent with the table in the scenario
|
||||
@project.move_to_bottom
|
||||
@project.save!
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
11
features/support/hooks.rb
Normal file
11
features/support/hooks.rb
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
AfterStep('@pause') do
|
||||
print "Press Return to continue..."
|
||||
STDIN.getc
|
||||
end
|
||||
|
||||
Before('@clear_cookies') do
|
||||
cookies = selenium.cookies
|
||||
cookies.split(';').each do | cookie |
|
||||
selenium.delete_cookie(cookie)
|
||||
end
|
||||
end
|
||||
|
|
@ -22,7 +22,7 @@ module TracksStepHelper
|
|||
!selenium.is_element_present("//form[@id='form_todo_#{todo.id}']")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def format_date(date)
|
||||
# copy-and-past from ApplicationController::format_date
|
||||
return date ? date.in_time_zone(@current_user.prefs.time_zone).strftime("#{@current_user.prefs.date_format}") : ''
|
||||
|
|
@ -46,14 +46,14 @@ module TracksStepHelper
|
|||
wait_for :timeout => 5 do
|
||||
selenium.is_element_present(edit_button)
|
||||
end
|
||||
|
||||
|
||||
selenium.click(edit_button, :wait_for => :ajax, :javascript_framework => :jquery)
|
||||
end
|
||||
|
||||
def wait_for_ajax
|
||||
selenium.wait_for :wait_for => :ajax, :javascript_framework => :jquery
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
World(TracksStepHelper)
|
||||
|
|
@ -9,13 +9,13 @@ Feature: Toggle the context containers
|
|||
| testuser | secret | false |
|
||||
And I have logged in as "testuser" with password "secret"
|
||||
|
||||
@selenium
|
||||
@selenium @clear_cookies
|
||||
Scenario: I can toggle a context container
|
||||
Given I have the following contexts
|
||||
| name | hide |
|
||||
| @ipad | false |
|
||||
| @home | false |
|
||||
| @boss | false |
|
||||
| context | hide |
|
||||
| @ipad | false |
|
||||
| @home | false |
|
||||
| @boss | false |
|
||||
And I have a project "collapse those contexts" that has the following todos
|
||||
| description | context |
|
||||
| test 1 | @ipad |
|
||||
|
|
@ -38,13 +38,13 @@ Feature: Toggle the context containers
|
|||
And I should not see "test 2"
|
||||
And I should not see "test 3"
|
||||
|
||||
@selenium
|
||||
@selenium @clear_cookies
|
||||
Scenario: I can hide all collapsed containers
|
||||
Given I have the following contexts
|
||||
| name | hide |
|
||||
| @ipad | false |
|
||||
| @home | false |
|
||||
| @boss | false |
|
||||
| context | hide |
|
||||
| @ipad | false |
|
||||
| @home | false |
|
||||
| @boss | false |
|
||||
And I have a project "collapse those contexts" that has the following todos
|
||||
| description | context |
|
||||
| test 1 | @ipad |
|
||||
|
|
@ -64,4 +64,3 @@ Feature: Toggle the context containers
|
|||
Then I should not see the context container for "@home"
|
||||
And I should not see the context container for "@boss"
|
||||
And I should not see the context container for "@ipad"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue