コード例 #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,
    )
コード例 #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,
    )
コード例 #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)
コード例 #4
0
 def _assert_has_no_errors():
     assert (
         expected_data in Arsenic().write_in_autocomplete_field(
             'journal_title',
             journal_title,
         )
     )
コード例 #5
0
 def _assert_has_no_errors():
     assert (
         expected_data in Arsenic().write_in_autocomplete_field(
             'conf_name',
             conference_title,
         )
     )
コード例 #6
0
 def _assert_has_no_errors():
     assert (
         expected_data == Arsenic().write_in_autocomplete_field(
             'supervisors-0-affiliation',
             institution,
         )
     )
コード例 #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)
コード例 #8
0
 def _assert_has_no_errors():
     assert (
         expected_data == Arsenic().write_in_autocomplete_field(
             'authors-0-affiliation',
             affiliation,
         )
     )
コード例 #9
0
ファイル: conftest.py プロジェクト: miguelgrc/inspire-next
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)
コード例 #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()
コード例 #11
0
def go_to():
    Arsenic().get(os.environ['SERVER_NAME'] + '/literature/new')
コード例 #12
0
 def _refresh_and_retry(try_count):
     Arsenic().refresh()
     return get_first_record_info(try_count=try_count)
コード例 #13
0
def go_to():
    Arsenic().get(os.environ['SERVER_NAME'] +
                  '/holdingpen/list/?page=1&size=10&workflow_name=HEP')
コード例 #14
0
ファイル: conftest.py プロジェクト: michamos/inspire-next
def arsenic(selenium, app):
    Arsenic(selenium)
コード例 #15
0
ファイル: actions.py プロジェクト: turtle321/inspire-next
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)))
コード例 #16
0
ファイル: actions.py プロジェクト: turtle321/inspire-next
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)))
コード例 #17
0
ファイル: actions.py プロジェクト: turtle321/inspire-next
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))
    )