Skip to content

Commit

Permalink
Added wait
Browse files Browse the repository at this point in the history
  • Loading branch information
therealryan committed Oct 21, 2024
1 parent f6721e9 commit 85ffc10
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.io.StringReader;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
Expand Down Expand Up @@ -366,10 +367,18 @@ public IndexSequence dragToInclude( String tag ) {
*/
public IndexSequence hasInteractionSummary( String expected ) {
trace( "hasInteractionSummary", expected );
assertEquals( expected, driver
.findElements( By.id( "interaction_summary" ) ).stream()
.map( WebElement::getText )
.collect( joining( "\n" ) ),
assertEquals( expected,
// the interaction summary is updated as flow details pages are downloaded in
// the background, so we might need to wait for it to settle
new WebDriverWait( driver, Duration.ofSeconds( 5 ) )
.pollingEvery( Duration.ofSeconds( 1 ) )
.withMessage( "Failed to find expected interaction summary" )
.until( d -> Optional
.ofNullable( d.findElements( By.id( "interaction_summary" ) ).stream()
.map( WebElement::getText )
.collect( joining( "\n" ) ) )
.filter( s -> expected.equals( s ) )
.orElse( null ) ),
"Interaction summary" );
return self();
}
Expand Down

0 comments on commit 85ffc10

Please sign in to comment.