Skip to content

Commit b754960

Browse files
authored
Fix unpack params with asasalint (#649)
* fix unpack params with asasalint * add more MustWait test
1 parent 55b49b9 commit b754960

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

element_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,23 @@ func TestElementEqual(t *testing.T) {
781781
g.False(el1.MustEqual(el3))
782782
}
783783

784+
func TestElementMustWait(t *testing.T) {
785+
g := setup(t)
786+
787+
p := g.page.MustNavigate(g.srcFile("fixtures/describe.html"))
788+
e1 := p.MustElement("body > ul > li")
789+
g.Eq(e1.MustText(), "coffee")
790+
791+
params := []interface{}{1, 3, 4}
792+
go func() {
793+
utils.Sleep(0.3)
794+
e1.MustEval(`(a, b, c) => this.innerText = 'x'.repeat(a + b + c)`, params...)
795+
}()
796+
797+
e1.MustWait(`(a, b, c) => this.innerText.length === (a + b + c)`, params...)
798+
g.Eq(e1.MustText(), "xxxxxxxx")
799+
}
800+
784801
func TestElementFromPointErr(t *testing.T) {
785802
g := setup(t)
786803

must.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@ func (el *Element) MustWaitStable() *Element {
867867

868868
// MustWait is similar to Element.Wait
869869
func (el *Element) MustWait(js string, params ...interface{}) *Element {
870-
el.e(el.Wait(Eval(js, params)))
870+
el.e(el.Wait(Eval(js, params...)))
871871
return el
872872
}
873873

page_eval_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ func TestPageEval(t *testing.T) {
3838
(a, b) => a + b
3939
`, 1, 2).Int())
4040

41+
g.Eq(10, page.MustEval(`(a, b, c, d) => a + b + c + d`, 1, 2, 3, 4).Int())
42+
4143
g.Eq(page.MustEval(`function() {
4244
return 11
4345
}`).Int(), 11)

0 commit comments

Comments
 (0)