Exemple #1
0
def test_logged_in_non_reviewer_cannot_review(driver, registrant):
    register_and_login_user(driver, registrant)
    driver.get(base_url + 'review_list')
    WebDriverWait(driver, driver_wait_time).until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Review List Failed'))
    logout_user(driver, registrant)
Exemple #2
0
def test_can_get_logout_page(driver, registrant):
    register_user(driver, registrant)
    driver.get(base_url + 'logout')
    WebDriverWait(driver, driver_wait_time).until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Call for Proposals'))
    check_menu_items(driver, ('Register', 'Login'))
Exemple #3
0
def test_can_get_submit_page(driver, registrant):
    register_and_login_user(driver, registrant)
    driver.get(base_url + 'submit')
    WebDriverWait(driver, driver_wait_time).until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Submit a proposal'))
    check_menu_items(driver, ())
Exemple #4
0
def test_cannot_access_login_success_page(driver, registrant):
    register_and_login_user(driver, registrant)
    driver.get(base_url + 'login_success')
    WebDriverWait(driver, driver_wait_time).until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Call for Proposals'))
    check_menu_items(driver, ())
Exemple #5
0
def test_can_get_registration_update_page(driver, registrant):
    register_and_login_user(driver, registrant)
    driver.get(base_url + 'registration_update')
    WebDriverWait(driver, driver_wait_time).until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Registration Details Updating'))
    check_menu_items(driver, ())
Exemple #6
0
def test_logged_in_reviewer_can_get_review_list(driver, reviewer):
    register_a_reviewer(driver, reviewer)
    login_user(driver, reviewer)
    driver.get(base_url + 'review_list')
    WebDriverWait(driver, driver_wait_time).until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – List of Proposals'))
    logout_user(driver, reviewer)
Exemple #7
0
def test_cannot_access_registration_update_success_page_not_logged_in(
        driver, registrant):
    register_user(driver, registrant)
    driver.get(base_url + 'registration_update_success')
    WebDriverWait(driver, driver_wait_time).until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Call for Proposals'))
    check_menu_items(driver, ('Register', 'Login'))
Exemple #8
0
def test_cannot_get_proposal_update_page_unless_logged_in(driver, registrant):
    register_user(driver, registrant)
    driver.get(base_url + 'proposal_update/1')
    WebDriverWait(driver, driver_wait_time).until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Proposal Update Failure'))
    assert 'You must be registered and logged in to update a proposal' in driver.find_element_by_class_name(
        'first').text
    check_menu_items(driver, ('Register', 'Login'))
Exemple #9
0
def test_can_get_register_page(driver, registrant):
    register_user(driver, registrant)
    driver.get(base_url + 'register')
    WebDriverWait(driver, driver_wait_time).until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Register'))
    assert 'Register here for submitting proposals to the ACCU' in driver.find_element_by_class_name(
        'first').text
    check_menu_items(driver, ('Login', ))
Exemple #10
0
def test_cannot_get_submit_page_if_not_logged_in(driver, registrant):
    register_user(driver, registrant)
    driver.get(base_url + 'submit')
    WebDriverWait(driver, driver_wait_time).until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Submit Not Possible'))
    assert 'You must be registered and logged in to submit a proposal.' in driver.find_element_by_class_name(
        'first').text
    check_menu_items(driver, ('Register', 'Login'))
Exemple #11
0
def test_cannot_get_review_proposal_page_unless_logged_in(driver, registrant):
    register_and_login_user(driver, registrant)
    driver.get(base_url + 'review_proposal/1')
    WebDriverWait(driver, driver_wait_time).until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Review Proposal Failed'))
    assert 'Logged in user is not a registered reviewer.' in driver.find_element_by_class_name(
        'first').text
    check_menu_items(driver, ())
Exemple #12
0
def test_cannot_get_next_proposal_if_not_logged_in(driver, registrant):
    register_user(driver, registrant)
    driver.get(base_url + 'next_proposal/2/0')
    WebDriverWait(driver, driver_wait_time).until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Proposal Navigation Failed'))
    assert 'You must be registered, logged in, and a reviewer to review a proposal' in driver.find_element_by_class_name(
        'first').text
    check_menu_items(driver, ('Register', 'Login'))
