def test_user_mandatory_notifications(base_url, selenium):
    user = User(selenium, base_url).open().wait_for_page_to_load()
    user.login('developer')
    # notifications 5 to 7 are mandatory for developers; clicking the checkboxes should have no effect
    for checkbox in user.edit.notifications_checkbox[4:7]:
        checkbox.click()
    user.edit.submit_changes()
    user.wait_for_user_to_load()
    user.view.click_edit_profile_button()
    # checks that the mandatory notification checkboxes are still selected
    for checkbox in user.edit.notifications_checkbox[4:7]:
        assert checkbox.is_selected()
def test_user_update_profile(base_url, selenium, variables):
    user = User(selenium, base_url).open().wait_for_page_to_load()
    user.login('reusable_user')
    updated_name = 'new_display_name'
    # update field
    user.edit.display_name_field.clear()
    user.edit.display_name_field.send_keys(updated_name)
    # clear field
    user.edit.location_field.clear()
    # append to field text
    user.edit.biography(variables['biography_extra'])
    user.edit.submit_changes()
    user.wait_for_user_to_load()
    assert updated_name in user.user_display_name.text
    # check that location field is not displayed
    with pytest.raises(NoSuchElementException):
        selenium.find_element_by_css_selector('.UserProfile-location')
    biography_text = variables['biography'] + variables['biography_extra']
    assert biography_text in user.view.user_biography