Reorganize Selenium tests into Test Suites and continue work on Ajax interactions for deferred actions section of Project Page.

Note that I'm currently only able to successfully run Seleniunm tests on Firefox (Mac & PC). I'm not successful on Safari or IE7.



git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@388 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lukemelia 2007-01-02 02:18:11 +00:00
parent bde8a0bde0
commit 10a4ead296
22 changed files with 95 additions and 37 deletions

View file

@ -186,3 +186,17 @@ end
due: ~
completed_at: ~
user_id: 1
15:
id: 15
context_id: 6
project_id: 1
description: Select Delorean model
notes: ~
state: deferred
created_at: <%= today %>
due: ~
completed_at: ~
show_from: <%= next_week %>
user_id: 1

View file

@ -22,14 +22,14 @@ class ProjectControllerTest < TodoContainerControllerTestBase
p = projects(:timemachine)
get :show, :url_friendly_name => p.url_friendly_name
assert_not_nil assigns['deferred']
assert_equal 0, assigns['deferred'].size
assert_equal 1, assigns['deferred'].size
t = p.not_done_todos[0]
t.show_from = 1.days.from_now.to_date
t.save!
get :show, :url_friendly_name => p.url_friendly_name
assert_equal 1, assigns['deferred'].size
assert_equal 2, assigns['deferred'].size
end
def test_create_project_via_ajax_increments_number_of_projects

View file

@ -49,6 +49,14 @@ class TodoControllerTest < Test::Unit::TestCase
assert_equal 1, assigns['context_not_done_counts'][contexts(:lab).id]
end
def test_deferred_count_for_project_source_view
@request.session['user_id'] = users(:admin_user).id
xhr :post, :toggle_check, :id => 5, :_source_view => 'project'
assert_equal 1, assigns['deferred_count']
xhr :post, :toggle_check, :id => 15, :_source_view => 'project'
assert_equal 0, assigns['deferred_count']
end
def test_destroy_item
@request.session['user_id'] = users(:admin_user).id
xhr :post, :destroy, :id => 1, :_source_view => 'todo'

View file

@ -1,4 +1,4 @@
setup :fixtures => :all
include_partial 'login', :username => 'admin', :password => 'abracadabra'
include_partial 'login/login', :username => 'admin', :password => 'abracadabra'
click "xpath=//div[@id='c1'] //div[@id='todo_9'] //input[@class='item-checkbox']"
wait_for_element_present "xpath=//div[@id='completed'] //div[@id='todo_9']"

View file

@ -1,5 +1,5 @@
setup :fixtures => :all
include_partial 'login', :username => 'admin', :password => 'abracadabra'
include_partial 'login/login', :username => 'admin', :password => 'abracadabra'
click "xpath=//div[@id='c5'] //div[@id='todo_5'] //input[@class='item-checkbox']"
wait_for_element_present "xpath=//div[@id='completed'] //div[@id='todo_5']"
wait_for_not_visible 'c5'

View file

@ -1,5 +1,5 @@
setup :fixtures => :all
include_partial 'login', :username => 'admin', :password => 'abracadabra'
include_partial 'login/login', :username => 'admin', :password => 'abracadabra'
click "xpath=//div[@id='completed'] //div[@id='todo_3'] //input[@class='item-checkbox']"
wait_for_element_present "xpath=//div[@id='c4'] //div[@id='todo_3']"
assert_not_visible "c4empty-nd"

View file

@ -1,10 +0,0 @@
setup :fixtures => :all
include_partial 'login', :username => 'admin', :password => 'abracadabra'
open "/project/Build_a_working_time_machine"
type "todo_description", "choose era"
type "todo_show_from", "1/1/2030"
click "//input[@value='Add item']"
wait_for_element_present "xpath=//div[@id='tickler'] //div[@class='item-container']"
open "/project/Build_a_working_time_machine"
click "xpath=//div[@id='tickler'] //input[@class='item-checkbox']"
wait_for_visible "tickler-empty-nd"

View file

