From 6492b6488a6b781361b4eec965deb584080b1eb5 Mon Sep 17 00:00:00 2001 From: Marcello Stanisci Date: Thu, 10 Nov 2016 00:11:22 +0100 Subject: selenium: fixing the way (certain) elements are clicked. Namely, since the lang bar at the bottom has absolute position it overlays on elements to be clicked; so the window needs to be scrolled a bit further in order to click the desired elements --- i18n/de.po | 2 +- i18n/en-US.po | 2 +- i18n/fr.po | 2 +- i18n/it.po | 2 +- i18n/taler-wallet-webex.pot | 2 +- selenium/test.py | 23 +++++++++++++++++------ 6 files changed, 22 insertions(+), 11 deletions(-) diff --git a/i18n/de.po b/i18n/de.po index 0ff84b473..0a5c1397f 100644 --- a/i18n/de.po +++ b/i18n/de.po @@ -17,7 +17,7 @@ msgid "" msgstr "" "Project-Id-Version: Taler Wallet\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-11-09 13:53+0100\n" +"POT-Creation-Date: 2016-11-09 22:39+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/i18n/en-US.po b/i18n/en-US.po index 2618065ad..befaf6974 100644 --- a/i18n/en-US.po +++ b/i18n/en-US.po @@ -17,7 +17,7 @@ msgid "" msgstr "" "Project-Id-Version: Taler Wallet\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-11-09 13:53+0100\n" +"POT-Creation-Date: 2016-11-09 22:39+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/i18n/fr.po b/i18n/fr.po index c063f4d3a..7a8422002 100644 --- a/i18n/fr.po +++ b/i18n/fr.po @@ -17,7 +17,7 @@ msgid "" msgstr "" "Project-Id-Version: Taler Wallet\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-11-09 13:53+0100\n" +"POT-Creation-Date: 2016-11-09 22:39+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/i18n/it.po b/i18n/it.po index c063f4d3a..7a8422002 100644 --- a/i18n/it.po +++ b/i18n/it.po @@ -17,7 +17,7 @@ msgid "" msgstr "" "Project-Id-Version: Taler Wallet\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-11-09 13:53+0100\n" +"POT-Creation-Date: 2016-11-09 22:39+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/i18n/taler-wallet-webex.pot b/i18n/taler-wallet-webex.pot index c063f4d3a..7a8422002 100644 --- a/i18n/taler-wallet-webex.pot +++ b/i18n/taler-wallet-webex.pot @@ -17,7 +17,7 @@ msgid "" msgstr "" "Project-Id-Version: Taler Wallet\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-11-09 13:53+0100\n" +"POT-Creation-Date: 2016-11-09 22:39+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/selenium/test.py b/selenium/test.py index 8d09d8bd2..d5cfad1f5 100644 --- a/selenium/test.py +++ b/selenium/test.py @@ -101,8 +101,10 @@ def make_donation(client, amount_menuentry=None): logger.error("value '" + str(amount_value) + "' is not offered by this shop to donate, please adapt it") sys.exit(1) form.submit() # amount and receiver chosen + wait = WebDriverWait(client, 10) try: - confirm_taler = client.find_element(By.XPATH, "//form//input[@type='button']") + confirm_taler = wait.until(EC.element_to_be_clickable((By.XPATH, "//form//input[@type='button']"))) + logger.info("confirm_taler: %s" % confirm_taler.get_attribute("outerHTML")) except NoSuchElementException: logger.error('Could not trigger contract on donation shop') sys.exit(1) @@ -110,7 +112,6 @@ def make_donation(client, amount_menuentry=None): # explicit get() is needed, it hangs (sometimes) otherwise time.sleep(1) client.get(client.current_url) - wait = WebDriverWait(client, 10) try: confirm_pay = wait.until(EC.element_to_be_clickable((By.XPATH, "//button[@class='accept']"))) except TimeoutException: @@ -124,9 +125,18 @@ def buy_article(client): client.get(parse.urljoin(taler_baseurl, "blog")) wait = WebDriverWait(client, 10) try: - teaser = wait.until(EC.element_to_be_clickable((By.XPATH, '//a[@href="/essay/Foreword"]'))) - actions = ActionChains(client); - actions.move_to_element(teaser).click().perform() + further_teaser = wait.until(EC.element_to_be_clickable((By.XPATH, '//h3[a[starts-with(@href, "/essay")]][4]'))) + teaser = wait.until(EC.element_to_be_clickable((By.XPATH, '//h3/a[@href="/essay/Foreword"]'))) + # NOTE: we need to scroll the browser a few inches deeper respect + # to the element which is to be clicked, otherwise we hit the lang + # bar at the bottom.. + # Unfortunately, just retrieving the element to click and click it + # did NOT work. + actions = ActionChains(client) + actions.move_to_element(further_teaser) + actions.move_to_element(teaser) + actions.click(teaser) + actions.perform() except (NoSuchElementException, TimeoutException): logger.error('Could not choose "Foreword" chapter on blog') sys.exit(1) @@ -261,7 +271,8 @@ logger.info("Withdrawing..") withdraw(client, "10.00 PUDOS") # switch_base() # inducing error logger.info("Making donations..") -time.sleep(5) # FIXME better wait for coins to be downloaded +# FIXME: wait for coins via a more suitable way +time.sleep(3) make_donation(client, "1.0 PUDOS") logger.info("Buying article..") buy_article(client) -- cgit v1.2.3