runRoutine = function(tries, done) {
        browser.navigate()
            .to(TEST_SERVER + '/' + testPath)
            .then(function() {
              waitForTest(function(status) {
                expect(status).toBeSuccess();
                done();
              }, function(err) {
                // If browser test execution times out try up to trial times.
                if (err.message &&
                    err.message.match(RETRY_MESSAGE_REGEX) &&
                    tries > 0) {
                  runRoutine(tries - 1, done);
                } else {
                  done.fail(err);
                }
              });
            }, function(err) {
              // If browser test execution times out try up to trial times.
              if (err.message &&
                  err.message.match(RETRY_MESSAGE_REGEX) &&
                  tries > 0) {
                runRoutine(tries - 1, done);
              } else {
                done.fail(err);
              }
            });
      }
Runs the test routines for a given test path and retries up to a
certain number of times on timeout.
@param {number} tries The number of times to retry on timeout.
@param {function()} done The function to run on completion.