def test_sees_no_proposal_prior_to_submitting_one(driver, registrant):
    register_and_login_user(driver, registrant)
    driver.get(base_url + 'my_proposals')
    wait = WebDriverWait(driver, driver_wait_time)
    wait.until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – My Proposals'))
    element = driver.find_element_by_class_name('first')
    assert 'The following are your current proposals.' in element.text
    proposal_list = driver.find_elements_by_class_name('proposal-list')
    assert len(proposal_list) == 0
Exemple #14
0
def submit_data_to_register_page(driver, registrant):
    driver.get(base_url + 'register')
    wait = WebDriverWait(driver, driver_wait_time)
    wait.until(ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'), ' – Register'))
    for key, value in registrant.items():
        driver.find_element_by_id(key).send_keys(value)
    puzzle_text = driver.find_element_by_id('puzzle_label').text
    driver.find_element_by_id('puzzle').send_keys(eval(puzzle_text))
    button = wait.until(ecs.element_to_be_clickable((By.ID, 'submit')))
    assert 'Register' == button.text
    assert 'registerUser(true)' == button.get_attribute('onclick')
    button.click()
Exemple #15
0
def submit_data_to_register_page(driver, registrant):
    driver.get(base_url + 'register')
    assert ' – Registration' in driver.find_element_by_class_name(
        'pagetitle').text
    for key, value in registrant.items():
        driver.find_element_by_id(key).send_keys(value)
    puzzle_text = driver.find_element_by_id('puzzle_label').text
    driver.find_element_by_id('puzzle').send_keys(eval(puzzle_text))
    button = WebDriverWait(driver, 1).until(
        ecs.element_to_be_clickable((By.ID, 'submit')))
    assert 'Register' in button.text
    assert 'registerUser()' in button.get_attribute('onclick')
    button.click()
Exemple #16
0
def test_registered_user_can_successfully_login(driver, registrant):
    register_user(driver, registrant)
    driver.get(base_url + 'login')
    wait = WebDriverWait(driver, driver_wait_time)
    wait.until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Login'))
    driver.find_element_by_id('email').send_keys(registrant['email'])
    driver.find_element_by_id('passphrase').send_keys(registrant['passphrase'])
    button = wait.until(ecs.element_to_be_clickable((By.ID, 'login')))
    button.click()
    wait.until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          'Login Successful'))
def test_can_see_both_previously_submitted_proposals(
        driver, registrant, proposal_single_presenter,
        proposal_multiple_presenters_single_lead):
    register_and_login_user(driver, registrant)
    driver.get(base_url + 'my_proposals')
    wait = WebDriverWait(driver, driver_wait_time)
    wait.until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – My Proposals'))
    element = driver.find_element_by_class_name('first')
    assert 'The following are your current proposals.' in element.text
    proposal_list = driver.find_elements_by_class_name('proposal-list')
    assert len(proposal_list) == 2
    assert proposal_single_presenter['title'] == proposal_list[0].text
    assert proposal_multiple_presenters_single_lead['title'] == proposal_list[
        1].text
def test_can_amend_the_first_submitted_proposal(driver, registrant,
                                                proposal_single_presenter):
    register_and_login_user(driver, registrant)
    driver.get(base_url + 'proposal_update/1')
    wait = WebDriverWait(driver, driver_wait_time)
    wait.until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Update a proposal'))
    title_element = driver.find_element_by_id('title')
    assert proposal_single_presenter['title'] == title_element.get_attribute(
        'value')
    assert '' == title_element.text
    assert proposal_single_presenter['summary'] == driver.find_element_by_id(
        'summary').text
    assert proposal_single_presenter['session_type'] == Select(
        driver.find_element_by_id(
            'session_type')).first_selected_option.get_attribute('value')
    assert proposal_single_presenter['audience'] == Select(
        driver.find_element_by_id(
            'audience')).first_selected_option.get_attribute('value')
    assert proposal_single_presenter['notes'] == driver.find_element_by_id(
        'notes').text
    assert proposal_single_presenter[
        'constraints'] == driver.find_element_by_id('constraints').text
    new_title = 'This is a new title for a proposal'
    title_element.clear()
    title_element.send_keys(new_title)
    assert new_title == title_element.get_attribute('value')
    assert '' == title_element.text
    name_field = driver.find_element_by_id('name_0_field')
    assert proposal_single_presenter['presenters'][0][
        'name'] == name_field.get_attribute('value')
    assert '' == name_field.text
    new_presenter_name = 'Monty the Gerbil'
    name_field.clear()
    name_field.send_keys(new_presenter_name)
    assert new_presenter_name == name_field.get_attribute('value')
    assert '' == name_field.text
    submit_button = wait.until(ecs.element_to_be_clickable((By.ID, 'submit')))
    assert 'Update' == driver.find_element_by_id('submit').text
    assert 'submitProposal(1)' == submit_button.get_attribute('onclick')
    submit_button.click()
    wait.until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Proposal Update Successful'))
    assert 'you have successfully updated your proposal for the ACCU' in driver.find_element_by_id(
        'content').text
