From 018727db8ef8044e84ce5e0369e5c5ebff7cb3fe Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Fri, 22 Jan 2021 06:51:59 -0800 Subject: [PATCH] test: add a test for focused input screenshot (#5060) Fails in various configurations. --- .../chromium-darwin/focused-input.png | Bin 0 -> 5549 bytes .../chromium-linux/focused-input.png | Bin 0 -> 5566 bytes .../chromium-win32/focused-input.png | Bin 0 -> 5566 bytes .../firefox-darwin/focused-input.png | Bin 0 -> 5444 bytes .../firefox-linux/focused-input.png | Bin 0 -> 5602 bytes .../firefox-win32/focused-input.png | Bin 0 -> 5387 bytes .../webkit-darwin/focused-input.png | Bin 0 -> 19252 bytes .../webkit-linux/focused-input.png | Bin 0 -> 5805 bytes .../webkit-win32/focused-input.png | Bin 0 -> 4662 bytes test/headful.spec.ts | 30 +++++++++++++++++- 10 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/chromium-darwin/focused-input.png create mode 100644 test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/chromium-linux/focused-input.png create mode 100644 test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/chromium-win32/focused-input.png create mode 100644 test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/firefox-darwin/focused-input.png create mode 100644 test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/firefox-linux/focused-input.png create mode 100644 test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/firefox-win32/focused-input.png create mode 100644 test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/webkit-darwin/focused-input.png create mode 100644 test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/webkit-linux/focused-input.png create mode 100644 test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/webkit-win32/focused-input.png diff --git a/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/chromium-darwin/focused-input.png b/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/chromium-darwin/focused-input.png new file mode 100644 index 0000000000000000000000000000000000000000..327fce85373f711a318d02c046fec4fcdf2938a8 GIT binary patch literal 5549 zcmeAS@N?(olHy`uVBq!ia0y~yU+}r zLn`LHy{qUQ7szn@;b*^QgBXFZ)~!dUO7{Ggn|1t;z+wJ{Id(W2kBg*yDW3oztRUU z-jvOWyR-L-+_f{?_20WX0Hqov*YY&H-}g_7-~asM=imDue{SEdzqNbE>eVgwcW#SQ3r~!e}6jwiAG9U^Ea$ z17Wn;JlZ`N?IVqL6oDn-XdsLR!sxikX!pPYm<`D4BmHAIE8%nXedo-HAQL=Y{an^L HB{Ts52!c=( literal 0 HcmV?d00001 diff --git a/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/chromium-linux/focused-input.png b/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/chromium-linux/focused-input.png new file mode 100644 index 0000000000000000000000000000000000000000..ca5082b3bfc7d3d477082b52b1ab15b5beb9c09e GIT binary patch literal 5566 zcmeAS@N?(olHy`uVBq!ia0y~yUZ@5XadCZT(~SN6{GQEY25K~zebmJF z@_*SKJ9kRne)}z;`ayJTe0=}!-@kXJgUmmZmd{{gYb!f{{`|)eA12P3J6ASKyyj%y zcInq&t8}KH{`l#W(RUf3!iJk~cpHFrCHENG+1dU3nXpl!+OE<5Q2l#7pzMMBCzKU{ zG%okz^$ZD;H|{a)h|xPPk^H7?x8X5~%O-#CxqjfCH-G+diU0TFf%Z4-zk0rw{oMKU z$IEuhzW(}40OaAAm@~GFK*@x#YUT%b@7}ervXb)m_kaBN?_Yu04^D@zzPe-AE~(jP z)81)<{IEI7=if_EB52U*ZvY9Phdv1oMvJ#morF^MXb6plkOC;v;V%G3lgVfZjV2S~ z8VjR&Wi+ph=9SUB0;*Ms>RpT$7^4NoXn`@BS4Inr(eC@`=m*vTxX~(--c{s&hGTca URO0h%DnZ4Pr>mdKI;Vst0Gx!6hX4Qo literal 0 HcmV?d00001 diff --git a/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/chromium-win32/focused-input.png b/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/chromium-win32/focused-input.png new file mode 100644 index 0000000000000000000000000000000000000000..ca5082b3bfc7d3d477082b52b1ab15b5beb9c09e GIT binary patch literal 5566 zcmeAS@N?(olHy`uVBq!ia0y~yUZ@5XadCZT(~SN6{GQEY25K~zebmJF z@_*SKJ9kRne)}z;`ayJTe0=}!-@kXJgUmmZmd{{gYb!f{{`|)eA12P3J6ASKyyj%y zcInq&t8}KH{`l#W(RUf3!iJk~cpHFrCHENG+1dU3nXpl!+OE<5Q2l#7pzMMBCzKU{ zG%okz^$ZD;H|{a)h|xPPk^H7?x8X5~%O-#CxqjfCH-G+diU0TFf%Z4-zk0rw{oMKU z$IEuhzW(}40OaAAm@~GFK*@x#YUT%b@7}ervXb)m_kaBN?_Yu04^D@zzPe-AE~(jP z)81)<{IEI7=if_EB52U*ZvY9Phdv1oMvJ#morF^MXb6plkOC;v;V%G3lgVfZjV2S~ z8VjR&Wi+ph=9SUB0;*Ms>RpT$7^4NoXn`@BS4Inr(eC@`=m*vTxX~(--c{s&hGTca URO0h%DnZ4Pr>mdKI;Vst0Gx!6hX4Qo literal 0 HcmV?d00001 diff --git a/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/firefox-darwin/focused-input.png b/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/firefox-darwin/focused-input.png new file mode 100644 index 0000000000000000000000000000000000000000..ee6ca12b5c869bc66d7fb3dfd2b606e41f7adaa5 GIT binary patch literal 5444 zcmeAS@N?(olHy`uVBq!ia0y~yUatbh@ym0=U#WpNPAa7~Z_B%t8K zzyhQi3>XDKqK8-e}4Lx`fZM^|MT#D*&xw>Icx`BCZy~I>HAO>&ivr^ z^ZuL8!eDcrz2Rz*zn{K&w;BTzQ2NX*S%!yUObS5e0UO2%sbFIpD$Uss98Ubq@kbe= zNSGng4Q%}kb%sqn3>-k!2L22wl3=$a%wsrVgkb`c!fB2MpgM-nEDqBkUU&YwH*?zMX(L+cKPa!OhK}kU#J`m+ipgOgo9l^y8Bu?makt zAILcZ5Pv(&0E;ptf*sD#!r3q?IT{GSG%y+nqk%A5CNPW^jG+2pw00N`gwb{a!)Rj( zm<>h)VKfj%`wpWWs0Ls*80|%l2Eu4Z5ts%>17S1}Na!tpdE{u_D-IMh1?_H~4_84NdQb7}l>lSI1Uo0rt@bCPo1@ zK?a~sh-qLCfpxMt0M#e3GAZ~dfjtYhf>8iw97h9?b%2Y-VTKC>3y=x6mu5zSoZVQz zNfu}k*hxv&Fx!vd4v7LYhP?LLoc7u~^_6>$R4Y9EcmDWB*>4{oKK^&l9~4$~1?kKW z-hMP$_g?N;*^T{wFFu*``}=La-#h+&O|1D9JsC>g@qT~! z*v_uju6OzK>E3T7fbtJQ)0q{3G{cAgs#uc+-ZV2RNhnv1hR|pTf%6ys!gn;8j3$%O zWI|j+Wi+ph=9SUBGMZO_jn>gX7!3rpZtQ67Fj_l|)()cu<7mM+S}p0L5E`z75pUXO@geCy~sF>ye literal 0 HcmV?d00001 diff --git a/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/firefox-win32/focused-input.png b/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/firefox-win32/focused-input.png new file mode 100644 index 0000000000000000000000000000000000000000..ea65d7a79f0232db37751ca4c270a430d7700bee GIT binary patch literal 5387 zcmeAS@N?(olHy`uVBq!ia0y~yUqnc+zb*t89b3`I^1AjLNX7%UaR7Ugg>%n@K<1d5rlIQVfi02vI@ObY5O4nRf& zFXIGZDjL^2ok`)(6l;(NK`waM2V^jq0ey4!UlNFU=krQ=5RE@9@CMYVu4aLcF#s@htb+$w00OR7)NUdv~jD^ ff^n!8jNdr>*p@Gq`Fp+zl&C#j{an^LB{Ts5IFKSh literal 0 HcmV?d00001 diff --git a/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/webkit-darwin/focused-input.png b/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/webkit-darwin/focused-input.png new file mode 100644 index 0000000000000000000000000000000000000000..0526762bf922085b4238470f09dea62c3d04d2e6 GIT binary patch literal 19252 zcmeHPVN4Te82;{P@mh4032F?^YJobE!4lmx>5!A*N;MTkA^p*?x@9hI4#>XKOeHjj?GpCvRwB^ZNK(5BZ8DsDmBdr2kh7B!O^V3w$z=APR@7Z^aSBv z%?iC28WbrMqiry+Zxy#OXk54W33J!@TI4cr<@V06-V#5EMo-o)8CCq6+S_ERGkn;Y zH(Su%5S^X+XXulGCo{6@oT=dN!&8s?nq7lOqM?KDTo8@DtB2!f?5S$Zh|LD4?at`U zLT#;<^;+vUkq->+FBD6yK#-o4%xK!R4tr!;U8V>&R{Zeyi-{xJuE>mL_y(+#Gk(8+ zup_dX)lui|c5B1aF|Ski<#f5&xEfNQaFr%^>;n(qBaJx;Z0&z(ipr?~qzt9xYp*7)NIzt?rw6G*M`Mjfr)_xe)I(Z9SEk@~vE8-@1n z=G2nJX9UwoPcpauddrN2cWFo3l*ZKBaYe$vIoQ7^Hk+CjM_#-etx==bJHMBh{#oo_ zZNEh!;onvU{n6FFD{**g+EPTL^V^!UB?5K}4%m?oa>b5d6*yr1%g;zm$xTrVOb9%L z!xlmgzlZP+VPFAJz(@(O&3}9V6aWjfBP1Fj(J0jSA*TSK067K7 zDa0u=BpQWPOu!U?DF9OdrV#%+&IxJ&1poyA1poyA1%Wbyd=P8_)d#3PK=lEt4^Vx8 z>VuFAWpK?19(=u?J#L tz(oLsxGi8+39Kr4o_XE>oXfE>6f+cEdh>MFNBlol8Fua|?kuu2{RdRluF3!a literal 0 HcmV?d00001 diff --git a/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/webkit-linux/focused-input.png b/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/webkit-linux/focused-input.png new file mode 100644 index 0000000000000000000000000000000000000000..f76edad846f564d68fe624236e85a311e9097015 GIT binary patch literal 5805 zcmeAS@N?(olHy`uVBq!ia0y~yUK9HUP@Zn>qLN_y2ym{_&UT*Tr|TZ+mm3 zyZZRar;9RkIC2XngLSqpl-I^;nz3xPiK5T)wfa|D8itlYTDnD z8_W-4M+D&wH+0EK2D8DDabVJ|5{8)DJN9csPV&+G61eD=qO&)I#<#w)jewSL^p9ezA|dHtU6Z+<-7E35}f01FVdQ&MBb@0M}|9Pyhe` literal 0 HcmV?d00001 diff --git a/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/webkit-win32/focused-input.png b/test/__snapshots__/headful/focused-input-should-produce-the-same-screenshot/webkit-win32/focused-input.png new file mode 100644 index 0000000000000000000000000000000000000000..c587794530d1d08b4dad0b4df2d0db54ad8b7b6c GIT binary patch literal 4662 zcmeAS@N?(olHy`uVBq!ia0y~yU|H*YfkE)K zr;B4q#hkZyb^TUHOEg?8Di&(8U}E*uzNmWj41-AVO9Kh+u5-;IF}a)z1Qb?0;t;y> z@Sb+Y&&q2-)@xtP-g|ZOU(@^7PM|h;f63kq2mL69XFqgMuRiGXui} zg$AGlJOmB^WmW$C`o2CN2=emg&7W^>$}gXpo}O+Y^X~oo+hGh04du)~e*Ua9n;jb) zdvo#oJR71AcoBQi;<1^1c-^}@TGZ-jXb5i=j?%lgzzkYo% zp`fy|vY_C>rw_BE)`oQ-O){DZRJeHY;=OzKo}b6T!0@1(^+VClnphbbnK^Uk=9a10 zT`IAvjn$d%4RZ68zkdZ^EMLC-dh71{@87*;k(ZaZuNDJ3O8>vqlC^8se)R_hXZ91@ z13*fJBLPSXu^0eJP9_PUD*XN?LivaNOh2AJP5ldu8-@eNn16hKe}8@V)vT@O;?v*W z^ZW4D2N;U8>i&Mc{IKB1t_U5m%P&i+tE)E$e>4nReKl$03?H@Tg9#>5H-X`}Am{bo z6A^EiO@^TZYw{PEq!nxr;*atr(_pnpNv&dvjpioQQHIf`8&cEFK;s9q Y^Z%k>)g4#(fI|xmp00i_>zopr0M;U>TL1t6 literal 0 HcmV?d00001 diff --git a/test/headful.spec.ts b/test/headful.spec.ts index 120fee4aa3..3842d467e3 100644 --- a/test/headful.spec.ts +++ b/test/headful.spec.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { it, expect } from './fixtures'; +import { it, expect, folio } from './fixtures'; it('should have default url when launching browser', async ({browserType, browserOptions, createUserDataDir}) => { const browserContext = await browserType.launchPersistentContext(await createUserDataDir(), {...browserOptions, headless: false }); @@ -168,3 +168,31 @@ it('Page.bringToFront should work', async ({browserType, browserOptions}) => { ); await browser.close(); }); + +const fixtures = folio.extend(); +fixtures.testParametersPathSegment.override(async ({ browserName, platform }, run) => { + await run(browserName + '-' + platform); +}); +fixtures.build().it('focused input should produce the same screenshot', (test, { browserName, platform }) => { + test.fail(browserName === 'firefox' && platform === 'darwin', 'headless has thinner outline'); + test.fail(browserName === 'firefox' && platform === 'linux', 'headless has no outline'); + test.skip(browserName === 'webkit' && platform === 'linux', 'gtk vs wpe'); + test.fail(browserName === 'chromium', 'Different outline color'); +}, async ({browserType, browserOptions}) => { + const headful = await browserType.launch({...browserOptions, headless: false }); + const headfulPage = await headful.newPage(); + await headfulPage.setContent(''); + await headfulPage.focus('input'); + const headfulScreenshot = await headfulPage.screenshot(); + await headful.close(); + + const headless = await browserType.launch({...browserOptions, headless: true }); + const headlessPage = await headless.newPage(); + await headlessPage.setContent(''); + await headlessPage.focus('input'); + const headlessScreenshot = await headlessPage.screenshot(); + await headless.close(); + + expect(headfulScreenshot).toMatchSnapshot('focused-input.png'); + expect(headlessScreenshot).toMatchSnapshot('focused-input.png'); +});