This repository was archived by the owner on Jan 30, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package tests
3
3
import (
4
4
"testing"
5
5
6
+ "github.com/stretchr/testify/assert"
6
7
"github.com/stretchr/testify/require"
7
8
)
8
9
@@ -21,3 +22,41 @@ func TestFramePress(t *testing.T) {
21
22
22
23
require .Equal (t , "AbC" , f .InputValue ("#text1" , nil ))
23
24
}
25
+
26
+ func TestFrameDismissDialogBox (t * testing.T ) {
27
+
28
+ t .Parallel ()
29
+
30
+ tests := []struct {
31
+ name string
32
+ }{
33
+ {
34
+ name : "alert" ,
35
+ },
36
+ }
37
+
38
+ for _ , tt := range tests {
39
+ t .Run (tt .name , func (t * testing.T ) {
40
+ t .Parallel ()
41
+
42
+ b := newTestBrowser (t , withFileServer ())
43
+
44
+ p := b .NewPage (nil )
45
+
46
+ err := b .await (func () error {
47
+ opts := b .toGojaValue (struct {
48
+ WaitUntil string `js:"waitUntil"`
49
+ }{
50
+ WaitUntil : "networkidle" ,
51
+ })
52
+ b .promise (p .Goto (b .staticURL ("dialog.html?dialogType=" + tt .name ), opts )).then (func () {
53
+ result := p .TextContent ("#text" , nil )
54
+ assert .EqualValues (t , "Hello World" , result )
55
+ })
56
+
57
+ return nil
58
+ })
59
+ require .NoError (t , err )
60
+ })
61
+ }
62
+ }
Original file line number Diff line number Diff line change
1
+ < html lang ="en ">
2
+ < head >
3
+ < script >
4
+ const queryString = window . location . search ;
5
+ const urlParams = new URLSearchParams ( queryString ) ;
6
+ const dialogType = urlParams . get ( 'dialogType' )
7
+
8
+ switch ( dialogType ) {
9
+ case "alert" :
10
+ alert ( "Click accept" ) ;
11
+ break ;
12
+ }
13
+ </ script >
14
+ </ head >
15
+ < body >
16
+ < div id ='text '> Hello World</ div >
17
+ </ body >
18
+ </ html >
You can’t perform that action at this time.
0 commit comments