Skip to content

Commit

Permalink
Improved reliability of test for creating a billing project.
Browse files Browse the repository at this point in the history
Don't hide the test failure if there is a problem capturing a screenshot.
Avoid stalled headless chrome nodes (SeleniumHQ/docker-selenium#87).
  • Loading branch information
breilly2 committed Jul 6, 2017
1 parent b4bb4bc commit 33ad111
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions automation/docker/hub-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ class CreateBillingProjectModal(implicit webDriver: WebDriver) extends FireCloud
ui.fillProjectName(projectName)
ui.selectBillingAccount(billingAccountName)
ui.clickCreateButton()
await toggle spinner
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down Expand Up @@ -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
}
}
}

0 comments on commit 33ad111

Please sign in to comment.