@ -1,8 +1,4 @@
setup :fixtures => :all
include_partial 'login', :username => 'admin', :password => 'abracadabra'
open "/project/Build_a_working_time_machine"
type "todo_description", "choose era"
type "todo_show_from", "1/1/2030"
click "//input[@value='Add item']"
wait_for_element_present "xpath=//div[@id='tickler'] //div[@class='item-container']"
assert_not_visible "tickler-empty-nd"
type "todo_description", "choose era"
type "todo_show_from", "1/1/2030"
click "//input[@value='Add item']"
wait_for_element_present "xpath=//div[@id='tickler'] //div[@class='item-container']"

View file

@ -0,0 +1,11 @@
setup :fixtures => :all
include_partial 'login/login', :username => 'admin', :password => 'abracadabra'
open "/project/Build_a_working_time_machine"
include_partial 'project_detail/add_deferred_todo'
open "/project/Build_a_working_time_machine"
click "edit_icon_todo_15"
wait_for_element_present "show_from_todo_15"
type "show_from_todo_15", ""
click "//input[@value='Update']"
wait_for_element_present "xpath=//div[@id='p1'] //div[@id='todo_15']"
assert_not_visible "tickler-empty-nd"

View file

@ -0,0 +1,10 @@
setup :fixtures => :all
include_partial 'login/login', :username => 'admin', :password => 'abracadabra'
open "/project/Build_a_working_time_machine"
open "/project/Build_a_working_time_machine"
click "edit_icon_todo_15"
wait_for_element_present "show_from_todo_15"
type "show_from_todo_15", ""
click "//input[@value='Update']"
wait_for_element_present "xpath=//div[@id='p1'] //div[@id='todo_15']"
wait_for_visible "tickler-empty-nd"

View file

@ -0,0 +1,5 @@
setup :fixtures => :all
include_partial 'login/login', :username => 'admin', :password => 'abracadabra'
open "/project/Build_a_working_time_machine"
include_partial 'project_detail/add_deferred_todo'
assert_not_visible "tickler-empty-nd"

View file

@ -1,5 +1,5 @@
setup :fixtures => :all
include_partial 'login', :username => 'admin', :password => 'abracadabra'
include_partial 'login/login', :username => 'admin', :password => 'abracadabra'
open "/project/Build_a_working_time_machine"
click "edit_icon_todo_5"
wait_for_element_present "show_from_todo_5"

View file

@ -0,0 +1,7 @@
setup :fixtures => :all
include_partial 'login/login', :username => 'admin', :password => 'abracadabra'
open "/project/Build_a_working_time_machine"
include_partial 'project_detail/add_deferred_todo'
click "xpath=//div[@id='tickler'] //div[@id='todo_15'] //input[@class='item-checkbox']"
wait_for_element_present "xpath=//div[@id='completed'] //div[@id='todo_15']"
assert_not_visible "tickler-empty-nd"

View file

@ -0,0 +1,5 @@
setup :fixtures => :all
include_partial 'login/login', :username => 'admin', :password => 'abracadabra'
open "/project/Build_a_working_time_machine"
click "xpath=//div[@id='tickler'] //div[@id='todo_15'] //input[@class='item-checkbox']"
wait_for_visible "tickler-empty-nd"

View file

@ -75,12 +75,12 @@ class ProjectTest < Test::Unit::TestCase
end
def test_delete_project_deletes_todos_within_it
assert_equal 2, @timemachine.todos.count
timemachine_todo_1_id = @timemachine.todos[0].id
timemachine_todo_2_id = @timemachine.todos[1].id
assert_equal 3, @timemachine.todos.count
timemachine_todo_ids = @timemachine.todos.map{ |t| t.id }
@timemachine.destroy
assert !Todo.exists?(timemachine_todo_1_id)
assert !Todo.exists?(timemachine_todo_2_id)
timemachine_todo_ids.each do |t_id|
assert !Todo.exists?(t_id)
end
end
def test_not_done_todos
@ -100,11 +100,11 @@ class ProjectTest < Test::Unit::TestCase
end
def test_deferred_todos
assert_equal 0, @timemachine.deferred_todos.size
assert_equal 1, @timemachine.deferred_todos.size
t = @timemachine.not_done_todos[0]
t.show_from = 1.days.from_now.to_date
t.save!
assert_equal 1, Project.find(@timemachine.id).deferred_todos.size
assert_equal 2, Project.find(@timemachine.id).deferred_todos.size
end
def test_url_friendly_name_for_name_with_spaces