##// END OF EJS Templates
Adds a UI test (#19851)....
Jean-Philippe Lang -
r13963:278468c0c8f2
parent child
Show More
@@ -0,0 +1,53
1 # Redmine - project management software
2 # Copyright (C) 2006-2015 Jean-Philippe Lang
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
18 require File.expand_path('../base', __FILE__)
19
20 class Redmine::UiTest::SudoModeTest < Redmine::UiTest::Base
21 fixtures :users, :email_addresses
22
23 def setup
24 Redmine::SudoMode.stubs(:enabled?).returns(true)
25 end
26
27 def test_add_user
28 log_user('admin', 'admin')
29 visit '/users/new'
30
31 assert_difference 'User.count' do
32 within('form#new_user') do
33 fill_in 'Login', :with => 'johnpaul'
34 fill_in 'First name', :with => 'John'
35 fill_in 'Last name', :with => 'Paul'
36 fill_in 'Email', :with => 'john@example.net'
37 fill_in 'Password', :with => 'password'
38 fill_in 'Confirmation', :with => 'password'
39 # click_button 'Create' would match both 'Create' and 'Create and continue' buttons
40 find('input[name=commit]').click
41 end
42
43 assert_equal '/users', current_path
44 assert page.has_content?("Confirm your password to continue")
45 assert page.has_css?('form#sudo-form')
46
47 within('form#sudo-form') do
48 fill_in 'Password', :with => 'admin'
49 click_button 'Submit'
50 end
51 end
52 end
53 end
@@ -1,5 +1,5
1 <h2><%= l :label_password_required %></h2>
1 <h2><%= l :label_password_required %></h2>
2 <%= form_tag({}, class: 'tabular') do %>
2 <%= form_tag({}, class: 'tabular', id: 'sudo-form') do %>
3
3
4 <%= hidden_field_tag '_method', request.request_method %>
4 <%= hidden_field_tag '_method', request.request_method %>
5 <%= hash_to_hidden_fields @sudo_form.original_fields %>
5 <%= hash_to_hidden_fields @sudo_form.original_fields %>
@@ -1,7 +1,7
1 require File.expand_path('../../test_helper', __FILE__)
1 require File.expand_path('../../test_helper', __FILE__)
2
2
3 class SudoTest < Redmine::IntegrationTest
3 class SudoModeTest < Redmine::IntegrationTest
4 fixtures :projects, :members, :member_roles, :roles, :users
4 fixtures :projects, :members, :member_roles, :roles, :users, :email_addresses
5
5
6 def setup
6 def setup
7 Redmine::SudoMode.stubs(:enabled?).returns(true)
7 Redmine::SudoMode.stubs(:enabled?).returns(true)
General Comments 0
You need to be logged in to leave comments. Login now