Exemplo n.º 1
0
def _populate_authors(authors):
    for index, author in enumerate(authors):
        write(_id='authors-%s-name' % index, data=author['name'])
        if 'affiliation' in author:
            write(
                _id='authors-%s-affiliation' % index,
                data=(
                    author['affiliation'],
                    author['name'],
                ),
            )

        click(link_text='Add another author')
Exemplo n.º 2
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.º 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 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.º 5
0
def _populate_subjects(subjects):

    click(xpath=SUBJECTS_BUTTON)
    for subject in subjects:
        click(xpath='//input[@value="' + subject + '"]')

    click(xpath=SUBJECTS_BUTTON)
Exemplo n.º 6
0
def get_first_record_info(try_count=0):
    def _refresh_and_retry(try_count):
        Arsenic().refresh()
        return get_first_record_info(try_count=try_count)

    try:
        click(xpath=FIRST_RECORD_SHOW_ABSTRACT_LINK)
        record = get_text_of(xpath=FIRST_RECORD)
    except (ElementNotVisibleException, WebDriverException):
        try_count += 1
        if try_count >= 15:
            raise
        record = _refresh_and_retry(try_count=try_count)

    if 'Waiting' in record:
        try_count += 1
        if try_count >= 15:
            raise Exception(
                'Timed out waiting for record to get out of Waiting status.')
        return _refresh_and_retry(try_count=try_count)

    return record
Exemplo n.º 7
0
def submit_doi_id(doi_id, expected_data):
    write(_id='doi', data=doi_id)
    click(_id='importData')
    click(_id='acceptData')
    wait_for(_id='doi')
    _skip_import_data()

    output_data = {
        'year': get_value_of(_id='year'),
        'title': get_value_of(_id='title'),
        'issue': get_value_of(_id='issue'),
        'volume': get_value_of(_id='volume'),
        'journal': get_value_of(_id='journal_title'),
        'author': get_value_of(_id='authors-0-name'),
        'author-1': get_value_of(_id='authors-1-name'),
        'author-2': get_value_of(_id='authors-2-name'),
        'page-range': get_value_of(_id='page_range_article_id'),
    }

    def _assert_has_no_errors():
        assert expected_data == output_data

    return ArsenicResponse(assert_has_no_errors_func=_assert_has_no_errors)
Exemplo n.º 8
0
def click_first_record():
    click(xpath=FIRST_RECORD_TITLE)
Exemplo n.º 9
0
def _populate_report_numbers(report_numbers):
    for index, report_number in enumerate(report_numbers):
        write(_id='report_numbers-%s-report_number' % index, data=report_number)
        click(link_text='Add another report number')