Exemplo n.º 1
0
def write_date_thesis(date_field, error_message_id, date):
    try:
        wait_for(_id=date_field)
    except (ElementNotVisibleException, WebDriverException):
        _skip_import_data()
        _populate_document_type('thesis')

    field = wait_for(_id=date_field)
    field.send_keys(date)
    Arsenic().hide_title_bar()
    Arsenic().click_with_coordinates('state-group-supervisors', 5, 5)
    try:
        error_message = get_text_of(_id=error_message_id)
    except (ElementNotVisibleException, WebDriverException):
        error_message = ''
    Arsenic().show_title_bar()
    field.clear()

    def _assert_has_errors():
        return (
            'Please, provide a valid date in the format YYYY-MM-DD, YYYY-MM '
            'or YYYY.'
        ) in error_message

    def _assert_has_no_errors():
        return (
            'Please, provide a valid date in the format YYYY-MM-DD, YYYY-MM '
            'or YYYY.'
        ) not in error_message

    return ArsenicResponse(
        assert_has_errors_func=_assert_has_errors,
        assert_has_no_errors_func=_assert_has_no_errors,
    )
Exemplo n.º 2
0
def write_pdf_link(pdf_link):
    try:
        wait_for(_id='url')
    except (ElementNotVisibleException, WebDriverException):
        _skip_import_data()
    field = wait_for(_id='url')
    field.send_keys(pdf_link)
    Arsenic().hide_title_bar()
    Arsenic().click_with_coordinates('state-group-url', 5, 5)
    try:
        message_err = get_text_of(_id='state-url')
    except (ElementNotVisibleException, WebDriverException):
        message_err = ''
    Arsenic().show_title_bar()
    field.clear()

    def _assert_has_errors():
        assert (
            'Please, provide an accessible direct link to a PDF document.'
        ) in message_err

    def _assert_has_no_errors():
        assert (
            'Please, provide an accessible direct link to a PDF document.'
        ) not in message_err

    return ArsenicResponse(
        assert_has_errors_func=_assert_has_errors,
        assert_has_no_errors_func=_assert_has_no_errors,
    )
Exemplo n.º 3
0
def submit_article(input_data):
    def _assert_has_no_errors():
        message = get_text_of(xpath=SUBMIT_RESULT_ALERT_SUCCESS)
        assert GOOD_MESSAGE in message

    _skip_import_data()
    Arsenic().hide_title_bar()
    _populate_document_type('article')
    _populate_links(input_data)
    _populate_basic_info(input_data)
    click(xpath=SUBMIT_BUTTON)
    Arsenic().show_title_bar()

    return ArsenicResponse(assert_has_no_errors_func=_assert_has_no_errors)
Exemplo n.º 4
0
 def _assert_has_no_errors():
     assert (
         expected_data in Arsenic().write_in_autocomplete_field(
             'journal_title',
             journal_title,
         )
     )
Exemplo n.º 5
0
 def _assert_has_no_errors():
     assert (
         expected_data in Arsenic().write_in_autocomplete_field(
             'conf_name',
             conference_title,
         )
     )
Exemplo n.º 6
0
 def _assert_has_no_errors():
     assert (
         expected_data == Arsenic().write_in_autocomplete_field(
             'supervisors-0-affiliation',
             institution,
         )
     )
Exemplo n.º 7
0
def submit_journal_article_with_proceeding(input_data):
    def _assert_has_no_errors():
        message = get_text_of(xpath=SUBMIT_RESULT_ALERT_SUCCESS)
        assert GOOD_MESSAGE in message

    _skip_import_data()
    Arsenic().hide_title_bar()
    _populate_links(input_data)
    _populate_basic_info(input_data)
    _populate_proceedings(input_data)
    _populate_journal_conference(input_data)
    _populate_references_comment(input_data)
    click(xpath=SUBMIT_BUTTON)
    Arsenic().show_title_bar()

    return ArsenicResponse(assert_has_no_errors_func=_assert_has_no_errors)
Exemplo n.º 8
0
 def _assert_has_no_errors():
     assert (
         expected_data == Arsenic().write_in_autocomplete_field(
             'authors-0-affiliation',
             affiliation,
         )
     )
Exemplo n.º 9
0
def arsenic(selenium, app):
    """Instantiate the Arsenic singleton.

    The ``Arsenic`` singleton provides some helpers and proxies the rest of
    the calls to the wrapped ``selenium`` fixtures.

    .. deprecated:: 2017-09-18
       This is needlessly complicated.
    """
    Arsenic(selenium)
Exemplo n.º 10
0
def _skip_import_data():
    Arsenic().hide_title_bar()
    click(_id='skipImportData')
    WebDriverWait(Arsenic(), 10).until(
        EC.text_to_be_present_in_element(
            (By.ID, 'form_container'),
            'Type of Document',
        )
    )
    Arsenic().execute_script(EXPAND_CONFERENCE_INFO)
    Arsenic().execute_script(EXPAND_PROCEEDINGS_INFO)
    Arsenic().execute_script(EXPAND_REFERENCES)
    Arsenic().execute_script(EXPAND_ADDITIONAL_COMMENTS)
    Arsenic().show_title_bar()
Exemplo n.º 11
0
def go_to():
    Arsenic().get(os.environ['SERVER_NAME'] + '/literature/new')
Exemplo n.º 12
0
 def _refresh_and_retry(try_count):
     Arsenic().refresh()
     return get_first_record_info(try_count=try_count)
Exemplo n.º 13
0
def go_to():
    Arsenic().get(os.environ['SERVER_NAME'] +
                  '/holdingpen/list/?page=1&size=10&workflow_name=HEP')
Exemplo n.º 14
0
def arsenic(selenium, app):
    Arsenic(selenium)
Exemplo n.º 15
0
def get_text_of(_id=None, xpath=None, link_text=None):
    by, value = _parse_selectors(_id=_id, xpath=xpath, link_text=link_text)
    return WebDriverWait(Arsenic(), 10).until(GetText((by, value)))
Exemplo n.º 16
0
def click(_id=None, xpath=None, link_text=None):
    by, value = _parse_selectors(_id=_id, xpath=xpath, link_text=link_text)
    return WebDriverWait(Arsenic(), 10).until(TryClick((by, value)))
Exemplo n.º 17
0
def wait_for(_id=None, xpath=None, link_text=None):
    by, value = _parse_selectors(_id=_id, xpath=xpath, link_text=link_text)
    return WebDriverWait(Arsenic(), 10).until(
        EC.visibility_of_element_located((by, value))
    )