mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-18 16:20:12 +01:00
add cucumber scenarios for new preferences
This commit is contained in:
parent
555311b681
commit
40a7cc2d3a
9 changed files with 70 additions and 11 deletions
|
|
@ -1,8 +1,19 @@
|
||||||
<label><%= t('preferences.token_header') %></label><br/><br/>
|
<label><%= t('preferences.token_header') %></label><br/><br/>
|
||||||
<%= t('preferences.token_description') %>: <span class="highlight"><%= current_user.token %></span>
|
<%= t('preferences.token_description') %>: <span class="highlight"><%= current_user.token %></span>
|
||||||
|
<br/><br/>
|
||||||
|
|
||||||
|
<div class="pref_new_token">
|
||||||
|
|
||||||
<% # TODO: make remote AJAX call for new token %>
|
<% # TODO: make remote AJAX call for new token %>
|
||||||
<%= button_to t('preferences.generate_new_token'), refresh_token_user_path(current_user),
|
|
||||||
:confirm => t('preferences.generate_new_token_confirm') %>
|
<%= link_to(
|
||||||
|
t('preferences.generate_new_token'),
|
||||||
|
refresh_token_user_path( current_user ),
|
||||||
|
:method => :post,
|
||||||
|
:confirm => t('preferences.generate_new_token_confirm'),
|
||||||
|
:id=>'prefs_new_token') %>
|
||||||
|
|
||||||
|
</div>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
<% if Tracks::Config.auth_schemes.length > 1 %>
|
<% if Tracks::Config.auth_schemes.length > 1 %>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<div id="footer">
|
<div id="footer">
|
||||||
<p><%= t('footer.send_feedback', :version => TRACKS_VERSION) %>: <a href="http://www.assembla.com/spaces/tracks-tickets/tickets"><%= t('common.bugs')%></a> |
|
<p><%= t('footer.send_feedback', :version => TRACKS_VERSION) %>: <a href="http://www.assembla.com/spaces/tracks-tickets/tickets"><%= t('common.bugs')%></a> |
|
||||||
<a href="http://www.getontracks.org/forums/"><%= t('common.forum')%></a> |
|
<a href="http://www.getontracks.org/forums/"><%= t('common.forum')%></a> |
|
||||||
<a href="http://www.getontracks.org/wiki/"><%= t('common.wiki')%></a> |
|
<a href="https://github.com/TracksApp/tracks/wiki"><%= t('common.wiki')%></a> |
|
||||||
<a href="mailto:butshesagirl@rousette.org.uk?subject=Tracks feedback"><%= t('common.email')%></a> |
|
<a href="mailto:butshesagirl@rousette.org.uk?subject=Tracks feedback"><%= t('common.email')%></a> |
|
||||||
<a href="http://www.getontracks.org/"><%= t('common.website')%></a> |
|
<a href="http://www.getontracks.org/"><%= t('common.website')%></a> |
|
||||||
<a href="http://getontracks.org/tracks/contribute"><%= t('common.contribute')%></a></p>
|
<a href="http://getontracks.org/tracks/contribute"><%= t('common.contribute')%></a></p>
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,33 @@ Feature: Manage preferences
|
||||||
And I have logged in as "testuser" with password "secret"
|
And I have logged in as "testuser" with password "secret"
|
||||||
|
|
||||||
Scenario: I can change my password
|
Scenario: I can change my password
|
||||||
Given this is a pending scenario
|
When I go to the preferences page
|
||||||
|
And I set the password and confirmation to "secret123"
|
||||||
|
When I log out of Tracks
|
||||||
|
And I go to the login page
|
||||||
|
And I submit the login form as user "testuser" with password "secret"
|
||||||
|
Then I should see "Login unsuccessful"
|
||||||
|
When I submit the login form as user "testuser" with password "secret123"
|
||||||
|
Then I should see "Login successful"
|
||||||
|
|
||||||
|
Scenario: I can leave password field empty and the password will not be changed
|
||||||
|
When I go to the preferences page
|
||||||
|
And I set the password and confirmation to ""
|
||||||
|
When I log out of Tracks
|
||||||
|
And I go to the login page
|
||||||
|
And I submit the login form as user "testuser" with password ""
|
||||||
|
Then I should see "Login unsuccessful"
|
||||||
|
When I submit the login form as user "testuser" with password "secret"
|
||||||
|
Then I should see "Login successful"
|
||||||
|
|
||||||
|
Scenario: The password and the confirmation need to be the same
|
||||||
|
When I go to the preferences page
|
||||||
|
And I set the password to "secret" and confirmation to "wrong"
|
||||||
|
Then I should see "Password doesn't match confirmation"
|
||||||
|
|
||||||
Scenario: I can generate a new token
|
|
||||||
Given this is a pending scenario
|
|
||||||
|
|
||||||
Scenario: I can edit preferences
|
Scenario: I can edit preferences
|
||||||
Given this is a pending scenario
|
When I go to the preferences page
|
||||||
|
Then I should see "Logout (testuser)"
|
||||||
|
When I edit my last name to "Tester"
|
||||||
|
Then I should see "Logout (Tester)"
|
||||||
|
|
@ -32,3 +32,7 @@ When /^my session expires$/ do
|
||||||
|
|
||||||
sleep(2)
|
sleep(2)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
When /^I log out of Tracks$/ do
|
||||||
|
When "I go to the logout page"
|
||||||
|
end
|
||||||
|
|
|
||||||
15
features/step_definitions/preferences_steps.rb
Normal file
15
features/step_definitions/preferences_steps.rb
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
When /^I edit my last name to "([^"]*)"$/ do |last_name|
|
||||||
|
fill_in "user[last_name]", :with => last_name
|
||||||
|
click_button "prefs_submit"
|
||||||
|
end
|
||||||
|
|
||||||
|
When /^I set the password and confirmation to "([^"]*)"$/ do |new_password|
|
||||||
|
When "I set the password to \"#{new_password}\" and confirmation to \"#{new_password}\""
|
||||||
|
end
|
||||||
|
|
||||||
|
When /^I set the password to "([^"]*)" and confirmation to "([^"]*)"$/ do |new_password, new_password_confirmation|
|
||||||
|
fill_in "user[password]", :with => new_password
|
||||||
|
fill_in "user[password_confirmation]", :with => new_password_confirmation
|
||||||
|
click_button "prefs_submit"
|
||||||
|
end
|
||||||
|
|
||||||
|
|
@ -2,7 +2,7 @@ Given /^the following user records?$/ do |table|
|
||||||
User.delete_all
|
User.delete_all
|
||||||
table.hashes.each do |hash|
|
table.hashes.each do |hash|
|
||||||
user = Factory(:user, hash)
|
user = Factory(:user, hash)
|
||||||
user.create_preference
|
user.create_preference({:locale => 'en'})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,8 @@ module NavigationHelpers
|
||||||
signup_path(options)
|
signup_path(options)
|
||||||
when /the login page/
|
when /the login page/
|
||||||
login_path(options)
|
login_path(options)
|
||||||
|
when /the logout page/
|
||||||
|
logout_path(options)
|
||||||
when /the notes page/
|
when /the notes page/
|
||||||
notes_path(options)
|
notes_path(options)
|
||||||
when /the calendar page/
|
when /the calendar page/
|
||||||
|
|
|
||||||
|
|
@ -629,7 +629,7 @@ var ProjectItems = {
|
||||||
|
|
||||||
var UsersPage = {
|
var UsersPage = {
|
||||||
setup_behavior: function() {
|
setup_behavior: function() {
|
||||||
/* delete button to delete a usedr from the list */
|
/* delete button to delete a user from the list */
|
||||||
$('a.delete_user_button').live('click', function(evt){
|
$('a.delete_user_button').live('click', function(evt){
|
||||||
var confirm_message = $(this).attr("x_confirm_message")
|
var confirm_message = $(this).attr("x_confirm_message")
|
||||||
if(confirm(confirm_message)){
|
if(confirm(confirm_message)){
|
||||||
|
|
|
||||||
|
|
@ -478,6 +478,10 @@ body.preferences div.ui-tabs li a {
|
||||||
padding: 0.1em 1em;
|
padding: 0.1em 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body.preferences div.pref_new_token a {
|
||||||
|
color: #CC3334;
|
||||||
|
}
|
||||||
|
|
||||||
/* The notes which may be attached to an item */
|
/* The notes which may be attached to an item */
|
||||||
.todo_notes {
|
.todo_notes {
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue