mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-25 11:38:49 +01:00
add tests for #886.
This commit is contained in:
parent
3d75cd2457
commit
c9be43b2c8
5 changed files with 55 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
|||
<div class="list-stategroup-contexts-container">
|
||||
<div class="list-stategroup-contexts-container" id="<%= state %>-contexts-container">
|
||||
<h2><span id="<%= state %>-contexts-count" class="badge"><%= context_state_group.length %></span><%= state.titlecase %> Contexts</h2>
|
||||
<div id="<%= state%>-contexts-empty-nd" style="<%= no_contexts ? 'display:block' : 'display:none'%>">
|
||||
<div class="message"><p>Currently there are no <%= state %> contexts</p></div>
|
||||
|
|
|
|||
|
|
@ -48,3 +48,23 @@ Feature: Manage contexts
|
|||
And he should see that a context named "@laptop" is not present
|
||||
And he should see that a context named "@ipad" is present
|
||||
And the badge should show 1
|
||||
|
||||
@selenium, @wip
|
||||
Scenario: Add new context
|
||||
Given I have the following contexts
|
||||
| name | hide |
|
||||
| @ipad | true |
|
||||
| @home | false |
|
||||
When I go to the contexts page
|
||||
And I add a new context "@phone"
|
||||
Then I should see the context "@phone" under "active"
|
||||
|
||||
@selenium, @wip
|
||||
Scenario: Add new hidden context
|
||||
Given I have the following contexts
|
||||
| name | hide |
|
||||
| @ipad | true |
|
||||
| @home | false |
|
||||
When I go to the contexts page
|
||||
And I add a new hidden context "@hidden"
|
||||
Then I should see the context "@hidden" under "hidden"
|
||||
|
|
|
|||
|
|
@ -20,6 +20,13 @@ 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 = Factory(:context, hash)
|
||||
end
|
||||
end
|
||||
|
||||
When /^I visit the context page for "([^\"]*)"$/ do |context_name|
|
||||
context = @current_user.contexts.find_by_name(context_name)
|
||||
context.should_not be_nil
|
||||
|
|
@ -61,6 +68,17 @@ When /^I edit the context to rename it to "([^\"]*)"$/ do |new_name|
|
|||
end
|
||||
end
|
||||
|
||||
When /^I add a new context "([^"]*)"$/ do |context_name|
|
||||
fill_in "context[name]", :with => context_name
|
||||
submit_new_context_form
|
||||
end
|
||||
|
||||
When /^I add a new hidden context "([^"]*)"$/ do |context_name|
|
||||
fill_in "context[name]", :with => context_name
|
||||
check "context_hide"
|
||||
submit_new_context_form
|
||||
end
|
||||
|
||||
Then /^I should see the context name is "([^\"]*)"$/ do |context_name|
|
||||
Then "I should see \"#{context_name}\""
|
||||
end
|
||||
|
|
@ -71,4 +89,9 @@ end
|
|||
|
||||
Then /^he should see that a context named "([^\"]*)" is not present$/ do |context_name|
|
||||
Then "I should not see \"#{context_name} (\""
|
||||
end
|
||||
end
|
||||
|
||||
Then /^I should see the context "([^"]*)" under "([^"]*)"$/ do |context_name, state|
|
||||
context = Context.find_by_name(context_name)
|
||||
response.should have_xpath("//div[@id='list-contexts-#{state}']//div[@id='context_#{context.id}']")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -7,6 +7,10 @@ module TracksStepHelper
|
|||
selenium.click("xpath=//form[@id='todo-form-new-action']//button[@id='todo_new_action_submit']", :wait_for => :ajax, :javascript_framework => :jquery)
|
||||
end
|
||||
|
||||
def submit_new_context_form
|
||||
selenium.click("xpath=//form[@id='context-form']//button[@id='context_new_submit']", :wait_for => :ajax, :javascript_framework => :jquery)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
World(TracksStepHelper)
|
||||
|
|
@ -3,4 +3,10 @@ Factory.define :user do |u|
|
|||
u.password "secret"
|
||||
u.password_confirmation { |user| user.password }
|
||||
u.is_admin false
|
||||
end
|
||||
|
||||
Factory.define :context do |c|
|
||||
c.sequence(:name) { |n| "testcontext#{n}" }
|
||||
c.hide false
|
||||
c.created_at Time.now.utc
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue