From c187f43391b1d2e36a4c13861b0ddf8896d03ed9 Mon Sep 17 00:00:00 2001 From: Yasar Luo <60771720+yasarluo@users.noreply.github.com> Date: Thu, 16 Jul 2020 17:12:10 +0800 Subject: [PATCH] add missed saving file for ScreentshotFullPage --- page_test.go | 4 ++++ sugar.go | 1 + 2 files changed, 5 insertions(+) diff --git a/page_test.go b/page_test.go index b8585cb1..7d4cd218 100644 --- a/page_test.go +++ b/page_test.go @@ -410,6 +410,10 @@ func (s *S) TestScreenshotFullPage() { res = p.Eval(`({w: innerWidth, h: innerHeight})`) s.EqualValues(800, res.Get("w").Int()) s.EqualValues(600, res.Get("h").Int()) + + kit.E(kit.Remove(slash("tmp/screenshots"))) + p.ScreenshotFullPage("") + s.Len(kit.Walk(slash("tmp/screenshots/*")).MustList(), 1) } func (s *S) TestScreenshotFullPageInit() { diff --git a/sugar.go b/sugar.go index 3e22e15b..100df056 100644 --- a/sugar.go +++ b/sugar.go @@ -212,6 +212,7 @@ func (p *Page) Screenshot(toFile ...string) []byte { func (p *Page) ScreenshotFullPage(toFile ...string) []byte { bin, err := p.ScreenshotE(true, &proto.PageCaptureScreenshot{}) kit.E(err) + kit.E(saveScreenshot(bin, toFile)) return bin }