another set of fixes for the cucumber scenario's

This commit is contained in:
Reinier Balt 2012-12-24 15:36:47 +01:00
parent da2bee2e53
commit b18b222834
7 changed files with 56 additions and 40 deletions

View file

@ -12,7 +12,7 @@
</div>
<div class="project-state-group" id="list-completed-projects-container" <%= " style=\"display:none\"" if @no_projects %>>
<%= will_paginate @projects, paginate_options %>
<div class="paginate_header"><%= will_paginate @projects, paginate_options %></div>
<h2>
<span id="completed-projects-count" class="badge"><%= "#{@total} (#{@range_low}-#{@range_high})" %></span>
<%= t('states.completed_plural' )%> <%= t('common.projects') %>
@ -21,7 +21,7 @@
<%= render :partial => 'project_listing', :collection => @projects %>
</div>
</div>
<%= will_paginate @projects, paginate_options %>
<div class="paginate_footer"><%= will_paginate @projects, paginate_options %></div>
</div>
<div id="input_box">

View file

@ -8,7 +8,7 @@
%>
<div id="display_box">
<div class="container" id="completed_recurring_todos_container">
<%= will_paginate @completed_recurring_todos, paginate_options %>
<div class="paginate_header"><%= will_paginate @completed_recurring_todos, paginate_options %></div>
<h2>
<span id="completed-projects-count" class="badge"><%= "#{@total} (#{@range_low}-#{@range_high})" %></span>
<%= t('todos.completed_recurring') %>
@ -19,6 +19,6 @@
</div>
<%= render :partial => @completed_recurring_todos %>
</div>
<%= will_paginate @completed_recurring_todos, paginate_options %>
<div class="paginate_footer"><%= will_paginate @completed_recurring_todos, paginate_options %></div>
</div>
</div>

View file

@ -8,7 +8,7 @@
%>
<div id="display_box_projects">
<div class="container">
<%= will_paginate @done, paginate_options %>
<div class="paginate_header"><%= will_paginate @done, paginate_options %></div>
<h2><%= t('todos.all_completed') %></h2>
<% if @done.empty? -%>
<div class="message"><p><%= t('todos.no_completed_actions') %></p></div>
@ -17,6 +17,6 @@
<% end -%>
</div>
<%= will_paginate @done, paginate_options %>
<div class="paginate_footer"><%= will_paginate @done, paginate_options %></div>
</div>

View file

