code: public void cookieMatches(double seconds, String cookieName, String expectedCookiePattern) {
          double end = System.currentTimeMillis() + (seconds * 1000);
          while (app.is().cookiePresent(cookieName) && System.currentTimeMillis() < end) ;
          if (app.is().cookiePresent(cookieName)) {
              while (!app.get().cookieValue(cookieName).matches(expectedCookiePattern) && System.currentTimeMillis() < end) ;
          }
          double timeTook = Math.min((seconds * 1000) - (end - System.currentTimeMillis()), seconds * 1000) / 1000;
          checkCookieMatches(cookieName, expectedCookiePattern, seconds, timeTook);
      }
docs: Waits up to the provided wait time for a cookies with the provided name has a value matching the
  expected pattern. This information will be logged and recorded, with a
  screenshot for traceability and added debugging support.
  
  @param cookieName            the name of the cookie
  @param expectedCookiePattern the expected value of the cookie
  @param seconds               the number of seconds to wait