Exemple #19
0
def test_logged_in_reviewer_can_move_to_next_unscored_proposal(driver):
    driver.get(base_url + 'review_proposal/1')
    wait = WebDriverWait(driver, driver_wait_time)
    wait.until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Proposal to Review'))
    next_button = wait.until(
        ecs.element_to_be_clickable((By.ID, 'review-next-unscored')))
    assert 'Next Unscored' == next_button.text
    assert 'navigateNextUnscored(1)' == next_button.get_attribute('onclick')
    next_button.click()
    # Travis-CI requires an extra wait here for some reason.
    time.sleep(1)
    wait.until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Proposal to Review'))
    assert base_url + 'review_proposal/2' == driver.current_url
def test_can_submit_a_single_presenter_proposal(driver, registrant,
                                                proposal_single_presenter):
    register_and_login_user(driver, registrant)
    driver.get(base_url + 'submit')
    wait = WebDriverWait(driver, driver_wait_time)
    wait.until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Submit'))
    driver.find_element_by_id('title').send_keys(
        proposal_single_presenter['title'])
    Select(driver.find_element_by_id('session_type')).select_by_value(
        proposal_single_presenter['session_type'])
    driver.find_element_by_id('summary').send_keys(
        proposal_single_presenter['summary'])
    Select(driver.find_element_by_id('audience')).select_by_value(
        proposal_single_presenter['audience'])
    driver.find_element_by_id('notes').send_keys(
        proposal_single_presenter['notes'])
    driver.find_element_by_id('constraints').send_keys(
        proposal_single_presenter['constraints'])
    presenter = proposal_single_presenter['presenters'][0]
    for key in presenter.keys():
        if key == 'is_lead':
            selected = driver.find_element_by_id(key +
                                                 '_0_field').is_selected()
            if (presenter[key] and not selected) or (not presenter[key]
                                                     and selected):
                driver.find_element_by_id(key + '_0_field').click()
        elif key == 'country':
            Select(driver.find_element_by_id(key +
                                             '_0_field')).select_by_value(
                                                 presenter[key])
        else:
            element = driver.find_element_by_id(key + '_0_field')
            element.clear()
            element.send_keys(presenter[key])
    button = wait.until(ecs.element_to_be_clickable((By.ID, 'submit')))
    assert 'Submit' == button.text
    assert 'submitProposal()' == button.get_attribute('onclick')
    button.click()
    wait.until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Submission Successful'))
    assert 'Thank you, you have successfully submitted a proposal for the ACCU' in driver.find_element_by_id(
        'content').text
Exemple #21
0
def test_malformed_data_cases_local_error(email, passphrase, error_key,
                                          error_message, driver):
    driver.get(base_url + 'login')
    wait = WebDriverWait(driver, driver_wait_time)
    wait.until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Login'))
    driver.find_element_by_id('email').send_keys(email)
    driver.find_element_by_id('passphrase').send_keys(passphrase)
    button = wait.until(ecs.element_to_be_clickable((By.ID, 'login')))
    button.click()
    WebDriverWait(driver, driver_wait_time).until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Login'))
    assert 'Problem with login form, not submitting.' in driver.find_element_by_id(
        'alert').text
    assert driver.find_element_by_id(error_key +
                                     '_alert').text == error_message
