mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-01 14:58:50 +01:00
migrate mobile selenium scripts to cucumber
Signed-off-by: Reinier Balt <lrbalt@gmail.com>
This commit is contained in:
parent
e5f30a58f8
commit
b8484e48fe
10 changed files with 137 additions and 81 deletions
|
|
@ -13,7 +13,7 @@
|
|||
</head><body>
|
||||
<% if !(@new_mobile || @edit_mobile)
|
||||
if current_user && !current_user.prefs.nil? -%>
|
||||
<h1><span class="count"><%= @down_count %></span> <%=
|
||||
<h1><span class="count" id="badge_count"><%= @down_count %></span> <%=
|
||||
l(Date.today, :format => current_user.prefs.title_date_format) -%></h1>
|
||||
<div class="nav">
|
||||
<%= (link_to(t('layouts.mobile_navigation.new_action'), new_todo_path(new_todo_params))+" | ") unless @new_mobile -%>
|
||||
|
|
|
|||
|
|
@ -19,9 +19,18 @@ Feature: Add new next action from mobile page
|
|||
And the selected context should be "<context>"
|
||||
|
||||
Scenarios: # empty means no selected, i.e. first in list is shown
|
||||
| page | project | context |
|
||||
| home page | | |
|
||||
| tickler page | | |
|
||||
| "test project" project | test project | |
|
||||
| context page for "test context" | | test context |
|
||||
| tag page for "starred" | | |
|
||||
| page | project | context |
|
||||
| home page | | |
|
||||
| tickler page | | |
|
||||
| "test project" project | test project | |
|
||||
| context page for "test context" | | test context |
|
||||
| tag page for "starred" | | |
|
||||
|
||||
Scenario: I can add a new todo using the mobile interface
|
||||
Given I am on the home page
|
||||
Then the badge should show 0
|
||||
When I follow "0-New action"
|
||||
And I fill in "Description" with "test me"
|
||||
And I press "Create"
|
||||
Then I should see "test me"
|
||||
And the badge should show 1
|
||||
|
|
|
|||
23
features/mobile_context_list.feature
Normal file
23
features/mobile_context_list.feature
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
Feature: View the list of contexts from mobile
|
||||
In order to be able to see all contexts from the mobile interface
|
||||
As a Tracks user
|
||||
I want to to be able to see a list of project
|
||||
|
||||
Background:
|
||||
Given the following user record
|
||||
| login | password | is_admin |
|
||||
| testuser | secret | false |
|
||||
And I am working on the mobile interface
|
||||
And I have logged in as "testuser" with password "secret"
|
||||
And I have a context called "@mobile"
|
||||
And I have a project "test project" that has the following todos
|
||||
| context | description |
|
||||
| @mobile | test action |
|
||||
|
||||
Scenario: I can go to a context from the mobile context list page
|
||||
Given I have a todo "test mobile page" in the context "@mobile"
|
||||
And I am on the contexts page
|
||||
Then I should see "@mobile"
|
||||
When I follow "@mobile"
|
||||
Then the badge should show 2
|
||||
And I should see "@mobile"
|
||||
38
features/mobile_edit_a_todo.feature
Normal file
38
features/mobile_edit_a_todo.feature
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
Feature: Edit a next action from the mobile view
|
||||
In order to manage a next action
|
||||
As a Tracks user
|
||||
I want to to be able to edit a next action
|
||||
|
||||
Background:
|
||||
Given the following user record
|
||||
| login | password | is_admin |
|
||||
| testuser | secret | false |
|
||||
And I am working on the mobile interface
|
||||
And I have logged in as "testuser" with password "secret"
|
||||
And I have a context called "@mobile"
|
||||
And I have a project "test project" that has the following todos
|
||||
| context | description |
|
||||
| @mobile | test action |
|
||||
|
||||
Scenario: I can edit an action on the mobile page
|
||||
When I am on the home page
|
||||
Then the badge should show 1
|
||||
Then I should see "test action"
|
||||
When I follow "test action"
|
||||
And I fill in "Description" with "changed action"
|
||||
And I press "Update"
|
||||
Then I should see "changed action"
|
||||
And I should not see "test action"
|
||||
When I follow "changed action"
|
||||
And I check "done"
|
||||
And I press "Update"
|
||||
Then I should not see "changed action"
|
||||
|
||||
Scenario: Navigate from home page
|
||||
move this to separate features when other scenarios are created for these features
|
||||
When I am on the home page
|
||||
Then the badge should show 1
|
||||
When I follow "Tickler"
|
||||
Then the badge should show 0
|
||||
When I follow "Feeds"
|
||||
Then I should see "Last 15 actions"
|
||||
22
features/mobile_project_list.feature
Normal file
22
features/mobile_project_list.feature
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
Feature: View the list of projects from mobile
|
||||
In order to be able to see all project from the mobile interface
|
||||
As a Tracks user
|
||||
I want to to be able to see a list of project
|
||||
|
||||
Background:
|
||||
Given the following user record
|
||||
| login | password | is_admin |
|
||||
| testuser | secret | false |
|
||||
And I am working on the mobile interface
|
||||
And I have logged in as "testuser" with password "secret"
|
||||
And I have a context called "@mobile"
|
||||
And I have a project "test project" that has the following todos
|
||||
| context | description |
|
||||
| @mobile | test action |
|
||||
|
||||
Scenario: I can go to a project from the list of project in mobile view
|
||||
Given I am on the projects page
|
||||
Then I should see "test project"
|
||||
When I follow "test project"
|
||||
Then the badge should show 1
|
||||
And I should see "test action"
|
||||
24
features/mobile_tagging_todos.feature
Normal file
24
features/mobile_tagging_todos.feature
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
Feature: Show the actions that are tagged on the mobile page
|
||||
In order to be able to see all actions tags with a certain tag
|
||||
As a Tracks user
|
||||
I want to to be able to find all actions with a specific tag
|
||||
|
||||
Background:
|
||||
Given the following user record
|
||||
| login | password | is_admin |
|
||||
| testuser | secret | false |
|
||||
And I am working on the mobile interface
|
||||
And I have logged in as "testuser" with password "secret"
|
||||
And I have a context called "@mobile"
|
||||
And I have a project "my project" that has the following todos
|
||||
| context | description | tags |
|
||||
| @mobile | first action | test, bla |
|
||||
| @mobile | second action | bla |
|
||||
|
||||
Scenario: I can follow the tag of a action to see all actions belonging to that todo
|
||||
When I go to the home page
|
||||
And I follow "test"
|
||||
Then the badge should show 1
|
||||
When I go to the home page
|
||||
And I follow "bla"
|
||||
Then the badge should show 2
|
||||
|
|
@ -2,15 +2,18 @@ Given /^I have no todos$/ do
|
|||
Todo.delete_all
|
||||
end
|
||||
|
||||
Given /^I have a todo "(.*)"$/ do |description|
|
||||
context = @current_user.contexts.create!(:name => "context A")
|
||||
Given /^I have a todo "([^"]*)" in the context "([^"]*)"$/ do |description, context_name|
|
||||
context = @current_user.contexts.find_or_create(:name => context_name)
|
||||
@current_user.todos.create!(:context_id => context.id, :description => description)
|
||||
end
|
||||
|
||||
Given /^I have a todo "([^"]*)"$/ do |description|
|
||||
Given "I have a todo \"#{description}\" in the context \"Context A\""
|
||||
end
|
||||
|
||||
Given /^I have ([0-9]+) todos$/ do |count|
|
||||
context = @current_user.contexts.create!(:name => "context A")
|
||||
count.to_i.downto 1 do |i|
|
||||
@current_user.todos.create!(:context_id => context.id, :description => "todo #{i}")
|
||||
Given "I have a todo \"todo #{i}\" in the context \"Context A\""
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -55,12 +58,15 @@ Given /^I have a project "([^"]*)" that has the following todos$/ do |project_na
|
|||
Given "I have a project called \"#{project_name}\""
|
||||
@project.should_not be_nil
|
||||
todos.hashes.each do |todo|
|
||||
context_id = @current_user.contexts.find_by_name(todo[:context])
|
||||
context_id.should_not be_nil
|
||||
@current_user.todos.create!(
|
||||
context = @current_user.contexts.find_by_name(todo[:context])
|
||||
context.should_not be_nil
|
||||
new_todo = @current_user.todos.create!(
|
||||
:description => todo[:description],
|
||||
:context_id => context_id,
|
||||
:context_id => context.id,
|
||||
:project_id=>@project.id)
|
||||
unless todo[:tags].nil?
|
||||
new_todo.tag_with(todo[:tags])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
setup :fixtures => :all
|
||||
login :as => 'admin'
|
||||
|
||||
open '/m'
|
||||
wait_for_text 'css=h1 span.count', '11'
|
||||
|
||||
click_and_wait "link=0-New action"
|
||||
|
||||
type "todo_notes", "test notes"
|
||||
type "todo_description", "test name"
|
||||
select "todo_context_id", "label=call"
|
||||
select "todo_project_id", "label=Make more money than Billy Gates"
|
||||
select "todo_due_3i", "label=1"
|
||||
select "todo_due_2i", "label=January"
|
||||
select "todo_due_1i", "label=2011"
|
||||
click_and_wait "//input[@value='Create']"
|
||||
|
||||
wait_for_text 'css=h1 span.count', '12'
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
setup :fixtures => :all
|
||||
login :as => 'admin'
|
||||
|
||||
open '/m'
|
||||
wait_for_text 'css=h1 span.count', '11'
|
||||
|
||||
open '/todos/6.m'
|
||||
wait_for_page_to_load 3000
|
||||
|
||||
click "done"
|
||||
click_and_wait "//input[@value='Update']"
|
||||
|
||||
wait_for_text 'css=h1 span.count', '10'
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
setup :fixtures => :all
|
||||
login :as => 'admin'
|
||||
|
||||
# open home page
|
||||
open '/m'
|
||||
wait_for_title "All actions"
|
||||
wait_for_text 'css=h1 span.count', '11'
|
||||
|
||||
# open context page
|
||||
click_and_wait "link=2-Contexts"
|
||||
# verify_title "All actions in context agenda"
|
||||
# choose agenda context
|
||||
click_and_wait "link=agenda"
|
||||
wait_for_text 'css=h1 span.count', '6'
|
||||
|
||||
# click on tag foo to go to tag page
|
||||
click_and_wait "link=foo"
|
||||
verify_title "TRACKS::Tagged with 'foo'"
|
||||
wait_for_text 'css=h1 span.count', '2'
|
||||
|
||||
click_and_wait "link=3-Projects"
|
||||
wait_for_text 'css=h1 span.count', '3'
|
||||
click_and_wait "link=Build a working time machine"
|
||||
wait_for_text 'css=h1 span.count', '3'
|
||||
|
||||
# follow link of action to edit form and mark done
|
||||
click_and_wait "link=Select Delorean model"
|
||||
click "done"
|
||||
click_and_wait "//input[@value='Update']"
|
||||
wait_for_text 'css=h1 span.count', '2'
|
||||
|
||||
# just test the navigation.
|
||||
click_and_wait "link=Tickler"
|
||||
wait_for_text 'css=h1 span.count', '1'
|
||||
click_and_wait "link=Feeds"
|
||||
Loading…
Add table
Add a link
Reference in a new issue