Selenium browser extensions tests
=================================

Let's test the selenium extensions created in the
schooltool.group.stesting module.

See the README.selenium.txt file in the schooltool/testing directory
for instructions on how to use them.

Some helpers for these tests:

    >>> def format_term_row(row):
    ...     title = row.query.xpath('td[1]/a').text
    ...     first = row.query.xpath('td[2]').text
    ...     last = row.query.xpath('td[3]').text
    ...     return '/ '.join([title, first, last])

Log in as manager:

    >>> manager = browsers.manager
    >>> manager.ui.login('manager', 'schooltool')

We're going to add:

A school year:

    >>> manager.ui.schoolyear.add('2012', '2012-01-01', '2012-12-31')


browser.ui.term.add()
-----------------------

Used for adding terms.

Let's add four terms for the year:

    >>> manager.ui.term.add('2012', 'Q1', '2012-01-01', '2012-03-31')
    >>> manager.ui.term.add('2012', 'Q2', '2012-04-01', '2012-06-30')
    >>> manager.ui.term.add('2012', 'Q3', '2012-07-01', '2012-09-30')
    >>> manager.ui.term.add('2012', 'Q4', '2012-10-01', '2012-12-31')

And check that they were added correctly:

    >>> manager.open('http://localhost/terms')
    >>> manager.query.link('2012').click()
    >>> for row in manager.query_all.css('form table tbody tr'):
    ...     print format_term_row(row)
    Q1/ Jan 1, 2012/ Mar 31, 2012
    Q2/ Apr 1, 2012/ Jun 30, 2012
    Q3/ Jul 1, 2012/ Sep 30, 2012
    Q4/ Oct 1, 2012/ Dec 31, 2012
