Skip to content

Commit

Permalink
Add WaitForNavigation with Click
Browse files Browse the repository at this point in the history
  • Loading branch information
ankur22 committed Jun 29, 2023
1 parent c959b57 commit 3015c48
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/frame_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package tests

import (
"context"
"net/http"
"strconv"
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -132,7 +134,14 @@ func TestFrameNoPanicNavigateAndClickOnPageWithIFrames(t *testing.T) {
_, err := p.Goto(tb.staticURL("iframe_home.html"), nil)
require.NoError(t, err)

err = p.Click(`a[href="/iframeSignIn"]`, nil)
ctx, cancel := context.WithTimeout(tb.context(), 5*time.Second)
defer cancel()

err = tb.run(
ctx,
func() error { return p.Click(`a[href="/iframeSignIn"]`, nil) },
func() error { _, err := p.WaitForNavigation(nil); return err },
)
require.NoError(t, err)

result := p.TextContent("#doneDiv", nil)
Expand Down

0 comments on commit 3015c48

Please sign in to comment.