@@ -541,3 +541,32 @@ func TestBrowserContextOnResponse(t *testing.T) {
541
541
require .NoError (t , err )
542
542
require .Equal (t , "<!DOCTYPE html>\n <title>Woof-Woof</title>\n " , string (body ))
543
543
}
544
+
545
+ func TestBrowserContextGetSecureCookies (t * testing.T ) {
546
+ BeforeEach (t , playwright.BrowserNewContextOptions {
547
+ IgnoreHttpsErrors : playwright .Bool (true ), // webkit requires https to support secure cookies
548
+ })
549
+
550
+ tlsServer := newTestServer (true )
551
+ defer tlsServer .testServer .Close ()
552
+
553
+ tlsServer .SetRoute ("/cookie.html" , func (w http.ResponseWriter , r * http.Request ) {
554
+ // set secure cookie
555
+ cookie := http.Cookie {
556
+ Name : "foo" ,
557
+ Value : "bar" ,
558
+ Secure : true ,
559
+ HttpOnly : true ,
560
+ }
561
+ http .SetCookie (w , & cookie )
562
+ })
563
+
564
+ _ , err := page .Goto (fmt .Sprintf ("%s/cookie.html" , tlsServer .PREFIX ))
565
+ require .NoError (t , err )
566
+ cookies , err := context .Cookies ()
567
+ require .NoError (t , err )
568
+ require .Equal (t , 1 , len (cookies ))
569
+ require .Equal (t , "foo" , cookies [0 ].Name )
570
+ require .Equal (t , "bar" , cookies [0 ].Value )
571
+ require .True (t , cookies [0 ].Secure )
572
+ }
0 commit comments