Exemple #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,
    )
Exemple #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,
    )
Exemple #3
0
def write_affiliation(affiliation, expected_data):
    def _assert_has_no_errors():
        assert (
            expected_data == Arsenic().write_in_autocomplete_field(
                'authors-0-affiliation',
                affiliation,
            )
        )

    _skip_import_data()
    return ArsenicResponse(assert_has_no_errors_func=_assert_has_no_errors)
Exemple #4
0
def write_journal_title(journal_title, expected_data):
    def _assert_has_no_errors():
        assert (
            expected_data in Arsenic().write_in_autocomplete_field(
                'journal_title',
                journal_title,
            )
        )

    _skip_import_data()
    return ArsenicResponse(assert_has_no_errors_func=_assert_has_no_errors)
Exemple #5
0
def write_conference(conference_title, expected_data):
    def _assert_has_no_errors():
        assert (
            expected_data in Arsenic().write_in_autocomplete_field(
                'conf_name',
                conference_title,
            )
        )

    _skip_import_data()
    return ArsenicResponse(assert_has_no_errors_func=_assert_has_no_errors)
Exemple #6
0
def write_institution_thesis(institution, expected_data):
    def _assert_has_no_errors():
        assert (
            expected_data == Arsenic().write_in_autocomplete_field(
                'supervisors-0-affiliation',
                institution,
            )
        )

    _skip_import_data()
    _populate_document_type('thesis')
    wait_for(_id='supervisors-0-affiliation')
    return ArsenicResponse(assert_has_no_errors_func=_assert_has_no_errors)
Exemple #7
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)
Exemple #8
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)
Exemple #9
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)