Exemple #22
0
def test_logged_in_reviewer_cannot_move_to_previous_unscored_proposal_if_they_have_reviewed_them_all(
        driver):
    driver.get(base_url + 'review_proposal/2')
    wait = WebDriverWait(driver, driver_wait_time)
    wait.until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Proposal to Review'))
    previous_button = wait.until(
        ecs.element_to_be_clickable((By.ID, 'review-previous-unscored')))
    assert 'Previous Unscored' == previous_button.text
    assert 'navigatePreviousUnscored(2)' == previous_button.get_attribute(
        'onclick')
    # TODO Why can't the alert be detected
    # previous_button.click()
    # wait.until(ecs.alert_is_present())
    # alert = driver.switch_to_alert()
    # assert 'Requested proposal does not exist.' == alert.text
    # alert.accept()
    assert base_url + 'review_proposal/2' == driver.current_url
def test_can_amend_registration_record(driver, registrant):
    register_and_login_user(driver, registrant)
    driver.get(base_url + 'registration_update')
    wait = WebDriverWait(driver, driver_wait_time)
    wait.until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Registration Details Updating'))
    assert 'India' == Select(
        driver.find_element_by_id('country')).first_selected_option.text
    driver.find_element_by_id('name').send_keys('Jo Bloggs')
    button = wait.until(ecs.element_to_be_clickable((By.ID, 'submit')))
    assert 'Save' == driver.find_element_by_id('submit').text
    assert 'registerUser(false)' == button.get_attribute('onclick')
    button.click()
    wait.until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Registration Update Successful'))
    assert 'Your registration details were successfully updated.' in driver.find_element_by_id(
        'content').text
Exemple #24
0
def test_logged_in_reviewer_can_review_submitted_proposal(
        driver, registrant, proposal_single_presenter, reviewer):
    register_user(driver, registrant)
    submit_a_proposal(driver, registrant, proposal_single_presenter)
    register_a_reviewer(driver, reviewer)
    login_user(driver, reviewer)
    driver.get(base_url + 'review_list')
    wait = WebDriverWait(driver, driver_wait_time)
    wait.until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – List of Proposals'))
    link = wait.until(
        ecs.element_to_be_clickable(
            (By.LINK_TEXT, proposal_single_presenter['title'])))
    link.click()
    wait.until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Proposal to Review'))
    driver.find_element_by_id('score').send_keys(typed_score)
    driver.find_element_by_id('comment-for-proposer').send_keys(
        typed_comment_for_proposer)
    driver.find_element_by_id('comment-for-committee').send_keys(
        typed_comment_for_committee)
    submit_button = wait.until(ecs.element_to_be_clickable((By.ID, 'submit')))
    assert 'Submit' == submit_button.text
    assert 'submitScoreAndComment(1)' == submit_button.get_attribute('onclick')
    submit_button.click()
    wait.until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Proposal to Review'))
    assert 'Review stored.' == driver.find_element_by_id('alert').text
    assert typed_score == driver.find_element_by_id('score').get_attribute(
        'value')
    assert typed_comment_for_proposer == driver.find_element_by_id(
        'comment-for-proposer').get_attribute('value')
    assert typed_comment_for_committee == driver.find_element_by_id(
        'comment-for-committee').get_attribute('value')
    logout_user(driver, reviewer)
Exemple #25
0
def test_logged_in_reviewer_can_move_to_next_proposal(
        driver, registrant, proposal_multiple_presenters_single_lead,
        reviewer):
    register_user(driver, registrant)
    submit_a_proposal(driver, registrant,
                      proposal_multiple_presenters_single_lead)
    login_user(driver, reviewer)
    driver.get(base_url + 'review_proposal/1')
    wait = WebDriverWait(driver, driver_wait_time)
    wait.until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Proposal to Review'))
    next_button = wait.until(
        ecs.element_to_be_clickable((By.ID, 'review-next')))
    assert 'Next' == next_button.text
    assert 'navigateNext(1)' == next_button.get_attribute('onclick')
    next_button.click()
    # Travis-CI requires an extra wait here for some reason.
    time.sleep(1)
    wait.until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Proposal to Review'))
    assert base_url + 'review_proposal/2' == driver.current_url
