diff --git a/element_test.go b/element_test.go index 00d5ca73..11285ee5 100644 --- a/element_test.go +++ b/element_test.go @@ -431,15 +431,18 @@ func (s *S) TestWaitInvisible() { func (s *S) TestWaitStable() { p := s.page.MustNavigate(srcFile("fixtures/wait-stable.html")) el := p.MustElement("button") - el.MustWaitStable() - el.MustClick() - p.MustHas("[event=click]") + start := time.Now() + el.MustWaitStable().MustClick() + s.Greater(time.Since(start), time.Second) ctx, cancel := context.WithCancel(context.Background()) - go func() { - utils.Sleep(0.2) - cancel() - }() + s.mc.stub(1, proto.DOMGetContentQuads{}, func(send func() ([]byte, error)) ([]byte, error) { + go func() { + utils.Sleep(0.1) + cancel() + }() + return send() + }) s.Error(el.Context(ctx).WaitStable(time.Minute)) s.Panics(func() { diff --git a/fixtures/wait-stable.html b/fixtures/wait-stable.html index 1063e204..43b877c7 100644 --- a/fixtures/wait-stable.html +++ b/fixtures/wait-stable.html @@ -1,7 +1,7 @@ - + diff --git a/must.go b/must.go index 9f5e246d..65871916 100644 --- a/must.go +++ b/must.go @@ -750,7 +750,7 @@ func (el *Element) MustWaitLoad() *Element { // MustWaitStable is similar to WaitStable func (el *Element) MustWaitStable() *Element { - utils.E(el.WaitStable(100 * time.Millisecond)) + utils.E(el.WaitStable(300 * time.Millisecond)) return el }