def load_submitted_record(input_data):
    def _assert_has_no_errors():
        assert ('M. Twain' in record and 'Twain, Mark' in record
                and 'retired' in record and 'ATLAS' in record
                and '2002' in record and '2005' in record
                and 'Submitted by [email protected]\non' in record
                and 'Some comments about the author' in record
                and 'http://www.example1.com' in record
                and 'http://www.example3.com' in record
                and 'http://www.example4.com' in record
                and 'http://www.example5.com' in record
                and 'cond-mat' in record and 'astro-ph' in record
                and 'Bob White' in record and 'CERN' in record
                and '2000' in record and '2001' in record)

    wait = WebDriverWait(Arsenic(), 10)
    try:
        record = wait.until(GetText((By.ID, 'hp-panel-detailed-info')))
        record += wait.until(GetText((By.ID, 'hp-panel-links')))
        record += wait.until(GetText((By.ID, 'hp-panel-notes')))
        record += wait.until(GetText((By.ID, 'hp-panel-submission-info')))
        record += wait.until(GetText((By.ID, 'hp-panel-subjects')))
        record += wait.until(GetText((By.ID, 'hp-panel-positions')))
        record += wait.until(GetText((By.ID, 'hp-panel-experiments')))
        record += wait.until(GetText((By.ID, 'hp-panel-advisors')))
    except (ElementNotVisibleException, WebDriverException):
        go_to()
        record = load_submitted_record(input_data)

    return ArsenicResponse(assert_has_no_errors_func=_assert_has_no_errors)
def assert_first_record_matches(input_data, try_count=0):
    def _assert_author_matches(author, authors_info):
        for name_part in author.get('name', ''):
            assert name_part in authors_info

        assert author.get('affiliation', '') in authors_info

    try:
        basic_info = WebDriverWait(Arsenic(),
                                   10).until(GetText((By.XPATH, BASIC_INFO)))
        submission_info = Arsenic().find_element_by_xpath(SUBMISSION_INFO).text
        first_subject = Arsenic().find_element_by_xpath(
            FIRST_SUBJECT_AREA).text
        second_subject = Arsenic().find_element_by_xpath(
            SECOND_SUBJECT_AREA).text
    except (ElementNotVisibleException, WebDriverException):
        try_count += 1
        go_to()
        if try_count > 15:
            raise
        assert_first_record_matches(input_data, try_count=try_count)

    for author in input_data.authors:
        _assert_author_matches(author, basic_info)
    if input_data.subjects:
        assert input_data.subjects[0] in first_subject
    if len(input_data.subjects) > 1:
        assert input_data.subjects[1] in second_subject

    assert input_data.get('abstract', '') in basic_info
    assert 'Submitted by [email protected]\non' in submission_info
def load_submission_record(input_data):
    def _load_submission_record():
        return ('CERN' in record and 'cond-mat' in record
                and 'astro-ph' in record and 'Twain, Mark' in record
                and '*****@*****.**' in record)

    try:
        record = WebDriverWait(Arsenic(), 10).until(
            GetText((By.XPATH, '//div[@class="row hp-item ng-scope"][1]')))
    except (ElementNotVisibleException, WebDriverException):
        go_to()
        return load_submission_record(input_data)

    return ArsenicResponse(_load_submission_record)
Esempio n. 4
0
def load_submitted_record(input_data):
    def _load_submitted_record():
        return ('Lorem ipsum dolor sit amet, consetetur sadipscing elitr.'
                in record and 'Submitted by [email protected]\non' in record
                and 'Wisconsin U., Madison' in record
                and 'My Title For Test' in record and 'Brown, James' in record
                and 'White, Barry' in record and 'Accelerators' in record
                and 'Computing' in record and 'CERN' in record)

    try:
        record = WebDriverWait(Arsenic(), 10).until(
            GetText((By.XPATH, '(//div[@class="ng-scope"])[2]')))
        record += Arsenic().find_element_by_xpath(
            '//p[@class="text-center ng-scope"]').text
        record += Arsenic().find_element_by_xpath(
            '(//div[@class="col-md-9 col-sm-9 col-xs-8 ng-binding"])[1]').text
        record += Arsenic().find_element_by_xpath(
            '(//div[@class="col-md-9 col-sm-9 col-xs-8 ng-binding"])[2]').text
    except (ElementNotVisibleException, WebDriverException):
        go_to()
        record = load_submitted_record(input_data)

    return ArsenicResponse(_load_submitted_record)
Esempio n. 5
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)))
 def _assert_has_no_errors():
     message = WebDriverWait(Arsenic(),
                             10).until(GetText(
                                 (By.XPATH, ACCEPTED_MESSAGE)))
     assert 'Accepted as Non-CORE' in message
 def _assert_has_no_errors():
     assert ('Accepted with Curation' in WebDriverWait(Arsenic(), 10).until(
         GetText((By.XPATH, ACCEPTED_WITH_CURATION_MESSAGE))))
 def _assert_has_no_errors():
     assert ('Rejected' in WebDriverWait(Arsenic(), 10).until(
         GetText((By.XPATH, REJECTED_MESSAGE))))