Exemple #26
0
def test_logged_in_reviewer_can_move_to_previous_proposal(driver):
    driver.get(base_url + 'review_proposal/2')
    wait = WebDriverWait(driver, driver_wait_time)
    wait.until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Proposal to Review'))
    previous_button = wait.until(
        ecs.element_to_be_clickable((By.ID, 'review-previous')))
    assert 'Previous' == previous_button.text
    assert 'navigatePrevious(2)' == previous_button.get_attribute('onclick')
    previous_button.click()
    # Travis-CI requires an extra wait here for some reason.
    time.sleep(1)
    wait.until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Proposal to Review'))
    assert base_url + 'review_proposal/1' == driver.current_url
    # This is a scored proposal so make sure the scores are present.
    assert typed_score == driver.find_element_by_id('score').get_attribute(
        'value')
    assert typed_comment_for_proposer == driver.find_element_by_id(
        'comment-for-proposer').text
    assert typed_comment_for_committee == driver.find_element_by_id(
        'comment-for-committee').text
Exemple #27
0
def test_can_get_root_page(driver):
    driver.get(base_url)
    assert ' – Call for Proposals' in driver.page_source
Exemple #28
0
def tests_cannot_get_login_page_when_logged_in(driver, registrant):
    driver.get(base_url + 'login')
    WebDriverWait(driver, driver_wait_time).until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Call for Proposals'))
Exemple #29
0
def test_logged_in_user_can_logout(driver):
    driver.get(base_url + 'logout')
    WebDriverWait(driver, driver_wait_time).until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Call for Proposals'))
Exemple #30
0
def test_amending_a_score_doesnt_create_a_second_score_object(driver):
    driver.get(base_url + 'review_proposal/1')
    wait = WebDriverWait(driver, driver_wait_time)
    wait.until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Proposal to Review'))
    new_score = '8'
    new_comment_for_proposer = 'OK_ish.'
    new_comment_for_committee = 'Not entirely crap.'
    score_node = driver.find_element_by_id('score')
    score_node.clear()
    score_node.send_keys(new_score)
    comment_for_proposer_node = driver.find_element_by_id(
        'comment-for-proposer')
    comment_for_proposer_node.clear()
    comment_for_proposer_node.send_keys(new_comment_for_proposer)
    comment_for_committee_node = driver.find_element_by_id(
        'comment-for-committee')
    comment_for_committee_node.clear()
    comment_for_committee_node.send_keys(new_comment_for_committee)
    submit_button = wait.until(ecs.element_to_be_clickable((By.ID, 'submit')))
    assert 'Update' == submit_button.text
    assert 'submitScoreAndComment(1)' == submit_button.get_attribute('onclick')
    submit_button.click()
    wait.until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Proposal to Review'))
    assert 'Review stored.' == driver.find_element_by_id('alert').text
    assert new_score == driver.find_element_by_id('score').get_attribute(
        'value')
    assert new_comment_for_proposer == driver.find_element_by_id(
        'comment-for-proposer').get_attribute('value')
    assert new_comment_for_committee == driver.find_element_by_id(
        'comment-for-committee').get_attribute('value')
    next_button = wait.until(
        ecs.element_to_be_clickable((By.ID, 'review-next')))
    assert 'Next' == next_button.text
    assert 'navigateNext(1)' == next_button.get_attribute('onclick')
    next_button.click()
    # Travis-CI requires an extra wait here for some reason.
    time.sleep(2)
    wait.until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Proposal to Review'))
    previous_button = wait.until(
        ecs.element_to_be_clickable((By.ID, 'review-previous')))
    assert 'Previous' == previous_button.text
    assert 'navigatePrevious(2)' == previous_button.get_attribute('onclick')
    previous_button.click()
    # Travis-CI requires an extra wait here for some reason.
    time.sleep(2)
    wait.until(
        ecs.text_to_be_present_in_element((By.CLASS_NAME, 'pagetitle'),
                                          ' – Proposal to Review'))
    assert base_url + 'review_proposal/1' == driver.current_url
    assert new_score == driver.find_element_by_id('score').get_attribute(
        'value')
    assert new_comment_for_proposer == driver.find_element_by_id(
        'comment-for-proposer').text
    assert new_comment_for_committee == driver.find_element_by_id(
        'comment-for-committee').text