Skip to content

Commit

Permalink
logging and error trapping around sign-in button wait (#1452)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidangb committed Nov 8, 2018
1 parent 4775b31 commit 24cd8e0
Showing 1 changed file with 23 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,29 @@ import scala.util.{Failure, Success, Try}
class SignInPage(val baseUrl: String)(implicit webDriver: WebDriver) extends FireCloudView with Page with PageUtil[SignInPage] {

override def awaitReady(): Unit = {
signInButton awaitReady()
/*
* The FireCloud not-signed-in page renders the sign-in button while it is still doing some
* initialization. If you log the status of the App components state for user-status and auth2
* with each render, you see the following sequence:
* '#{}' ''
* '#{}' '[object Object]'
* '#{:refresh-token-saved}' '[object Object]'
* If the page is used before this is complete (for example window.forceSignedIn adding
* :signed-in to user-status), bad things happen (for example :signed-in being dropped from
* user-status). Instead of reworking the sign-in logic for a case that (for the most part) only
* a computer will operate fast enough to encounter, we'll just slow the computer down a little.
*/
Thread.sleep(500)
log.info("SignInPage.awaitReady starting to wait for signInButton ... ")

Try (signInButton awaitReady()) match {
case Success(_) =>
log.info("SignInPage.awaitReady believes signInButton is ready; sleeping for 500ms ... ")

/*
* The FireCloud not-signed-in page renders the sign-in button while it is still doing some
* initialization. If you log the status of the App components state for user-status and auth2
* with each render, you see the following sequence:
* '#{}' ''
* '#{}' '[object Object]'
* '#{:refresh-token-saved}' '[object Object]'
* If the page is used before this is complete (for example window.forceSignedIn adding
* :signed-in to user-status), bad things happen (for example :signed-in being dropped from
* user-status). Instead of reworking the sign-in logic for a case that (for the most part) only
* a computer will operate fast enough to encounter, we'll just slow the computer down a little.
*/
Thread.sleep(500)
case Failure(f) =>
log.error(s"SignInPage timed out waiting for signInButton to be ready: ${f.getMessage}")
throw(f)
}
}

override val url: String = baseUrl
Expand Down

0 comments on commit 24cd8e0

Please sign in to comment.