public void cookieEquals ( double seconds , String cookieName , String expectedCookieValue ) { double end = System . currentTimeMillis ( ) + ( seconds * 1000 ) ; while ( app . is ( ) . cookiePresent ( cookieName ) && System . currentTimeMillis ( ) < end ) ; if ( app . is ( ) . cookiePresent ( cookieName ) ) { while ( ! app . get ( ) . cookieValue ( cookieName ) . equals ( expectedCookieValue ) && System . currentTimeMillis ( ) < end ) ; } double timeTook = Math . min ( ( seconds * 1000 ) - ( end - System . currentTimeMillis ( ) ) , seconds * 1000 ) / 1000 ; checkCookieEquals ( cookieName , expectedCookieValue , seconds , timeTook ) ; }
Waits up to the provided wait time for a cookies with the provided name has a value equal to the expected value . This information will be logged and recorded with a screenshot for traceability and added debugging support .