From af52f13e22465ade4c839963d80398c8ee216573 Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Fri, 16 Jun 2017 22:02:03 -0700 Subject: [PATCH] Add screenshot test to verify clipping of offscreen areas. --- test/golden/screenshot-offscreen-clip.png | Bin 0 -> 1513 bytes test/test.js | 15 +++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 test/golden/screenshot-offscreen-clip.png diff --git a/test/golden/screenshot-offscreen-clip.png b/test/golden/screenshot-offscreen-clip.png new file mode 100644 index 0000000000000000000000000000000000000000..fac15c30e0b3c92ff2560ab1763eb95837fb4ae0 GIT binary patch literal 1513 zcmbVM{WsGK82{?+GA0@2Wt8%=d(*X)mx)}n3D;eQ@^Ysrc7B_=lM&N=rFxZQI;&-489c|PZJ&ht4B!yk7H3Ne8I z008yz#ssJ*xKWzh)IDM9Mi2mOt@6Qm1f{U&*+g$J(ukg6)3k$4#<2KdB5;=jff4{_ zgQI4_mZ45VF<)-`i!x_v@xoW2^#MZ@OY8kR1M?#pg;yXhQBQ9oXnW^_+TPLhW3u`M ze2bj1;m$eoK*6DDc7YvnGM%@iYQ8YOD2qsZLCIOxg8hE5$X z&kw>F0YpkZyjrCuKit-dP9^+^^e!t__218En^l}nNYML<>lj`k7JL*s2LuLAlIsr- z!CqvZ)$*b>yZ=FU{yFZc{|(v^jg9r4o#?sbBVw`GpFl86aCdPr(bCdFTwEP4QZzNW z5)_yc$73Ej@YwE0*lN8xNuFH`g;QRRn7CBrp!=t(?3@R~K_;$lz5_+w@`ykN5pv#a<5{vzZ1#EwQz!AFe&a-VC#~wJqjyp{T9b z81Xi_w?I@;u&87?9LW(}5cz}Fk}5twtE&qabgI*E#1}Ebhu<>Xa85;9Y(I*ELZQ!7 z*JJQ;)H5u(b7{Wke7(Qsj_d3Yo!_5lDl&e(g80&sD7`1E)I$vv1$wsAq|pUg-P4HBzLqmh|!z`1@bW5|cvH~`_ zld4iVT2Az_rsw%er80Sy?*LulJ9va>9{gHZnv=Y=FVXe(L4ZEyiagVO?G_vdUx3%G zUf=BYRboln_3kZsn`l1gh)z0t2=*2P`$?GUmk9OMU#~e{jD9Es(Pf|jN`rr- zR7OfB`%!q@CwKat&L~Su%PrDI_Nt4k`S!xXLOoN{t4d{RZf-8grPXMkg95`D_%yf& zRkkdD$~vi4IiyW*yUb!49CmaR#6CHllw{E1Thz1US~za8$g_H|-|uvzN@lIrYG`a+ z5GyFoDzBqaQBf0%t5q}W$0%<2wW%<48G1a858uVR*Jd2bJRiz*kA%s2HGk&^-k^Q! z3zJVRp6MAIW6p_d+|B}3wY6pSMF_OQK}lh=7E5G0eMXT%ls-4{n@dy;rHwdd-R$FoY@c%qY~F1)dkX-9 zAeCTu-IZ5T>50`vod~iKr_Zee)z#GqJ3D%Z%p+s5T$C(Wi6$~VXz*aQ$EovvEZF*Q zIlcOMuh;8Hj(2+d`}Z~6MVdds$nNT)x@;s!Cnvf(t?cGy4(}+Mn)}4hETlTbc33Jk z=*1byOvs?Gbwx!5DLPv7CQ@kZ6)vhAmuC0BZ5J+mcAJI4U^xs1Bk4%Q+UxGbV65)r z433mLinXMpx{y@2 ztj3gKm>ih+G>RSW`woxCYXC?i9V2sdFWH2lMSsWOMfD2@e6TnS4^7JY2XG&>`2YX_ literal 0 HcmV?d00001 diff --git a/test/test.js b/test/test.js index d7fd5e64c87..7dc45ea701b 100644 --- a/test/test.js +++ b/test/test.js @@ -215,7 +215,6 @@ describe('Puppeteer', function() { var screenshot = await page.screenshot(); expect(screenshot).toBeGolden('screenshot-sanity.png'); })); - it('should clip rect', SX(async function() { await page.setViewportSize({width: 500, height: 500}); await page.navigate(STATIC_PREFIX + '/grid.html'); @@ -229,7 +228,19 @@ describe('Puppeteer', function() { }); expect(screenshot).toBeGolden('screenshot-clip-rect.png'); })); - + it('should work for offscreen clip', SX(async function() { + await page.setViewportSize({width: 500, height: 500}); + await page.navigate(STATIC_PREFIX + '/grid.html'); + var screenshot = await page.screenshot({ + clip: { + x: 50, + y: 600, + width: 100, + height: 100 + } + }); + expect(screenshot).toBeGolden('screenshot-offscreen-clip.png'); + })); it('should run in parallel', SX(async function() { await page.setViewportSize({width: 500, height: 500}); await page.navigate(STATIC_PREFIX + '/grid.html');