@ -188,7 +188,9 @@ end
####### submitting using sidebar form #######
When /^I submit a new action with description "([^"]*)"$/ do |description|
fill_in "todo[description]", :with => description
within "form#todo-form-new-action" do
fill_in "todo[description]", :with => description
end
submit_next_action_form
end
@ -196,16 +198,16 @@ When /^I submit a new action with description "([^"]*)" with a dependency on "([
predecessor = @current_user.todos.find_by_description(predecessor_description)
predecessor.should_not be_nil
fill_in "todo[description]", :with => todo_description
fill_in "predecessor_input", :with => predecessor_description
within "form#todo-form-new-action" do
fill_in "todo[description]", :with => todo_description
fill_in "predecessor_input", :with => predecessor_description
end
# wait for auto complete
autocomplete = "//a[@id='ui-active-menuitem']"
page.should have_xpath(autocomplete, :visible => true)
# wait for auto complete
page.should have_css("a.ui-state-focus", :visible => true)
# click first line
first_elem = "//ul/li[1]/a[@id='ui-active-menuitem']"
page.find(:xpath, first_elem).click
page.find(:css, "ul li a.ui-state-focus").click
new_dependency_line = "//li[@id='pred_#{predecessor.id}']"
page.should have_xpath(new_dependency_line, :visible => true)
@ -214,24 +216,28 @@ When /^I submit a new action with description "([^"]*)" with a dependency on "([
end
When /^I submit a new action with description "([^"]*)" and the tags "([^"]*)" in the context "([^"]*)"$/ do |description, tags, context_name|
fill_in "todo[description]", :with => description
fill_in "tag_list", :with => tags
within "form#todo-form-new-action" do
fill_in "todo[description]", :with => description
fill_in "tag_list", :with => tags
# fill_in does not seem to work when the field is prefilled with something. Empty the field first
clear_context_name_from_next_action_form
fill_in "todo_context_name", :with => context_name
# fill_in does not seem to work when the field is prefilled with something. Empty the field first
clear_context_name_from_next_action_form
fill_in "todo_context_name", :with => context_name
end
submit_next_action_form
end
When /^I submit a new action with description "([^"]*)" to project "([^"]*)" with tags "([^"]*)" in the context "([^"]*)"$/ do |description, project_name, tags, context_name|
fill_in "todo[description]", :with => description
within "form#todo-form-new-action" do
fill_in "todo[description]", :with => description
clear_project_name_from_next_action_form
clear_context_name_from_next_action_form
clear_project_name_from_next_action_form
clear_context_name_from_next_action_form
fill_in "todo_project_name", :with => project_name
fill_in "todo_context_name", :with => context_name
fill_in "tag_list", :with => tags
fill_in "todo_project_name", :with => project_name
fill_in "todo_context_name", :with => context_name
fill_in "tag_list", :with => tags
end
submit_next_action_form
end
@ -241,10 +247,12 @@ When /^I submit a new action with description "([^"]*)" to project "([^"]*)" in
end
When /^I submit a new action with description "([^"]*)" in the context "([^"]*)"$/ do |description, context_name|
fill_in "todo[description]", :with => description
within "form#todo-form-new-action" do
fill_in "todo[description]", :with => description
clear_context_name_from_next_action_form
fill_in "todo_context_name", :with => context_name
clear_context_name_from_next_action_form
fill_in "todo_context_name", :with => context_name
end
submit_next_action_form
end
@ -258,13 +266,15 @@ When /^I submit a new deferred action with description "([^"]*)"$/ do |descripti
end
When /^I submit a new deferred action with description "([^"]*)" and the tags "([^"]*)" in the context "([^"]*)"$/ do |description, tags, context_name|
fill_in "todo[description]", :with => description
within "form#todo-form-new-action" do
fill_in "todo[description]", :with => description
clear_context_name_from_next_action_form
fill_in "todo_context_name", :with => context_name
clear_context_name_from_next_action_form
fill_in "todo_context_name", :with => context_name
fill_in "tag_list", :with => tags
fill_in "todo[show_from]", :with => format_date(@current_user.time + 1.week)
fill_in "tag_list", :with => tags
fill_in "todo[show_from]", :with => format_date(@current_user.time + 1.week)
end
submit_next_action_form
end
@ -274,10 +284,12 @@ When /^I submit a new deferred action with description "([^"]*)" to project "([^
clear_project_name_from_next_action_form
clear_context_name_from_next_action_form
fill_in "todo_project_name", :with => project_name
fill_in "todo_context_name", :with => context_name
fill_in "tag_list", :with => tags
fill_in "todo[show_from]", :with => format_date(@current_user.time + 1.week)
within "form#todo-form-new-action" do
fill_in "todo_project_name", :with => project_name
fill_in "todo_context_name", :with => context_name
fill_in "tag_list", :with => tags
fill_in "todo[show_from]", :with => format_date(@current_user.time + 1.week)
end
submit_next_action_form
end

View file

@ -1,3 +1,7 @@
When /^I select the second page$/ do
step "I follow \"2\" within \"div.paginate_header\""
end
####### DELETE #######
When /^I delete the action "([^"]*)"$/ do |action_description|
@ -108,7 +112,7 @@ Then /^I should see the page selector$/ do
end
Then /^the page should be "([^"]*)"$/ do |page_number|
page.find(:xpath, ".//em[@class='current']").text.should == page_number
page.find(:xpath, ".//div[@class='paginate_header']//em[@class='current']").text.should == page_number
end
Then /^the project field of the new todo form should contain "([^"]*)"$/ do |project_name|

View file

@ -63,7 +63,7 @@ Feature: Show done
Given I have 50 completed todos with a note in project "test project" in context "@pc" with tags "starred"
When I go to the <page>
Then I should see the page selector
When I follow "2"
When I select the second page
Then I should be on the <page>
And the page should be "2"

View file

@ -1 +1 @@
task :ci => ['db:migrate', :test]
task :ci => ['db:migrate', :test, :cucumber]