@@ -30,25 +30,17 @@ def _fill_in_author_form(form_elt, name, email, affiliation, country):
3030 # To enter the person, type their name in the select2 search box, wait for the
3131 # search to offer the result, then press 'enter' to accept the result and close
3232 # the search input.
33- # self.driver.set_page_load_timeout(60)
3433 person_span = form_elt .find_element (By .CLASS_NAME , 'select2-selection' )
3534 self .scroll_to_element (person_span )
3635 person_span .click ()
3736 input = self .driver .find_element (By .CLASS_NAME , 'select2-search__field' )
3837 input .send_keys (name )
3938 result_selector = 'ul.select2-results__options > li.select2-results__option--selectable'
40- try :
41- WebDriverWait (self .driver , 3 ).until (
42- expected_conditions .text_to_be_present_in_element (
43- (By .CSS_SELECTOR , result_selector ),
44- name
45- ))
46- except :
47- # print(self.driver.execute_script("return document.documentElement.outerHTML"))
48- print (name , email , self .driver .find_element (By .CSS_SELECTOR , ".select2-results__message" ).text )
49- # FIXME-LARS: force the test to succeed anyway, so CI doesn't crap out
50- return
51-
39+ self .wait .until (
40+ expected_conditions .text_to_be_present_in_element (
41+ (By .CSS_SELECTOR , result_selector ),
42+ name
43+ ))
5244 input .send_keys ('\n ' ) # select the object
5345
5446 # After the author is selected, the email select options will be populated.
@@ -75,8 +67,6 @@ def _read_author_form(form_elt):
7567 email_select = form_elt .find_element (By .CSS_SELECTOR , 'select[name$="email"]' )
7668 affil_input = form_elt .find_element (By .CSS_SELECTOR , 'input[name$="affiliation"]' )
7769 country_input = form_elt .find_element (By .CSS_SELECTOR , 'input[name$="country"]' )
78- print ("hidden_person_input.get_attribute('value')" , hidden_person_input .get_attribute ('value' ))
79- print ("hidden_person_input.get_attribute('outerHTML')" , hidden_person_input .get_attribute ('outerHTML' ))
8070 return (
8171 Person .objects .get (pk = hidden_person_input .get_attribute ('value' )),
8272 email_select .get_attribute ('value' ),
@@ -104,8 +94,9 @@ def _read_author_form(form_elt):
10494 # get the "add author" button so we can add blank author forms
10595 add_author_button = self .driver .find_element (By .ID , 'add-author-button' )
10696 for index , auth in enumerate (authors ):
107- self .driver .execute_script ("arguments[0].click ();" , add_author_button ) # FIXME-LARS: no idea why this fails:
97+ self .driver .execute_script ("arguments[0].scrollIntoView ();" , add_author_button ) # FIXME-LARS: no idea why this fails:
10898 # self.scroll_to_element(add_author_button) # Can only click if it's in view!
99+ self .driver .execute_script ("arguments[0].click();" , add_author_button ) # FIXME-LARS: no idea why this fails:
109100 # add_author_button.click() # Create a new form. Automatically scrolls to it.
110101 author_forms = authors_list .find_elements (By .CLASS_NAME , 'author-panel' )
111102 authors_added = index + 1
0 commit comments