Commit 95db27a8 authored by Vincent Pelletier's avatar Vincent Pelletier

ERP5TypeFunctionalTestCase: Improve initial login realism.

This currently only works because CookieCrumbler reacts on *all* urls which
contain the magic login & password fields. But the POST request body lacks
any value from submit fields, which bypasses the "logged-in" scripts, which
is harmless with current code but lack realism.
parent 22f70018
Pipeline #19877 failed with stage
in 0 seconds
......@@ -320,7 +320,13 @@ class FunctionalTestRunner:
password_field.clear()
password_field.send_keys(self.password)
login_form_url = browser.current_url
password_field.submit()
# Note: password_field.submit() (and in general, x.submit(), even if x is
# an <input type="submit"...>) does not work: it seems to submit only
# fields which have a value on their own. Which means type="submit" fields
# are absent, which breaks the form submission handling locic on Zope side.
password_field.find_element_by_xpath(
'ancestor::fieldset/descendant::input[@type="submit"]',
).click()
WebDriverWait(browser, 10).until(EC.url_changes(login_form_url))
WebDriverWait(browser, 10).until(EC.presence_of_element_located((By.TAG_NAME, 'body')))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment