From 33ad111b47c0b27a3f4bc5114388468cd59895f8 Mon Sep 17 00:00:00 2001 From: Brian Reilly Date: Thu, 6 Jul 2017 11:37:39 -0400 Subject: [PATCH] Improved reliability of test for creating a billing project. Don't hide the test failure if there is a problem capturing a screenshot. Avoid stalled headless chrome nodes (https://github.com/SeleniumHQ/docker-selenium/issues/87). --- automation/docker/hub-compose.yml | 1 + .../pages/BillingManagementPage.scala | 1 - .../dsde/firecloud/pages/WebBrowserSpec.scala | 20 +++++++++++++------ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/automation/docker/hub-compose.yml b/automation/docker/hub-compose.yml index d0f8e42e22..edbac83ff5 100644 --- a/automation/docker/hub-compose.yml +++ b/automation/docker/hub-compose.yml @@ -19,6 +19,7 @@ services: environment: HUB_PORT_4444_TCP_ADDR: hub HUB_PORT_4444_TCP_PORT: 4444 + DBUS_SESSION_BUS_ADDRESS: /dev/null extra_hosts: - "firecloud-fiab.dsde-$ENV.broadinstitute.org:$DOCKERHOST" - "firecloud-orchestration-fiab.dsde-$ENV.broadinstitute.org:$DOCKERHOST" \ No newline at end of file diff --git a/automation/src/test/scala/org/broadinstitute/dsde/firecloud/pages/BillingManagementPage.scala b/automation/src/test/scala/org/broadinstitute/dsde/firecloud/pages/BillingManagementPage.scala index b1b1ab3aa0..1725f047b1 100644 --- a/automation/src/test/scala/org/broadinstitute/dsde/firecloud/pages/BillingManagementPage.scala +++ b/automation/src/test/scala/org/broadinstitute/dsde/firecloud/pages/BillingManagementPage.scala @@ -107,7 +107,6 @@ class CreateBillingProjectModal(implicit webDriver: WebDriver) extends FireCloud ui.fillProjectName(projectName) ui.selectBillingAccount(billingAccountName) ui.clickCreateButton() - await toggle spinner } diff --git a/automation/src/test/scala/org/broadinstitute/dsde/firecloud/pages/WebBrowserSpec.scala b/automation/src/test/scala/org/broadinstitute/dsde/firecloud/pages/WebBrowserSpec.scala index 2e09a5b14c..5154d400c6 100644 --- a/automation/src/test/scala/org/broadinstitute/dsde/firecloud/pages/WebBrowserSpec.scala +++ b/automation/src/test/scala/org/broadinstitute/dsde/firecloud/pages/WebBrowserSpec.scala @@ -62,6 +62,9 @@ trait WebBrowserSpec extends WebBrowserUtil with LazyLogging { self: Suite => withScreenshot { testCode(driver) } + } catch { + case t: Throwable => + logger.error(s"Failure in $suiteName", t) } finally { driver.quit() } @@ -108,14 +111,19 @@ trait WebBrowserSpec extends WebBrowserUtil with LazyLogging { self: Suite => try { f } catch { - case e: Throwable => + case t: Throwable => val date = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss-SSS").format(new java.util.Date()) - val tmpFile = new Augmenter().augment(driver).asInstanceOf[TakesScreenshot].getScreenshotAs(OutputType.FILE) val fileName = s"failure_screenshots/${date}_$suiteName.png" - logger.error(s"Failure screenshot saved to $fileName") - new FileOutputStream(new File(fileName)).getChannel.transferFrom( - new FileInputStream(tmpFile).getChannel, 0, Long.MaxValue) - throw e + try { + val tmpFile = new Augmenter().augment(driver).asInstanceOf[TakesScreenshot].getScreenshotAs(OutputType.FILE) + logger.error(s"Failure screenshot saved to $fileName") + new FileOutputStream(new File(fileName)).getChannel.transferFrom( + new FileInputStream(tmpFile).getChannel, 0, Long.MaxValue) + } catch { + case t: Throwable => + logger.error(s"FAILED TO SAVE SCREENSHOT $fileName: ${t.getMessage}") + } + throw t } } }