migrate selenium script for integrations page and enhance the story

This commit is contained in:
Reinier Balt 2010-05-05 19:09:51 +02:00
parent 44c61d942a
commit d6e20a76c2
6 changed files with 74 additions and 15 deletions

View file

@ -0,0 +1,38 @@
Feature: Integrate Tracks in various ways
In order to use tracks with other software
As a Tracks user
I want to be informed about the various ways to integrate tracks
Background:
Given the following user record
| login | password | is_admin |
| testuser | secret | false |
And I have logged in as "testuser" with password "secret"
Scenario: I cannot see scripts when I do not have a context
Given I have no contexts
When I go to the integrations page
Then I should see a message that you need a context to see scripts
Scenario: I can see scripts when I have one or more contexts
Given I have a context called "@pc"
When I go to the integrations page
Then I should see scripts
@selenium
Scenario: When I select a different context the example scripts should change accoordingly
Given I have the following contexts:
| context |
| @pc |
| @home |
| @shops |
| @boss |
When I go to the integrations page
Then I should see a script "applescript1" for "@pc"
When I select "@home" from "applescript1-contexts"
Then I should see a script "applescript1" for "@home"
When I select "@shops" from "applescript2-contexts"
Then I should see a script "applescript2" for "@shops"
When I select "@boss" from "quicksilver-contexts"
Then I should see a script "quicksilver" for "@boss"

View file

@ -1,7 +1,18 @@
Given /^I have no contexts$/ do
# should probably not be needed as you use this given at the start of a scenario
Context.delete_all
end
Given /^I have a context called "([^\"]*)"$/ do |context_name|
@context = @current_user.contexts.create!(:name => context_name)
end
Given /^I have the following contexts:$/ do |table|
table.hashes.each do |context|
Given 'I have a context called "'+context[:context]+'"'
end
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|

View file

@ -0,0 +1,23 @@
Then /^I should see a message that you need a context to see scripts$/ do
Then 'I should see "You do not have any context yet. The script will be available after you add your first context"'
end
Then /^I should see scripts$/ do
# check on a small snippet of the first applescript
Then 'I should see "set returnValue to call xmlrpc"'
end
Then /^I should see a script "([^\"]*)" for "([^\"]*)"$/ do |script, context_name|
selenium.is_visible(script)
context = Context.find_by_name(context_name)
# wait for the script to refresh
wait_for :timeout => 15 do
selenium.is_text_present("#{context.id} (* #{context_name} *)")
end
# make sure the text is found within the textarea
script_source = selenium.get_text("//textarea[@id='#{script}']")
script_source.should =~ /#{context.id} \(\* #{context_name} \*\)/
end

View file

@ -62,7 +62,6 @@ Then /^the first note should disappear$/ do
end
end
Then /^I should see the note text$/ do
Then "I should see \"after 50 characters\""
end

View file

@ -20,6 +20,8 @@ module NavigationHelpers
users_path
when /the repeating todos page/
recurring_todos_path
when /the integrations page/
integrations_path
# Add more page name => path mappings here

View file

@ -1,14 +0,0 @@
setup :fixtures => :users, :clear_tables => [:projects, :contexts, :todos]
login :as => 'admin'
open "/integrations"
wait_for_element_present "no_context_msg"
open "/contexts"
type "context_name", "my first context"
click "context_new_submit"
# wait for new context to appear before navigating away from project page to
# make sure that the changes have been saved
wait_for_text_present 'DRAG'
open "/integrations"
wait_for_element_present "applescript1-contexts"