Changeset 4513
- Timestamp:
- 1 Aug 2009, 08:36:33 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-rewrite/src/waeup/browser.txt
r4505 r4513 290 290 >>> ctrl.value = 'My Course 1' 291 291 292 Furthermore we add a code (kind of abbreviation): 293 294 >>> browser.getControl(name='form.code').value = 'COURSE1' 295 296 This course will take place in the the first semester, so we set the 297 `semester` value to 1: 298 299 >>> ctrl = browser.getControl(name='form.semester') 300 >>> ctrl.options 301 ['0', '1', '2', '3'] 302 303 >>> ctrl.displayOptions 304 ['N/A', 'First Semester', 'Second Semester', 'Combined'] 305 306 >>> ctrl.value = ['1'] 307 308 Finally, we create the course: 309 310 >>> browser.getControl('Add course').click() 311 312 If we try to register a course under the same code twice we will 313 get an error: 314 315 >>> browser.open(dept_url + '/addcourse') 316 >>> ctrl = browser.getControl(name='form.title') 317 >>> ctrl.value = 'Another course with same code' 318 >>> browser.getControl(name='form.code').value = 'COURSE1' 319 >>> browser.getControl('Add course').click() 320 >>> print browser.contents 321 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... 322 ...<div>The code chosen already exists in the database</div> 323 ... 324 325 Our course will be linked under the code on the department page: 326 327 >>> browser.open(dept_url) 328 >>> browser.getLink('COURSE1').click() 329 >>> browser.url 330 'http://localhost/myuniversity/faculties/TF/TD/courses/COURSE1' 331 332 333 Modifying courses 334 ----------------- 335 336 We can change the settings for a course by clicking on the provided 337 'Edit settings' link: 338 339 >>> browser.open(dept_url + '/courses/COURSE1') 340 >>> browser.getLink('Edit settings').click() 341 342 When modifying a course, we cannot change the code any more: 343 344 >>> browser.getControl(name='form.code') 345 Traceback (most recent call last): 346 ... 347 LookupError: name 'form.code' 348 349 Let's set a new title and save the form: 350 351 >>> browser.getControl(name='form.title').value = "My test course" 352 >>> browser.getControl(name='form.actions.save').click() 353 354 Clicking 'Save' we will stay on the settings form. So we can change 355 the course again. This time we will return to the overview page 356 afterwards: 357 358 >>> browser.getControl(name='form.title').value = "My renamed course" 359 >>> ctrl = browser.getControl("Save and return") 360 >>> ctrl.click() 361 362 If we go to the settings page and click ``Cancel`` nothing will be 363 changed: 364 365 >>> browser.getLink('Edit settings').click() 366 >>> browser.getControl(name='form.title').value = "Blah" 367 >>> browser.getControl('Cancel').click() 368 369 Our course was indeed renamed to ``My renamed course`` and not to 370 ``Blah``: 371 372 >>> browser.open('http://localhost/myuniversity/faculties/TF/TD') 373 >>> print browser.contents 374 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... 375 ...<div name="thecoursetable"> 376 ...<td>My renamed course</td>... 377 ... 292 378 293 379
Note: See TracChangeset for help on using the changeset viewer.