Description:
fix test to match button name in create new list of user
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r781:e1003a3daa2b - - 2 files changed: 1 inserted, 2 deleted

@@ -102,97 +102,96
102 102 end
103 103
104 104
105 105 #user admin
106 106 resources :user_admin do
107 107 collection do
108 108 match 'bulk_manage', via: [:get, :post]
109 109 get 'bulk_mail'
110 110 get 'user_stat'
111 111 get 'import'
112 112 get 'new_list'
113 113 get 'admin'
114 114 get 'active'
115 115 get 'mass_mailing'
116 116 get 'revoke_admin'
117 117 post 'grant_admin'
118 118 match 'create_from_list', via: [:get, :post]
119 119 match 'random_all_passwords', via: [:get, :post]
120 120 end
121 121 member do
122 122 get 'clear_last_ip'
123 123 end
124 124 end
125 125
126 126 resources :contest_management, only: [:index] do
127 127 collection do
128 128 get 'user_stat'
129 129 get 'clear_stat'
130 130 get 'clear_all_stat'
131 131 get 'change_contest_mode'
132 132 end
133 133 end
134 134
135 135 #get 'user_admin', to: 'user_admin#index'
136 136 #get 'user_admin/bulk_manage', to: 'user_admin#bulk_manage', as: 'bulk_manage_user_admin'
137 137 #post 'user_admin', to: 'user_admin#create'
138 138 #delete 'user_admin/:id', to: 'user_admin#destroy', as: 'user_admin_destroy'
139 139
140 140 #singular resource
141 141 #---- BEWARE ---- singular resource maps to plural controller by default, we can override by provide controller name directly
142 142 #report
143 143 resource :report, only: [], controller: 'report' do
144 144 get 'login'
145 145 get 'multiple_login'
146 146 get 'problem_hof(/:id)', action: 'problem_hof', as: 'problem_hof'
147 147 get 'current_score(/:group_id)', action: 'current_score', as: 'current_score'
148 148 get 'max_score'
149 149 post 'show_max_score'
150 - get 'problem_hof(/:id)', action: 'problem_hof', as: 'problem_hof'
151 150 get 'stuck'
152 151 get 'cheat_report'
153 152 post 'cheat_report'
154 153 get 'cheat_scruntinize'
155 154 post 'cheat_scruntinize'
156 155 end
157 156 #get 'report/current_score', to: 'report#current_score', as: 'report_current_score'
158 157 #get 'report/problem_hof(/:id)', to: 'report#problem_hof', as: 'report_problem_hof'
159 158 #get "report/login"
160 159 #get 'report/max_score', to: 'report#max_score', as: 'report_max_score'
161 160 #post 'report/show_max_score', to: 'report#show_max_score', as: 'report_show_max_score'
162 161
163 162 resource :main, only: [], controller: 'main' do
164 163 get 'login'
165 164 get 'logout'
166 165 get 'list'
167 166 get 'submission(/:id)', action: 'submission', as: 'main_submission'
168 167 get 'announcements'
169 168 get 'help'
170 169 post 'submit'
171 170 end
172 171 #main
173 172 #get "main/list"
174 173 #get 'main/submission(/:id)', to: 'main#submission', as: 'main_submission'
175 174 #post 'main/submit', to: 'main#submit'
176 175 #get 'main/announcements', to: 'main#announcements'
177 176
178 177
179 178 #
180 179 get 'tasks/view/:file.:ext' => 'tasks#view'
181 180 get 'tasks/download/:id/:file.:ext' => 'tasks#download'
182 181 get 'heartbeat/:id/edit' => 'heartbeat#edit'
183 182
184 183 #grader
185 184 get 'graders/list', to: 'graders#list', as: 'grader_list'
186 185 namespace :graders do
187 186 get 'task/:id/:type', action: 'task', as: 'task'
188 187 get 'view/:id/:type', action: 'view', as: 'view'
189 188 get 'clear/:id', action: 'clear', as: 'clear'
190 189 get 'stop'
191 190 get 'stop_all'
192 191 get 'clear_all'
193 192 get 'clear_terminated'
194 193 get 'start_grading'
195 194 get 'start_exam'
196 195
197 196 end
198 197
@@ -5,97 +5,97
5 5 # visit users_url
6 6 #
7 7 # assert_selector "h1", text: "User"
8 8 # end
9 9
10 10 test "add new user and edit" do
11 11 login('admin','admin')
12 12 within 'header' do
13 13 click_on 'Manage'
14 14 click_on 'Users', match: :first
15 15 end
16 16
17 17 assert_text "Users"
18 18 assert_text "New user"
19 19
20 20 click_on "New user", match: :first
21 21 fill_in 'Login', with: 'test1'
22 22 fill_in 'Full name', with: 'test1 McTestface'
23 23 fill_in 'e-mail', with: 'a@a.com'
24 24 fill_in 'Password', with: 'abcdef'
25 25 fill_in 'Password confirmation', with: 'abcdef'
26 26
27 27 click_on 'Create'
28 28
29 29 assert_text 'User was successfully created'
30 30 assert_text 'a@a.com'
31 31 assert_text 'test1 McTestface'
32 32
33 33 within('tr', text: 'McTestface') do
34 34 click_on 'Edit'
35 35 end
36 36
37 37 fill_in 'Alias', with: 'hahaha'
38 38 fill_in 'Remark', with: 'section 2'
39 39 click_on 'Update User'
40 40
41 41 assert_text 'section 2'
42 42 end
43 43
44 44 test "add multiple users" do
45 45 login 'admin', 'admin'
46 46 within 'header' do
47 47 click_on 'Manage'
48 48 click_on 'Users', match: :first
49 49 end
50 50
51 51 click_on 'New list of users', match: :first
52 52 find(:css, 'textarea').fill_in with:"abc1,Boaty McBoatface,abcdef,alias1,remark1,\nabc2,Boaty2 McSecond,acbdef123,aias2,remark2"
53 - click_on 'create users'
53 + click_on 'Create following users'
54 54
55 55 assert_text('remark1')
56 56 assert_text('remark2')
57 57 end
58 58
59 59 test "grant admin right" do
60 60 login 'admin', 'admin'
61 61 within 'header' do
62 62 click_on 'Manage'
63 63 click_on 'Users', match: :first
64 64 end
65 65
66 66 click_on "View administrator"
67 67 fill_in 'login', with: 'john'
68 68 click_on "Grant"
69 69
70 70 visit logout_main_path
71 71 login 'john','hello'
72 72 within 'header' do
73 73 click_on 'Manage'
74 74 click_on 'Problem', match: :first
75 75 end
76 76 assert_text "Turn off all problems"
77 77 end
78 78
79 79 test "try using admin from normal user" do
80 80 login 'admin','admin'
81 81 visit bulk_manage_user_admin_index_path
82 82 assert_current_path bulk_manage_user_admin_index_path
83 83 visit logout_main_path
84 84
85 85 login 'jack','morning'
86 86 visit bulk_manage_user_admin_index_path
87 87 assert_text 'You are not authorized'
88 88 assert_current_path login_main_path
89 89
90 90 login 'james','morning'
91 91 visit new_list_user_admin_index_path
92 92 assert_text 'You are not authorized'
93 93 assert_current_path login_main_path
94 94 end
95 95
96 96 test "login then change password" do
97 97 newpassword = '1234asdf'
98 98 login 'john', 'hello'
99 99 visit profile_users_path
100 100
101 101 fill_in 'password', with: newpassword
You need to be logged in to leave comments. Login now