From ef4c947c409444a07f1da814835d7293bf0ab438 Mon Sep 17 00:00:00 2001 From: Daniel Eshkeri Date: Wed, 9 Oct 2024 14:38:38 +0100 Subject: [PATCH 01/16] tests --- .../components/accordion/accordion_test.dart | 263 +++++++------- .../badge/golden/indicator_default.png | Bin 3998 -> 4192 bytes .../badge/golden/indicator_icon_default.png | Bin 4135 -> 4265 bytes .../badge/golden/indicator_icon_values.png | Bin 3896 -> 3865 bytes .../golden/indicator_notification_default.png | Bin 3998 -> 4192 bytes .../golden/indicator_notification_values.png | Bin 3599 -> 3599 bytes .../components/badge/golden/label_dark.png | Bin 3677 -> 3580 bytes .../components/badge/golden/label_default.png | Bin 3630 -> 3558 bytes .../badge/golden/label_negative.png | Bin 3677 -> 3568 bytes .../components/badge/golden/label_neutral.png | Bin 3625 -> 3546 bytes .../badge/golden/label_positive.png | Bin 3685 -> 3578 bytes .../components/badge/golden/label_sharp.png | Bin 3457 -> 3388 bytes .../components/badge/golden/label_warning.png | Bin 3671 -> 3571 bytes test/src/components/badge/indicator_test.dart | 321 +++++++++--------- test/src/components/badge/label_test.dart | 174 ++++++---- test/test_utils/utils.dart | 23 ++ test/testing_conventions.mdx | 53 +++ 17 files changed, 480 insertions(+), 354 deletions(-) create mode 100644 test/testing_conventions.mdx diff --git a/test/src/components/accordion/accordion_test.dart b/test/src/components/accordion/accordion_test.dart index 7cc78fe4..01200185 100644 --- a/test/src/components/accordion/accordion_test.dart +++ b/test/src/components/accordion/accordion_test.dart @@ -9,145 +9,154 @@ import '../../../test_utils/test_app.dart'; import '../../../test_utils/utils.dart'; void main() { - testWidgets('ZetaAccordion expands and collapses correctly', (WidgetTester tester) async { - await tester.pumpWidget( - const TestApp( - home: ZetaAccordion( - title: 'Accordion Title', - child: Text('Accordion Content'), - ), - ), - ); - - // Verify that the accordion is initially collapsed - final Finder accordionContent = find.byType(SizeTransition); - expect(accordionContent, findsOneWidget); - - final SizeTransition sizeTransition = tester.widget(accordionContent); - expect(sizeTransition.sizeFactor.value, 0); - - // Tap on the accordion to expand it - await tester.tap(find.text('Accordion Title')); - await tester.pumpAndSettle(); - - // Verify that the accordion is now expanded - expect(sizeTransition.sizeFactor.value, 1); - - // Tap on the accordion again to collapse it - await tester.tap(find.text('Accordion Title')); - await tester.pumpAndSettle(); - - expect(sizeTransition.sizeFactor.value, 0); - }); - - testWidgets('ZetaAccordion changes isOpen property correctly', (WidgetTester tester) async { - bool isOpen = false; - StateSetter? setState; - - await tester.pumpWidget( - TestApp( - home: StatefulBuilder( + const String componentName = 'ZetaAccordion'; + // group('$componentName Accessibility Tests', () {}); + group('$componentName Content Tests', () { + testWidgets('debugFillProperties works correctly', (WidgetTester tester) async { + final diagnostics = DiagnosticPropertiesBuilder(); + const ZetaAccordion( + title: 'Title', + ).debugFillProperties(diagnostics); + + expect(diagnostics.finder('title'), '"Title"'); + expect(diagnostics.finder('rounded'), 'null'); + expect(diagnostics.finder('contained'), 'false'); + expect(diagnostics.finder('isOpen'), 'false'); + }); + + testWidgets('Programatically change child', (WidgetTester tester) async { + Widget? child = const Text('Text 1'); + StateSetter? setState; + + await tester.pumpWidget( + StatefulBuilder( builder: (context, setState2) { setState = setState2; - return ZetaAccordion( - title: 'Accordion Title', - isOpen: isOpen, - child: const Text('Accordion Content'), + return TestApp( + home: ZetaAccordion( + title: 'Accordion Title', + child: child, + ), ); }, ), - ), - ); - - // Verify that the accordion is initially closed - final Finder accordionContent = find.byType(SizeTransition); - expect(accordionContent, findsOneWidget); - - final SizeTransition sizeTransition = tester.widget(accordionContent); - expect(sizeTransition.sizeFactor.value, 0); - - // Change isOpen property to true - setState?.call(() => isOpen = true); - - await tester.pumpAndSettle(); + ); + + final Finder accordionContent = find.text('Text 1'); + expect(accordionContent, findsOneWidget); + setState?.call(() => child = null); + await tester.pumpAndSettle(); + expect(accordionContent, findsNothing); + }); + }); + // group('$componentName Dimensions Tests', () {}); + group('$componentName Styling Tests', () { + testWidgets('ZetaAccordion changes color on hover', (WidgetTester tester) async { + await tester.pumpWidget( + const TestApp( + home: ZetaAccordion( + title: 'Accordion Title', + child: Text('Accordion Content'), + ), + ), + ); + + final textButtonFinder = find.byType(TextButton); + final textButton = tester.widget(textButtonFinder); + final gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); + await gesture.addPointer(location: Offset.zero); + addTearDown(gesture.removePointer); + + await tester.pump(); + await gesture.moveTo(tester.getCenter(find.byType(ZetaAccordion))); + await tester.pumpAndSettle(); + // Verify that the textButton color matches the hover color + expect( + textButton.style!.overlayColor?.resolve({WidgetState.hovered}), + ZetaColorBase.cool.shade20, + ); + expect( + textButton.style!.overlayColor?.resolve({WidgetState.focused}), + Colors.transparent, + ); + expect(textButton.style!.side?.resolve({WidgetState.focused})?.color, ZetaColorBase.blue.shade50); + }); + }); + group('$componentName Interaction Tests', () { + testWidgets('ZetaAccordion expands and collapses correctly', (WidgetTester tester) async { + await tester.pumpWidget( + const TestApp( + home: ZetaAccordion( + title: 'Accordion Title', + child: Text('Accordion Content'), + ), + ), + ); + + // Verify that the accordion is initially collapsed + final Finder accordionContent = find.byType(SizeTransition); + expect(accordionContent, findsOneWidget); + + final SizeTransition sizeTransition = tester.widget(accordionContent); + expect(sizeTransition.sizeFactor.value, 0); + + // Tap on the accordion to expand it + await tester.tap(find.text('Accordion Title')); + await tester.pumpAndSettle(); + + // Verify that the accordion is now expanded + expect(sizeTransition.sizeFactor.value, 1); + + // Tap on the accordion again to collapse it + await tester.tap(find.text('Accordion Title')); + await tester.pumpAndSettle(); + + expect(sizeTransition.sizeFactor.value, 0); + }); + + testWidgets('ZetaAccordion changes isOpen property correctly', (WidgetTester tester) async { + bool isOpen = false; + StateSetter? setState; + + await tester.pumpWidget( + TestApp( + home: StatefulBuilder( + builder: (context, setState2) { + setState = setState2; + return ZetaAccordion( + title: 'Accordion Title', + isOpen: isOpen, + child: const Text('Accordion Content'), + ); + }, + ), + ), + ); - // Verify that the accordion is now open - expect(sizeTransition.sizeFactor.value, 1); + // Verify that the accordion is initially closed + final Finder accordionContent = find.byType(SizeTransition); + expect(accordionContent, findsOneWidget); - // Change isOpen property to false - setState?.call(() => isOpen = false); + final SizeTransition sizeTransition = tester.widget(accordionContent); + expect(sizeTransition.sizeFactor.value, 0); - await tester.pumpAndSettle(); + // Change isOpen property to true + setState?.call(() => isOpen = true); - // Verify that the accordion is now closed - expect(sizeTransition.sizeFactor.value, 0); - }); + await tester.pumpAndSettle(); - testWidgets('debugFillProperties works correctly', (WidgetTester tester) async { - final diagnostics = DiagnosticPropertiesBuilder(); - const ZetaAccordion( - title: 'Title', - ).debugFillProperties(diagnostics); + // Verify that the accordion is now open + expect(sizeTransition.sizeFactor.value, 1); - expect(diagnostics.finder('title'), '"Title"'); - expect(diagnostics.finder('rounded'), 'null'); - expect(diagnostics.finder('contained'), 'false'); - expect(diagnostics.finder('isOpen'), 'false'); - }); + // Change isOpen property to false + setState?.call(() => isOpen = false); - testWidgets('Programatically change child', (WidgetTester tester) async { - Widget? child = const Text('Text 1'); - StateSetter? setState; - - await tester.pumpWidget( - StatefulBuilder( - builder: (context, setState2) { - setState = setState2; - return TestApp( - home: ZetaAccordion( - title: 'Accordion Title', - child: child, - ), - ); - }, - ), - ); - - final Finder accordionContent = find.text('Text 1'); - expect(accordionContent, findsOneWidget); - setState?.call(() => child = null); - await tester.pumpAndSettle(); - expect(accordionContent, findsNothing); - }); + await tester.pumpAndSettle(); - testWidgets('ZetaAccordion changes color on hover', (WidgetTester tester) async { - await tester.pumpWidget( - const TestApp( - home: ZetaAccordion( - title: 'Accordion Title', - child: Text('Accordion Content'), - ), - ), - ); - - final textButtonFinder = find.byType(TextButton); - final textButton = tester.widget(textButtonFinder); - final gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); - await gesture.addPointer(location: Offset.zero); - addTearDown(gesture.removePointer); - - await tester.pump(); - await gesture.moveTo(tester.getCenter(find.byType(ZetaAccordion))); - await tester.pumpAndSettle(); - // Verify that the textButton color matches the hover color - expect( - textButton.style!.overlayColor?.resolve({WidgetState.hovered}), - ZetaColorBase.cool.shade20, - ); - expect( - textButton.style!.overlayColor?.resolve({WidgetState.focused}), - Colors.transparent, - ); - expect(textButton.style!.side?.resolve({WidgetState.focused})?.color, ZetaColorBase.blue.shade50); + // Verify that the accordion is now closed + expect(sizeTransition.sizeFactor.value, 0); + }); }); + // group('$componentName Golden Tests', () {}); + // group('$componentName Performance Tests', () {}); } diff --git a/test/src/components/badge/golden/indicator_default.png b/test/src/components/badge/golden/indicator_default.png index 291fd461ab4aae8e99d280eb7b52d4f9637da77b..51235d00ae515dbfc88c380e460bc7b18d4c3405 100644 GIT binary patch literal 4192 zcmeHJ?N3uz7(Wy?I}(MM3C1!YGt&$DmY?Uk1%y3H(|R%Cz$%C(yv8g6MER;;D%0NaX4Z7H=tTka0oKd}!zU!I)joSf%* ze$UJAT-dcUZ+YyRSOCEC{4aC&01%xD0HcWcKGa+no~?!=3fq&n4cr+@nuMDeY+L?5 zCR`27qvrvLkIm2Bx=-9PZ8geX&VMuD746?4GMuVHh1(0BoR8Ul?USf2cVpJpJ?B3d zt$9qQ?*2fL%3&U1Z2fSYj=#Lh`)cE{go93KTh^4mPdQB0VlwtrR| zpM0&iI6Pd4(y!UBnPxiErS8w_D57-I5`{_Hrqn|@XkU0mm2qVHBaO}>?{6c^=z2Q@ zYmPrHWxTY74SincBt@msQ(VmZtC2EqD8UE5_shsk6*<>orb9si>KqDQa?TwOA6Bve z5XWv*FJ@a$*ng0l>>+DQ|ExEKm4YAwb%P`;L(*^{gAP;FsKmF}QrY#^K}3Nwx1QFZ z&hhb@!({zt1W{#>yg-iMY_@W1$FEqmO`1Ru=PhXw1O`ROWP^d%6aWwQmM!6Dr*+yT z>}D)>BA5}jy(w^$z3me>HU2o98!Qpiqdm3RMk}ZPU34@61!_lSceBAfPgSxLaStK- z2)Y(*3S#q8WvhAGd8(t;>TadaB>>MF5Lg(3w76uxc8XQ=|?r;O)G_@ubm?vTQ9$S&V?Tn zl0gfCV5`{BF6L)GTk!n#rpns#C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9|H>PT0wyhryKps)B?Ljyj+MLlx2DeVqt*h(|8e%^{5o$boe%B`sFF>g6lC(0Yds&`FPN*mvMx79h z?LH@WJqq^+09=STf%RvA7B|kaqB6!u%tA<`R^s3?i bPz|NPG>qlqYucFT2L$APoR>A6`E}EO0>jYz diff --git a/test/src/components/badge/golden/indicator_icon_values.png b/test/src/components/badge/golden/indicator_icon_values.png index 96e73834b042dec5f2f598fb4ceda7e9902bbd26..9c17abf9476753af2fae9342457b12aed984a7c7 100644 GIT binary patch literal 3865 zcmeAS@N?(olHy`uVBq!ia0y~yU{+vYV2a>i1B%QlYbpRzjKx9jP7LeL$-D$|Sc;uI zLpXq-h9jkefr0O^r;B4q#hkZy3|HSxmp$I zj(5M*mP}sIy?Xs&ae)^?Ru(rGE}m>6!qlqJ^aqW{fECEi@H4{>QCE}`RBjQ z`TU1}|JTz$?ayzznN#+eQ~ma3OS^k#PJS!#+qT@;cyrv_^HqE8+r|0Q_TG|bU}*S% zv`9{2_uVtii`$F;AN(jRzoY7DfnNMBi_<~991IM5G^U+R+Z;VD_1~xM)thhTq^CW5 z%O6(!`di+;-yd@RzB;|S^6@XD{C!2+>?|VAn(wbGE!%xpxL$^V;lX5(&gz0M8Sn1e z&)O}o`+4?=Bxd^7G!?P6kGx(7k)pcllip-NV3eKzu{g z`tahaT{ESxe|vuZ{r}gdYtCDD*clf;zV+`+jSc(jP!lzvW0WFf*L-{a@XVh-)zv_+ zrpwp;V)(WE@0(*c7Uu8^ZD2IZJ!svU-SPpv;Dt!2W$S{UcOo9 zbj+@b2|S#@P?z}j?c22D;V=Jv+Ilx8qW0gxK5h2Xe|~Mr_?q?qrY|=GgU$7S$__wB{EPoK?<i1B%QlYbpRzjKx9jP7LeL$-D$|Sc;uI zLpXq-h9jkefr0Olr;B4q#hkZy47;C(OCEUmz5e;Vn{!X5IiGRkJR*|ls*^NbZ-Lmd zPL63!b*$Rj2St9x=CnG@N=Qs?nG!ZjRe-Z)hKuU%nV#>?yxA&IE_(Jz?}PlCKWy$c z7VG8zemw7gEPqo?mzi+(f@A!GE`~8`4`S`Q?`^x1s;`e+zvF3Z&%?%6;2by#LKKxjg zmKL{bD4{{6M*+uyy}``JqjXy)FCyPX~P_tw5QEKGm@vXcSmop*PC zEqY$EKK}OX<9+AXC)-vP98~lF$i%=f|6tYT$n!UEmd&e7%D-3nSN{5jy5Ebl#pSA= zb?%+H)Asl5QUfIhh7Xk+@5R4A>u&t{@cQ-7!q=bQQ(sa&O@9C1mF;yO&iss*mu3VS zR>QXXaI^PjozpdsPcQ%cc74vj$Bpl6a_jf~ymC|Lv{C!?@6Ce1fI8oOHEZjgTCeZw z=iffN^y?A7^}09upC1)JzrJOiU5&x&sr?QN3=P%WbGF~Ud*)1a{Z2~)QDR|lpoC`6!ok2WK~RB#!NIKo zC?E-vP8k&(4Uo~qFq#oYONP->akNGltqn(O!_nGsv^E?Lwc)dTZk~((!-~_U15-4E Mr>mdKI;Vst0FF2ZVE_OC diff --git a/test/src/components/badge/golden/indicator_notification_default.png b/test/src/components/badge/golden/indicator_notification_default.png index 291fd461ab4aae8e99d280eb7b52d4f9637da77b..51235d00ae515dbfc88c380e460bc7b18d4c3405 100644 GIT binary patch literal 4192 zcmeHJ?N3uz7(Wy?I}(MM3C1!YGt&$DmY?Uk1%y3H(|R%Cz$%C(yv8g6MER;;D%0NaX4Z7H=tTka0oKd}!zU!I)joSf%* ze$UJAT-dcUZ+YyRSOCEC{4aC&01%xD0HcWcKGa+no~?!=3fq&n4cr+@nuMDeY+L?5 zCR`27qvrvLkIm2Bx=-9PZ8geX&VMuD746?4GMuVHh1(0BoR8Ul?USf2cVpJpJ?B3d zt$9qQ?*2fL%3&U1Z2fSYj=#Lh`)cE{go93KTh^4mPdQB0VlwtrR| zpM0&iI6Pd4(y!UBnPxiErS8w_D57-I5`{_Hrqn|@XkU0mm2qVHBaO}>?{6c^=z2Q@ zYmPrHWxTY74SincBt@msQ(VmZtC2EqD8UE5_shsk6*<>orb9si>KqDQa?T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{Bd6 zfHASF$2!dzMyP(5OX;0Sscju!?&p!Fx>Hc7HMOU#ygUqm?D?+evNHix3Uyqr<*V)X zHNIyP{SoXqR--hOBWHP=&tn&you*4FEs8dJKI@*vFbGm+-F3{GSFe;}n5H}J^`H{x#uI$DNi`Q0pk8c7}8TV&#cS}8_=)iY>Z3X_C3Q{ zi!()i5?`>iPpGedO*-!(1Ovd~B*(UEjQj-)H5uwq`36beb(xKAcYF84o|SZH=&I`> zmkte`G~OQ!0wAejN_>vouj?Zngiq=26IFfBig>k9!_P~_19}P1jKF?hEmSf^YF(L0 z$l&dGt*(R(qdvQFs#LDiq$^OKN~+&TLG3nw2GULIwHC%g5afF*gxy{`-L+i>X9iZ2 zW7bReaL}AQI?&9Rz0MyORAH-4vvKhJ}EYEQSETHO;Z~!`Y?*rgaz5v5; zBc2ev81RpPcLuyG;);N)A+CnF8scjBe^WzObX90TWcfD!J&Ze0aD6e*soc$9kBSXXY;}g#%u-{B#U^wvm`D9Z@XZ9RJ28IWJH&3o-)MneO&%p43 aZ}SF5e;xr1u8ma;K;Y@>=d#Wzp$P!dq!}6j delta 70 zcmeB|>6e*soc+;P28M?3CnuguU_Tkez;NLA%gLsU&g?0g3=9wcZkb%qsLi%VkAdNX a-sTOA{yYL*hFhu`fWXt$&t;ucLK6TA_ZoQs diff --git a/test/src/components/badge/golden/label_dark.png b/test/src/components/badge/golden/label_dark.png index 56650a3549980dd8fac82044a82968ea850fb4b9..a694b52a9d7014a191797f7b3032d1cd3065a51a 100644 GIT binary patch literal 3580 zcmeAS@N?(olHy`uVBq!ia0y~yU{+vYV2a>i1B%QlYbpRzjKx9jP7LeL$-D$|Sc;uI zLpXq-h9ji|sA-v}i(^Q|oVR!OcgdDAv^~5(FXvEGci@wZFy<~LjVRVNI)3w|J6tbi zPBhz_pt`e}ql$Z*&;{-Q>x~8i-7IGH9WttFEv9f*8K3cJOhK!=9TQgKzi-m03;l4-(eTnJ*cwK3{sax}Wdf&J&+5zWed>TlwSH@9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i-(X71l_+ppgFRk!tv1W=UucKx3}Uygl# zv)lN*P5B3In;+@Vo&>JDKi{(Q)q~gRX?gMUZ`#=X_$7XCM&-Y!&SymK9B!^QR`-{` z>r?;V?(=nh|Gxi!GEMXAc39T`U}a!+{G)kTj!Z$8btd5X69^mz%D%g^OZ zlVfCPNKSaYbbF4?%*v0s=NTCo-1A@mJujyZ43z4phtkf~D>yJPSX8b4TD5m)WvS_P zz4~j}x}Wt>60#7`8(HSh*P(HYYRX ga!+E)6FalNkfmrhLwLqdpwk&VUHx3vIVCg!0Js?ixc~qF diff --git a/test/src/components/badge/golden/label_negative.png b/test/src/components/badge/golden/label_negative.png index efd6692b2a77176498a8310b0528ad7245a17308..7f57efd07505d2280d982a1212b44b9a1ee238ce 100644 GIT binary patch delta 466 zcmV;@0WJRB9Pk^EKz|LINkl z_by(VdIu9a^3exl=lb3li^bGa004Nw&Hni0v(=N|ZahD+`{#|Z_0GQ0ssJH=JVsPO}&9NusD8f>InbEa=BbhJpup#*bM#!3$sB31`Ctm0_+ydzw^Ibfxj}cVgLXD07*qo IM6N<$g2L44;{X5v delta 556 zcmV+{0@MBQ8{Hg`Kz|MgNkloKHuK>^6PQ!%m-us!;fR@`k#a4uzuqB*z@X3u(SMz93ZBEF_gVCHxbxc|_gQq) z=J^Zb@~P8zZ~uM6Z+`#)xc_ET4*&oFmWKcV001%q1d})eEq|=d4m>!vZrr?k;irAa zCY&>k%co9HJz;XI2lh`r0RVs{Fni$f$EM!Ef55u;0RRAj*}-?;nR){g+x5&-WA7_3 zPCWwvfF&^7_xkB^=<|=q?iZdLvxB~dvrN`c93T7Nesdi9;*&8}SErr>0KgJhna}6j uQ;z@u0G5M)!2trZVFGyzlQ08h7V{6ipnutE4==O;0000i1B%QlYbpRzjKx9jP7LeL$-D$|Sc;uI zLpXq-h9ji|sHw%%#WAE}&fD9LS<&GPZ5LOkpHvel7dSEP60b>i#@-GgC-DnqQ_6Tx zvdzl$oF?p~)U0zd==j`7=KAvsirXG}{o(Jm+mXNVZeIWF-FGAI=N+r7x92H6!Q&tqgbAQ`bP-~9jY z2j}hUNNYU)A?_2cOsP+bLN;zu@2U>+Ah*86T7QU-zr#($9YR|C0On z*8YC*`Ka-nUvq>1x5wY#Be_2Auf;Km}t{qg(OJ->IbCv0{1$4^K3i_bGK zJmAsUcKdB%@pkFgx6j^q|Ni*HiaFK76Q3S6S*I8N_}9zopr0IUgFhyVZp literal 3625 zcmeAS@N?(olHy`uVBq!ia0y~yU{+vYV2a>i1B%QlYbpRzjKx9jP7LeL$-D$|Sc;uI zLpXq-h9ji|sOhq&i(^Q|oVT|f^P)o;+Ad}v_sf{f!O2<5{L<-#*$buy!wrg;Y#Ew2 z^P^Ll>Pn0=LDVBkCO=KJic@2=m^TYm3g%e2!+fBabdd1X2SLjl7x zpw5-%1{=?&S--nJ8zLrl`|a-idkbr8ZOvx?t?$tj>)v=b@4Map7`S{%t>= z*W2y;_v-Y=$Ft3=>kq2y$Mwj^?XSy!u0PLSK0N>ayV|-Q!+n3>{VuF3+xGou`1Jcd z;nSyA&(~k~@X@2BnAq68+kNNntFg5E{ioYL-rmN>CQF`y;g9s^mF&RKZFg<}l9G%} z3=AnOK>H>LDljlOxDgOcv;X_&^t;6Ev#Z#Je}DM%(xSG?=qnEc!@uXxx{qGGBK?Cu zLgx+-GsASBx1LEEqO_t=hYL_x+yRSMT1)yU*L7EZcYV zV$B>G{o_AxPBxr>e%U-`h69W<)?Uv(%E-W=V)KKaB-at|k5QGx#P(4n5- zvKdV_qseBp<|499Fn{i5H%_-F8R^>bP0l+XkK`G;3v diff --git a/test/src/components/badge/golden/label_positive.png b/test/src/components/badge/golden/label_positive.png index 5df40805b9263022208ce20bb1730ddb95241b4d..537944fa46dcc277d0dbcf31358783fa35f42dd8 100644 GIT binary patch delta 450 zcmV;z0X_cZ9QqrOKz|LSNkl`0Iofmon000|cescQP)Eig>C;t5b03hJdKa-IHB7d3r*2TA{-oP5zy7OTC>VE_OC07*qoM6N<$f(Y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& g&FJA$T+}msH@BWDa^iR=u({9R>FVdQ&MBb@01X%`HUIzs diff --git a/test/src/components/badge/golden/label_warning.png b/test/src/components/badge/golden/label_warning.png index b4091b2c8114cc7c128e58ea44c0f5fddf6cb811..2342243e61dc1aca18a18e4dd83733d5bbe531d9 100644 GIT binary patch literal 3571 zcmeAS@N?(olHy`uVBq!ia0y~yU{+vYV2a>i1B%QlYbpRzjKx9jP7LeL$-D$|Sc;uI zLpXq-h9ji|sA;aJi(^Q|oVT|PyJJEb+8!3CZ$5i$#RL(yEyceTI;Q<&-srz@{{geP zu>xB*Zn$=@;|IUWTd|GeN^7DyRxj9*U1pHvW~C#XpzT%rw4ibN+Nm zoe|$WJE_Y@UrO9QeXuT~?_J;1Z+k!f`SDMpefza}%nS$QW^7CEpWdv_fBoLUu4&{By^{?f-l{q+jvj-`tNczweK|`Lq9Cb?I{3 z$COS|qHU-RSEj|Xq->%Y$U_b1b5|9^{V*7qe|~DGXsMpBNGEd3JV7V z!vsNKcsjT>0D}%m@Me#+dv^W0TZ!H-Z z-ZW;;d!G6h=i1B%QlYbpRzjKx9jP7LeL$-D$|Sc;uI zLpXq-h9jkefq{?F)5S5QV$Rz;d%I#%8IC{v{wA;ESg)drZ;#R<#;skMdzhsi9dC<> znZ-4kCoJB&vonIt(fW47#t(}HlvFMrS|D_TW$u}G8-p*M75mqhGJpB(hjVBCPh2Jc z*>G*x>dIZ!wK@0qSS{NdoxJ8fe_z|rBRdV}@3i=)A0zkp#>u7685jy!d|q3}pS^8v z7gfd1JRX{)W?_9ffzFl+`GxzLwe=U~X-xpa0^q2dAb6d)PPqePv zyIqd|JO4+P+m|EWpO>C*zs~+jy-}N#J;&?aSNiels&1s6RjbA0tCU4+A3ugAo%81H%ap z0R{#IWd{brfsoUd!k%+PTB&b2+i?_84pAwOe&RoP2U z1_l|%XmN0O0=fgyzjC_F(>VN`H5 zKt>b8Xhs+<8AeOR(Hdd2HXN-DM{C2;+HeTghX2^~IXiY=x@>s}*u-b>boFyt=akR{ E0DB5^egFUf diff --git a/test/src/components/badge/indicator_test.dart b/test/src/components/badge/indicator_test.dart index cf732149..16161c0f 100644 --- a/test/src/components/badge/indicator_test.dart +++ b/test/src/components/badge/indicator_test.dart @@ -7,169 +7,182 @@ import '../../../test_utils/tolerant_comparator.dart'; import '../../../test_utils/utils.dart'; void main() { - const goldenFile = GoldenFiles(component: 'badge'); + const String componentName = 'ZetaIndicator'; + const String parentFolder = 'badge'; + const goldenFile = GoldenFiles(component: parentFolder); setUpAll(() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - testWidgets('Default constructor initializes with correct parameters', (WidgetTester tester) async { - await tester.pumpWidget(const TestApp(home: ZetaIndicator())); - - final zetaIndicatorFinder = find.byType(ZetaIndicator); - final ZetaIndicator indicator = tester.firstWidget(zetaIndicatorFinder); - - expect(indicator.rounded, null); - expect(indicator.type, ZetaIndicatorType.notification); - expect(indicator.size, ZetaWidgetSize.large); - expect(indicator.icon, null); - expect(indicator.value, null); - expect(indicator.inverse, false); - expect(indicator.color, null); - - await expectLater( - find.byType(ZetaIndicator), - matchesGoldenFile(goldenFile.getFileUri('indicator_default')), - ); - }); - - testWidgets('Copy with function works', (WidgetTester tester) async { - const Key key1 = Key('1'); - const Key key2 = Key('2'); - const ZetaIndicator one = ZetaIndicator(key: key1); - final ZetaIndicator two = one.copyWith( - key: key2, - ); - await tester.pumpWidget(TestApp(home: Column(children: [one, two]))); - - final zetaIndicatorFinder1 = find.byKey(key1); - final ZetaIndicator indicator1 = tester.firstWidget(zetaIndicatorFinder1); - final zetaIndicatorFinder2 = find.byKey(key2); - final ZetaIndicator indicator2 = tester.firstWidget(zetaIndicatorFinder2); - - expect(indicator1.rounded, null); - expect(indicator1.type, ZetaIndicatorType.notification); - expect(indicator1.size, ZetaWidgetSize.large); - expect(indicator1.icon, null); - expect(indicator1.value, null); - expect(indicator1.inverse, false); - expect(indicator1.color, null); - - expect(indicator2.rounded, null); - }); - testWidgets('Icon constructor initializes with correct parameters', (WidgetTester tester) async { - await tester.pumpWidget(const TestApp(home: ZetaIndicator.icon())); - - final zetaIndicatorFinder = find.byType(ZetaIndicator); - final ZetaIndicator indicator = tester.firstWidget(zetaIndicatorFinder); - - expect(indicator.rounded, null); - expect(indicator.type, ZetaIndicatorType.icon); - expect(indicator.size, ZetaWidgetSize.large); - expect(indicator.icon, null); - expect(indicator.value, null); - expect(indicator.inverse, false); - expect(indicator.color, null); - - await expectLater( - find.byType(ZetaIndicator), - matchesGoldenFile(goldenFile.getFileUri('indicator_icon_default')), - ); - }); - testWidgets('Icon constructor with values', (WidgetTester tester) async { - await tester.pumpWidget( - const TestApp( - home: ZetaIndicator.icon( - color: Colors.purple, - icon: Icons.abc, - inverse: true, - size: ZetaWidgetSize.medium, + // group('$componentName Accessibility Tests', () {}); + group('$componentName Content Tests', () { + testWidgets('Default constructor initializes with correct parameters', (WidgetTester tester) async { + await tester.pumpWidget(const TestApp(home: ZetaIndicator())); + + final zetaIndicatorFinder = find.byType(ZetaIndicator); + final ZetaIndicator indicator = tester.firstWidget(zetaIndicatorFinder); + + expect(indicator.rounded, null); + expect(indicator.type, ZetaIndicatorType.notification); + expect(indicator.size, ZetaWidgetSize.large); + expect(indicator.icon, null); + expect(indicator.value, null); + expect(indicator.inverse, false); + expect(indicator.color, null); + }); + + testWidgets('Copy with function works', (WidgetTester tester) async { + const Key key1 = Key('1'); + const Key key2 = Key('2'); + + const ZetaIndicator one = ZetaIndicator(key: key1); + final ZetaIndicator two = one.copyWith( + key: key2, + ); + await tester.pumpWidget(TestApp(home: Column(children: [one, two]))); + + final zetaIndicatorFinder1 = find.byKey(key1); + final ZetaIndicator indicator1 = tester.firstWidget(zetaIndicatorFinder1); + final zetaIndicatorFinder2 = find.byKey(key2); + final ZetaIndicator indicator2 = tester.firstWidget(zetaIndicatorFinder2); + + expect(indicator1.rounded, null); + expect(indicator1.type, ZetaIndicatorType.notification); + expect(indicator1.size, ZetaWidgetSize.large); + expect(indicator1.icon, null); + expect(indicator1.value, null); + expect(indicator1.inverse, false); + expect(indicator1.color, null); + + expect(indicator2.rounded, null); + }); + testWidgets('Icon constructor initializes with correct parameters', (WidgetTester tester) async { + await tester.pumpWidget(const TestApp(home: ZetaIndicator.icon())); + + final zetaIndicatorFinder = find.byType(ZetaIndicator); + final ZetaIndicator indicator = tester.firstWidget(zetaIndicatorFinder); + + expect(indicator.rounded, null); + expect(indicator.type, ZetaIndicatorType.icon); + expect(indicator.size, ZetaWidgetSize.large); + expect(indicator.icon, null); + expect(indicator.value, null); + expect(indicator.inverse, false); + expect(indicator.color, null); + }); + testWidgets('Icon constructor with values', (WidgetTester tester) async { + await tester.pumpWidget( + const TestApp( + home: ZetaIndicator.icon( + color: Colors.purple, + icon: Icons.abc, + inverse: true, + size: ZetaWidgetSize.medium, + ), ), - ), - ); - - final zetaIndicatorFinder = find.byType(ZetaIndicator); - final ZetaIndicator indicator = tester.firstWidget(zetaIndicatorFinder); - - expect(indicator.rounded, null); - expect(indicator.type, ZetaIndicatorType.icon); - expect(indicator.size, ZetaWidgetSize.medium); - expect(indicator.icon, Icons.abc); - expect(indicator.value, null); - expect(indicator.inverse, true); - expect(indicator.color, Colors.purple); - - await expectLater( - find.byType(ZetaIndicator), - matchesGoldenFile(goldenFile.getFileUri('indicator_icon_values')), - ); - }); - testWidgets('Notification constructor initializes with correct parameters', (WidgetTester tester) async { - await tester.pumpWidget(const TestApp(home: ZetaIndicator.notification())); - - final zetaIndicatorFinder = find.byType(ZetaIndicator); - final ZetaIndicator indicator = tester.firstWidget(zetaIndicatorFinder); - - expect(indicator.rounded, null); - expect(indicator.type, ZetaIndicatorType.notification); - expect(indicator.size, ZetaWidgetSize.large); - expect(indicator.icon, null); - expect(indicator.value, null); - expect(indicator.inverse, false); - expect(indicator.color, null); - - await expectLater( - find.byType(ZetaIndicator), - matchesGoldenFile(goldenFile.getFileUri('indicator_notification_default')), - ); - }); - testWidgets('Notification constructor with values', (WidgetTester tester) async { - await tester.pumpWidget( - const TestApp( - home: ZetaIndicator.notification( - rounded: false, - color: Colors.green, - inverse: true, - size: ZetaWidgetSize.small, - value: 1, + ); + + final zetaIndicatorFinder = find.byType(ZetaIndicator); + final ZetaIndicator indicator = tester.firstWidget(zetaIndicatorFinder); + + expect(indicator.rounded, null); + expect(indicator.type, ZetaIndicatorType.icon); + expect(indicator.size, ZetaWidgetSize.medium); + expect(indicator.icon, Icons.abc); + expect(indicator.value, null); + expect(indicator.inverse, true); + expect(indicator.color, Colors.purple); + }); + testWidgets('Notification constructor initializes with correct parameters', (WidgetTester tester) async { + await tester.pumpWidget(const TestApp(home: ZetaIndicator.notification())); + + final zetaIndicatorFinder = find.byType(ZetaIndicator); + final ZetaIndicator indicator = tester.firstWidget(zetaIndicatorFinder); + + expect(indicator.rounded, null); + expect(indicator.type, ZetaIndicatorType.notification); + expect(indicator.size, ZetaWidgetSize.large); + expect(indicator.icon, null); + expect(indicator.value, null); + expect(indicator.inverse, false); + expect(indicator.color, null); + }); + testWidgets('Notification constructor with values', (WidgetTester tester) async { + await tester.pumpWidget( + const TestApp( + home: ZetaIndicator.notification( + rounded: false, + color: Colors.green, + inverse: true, + size: ZetaWidgetSize.small, + value: 1, + ), ), + ); + + final zetaIndicatorFinder = find.byType(ZetaIndicator); + final ZetaIndicator indicator = tester.firstWidget(zetaIndicatorFinder); + + expect(indicator.rounded, false); + expect(indicator.type, ZetaIndicatorType.notification); + expect(indicator.size, ZetaWidgetSize.small); + expect(indicator.icon, null); + expect(indicator.value, 1); + expect(indicator.inverse, true); + expect(indicator.color, Colors.green); + }); + testWidgets('debugFillProperties works correctly', (WidgetTester tester) async { + final diagnostics = DiagnosticPropertiesBuilder(); + const ZetaIndicator( + color: Colors.orange, + icon: Icons.abc, + inverse: true, + rounded: false, + size: ZetaWidgetSize.small, + type: ZetaIndicatorType.icon, + value: 1, + ).debugFillProperties(diagnostics); + + expect(diagnostics.finder('color'), 'MaterialColor(primary value: Color(0xffff9800))'); + expect(diagnostics.finder('icon'), 'IconData(U+F04B6)'); + expect(diagnostics.finder('inverse'), 'true'); + expect(diagnostics.finder('rounded'), 'false'); + expect(diagnostics.finder('size'), 'ZetaWidgetSize.small'); + expect(diagnostics.finder('type'), 'ZetaIndicatorType.icon'); + expect(diagnostics.finder('value'), '1'); + }); + }); + // group('$componentName Dimensions Tests', () {}); + // group('$componentName Styling Tests', () {}); + // group('$componentName Interaction Tests', () {}); + group('$componentName Golden Tests', () { + goldenTest(goldenFile, const ZetaIndicator(), ZetaIndicator, 'indicator_default'); + goldenTest(goldenFile, const ZetaIndicator.icon(), ZetaIndicator, 'indicator_icon_default'); + goldenTest( + goldenFile, + const ZetaIndicator.icon( + color: Colors.purple, + icon: Icons.abc, + inverse: true, + size: ZetaWidgetSize.medium, ), + ZetaIndicator, + 'indicator_icon_values', ); - - final zetaIndicatorFinder = find.byType(ZetaIndicator); - final ZetaIndicator indicator = tester.firstWidget(zetaIndicatorFinder); - - expect(indicator.rounded, false); - expect(indicator.type, ZetaIndicatorType.notification); - expect(indicator.size, ZetaWidgetSize.small); - expect(indicator.icon, null); - expect(indicator.value, 1); - expect(indicator.inverse, true); - expect(indicator.color, Colors.green); - - await expectLater( - find.byType(ZetaIndicator), - matchesGoldenFile(goldenFile.getFileUri('indicator_notification_values')), + goldenTest(goldenFile, const ZetaIndicator.notification(), ZetaIndicator, 'indicator_notification_default'); + goldenTest( + goldenFile, + const ZetaIndicator.notification( + rounded: false, + color: Colors.green, + inverse: true, + size: ZetaWidgetSize.small, + value: 1, + ), + ZetaIndicator, + 'indicator_notification_values', ); }); - testWidgets('debugFillProperties works correctly', (WidgetTester tester) async { - final diagnostics = DiagnosticPropertiesBuilder(); - const ZetaIndicator( - color: Colors.orange, - icon: Icons.abc, - inverse: true, - rounded: false, - size: ZetaWidgetSize.small, - type: ZetaIndicatorType.icon, - value: 1, - ).debugFillProperties(diagnostics); - - expect(diagnostics.finder('color'), 'MaterialColor(primary value: Color(0xffff9800))'); - expect(diagnostics.finder('icon'), 'IconData(U+F04B6)'); - expect(diagnostics.finder('inverse'), 'true'); - expect(diagnostics.finder('rounded'), 'false'); - expect(diagnostics.finder('size'), 'ZetaWidgetSize.small'); - expect(diagnostics.finder('type'), 'ZetaIndicatorType.icon'); - expect(diagnostics.finder('value'), '1'); - }); + // group('$componentName Performance Tests', () {}); } diff --git a/test/src/components/badge/label_test.dart b/test/src/components/badge/label_test.dart index d5bfb5d2..bc8f0ffb 100644 --- a/test/src/components/badge/label_test.dart +++ b/test/src/components/badge/label_test.dart @@ -1,111 +1,139 @@ +import 'dart:ui'; + import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:zeta_flutter/zeta_flutter.dart'; + import '../../../test_utils/test_app.dart'; import '../../../test_utils/tolerant_comparator.dart'; import '../../../test_utils/utils.dart'; void main() { - const goldenFile = GoldenFiles(component: 'badge'); + const String componentName = 'ZetaLabel'; + const String parentFolder = 'badge'; + const goldenFile = GoldenFiles(component: parentFolder); setUpAll(() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - testWidgets('Initializes with correct parameters', (WidgetTester tester) async { - await tester.pumpWidget(const TestApp(home: ZetaLabel(label: 'Test Label'))); - final zetaBadgeFinder = find.byType(ZetaLabel); - final ZetaLabel label = tester.firstWidget(zetaBadgeFinder); + // group('$componentName Accessibility Tests', () {}); + group('$componentName Content Tests', () { + testWidgets('Initializes with correct parameters', (WidgetTester tester) async { + await tester.pumpWidget(const TestApp(home: ZetaLabel(label: 'Test Label'))); - expect(label.rounded, null); - expect(label.label, 'Test Label'); - expect(label.status, ZetaWidgetStatus.info); + final zetaBadgeFinder = find.byType(ZetaLabel); + final ZetaLabel label = tester.firstWidget(zetaBadgeFinder); - await expectLater(find.byType(ZetaLabel), matchesGoldenFile(goldenFile.getFileUri('label_default'))); - }); + expect(label.rounded, null); + expect(label.label, 'Test Label'); + expect(label.status, ZetaWidgetStatus.info); + }); - testWidgets('Positive status', (WidgetTester tester) async { - await tester.pumpWidget(const TestApp(home: ZetaLabel(label: 'Test Label', status: ZetaWidgetStatus.positive))); + testWidgets('Positive status', (WidgetTester tester) async { + await tester.pumpWidget(const TestApp(home: ZetaLabel(label: 'Test Label', status: ZetaWidgetStatus.positive))); - final zetaBadgeFinder = find.byType(ZetaLabel); - final ZetaLabel label = tester.firstWidget(zetaBadgeFinder); + final zetaBadgeFinder = find.byType(ZetaLabel); + final ZetaLabel label = tester.firstWidget(zetaBadgeFinder); - expect(label.status, ZetaWidgetStatus.positive); + expect(label.status, ZetaWidgetStatus.positive); + }); - await expectLater(find.byType(ZetaLabel), matchesGoldenFile(goldenFile.getFileUri('label_positive'))); - }); + testWidgets('Warning status', (WidgetTester tester) async { + await tester.pumpWidget(const TestApp(home: ZetaLabel(label: 'Test Label', status: ZetaWidgetStatus.warning))); - testWidgets('Warning status', (WidgetTester tester) async { - await tester.pumpWidget(const TestApp(home: ZetaLabel(label: 'Test Label', status: ZetaWidgetStatus.warning))); + final zetaBadgeFinder = find.byType(ZetaLabel); + final ZetaLabel label = tester.firstWidget(zetaBadgeFinder); - final zetaBadgeFinder = find.byType(ZetaLabel); - final ZetaLabel label = tester.firstWidget(zetaBadgeFinder); + expect(label.status, ZetaWidgetStatus.warning); + }); + testWidgets('Negative status', (WidgetTester tester) async { + await tester.pumpWidget(const TestApp(home: ZetaLabel(label: 'Test Label', status: ZetaWidgetStatus.negative))); - expect(label.status, ZetaWidgetStatus.warning); + final zetaBadgeFinder = find.byType(ZetaLabel); + final ZetaLabel label = tester.firstWidget(zetaBadgeFinder); - await expectLater(find.byType(ZetaLabel), matchesGoldenFile(goldenFile.getFileUri('label_warning'))); - }); - testWidgets('Negative status', (WidgetTester tester) async { - await tester.pumpWidget(const TestApp(home: ZetaLabel(label: 'Test Label', status: ZetaWidgetStatus.negative))); + expect(label.status, ZetaWidgetStatus.negative); + }); + testWidgets('Neutral status', (WidgetTester tester) async { + await tester.pumpWidget(const TestApp(home: ZetaLabel(label: 'Test Label', status: ZetaWidgetStatus.neutral))); - final zetaBadgeFinder = find.byType(ZetaLabel); - final ZetaLabel label = tester.firstWidget(zetaBadgeFinder); + final zetaBadgeFinder = find.byType(ZetaLabel); + final ZetaLabel label = tester.firstWidget(zetaBadgeFinder); - expect(label.status, ZetaWidgetStatus.negative); + expect(label.status, ZetaWidgetStatus.neutral); + }); - await expectLater(find.byType(ZetaLabel), matchesGoldenFile(goldenFile.getFileUri('label_negative'))); - }); - testWidgets('Neutral status', (WidgetTester tester) async { - await tester.pumpWidget(const TestApp(home: ZetaLabel(label: 'Test Label', status: ZetaWidgetStatus.neutral))); + testWidgets('Dark mode', (WidgetTester tester) async { + await tester.pumpWidget( + const TestApp( + themeMode: ThemeMode.dark, + home: ZetaLabel(label: 'Test Label'), + ), + ); - final zetaBadgeFinder = find.byType(ZetaLabel); - final ZetaLabel label = tester.firstWidget(zetaBadgeFinder); + final zetaBadgeFinder = find.byType(ZetaLabel); + final ZetaLabel label = tester.firstWidget(zetaBadgeFinder); - expect(label.status, ZetaWidgetStatus.neutral); + expect(label.status, ZetaWidgetStatus.info); + }); - await expectLater(find.byType(ZetaLabel), matchesGoldenFile(goldenFile.getFileUri('label_neutral'))); - }); + testWidgets('Sharp', (WidgetTester tester) async { + await tester.pumpWidget( + const TestApp(home: ZetaLabel(label: 'Test Label', rounded: false)), + ); - testWidgets('Dark mode', (WidgetTester tester) async { - await tester.pumpWidget( - const TestApp( - themeMode: ThemeMode.dark, - home: ZetaLabel(label: 'Test Label'), - ), - ); + final zetaBadgeFinder = find.byType(ZetaLabel); + final ZetaLabel label = tester.firstWidget(zetaBadgeFinder); - final zetaBadgeFinder = find.byType(ZetaLabel); - final ZetaLabel label = tester.firstWidget(zetaBadgeFinder); + expect(label.rounded, false); + }); - expect(label.status, ZetaWidgetStatus.info); + testWidgets('debugFillProperties works correctly', (WidgetTester tester) async { + final diagnostics = DiagnosticPropertiesBuilder(); + const ZetaLabel( + label: 'Test label', + rounded: false, + status: ZetaWidgetStatus.positive, + ).debugFillProperties(diagnostics); - await expectLater(find.byType(ZetaLabel), matchesGoldenFile(goldenFile.getFileUri('label_dark'))); + expect(diagnostics.finder('label'), '"Test label"'); + expect(diagnostics.finder('status'), 'positive'); + expect(diagnostics.finder('rounded'), 'false'); + }); }); - - testWidgets('Sharp', (WidgetTester tester) async { - await tester.pumpWidget( - const TestApp(home: ZetaLabel(label: 'Test Label', rounded: false)), + // group('$componentName Dimensions Tests', () {}); + // group('$componentName Styling Tests', () {}); + // group('$componentName Interaction Tests', () {}); + group('$componentName Golden Tests', () { + goldenTest(goldenFile, const ZetaLabel(label: 'Test Label'), ZetaLabel, 'label_default'); + goldenTest( + goldenFile, + const ZetaLabel(label: 'Test Label', status: ZetaWidgetStatus.positive), + ZetaLabel, + 'label_positive', ); - - final zetaBadgeFinder = find.byType(ZetaLabel); - final ZetaLabel label = tester.firstWidget(zetaBadgeFinder); - - expect(label.rounded, false); - - await expectLater(find.byType(ZetaLabel), matchesGoldenFile(goldenFile.getFileUri('label_sharp'))); - }); - - testWidgets('debugFillProperties works correctly', (WidgetTester tester) async { - final diagnostics = DiagnosticPropertiesBuilder(); - const ZetaLabel( - label: 'Test label', - rounded: false, - status: ZetaWidgetStatus.positive, - ).debugFillProperties(diagnostics); - - expect(diagnostics.finder('label'), '"Test label"'); - expect(diagnostics.finder('status'), 'positive'); - expect(diagnostics.finder('rounded'), 'false'); + goldenTest( + goldenFile, + const ZetaLabel(label: 'Test Label', status: ZetaWidgetStatus.warning), + ZetaLabel, + 'label_warning', + ); + goldenTest( + goldenFile, + const ZetaLabel(label: 'Test Label', status: ZetaWidgetStatus.negative), + ZetaLabel, + 'label_negative', + ); + goldenTest( + goldenFile, + const ZetaLabel(label: 'Test Label', status: ZetaWidgetStatus.neutral), + ZetaLabel, + 'label_neutral', + ); + goldenTest(goldenFile, const ZetaLabel(label: 'Test Label'), ZetaLabel, 'label_dark', darkMode: true); + goldenTest(goldenFile, const ZetaLabel(label: 'Test Label', rounded: false), ZetaLabel, 'label_sharp'); }); + // group('$componentName Performance Tests', () {}); } diff --git a/test/test_utils/utils.dart b/test/test_utils/utils.dart index e8e7acc2..1cc72f71 100644 --- a/test/test_utils/utils.dart +++ b/test/test_utils/utils.dart @@ -2,7 +2,10 @@ import 'dart:io'; import 'package:collection/collection.dart'; import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; import 'package:path/path.dart'; +import 'package:flutter_test/flutter_test.dart'; +import '../test_utils/test_app.dart'; extension Util on DiagnosticPropertiesBuilder { dynamic finder(String finder) { @@ -27,3 +30,23 @@ class GoldenFiles { .replace(scheme: 'file'); } } + +void goldenTest(GoldenFiles goldenFile, Widget widget, Type widgetType, String fileName, {bool darkMode = false}) { + testWidgets('$fileName golden', (WidgetTester tester) async { + await tester.pumpWidget( + TestApp( + themeMode: darkMode ? ThemeMode.dark : ThemeMode.light, + home: widget, + ), + ); + + await expectLater( + find.byType(widgetType), + matchesGoldenFile(goldenFile.getFileUri(fileName)), + ); + }); +} + +BuildContext getBuildContext(WidgetTester tester, Type type) { + return tester.element(find.byType(type)); +} diff --git a/test/testing_conventions.mdx b/test/testing_conventions.mdx new file mode 100644 index 00000000..f4a8949b --- /dev/null +++ b/test/testing_conventions.mdx @@ -0,0 +1,53 @@ +# Testing Conventions Flutter Components + +## Groups + +- Accessibility Tests + Semantic labels, touch areas, contrast ratios, etc. +- Content Tests + Finds the widget, parameter statuses, etc. +- Dimensions Tests + Size, padding, margin, alignment, etc. +- Styling Tests + Rendered colors, fonts, borders, radii etc. +- Interaction Tests + Gesture recognizers, taps, drags, etc. +- Golden Tests + Compares the rendered widget with the golden file. Use the `goldenTest()` function from test_utils/utils.dart. +- Performance Tests + Animation performance, rendering performance, data manupulation performance, etc. + +## Testing File Template + +``` +import 'dart:ui'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:zeta_flutter/zeta_flutter.dart'; + +import '../../../test_utils/test_app.dart'; +import '../../../test_utils/tolerant_comparator.dart'; +import '../../../test_utils/utils.dart'; + +void main() { + const String componentName = 'ENTER_COMPONENT_NAME (e.g. ZetaButton)'; + const String parentFolder = 'ENTER_PARENT_FOLDER (e.g. button)'; + + const goldenFile = GoldenFiles(component: parentFolder); + setUpAll(() { + goldenFileComparator = TolerantComparator(goldenFile.uri); + }); + + group('$componentName Accessibility Tests', () {}); + group('$componentName Content Tests', () {}); + group('$componentName Dimensions Tests', () {}); + group('$componentName Styling Tests', () {}); + group('$componentName Interaction Tests', () {}); + group('$componentName Golden Tests', () { + goldenTest(goldenFile, widget, widgetType, 'PNG_FILE_NAME'); + }); + group('$componentName Performance Tests', () {}); +} +``` From 8bbd4410c303dc12244143f26edbe6070b589f97 Mon Sep 17 00:00:00 2001 From: Daniel Eshkeri Date: Wed, 9 Oct 2024 17:03:36 +0100 Subject: [PATCH 02/16] test: standardising tests for badges test: added debugFillProperties test helper function --- .../badge/golden/priority_pill_default.png | Bin 4502 -> 4329 bytes .../badge/golden/priority_pill_high.png | Bin 3681 -> 3450 bytes .../badge/golden/priority_pill_low.png | Bin 3870 -> 3817 bytes .../badge/golden/priority_pill_medium.png | Bin 4059 -> 4001 bytes .../badge/golden/status_label_custom.png | Bin 4609 -> 4407 bytes .../badge/golden/status_label_default.png | Bin 4561 -> 4392 bytes test/src/components/badge/golden/tag_left.png | Bin 3580 -> 3543 bytes .../src/components/badge/golden/tag_right.png | Bin 3536 -> 3487 bytes test/src/components/badge/indicator_test.dart | 53 ++-- test/src/components/badge/label_test.dart | 40 ++- .../components/badge/priority_pill_test.dart | 240 +++++++++++------- .../components/badge/status_label_test.dart | 79 +++--- test/src/components/badge/tag_test.dart | 51 ++-- test/test_utils/utils.dart | 11 + test/testing_conventions.mdx | 10 +- 15 files changed, 280 insertions(+), 204 deletions(-) diff --git a/test/src/components/badge/golden/priority_pill_default.png b/test/src/components/badge/golden/priority_pill_default.png index 3ec6f2a10b12024413243aa1ca650a7d880dea75..6ff50feb40d4126d7ff766e3ec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19b5f0&k=3zzD03B@XYlL`Pw%^3tF0HWU!Ry#Km;_UVD38H_UZg&R5p?iH0M>*D*ylh diff --git a/test/src/components/badge/golden/priority_pill_high.png b/test/src/components/badge/golden/priority_pill_high.png index 0384a884819a8556936e2f3bc99c6439885b2af2..02c9e2525d7041c54ceea259f2381399c0a5dcc5 100644 GIT binary patch literal 3450 zcmeAS@N?(olHy`uVBq!ia0y~yU{+vYV2a>i1B%QlYbpRzjKx9jP7LeL$-D$|Sc;uI zLpXq-h9ji|s7b}s#WAE}&fD7?vqBst8ZJied}`+*=dxvEMDALhNnzW#Z`|m}Z0d-W z($-Ggxb*rErgg@7#b|^SbqV!_@ zIB&6gMu=eS`L9xL0A-n18+1yMpFnVzmFz{(UJjP_>U%r(Zn#C7)DD)h7+UBgVE-} eplcqS(P#W??{XuW-5J=>XYh3Ob6Mw<&;$U%jU9#n literal 3681 zcmeAS@N?(olHy`uVBq!ia0y~yU{+vYV2a>i1B%QlYbpRzjKx9jP7LeL$-D$|Sc;uI zLpXq-h9jkefq{?P)5S5QV$R#U`&WmR${hIk{_Jbj*I8ejb(ESkc4j&SI8PCjkT7jo ztLw{`%h~AtzoEH0_=1pQ!h;10DjaOOyo(}CSR`H2Bw3xj;(jwPnU`$4Z~ep9rgk;w ze%4vsmOghl(&G2Yec8!Mt6D1`*q*{-g&kyXJ7rC{U1&*k-cC2{q4prTk4+O+4y*V|K#|Zood#8 zbLUolJNJB^dg$BU0Mi>d~hg zcUf3(V_Pwszn X>MNGU@BIjD(ldCv`njxgN@xNA3&3x| diff --git a/test/src/components/badge/golden/priority_pill_low.png b/test/src/components/badge/golden/priority_pill_low.png index 6199e19f5fe7c15228ce57418b33df4f680f3eb1..ff465b652cee4db023bf3f7481e45c51c32e3b29 100644 GIT binary patch delta 740 zcmV=(}=uOe+u8RnSBBCz5+KTA1i;x(h*&pbaAR=klj6p89(M=14`RmWmD+gQ5 z#{B-C;py?XIyav;uiGbw!`ax{+S;Cr{A>H)^Z1EpX7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s5{u diff --git a/test/src/components/badge/golden/priority_pill_medium.png b/test/src/components/badge/golden/priority_pill_medium.png index e5a1ab11c0bc8dc12d0426bfb0a9b30818a57f97..196178dfa775074cfb924f6b89b1462dd79e2a33 100644 GIT binary patch literal 4001 zcmeHJ|1;ZX9DjTp_2p8xp4=+LwqBhp*~V3boR)Ittc^#{gCIE=brby@BMzgU-x>R z*Tapz6yaol(jEZd6!~#j3; zY1p=ogiN)F;++6^a?fWdt}H7Xk?USe>NgRZM3%ac@%Y8st#Nq?Hr$8({w#wnoV^Qq zNL)?Adn~l2yBnqra%}c(ta2o$`Hvsxl6$DS;zFgoFgLBfzF_UL1t@b+tXnQu(gX-I z;<;+2T14e(d-nw1(^i!@i4VEGY2D8f06dprBd%3uOB#rWb6Na^qNd*1M)u;?ElTlf zS99EP2<|~MhyHqUbCq(w-s1|M5^NPI@G)%cd9Oxk+Zx~ zP0vR!WOm<3*9fg(2jL2jS40e=&_*8V`#+$SFl$2fI!o#@ON03w+^odK^5hCB{cn- z12t3dbZPB~S&`UXO7n+V0VZ!j-+PWVxh^or7)OX_O24k_h6pfZ2_p`AyB6$6lmE>N z#)j)CU#h1BxWFg;(m;Xr^YUh8~vm2UcG>9@f0krWrpHueJ1P zo?8VC?9WJ!L~h540E|j9O~;OUaUGHiqGU=Dqh88>HFPEl+j3(_@wmW38vq8EcAeWz zx~KUG`3Du5*g=Coa#gn88Q(%Iesf#D^-D7j!Yh6G;raA*e^JI}>EUuQn&GKh6{`K> zv$Uh14sTDEV0Cwsf}a_82>{%zCOg%b=3g}GSNLRfg4T)rC-XBQd0OLmVo?er-)*VW zZyYdGsdGNa?Tdf6xHx#N3{Jdp!nPHX`7N*jz}FJ;CANbi^LYQfIcO%tEC%yMFux4u qSJCVUW;Zmuq1g@1Zuq}(!$Vg>@(!Z)okHO!9z=#;3KN8;l>Y@Jx^{~I literal 4059 zcmeHI`#0NX7=IOG&9ELl9M#d&AKLC9M%;1|qAp7vJM47K-P9$K;}%U3$0f#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i+LKvZN*1UoFF_CMK9 BX^;Q_ diff --git a/test/src/components/badge/golden/status_label_custom.png b/test/src/components/badge/golden/status_label_custom.png index dd961c4f1bbffd4975d3b52d00c761a1312e1666..b3fd2c0b8728c4c67a059fd4d882dbd881048c01 100644 GIT binary patch literal 4407 zcmeH}{a4ag9LFzOX?4=s!(3rWKQzxWvtlZyNOM;6*kr3t=)#Ax!AYTTUsH%DS8Mig zvIoyde4^%xIwabdHZ-%^ii$7L$rJ$-%=(g3!9YVEgwg(r{lNX@p8GlHp7Xh%^M1cy z_tZDp+ZQcZu>b(DDD$g~od5)500_zno#(IAl^QG8DH#XHcY(aU$=(jDc(7pO=I5;Mdy`4UHSB+iiFs~jE%osi?fAf>rY=l zG_QD+uqKyJ%RLaWER%(fSiXAiMNG|~>75sr<&oDduFul%IJ{vow%^idI`LB3($&az z7w!1;?8FaNCa;6NDjYXC`@mtxw?eoOb&bZsA(X@rn^N(_SFxg8Rd)ypGMcr>eK)n5 zu)+T9R7}c(#HxiAFs++OQCNid)|3RcvFzx2mhQ$?Dhi~=wcx+49CQv(I~8aWH2hu| z*~3D%k~B19f^33?jik}59`yE|It)jpY=WjFSjVb{9acbw$(vkGUpr` zQ)SH+1s^U@6)RyhpN(|!7{b!Y9Y@S6Y{j^UH7ub@-LfjPL1h0eW(5i)p72Ft3cRmf zgRV0Y=Z_Bc9VAkKo~J2`saA7bBuX{sAR4^az&Eoz-zKmb}-Hj-J;WGoVInJFT~4`a>tHPxgHqKk`A!574frp=2~9Z zkngT>2AL&wvk`9>HOz|$Sjw~EqG@{&NbRKyh4L|t)_l=g@3fSt$1fMSTe0lHkbK7a zUX#ZrAk;d0wNjPDD62D*Emw2EJ>-wgP7^%QbGuG!Y@1q&>!HgTNV`?&G&ow~@pD1p zMoIi^pNl+oQD|;5#8N7;leXI`kAeWFGL8D@y8!t3mP>E$r&z<|@xh5zR6H9wVI3xnZv=7{3BQqDSk^op&bY%Q7 zT*17(_VM^Y0<@zNfch83^aMzsax9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BwF zCikuxZJ`WRd-dQAs;G|q)YhC78gx&zSEomM$TGL}Hej*n`mAS`u+q8JASe;*$}YLK z1qHULo@F@(U^#aK1CP;Z69ZHu!{EC}!0@QA}EDI zVq@$dQGcIgC6dR|c$Yu-%)QHIvpLL(cKex+`%|y}|5#>bS!V9n$DaTIz1;=-Hk>V003OV(SHCrjQIH6!4e1n0G#b; zfNYH&0RR9O@?wB&cmCrK003Oh{c~?@caINVf3J6czMH>4d^r1tUcY%g@Be!L(?0+E zt5@^(kGE%k9smG%-Zxi3cKh?<0{{TvC0_-|EpN9A003Oq7Xh-j-7WwCa79l6;;at< z0N~ozan=U_0Dll!XJ$S+>jMA)2(0^q9j^cYfX302&;bAdE@fSpnRWTuw*deE+=6vx z=HYH;5g`Boz?D6XU_BVd0ssK6>?u2z<#8nh007`xzF7BIMF;=@a7AAYUaiZ_y>To6 z0N@I~nHqQN;|l-);F6ZjX7lVZgxj4%3jfQP8UO&C?@z^b4%_nr005VCbkOSIZbpLu z005V8G(eUya`ZVXLI418zLOp`cSgv+Je&^z0OvdT&*@vRST1l16~)Ie*mCkT8=JMHzNQ5002ovPDHLkV1nv(-h}`F delta 550 zcmV+>0@?l78~huPL4T%6L_t(|obBC9jv7}OfYDn8^e*g)vyvV=tBuFKl6d0m0t{q; z)R7-FG>@<4_#BB56uPR}r~2#OX}w%- zf4JNK-tjTU;T~+y&NTo4;Cp8U$bLV@W_$0Y{2KNG1ONaoc7HNJ_CtIC006gfGC(%l zLxcbT09qn0M`SN9~*PDwMw0c;L%^P0-@UR;1-oL;2dH?|6xars~SexzP zrR&%F^W(?y`R~scFX-{{aXdXez1j62{`fHd`t<4O_wzKyYH{)30|3Bp?WZGH+uddH z0RRB-k{<%Zc7MA70KmO`6CgX=?E(M*ck~<}&iViV0Pbxb!&x5y06=3NV~nrP`Tzg` z0`qQf$14B;pmFjfbN~Q=TbbwSaJU`-0KmP?V;oNQoy@Bme*a diff --git a/test/src/components/badge/golden/tag_right.png b/test/src/components/badge/golden/tag_right.png index 2f860de3baeb6371bad0a5641371cd8ab1b103cc..1951b8be5341c0f66287353da2090570e36f82ce 100644 GIT binary patch delta 446 zcmca0Jzsi)W4))Ri(^Q|oVRx!{h|UH+AjWPxa@n)_r^@w?VERT?sgVt=eohj*VEbc z=|{$wIW3Yc)_daRe$LFxdoOoPynLHXvf4e(L(wHvB(WWqfSipG{cK`qWsfqcwr{;S4wcCcvP8x|ZFq}CnJVE?UewqDA zpc&7U9pVz_i31s`2*$kxu!yq5HwZ(~;adtwgiqb!UgF-ZJ**52?E(r63=VGf4SNn} zJv`6J$nZdbDaHTv(RV<(nmO8E<-{((d&$ngP#|&rmATJliS*MDC$lqt>dNfkXJD8y znW6G%*3NDL28IMVrYEfF-reC03hICnP+ls7GRcP b6#K)Rvde8c%l}DrKq&@KS3j3^P6^UiX?U@ zOo5Py9eaF@!a34(^E9t~*JFJ%egAR)H2!nzJ z0099qcJcABx%4go0O0i#Aiq34i4Xt)I5z?Eo9)vWkK0S{0)GGiUa!@@8@}D$jr;qD zqaU!oT91bduD`lkkGJpM9en?0JH|A|SV}Vh0GQphZwl6@j~~bF*W05XaD9C}Zfw@mUIJtf z<9Pu9U_Jum0Ds2w0sz1~1jvCl+ua2K031(%yujnuWGnyxIE4TK001%qA14F= zfKv#N11%T33jhE(o+I@E7SrzS2LJ$Y8prBArfH1z^3uBi0D#v)fIMRw;sXEx<|II# zv0CmT1ONb-$KC*0EmtQ!V46-l!k@bS*!{1UCSCymz)0Mt??3K+TJH}l6R!XO;4B=o z|6trM005kiqxNr%+XVoC^K#t&#kgGn060GZGK|{=0Dy`B8OH4b06=B+=Cmoh00007 l^9HlA0@w properties) { + testWidgets('debugFillProperties works correctly', (WidgetTester tester) async { + final diagnostics = DiagnosticPropertiesBuilder(); + widget.debugFillProperties(diagnostics); + + properties.forEach((key, value) { + expect(diagnostics.finder(key), value); + }); + }); +} diff --git a/test/testing_conventions.mdx b/test/testing_conventions.mdx index f4a8949b..25566aa8 100644 --- a/test/testing_conventions.mdx +++ b/test/testing_conventions.mdx @@ -41,7 +41,15 @@ void main() { }); group('$componentName Accessibility Tests', () {}); - group('$componentName Content Tests', () {}); + group('$componentName Content Tests', () { + final debugFillProperties = { + '': '', + }; + debugFillPropertiesTests( + widget, + debugFillProperties, + ); + }); group('$componentName Dimensions Tests', () {}); group('$componentName Styling Tests', () {}); group('$componentName Interaction Tests', () {}); From eace0a5d26bc5a148c22b6b3a3f120e27e2c75b2 Mon Sep 17 00:00:00 2001 From: Daniel Eshkeri Date: Wed, 9 Oct 2024 17:24:16 +0100 Subject: [PATCH 03/16] docs: added helper function section to TESTING_README --- .../{testing_conventions.mdx => TESTING_README.mdx} | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) rename test/{testing_conventions.mdx => TESTING_README.mdx} (78%) diff --git a/test/testing_conventions.mdx b/test/TESTING_README.mdx similarity index 78% rename from test/testing_conventions.mdx rename to test/TESTING_README.mdx index 25566aa8..c4d16e67 100644 --- a/test/testing_conventions.mdx +++ b/test/TESTING_README.mdx @@ -1,6 +1,15 @@ # Testing Conventions Flutter Components -## Groups +### Helper Functions + +As you are writing tests think about helper function you could write and add them to the `test_utils/utils.dart` file. This will help you and others write tests faster and more consistently. + +- For golden tests + `goldenTest(GoldenFiles goldenFile, Widget widget, Type widgetType, String fileName, {bool darkMode = false})` +- For debugFillProperties tests + `debugFillPropertiesTests(Widget widget, Map debugFillProperties)` + +### Groups - Accessibility Tests Semantic labels, touch areas, contrast ratios, etc. @@ -17,7 +26,7 @@ - Performance Tests Animation performance, rendering performance, data manupulation performance, etc. -## Testing File Template +### Testing File Template ``` import 'dart:ui'; From d23dce171394a065c641071fbc8b092ce2f534d5 Mon Sep 17 00:00:00 2001 From: Daniel Eshkeri Date: Wed, 9 Oct 2024 17:31:07 +0100 Subject: [PATCH 04/16] docs: added link to excel sheet in TESTING_README --- test/TESTING_README.mdx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/TESTING_README.mdx b/test/TESTING_README.mdx index c4d16e67..eb5a97bf 100644 --- a/test/TESTING_README.mdx +++ b/test/TESTING_README.mdx @@ -68,3 +68,7 @@ void main() { group('$componentName Performance Tests', () {}); } ``` + +#### Visibility Excel Sheet + +https://zebra-my.sharepoint.com/:x:/p/de7924/Ea0l7BF7AzJJoBVPrg4cIswBZRyek6iNT3zzwDcLn-5ZGg?e=NTJIZU From 717673d67c5688c59e7fbe7bd851e3620257988f Mon Sep 17 00:00:00 2001 From: Daniel Eshkeri Date: Thu, 10 Oct 2024 11:25:53 +0100 Subject: [PATCH 05/16] test: added test count script --- test/output/test_counts.json | 77 +++++++++++++++++++ test/scripts/test_counter.dart | 67 ++++++++++++++++ .../components/accordion/accordion_test.dart | 28 +++---- 3 files changed, 158 insertions(+), 14 deletions(-) create mode 100644 test/output/test_counts.json create mode 100644 test/scripts/test_counter.dart diff --git a/test/output/test_counts.json b/test/output/test_counts.json new file mode 100644 index 00000000..b0b6806e --- /dev/null +++ b/test/output/test_counts.json @@ -0,0 +1,77 @@ +{ + "test/src/components\\accordion\\accordion_test.dart": { + "Accessibility Tests": 0, + "Content Tests": 2, + "Dimensions Tests": 0, + "Styling Tests": 1, + "Interaction Tests": 2, + "Golden Tests": 0, + "Performance Tests": 0 + }, + "test/src/components\\badge\\indicator_test.dart": { + "Accessibility Tests": 0, + "Content Tests": 7, + "Dimensions Tests": 0, + "Styling Tests": 0, + "Interaction Tests": 0, + "Golden Tests": 5, + "Performance Tests": 0 + }, + "test/src/components\\badge\\label_test.dart": { + "Accessibility Tests": 0, + "Content Tests": 8, + "Dimensions Tests": 0, + "Styling Tests": 0, + "Interaction Tests": 0, + "Golden Tests": 7, + "Performance Tests": 0 + }, + "test/src/components\\badge\\priority_pill_test.dart": { + "Accessibility Tests": 0, + "Content Tests": 5, + "Dimensions Tests": 0, + "Styling Tests": 0, + "Interaction Tests": 0, + "Golden Tests": 4, + "Performance Tests": 0 + }, + "test/src/components\\badge\\status_label_test.dart": { + "Accessibility Tests": 0, + "Content Tests": 3, + "Dimensions Tests": 0, + "Styling Tests": 0, + "Interaction Tests": 0, + "Golden Tests": 2, + "Performance Tests": 0 + }, + "test/src/components\\badge\\tag_test.dart": { + "Accessibility Tests": 0, + "Content Tests": 3, + "Dimensions Tests": 0, + "Styling Tests": 0, + "Interaction Tests": 0, + "Golden Tests": 2, + "Performance Tests": 0 + }, + "test/src/components\\button\\button_test.dart": { "unorganised": 13 }, + "test/src/components\\chat_item\\chat_item_test.dart": { "unorganised": 9 }, + "test/src/components\\checkbox\\checkbox_test.dart": { "unorganised": 5 }, + "test/src/components\\chips\\chip_test.dart": { "unorganised": 6 }, + "test/src/components\\comms_button\\comms_button_test.dart": { + "unorganised": 9 + }, + "test/src/components\\dialpad\\dialpad_test.dart": { "unorganised": 4 }, + "test/src/components\\fabs\\fab_test.dart": { "unorganised": 8 }, + "test/src/components\\icon\\icon_test.dart": { "unorganised": 12 }, + "test/src/components\\in_page_banner\\in_page_banner_test.dart": { + "unorganised": 3 + }, + "test/src/components\\password\\password_input_test.dart": {}, + "test/src/components\\search_bar\\search_bar_test.dart": { + "unorganised": 14 + }, + "test/src/components\\slider\\slider_test.dart": {}, + "test/src/components\\stepper input\\stepper_input_test.dart": {}, + "test/src/components\\tooltip\\tooltip_test.dart": { "unorganised": 9 }, + "test/src/components\\top_app_bar\\extended_top_app_bar_test.dart": {} +} diff --git a/test/scripts/test_counter.dart b/test/scripts/test_counter.dart new file mode 100644 index 00000000..f8a24def --- /dev/null +++ b/test/scripts/test_counter.dart @@ -0,0 +1,67 @@ +import 'dart:convert'; +import 'dart:io'; + +enum TestGroups { + accessibility, + content, + dimensions, + styling, + interaction, + golden, + performance, +} + +void main() async { + final testDirectory = Directory('test/src/components'); + final outputDirectory = Directory('test/output'); + if (!outputDirectory.existsSync()) { + await outputDirectory.create(recursive: true); + } + + final testFiles = + testDirectory.listSync(recursive: true).where((entity) => entity is File && entity.path.endsWith('_test.dart')); + final Map> testCounts = {}; + + for (final FileSystemEntity file in testFiles) { + final String content = await File(file.path).readAsString(); + final Map testGroups = _extractTestGroups(content); + testCounts[file.path] = testGroups; + } + + final jsonOutput = jsonEncode(testCounts); + final outputFile = File('${outputDirectory.path}/test_counts.json'); + await outputFile.writeAsString(jsonOutput); + + print('Test counts saved to ${outputFile.path}'); +} + +Map _extractTestGroups(String content) { + final Map testGroups = {}; + final groupRegex = RegExp(r"group\('([^']+)'"); + final testRegex = RegExp(r"testWidgets\('([^']+)'"); + final goldenTestRegex = RegExp(r'goldenTest\('); + final debugFillPropertiesRegex = RegExp(r'debugFillPropertiesTests\('); + + final groupMatches = groupRegex.allMatches(content); + for (var groupMatch in groupMatches) { + final groupName = groupMatch.group(1); + print('groupMatch: $groupMatch'); + if (groupName != null) { + final groupContent = content.substring(groupMatch.end).split('group(').first; + print('groupContent: $groupContent'); + + final testMatches = testRegex.allMatches(groupContent).toList() + + goldenTestRegex.allMatches(groupContent).toList() + + debugFillPropertiesRegex.allMatches(groupContent).toList(); + if (!TestGroups.values + .map((el) => el.name) + .contains(groupName.split('Name').last.trim().split('Tests').first.trim().toLowerCase())) { + testGroups['unorganised'] = testMatches.length; + return testGroups; + } + testGroups[groupName.split('Name').last.trim()] = testMatches.length; + } + } + + return testGroups; +} diff --git a/test/src/components/accordion/accordion_test.dart b/test/src/components/accordion/accordion_test.dart index 01200185..0b05487c 100644 --- a/test/src/components/accordion/accordion_test.dart +++ b/test/src/components/accordion/accordion_test.dart @@ -1,6 +1,5 @@ import 'dart:ui'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:zeta_flutter/zeta_flutter.dart'; @@ -10,19 +9,20 @@ import '../../../test_utils/utils.dart'; void main() { const String componentName = 'ZetaAccordion'; - // group('$componentName Accessibility Tests', () {}); + group('$componentName Accessibility Tests', () {}); group('$componentName Content Tests', () { - testWidgets('debugFillProperties works correctly', (WidgetTester tester) async { - final diagnostics = DiagnosticPropertiesBuilder(); + final debugFillProperties = { + 'title': '"Title"', + 'rounded': 'null', + 'contained': 'false', + 'isOpen': 'false', + }; + debugFillPropertiesTests( const ZetaAccordion( title: 'Title', - ).debugFillProperties(diagnostics); - - expect(diagnostics.finder('title'), '"Title"'); - expect(diagnostics.finder('rounded'), 'null'); - expect(diagnostics.finder('contained'), 'false'); - expect(diagnostics.finder('isOpen'), 'false'); - }); + ), + debugFillProperties, + ); testWidgets('Programatically change child', (WidgetTester tester) async { Widget? child = const Text('Text 1'); @@ -49,7 +49,7 @@ void main() { expect(accordionContent, findsNothing); }); }); - // group('$componentName Dimensions Tests', () {}); + group('$componentName Dimensions Tests', () {}); group('$componentName Styling Tests', () { testWidgets('ZetaAccordion changes color on hover', (WidgetTester tester) async { await tester.pumpWidget( @@ -157,6 +157,6 @@ void main() { expect(sizeTransition.sizeFactor.value, 0); }); }); - // group('$componentName Golden Tests', () {}); - // group('$componentName Performance Tests', () {}); + group('$componentName Golden Tests', () {}); + group('$componentName Performance Tests', () {}); } From 9b3bde38aaf433e9648ba1f4c8ea803e32f52ecc Mon Sep 17 00:00:00 2001 From: Daniel Eshkeri Date: Thu, 10 Oct 2024 11:39:38 +0100 Subject: [PATCH 06/16] fix: changed storybook to widgetbook in name of deploy preview in pull request github action --- .github/workflows/pull-request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index c58f8ab5..a55af954 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -41,7 +41,7 @@ jobs: fi deploy-preview: - name: Deploy preview version of the storybook on firebase + name: Deploy preview version of the widgetbook on firebase needs: [code-quality, check-secret] if: needs.check-secret.outputs.secret-exists == 'true' runs-on: ubuntu-latest From 32ff1f90704dedba60073c8b40383285cbfd56ec Mon Sep 17 00:00:00 2001 From: Daniel Eshkeri Date: Thu, 10 Oct 2024 16:27:12 +0100 Subject: [PATCH 07/16] docs: created test counter script --- pubspec.yaml | 1 + test/output/test_counts.json | 115 +++++++------ test/output/test_groups.json | 269 +++++++++++++++++++++++++++++++ test/scripts/test_counter.dart | 285 +++++++++++++++++++++++++++------ 4 files changed, 570 insertions(+), 100 deletions(-) create mode 100644 test/output/test_groups.json diff --git a/pubspec.yaml b/pubspec.yaml index 05511bcd..b39bb34f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -21,6 +21,7 @@ environment: flutter: ">=3.16.0" dependencies: + analyzer: ^6.7.0 collection: ^1.18.0 equatable: ^2.0.5 flutter: diff --git a/test/output/test_counts.json b/test/output/test_counts.json index b0b6806e..fab3c402 100644 --- a/test/output/test_counts.json +++ b/test/output/test_counts.json @@ -1,77 +1,86 @@ { "test/src/components\\accordion\\accordion_test.dart": { - "Accessibility Tests": 0, - "Content Tests": 2, - "Dimensions Tests": 0, - "Styling Tests": 1, - "Interaction Tests": 2, - "Golden Tests": 0, - "Performance Tests": 0 + "'$componentName Accessibility Tests'": 0, + "'$componentName Content Tests'": 1, + "'$componentName Dimensions Tests'": 0, + "'$componentName Styling Tests'": 1, + "'$componentName Interaction Tests'": 2, + "'$componentName Golden Tests'": 0, + "'$componentName Performance Tests'": 0 }, "test/src/components\\badge\\indicator_test.dart": { - "Accessibility Tests": 0, - "Content Tests": 7, - "Dimensions Tests": 0, - "Styling Tests": 0, - "Interaction Tests": 0, - "Golden Tests": 5, - "Performance Tests": 0 + "'$componentName Accessibility Tests'": 0, + "'$componentName Content Tests'": 6, + "'$componentName Dimensions Tests'": 0, + "'$componentName Styling Tests'": 0, + "'$componentName Interaction Tests'": 0, + "'$componentName Golden Tests'": 0, + "'$componentName Performance Tests'": 0 }, "test/src/components\\badge\\label_test.dart": { - "Accessibility Tests": 0, - "Content Tests": 8, - "Dimensions Tests": 0, - "Styling Tests": 0, - "Interaction Tests": 0, - "Golden Tests": 7, - "Performance Tests": 0 + "'$componentName Accessibility Tests'": 0, + "'$componentName Content Tests'": 7, + "'$componentName Dimensions Tests'": 0, + "'$componentName Styling Tests'": 0, + "'$componentName Interaction Tests'": 0, + "'$componentName Golden Tests'": 0, + "'$componentName Performance Tests'": 0 }, "test/src/components\\badge\\priority_pill_test.dart": { - "Accessibility Tests": 0, - "Content Tests": 5, - "Dimensions Tests": 0, - "Styling Tests": 0, - "Interaction Tests": 0, - "Golden Tests": 4, - "Performance Tests": 0 + "'$componentName Accessibility Tests'": 0, + "'$componentName Content Tests'": 4, + "'$componentName Dimensions Tests'": 0, + "'$componentName Styling Tests'": 0, + "'$componentName Interaction Tests'": 0, + "'$componentName Golden Tests'": 0, + "'$componentName Performance Tests'": 0 }, "test/src/components\\badge\\status_label_test.dart": { - "Accessibility Tests": 0, - "Content Tests": 3, - "Dimensions Tests": 0, - "Styling Tests": 0, - "Interaction Tests": 0, - "Golden Tests": 2, - "Performance Tests": 0 + "'$componentName Accessibility Tests'": 0, + "'$componentName Content Tests'": 2, + "'$componentName Dimensions Tests'": 0, + "'$componentName Styling Tests'": 0, + "'$componentName Interaction Tests'": 0, + "'$componentName Golden Tests'": 0, + "'$componentName Performance Tests'": 0 }, "test/src/components\\badge\\tag_test.dart": { - "Accessibility Tests": 0, - "Content Tests": 3, - "Dimensions Tests": 0, - "Styling Tests": 0, - "Interaction Tests": 0, - "Golden Tests": 2, - "Performance Tests": 0 + "'$componentName Accessibility Tests'": 0, + "'$componentName Content Tests'": 2, + "'$componentName Dimensions Tests'": 0, + "'$componentName Styling Tests'": 0, + "'$componentName Interaction Tests'": 0, + "'$componentName Golden Tests'": 0, + "'$componentName Performance Tests'": 0 }, - "test/src/components\\button\\button_test.dart": { "unorganised": 13 }, - "test/src/components\\chat_item\\chat_item_test.dart": { "unorganised": 9 }, - "test/src/components\\checkbox\\checkbox_test.dart": { "unorganised": 5 }, - "test/src/components\\chips\\chip_test.dart": { "unorganised": 6 }, + "test/src/components\\button\\button_test.dart": { "'ZetaButton Tests'": 1 }, + "test/src/components\\chat_item\\chat_item_test.dart": { + "'ZetaChatItem Tests'": 9 + }, + "test/src/components\\checkbox\\checkbox_test.dart": { + "'ZetaCheckbox Tests'": 6 + }, + "test/src/components\\chips\\chip_test.dart": { "'ZetaChip'": 5 }, "test/src/components\\comms_button\\comms_button_test.dart": { - "unorganised": 9 + "'ZetaCommsButton Tests'": 9, + "'ZetaCommsButton Golden Tests'": 1 }, - "test/src/components\\dialpad\\dialpad_test.dart": { "unorganised": 4 }, - "test/src/components\\fabs\\fab_test.dart": { "unorganised": 8 }, - "test/src/components\\icon\\icon_test.dart": { "unorganised": 12 }, + "test/src/components\\dialpad\\dialpad_test.dart": { + "'ZetaDialPad Tests'": 1 + }, + "test/src/components\\fabs\\fab_test.dart": { "'ZetaFAB Tests'": 2 }, + "test/src/components\\icon\\icon_test.dart": { "'Zeta Icon'": 12 }, "test/src/components\\in_page_banner\\in_page_banner_test.dart": { - "unorganised": 3 + "'ZetaInPageBanner Tests'": 1 }, "test/src/components\\password\\password_input_test.dart": {}, "test/src/components\\search_bar\\search_bar_test.dart": { - "unorganised": 14 + "'ZetaSearchBar'": 14 }, "test/src/components\\slider\\slider_test.dart": {}, "test/src/components\\stepper input\\stepper_input_test.dart": {}, - "test/src/components\\tooltip\\tooltip_test.dart": { "unorganised": 9 }, + "test/src/components\\tooltip\\tooltip_test.dart": { + "'ZetaTooltip Widget Tests'": 9 + }, "test/src/components\\top_app_bar\\extended_top_app_bar_test.dart": {} } diff --git a/test/output/test_groups.json b/test/output/test_groups.json new file mode 100644 index 00000000..08cf28b3 --- /dev/null +++ b/test/output/test_groups.json @@ -0,0 +1,269 @@ +{ + "test/src/components\\accordion\\accordion_test.dart": [ + { "group": "'$componentName Accessibility Tests'", "tests": [] }, + { + "group": "'$componentName Content Tests'", + "tests": [{ "name": "'Programatically change child'" }] + }, + { "group": "'$componentName Dimensions Tests'", "tests": [] }, + { + "group": "'$componentName Styling Tests'", + "tests": [{ "name": "'ZetaAccordion changes color on hover'" }] + }, + { + "group": "'$componentName Interaction Tests'", + "tests": [ + { "name": "'ZetaAccordion expands and collapses correctly'" }, + { "name": "'ZetaAccordion changes isOpen property correctly'" } + ] + }, + { "group": "'$componentName Golden Tests'", "tests": [] }, + { "group": "'$componentName Performance Tests'", "tests": [] } + ], + "test/src/components\\badge\\indicator_test.dart": [ + { "group": "'$componentName Accessibility Tests'", "tests": [] }, + { + "group": "'$componentName Content Tests'", + "tests": [ + { "name": "'Default constructor initializes with correct parameters'" }, + { "name": "'Copy with function works'" }, + { "name": "'Icon constructor initializes with correct parameters'" }, + { "name": "'Icon constructor with values'" }, + { + "name": "'Notification constructor initializes with correct parameters'" + }, + { "name": "'Notification constructor with values'" } + ] + }, + { "group": "'$componentName Dimensions Tests'", "tests": [] }, + { "group": "'$componentName Styling Tests'", "tests": [] }, + { "group": "'$componentName Interaction Tests'", "tests": [] }, + { "group": "'$componentName Golden Tests'", "tests": [] }, + { "group": "'$componentName Performance Tests'", "tests": [] } + ], + "test/src/components\\badge\\label_test.dart": [ + { "group": "'$componentName Accessibility Tests'", "tests": [] }, + { + "group": "'$componentName Content Tests'", + "tests": [ + { "name": "'Initializes with correct parameters'" }, + { "name": "'Positive status'" }, + { "name": "'Warning status'" }, + { "name": "'Negative status'" }, + { "name": "'Neutral status'" }, + { "name": "'Dark mode'" }, + { "name": "'Sharp'" } + ] + }, + { "group": "'$componentName Dimensions Tests'", "tests": [] }, + { "group": "'$componentName Styling Tests'", "tests": [] }, + { "group": "'$componentName Interaction Tests'", "tests": [] }, + { "group": "'$componentName Golden Tests'", "tests": [] }, + { "group": "'$componentName Performance Tests'", "tests": [] } + ], + "test/src/components\\badge\\priority_pill_test.dart": [ + { "group": "'$componentName Accessibility Tests'", "tests": [] }, + { + "group": "'$componentName Content Tests'", + "tests": [ + { "name": "'Initializes with correct label and index'" }, + { "name": "'High priority pill'" }, + { "name": "'Medium priority pill'" }, + { "name": "'Low priority pill'" } + ] + }, + { "group": "'$componentName Dimensions Tests'", "tests": [] }, + { "group": "'$componentName Styling Tests'", "tests": [] }, + { "group": "'$componentName Interaction Tests'", "tests": [] }, + { "group": "'$componentName Golden Tests'", "tests": [] }, + { "group": "'$componentName Performance Tests'", "tests": [] } + ], + "test/src/components\\badge\\status_label_test.dart": [ + { "group": "'$componentName Accessibility Tests'", "tests": [] }, + { + "group": "'$componentName Content Tests'", + "tests": [ + { "name": "'Initializes with correct properties'" }, + { "name": "'Initializes with correct label and custom icon'" } + ] + }, + { "group": "'$componentName Dimensions Tests'", "tests": [] }, + { "group": "'$componentName Styling Tests'", "tests": [] }, + { "group": "'$componentName Interaction Tests'", "tests": [] }, + { "group": "'$componentName Golden Tests'", "tests": [] }, + { "group": "'$componentName Performance Tests'", "tests": [] } + ], + "test/src/components\\badge\\tag_test.dart": [ + { "group": "'$componentName Accessibility Tests'", "tests": [] }, + { + "group": "'$componentName Content Tests'", + "tests": [ + { "name": "'Initializes right with correct parameters'" }, + { "name": "'Initializes left with correct parameters'" } + ] + }, + { "group": "'$componentName Dimensions Tests'", "tests": [] }, + { "group": "'$componentName Styling Tests'", "tests": [] }, + { "group": "'$componentName Interaction Tests'", "tests": [] }, + { "group": "'$componentName Golden Tests'", "tests": [] }, + { "group": "'$componentName Performance Tests'", "tests": [] } + ], + "test/src/components\\button\\button_test.dart": [ + { + "group": "'ZetaButton Tests'", + "tests": [{ "name": "'Initializes with correct Label'" }] + } + ], + "test/src/components\\chat_item\\chat_item_test.dart": [ + { + "group": "'ZetaChatItem Tests'", + "tests": [ + { "name": "'ZetaChatItem displays correctly'" }, + { "name": "'ZetaChatItem highlighted'" }, + { "name": "'ZetaChatItem slidable actions'" }, + { "name": "'ZetaChatItem with pale slidable button colors'" }, + { "name": "'ZetaChatItem with 2 pale buttons and 2 regular buttons'" }, + { "name": "'ZetaChatItem with custom leading widget'" }, + { "name": "'ZetaChatItem with custom slidable buttons'" }, + { "name": "'debugFillProperties works correctly'" }, + { "name": "'ZetaChatItem displays correctly'" } + ] + } + ], + "test/src/components\\checkbox\\checkbox_test.dart": [ + { + "group": "'ZetaCheckbox Tests'", + "tests": [ + { "name": "'Initializes with correct parameters'" }, + { "name": "'ZetaCheckbox changes state on tap'" }, + { "name": "\"Disabled ZetaCheckbox doesn't change state on tap\"" }, + { "name": "'ZetaCheckbox interaction'" }, + { "name": "'ZetaCheckbox UI changes on hover'" }, + { "name": "'debugFillProperties works correctly'" } + ] + } + ], + "test/src/components\\chips\\chip_test.dart": [ + { + "group": "'ZetaChip'", + "tests": [ + { "name": "'renders label correctly'" }, + { "name": "'triggers onTap callback when tapped'" }, + { "name": "'triggers onToggle callback when selected'" }, + { "name": "'renders leading widget correctly'" }, + { "name": "'renders trailing widget correctly'" } + ] + } + ], + "test/src/components\\comms_button\\comms_button_test.dart": [ + { + "group": "'ZetaCommsButton Tests'", + "tests": [ + { "name": "'Initializes with correct label'" }, + { "name": "'Initializes with correct icon'" }, + { "name": "'Initializes with correct type'" }, + { "name": "'Changes label, icon, and type when toggled'" }, + { "name": "'Button is not toggleable when onToggle is null'" }, + { "name": "'Button calls onPressed callback when pressed'" }, + { "name": "'debugFillProperties Test'" }, + { "name": "'Button meets accessibility requirements'" }, + { "name": "'Button meets accessibility requirements when toggled'" } + ] + }, + { + "group": "'ZetaCommsButton Golden Tests'", + "tests": [{ "name": "'ZetaCommsButton with type $type'" }] + } + ], + "test/src/components\\dialpad\\dialpad_test.dart": [ + { + "group": "'ZetaDialPad Tests'", + "tests": [ + { "name": "'Initializes with correct parameters and is enabled'" } + ] + } + ], + "test/src/components\\fabs\\fab_test.dart": [ + { + "group": "'ZetaFAB Tests'", + "tests": [ + { "name": "'Initializes with correct parameters'" }, + { "name": "'OnPressed callback'" } + ] + } + ], + "test/src/components\\icon\\icon_test.dart": [ + { + "group": "'Zeta Icon'", + "tests": [ + { "name": "'renders icon correctly'" }, + { "name": "'applies correct size to icon'" }, + { "name": "'applies correct color to icon'" }, + { "name": "'applies correct semantic label to icon'" }, + { "name": "'applies sharp family to icon'" }, + { "name": "'applies correct font family to icon'" }, + { "name": "'applies correct font family when rounded is false'" }, + { + "name": "'does not change fontFamily if specific rounded / sharp variant is requested'" + }, + { "name": "'apply() sets round icon font'" }, + { "name": "'apply() uses rounded from context'" }, + { + "name": "'apply() returns the same icon if not in ZetaIcons family'" + }, + { "name": "'debugFillProperties works correctly'" } + ] + } + ], + "test/src/components\\in_page_banner\\in_page_banner_test.dart": [ + { + "group": "'ZetaInPageBanner Tests'", + "tests": [{ "name": "'ZetaInPageBanner creation'" }] + } + ], + "test/src/components\\password\\password_input_test.dart": [], + "test/src/components\\search_bar\\search_bar_test.dart": [ + { + "group": "'ZetaSearchBar'", + "tests": [ + { "name": "'renders with default parameters'" }, + { "name": "'golden: renders initializes correctly'" }, + { "name": "'golden: renders size medium correctly'" }, + { "name": "'golden: renders size small correctly'" }, + { "name": "'golden: renders shape full correctly'" }, + { "name": "'golden: renders shape sharp correctly'" }, + { "name": "'sets initial value correctly'" }, + { "name": "'sets updated initial value correctly'" }, + { "name": "'triggers onChanged callback when text is entered'" }, + { + "name": "'triggers onSubmit callback when submit action is performed'" + }, + { + "name": "'triggers onSpeechToText callback when microphone button is pressed'" + }, + { "name": "'does not allow text input when disabled'" }, + { "name": "'speech-to-text button visibility'" }, + { "name": "'clear button functionality'" } + ] + } + ], + "test/src/components\\slider\\slider_test.dart": [], + "test/src/components\\stepper input\\stepper_input_test.dart": [], + "test/src/components\\tooltip\\tooltip_test.dart": [ + { + "group": "'ZetaTooltip Widget Tests'", + "tests": [ + { "name": "'renders with default properties'" }, + { "name": "'renders with custom color and padding'" }, + { "name": "'renders with custom text style'" }, + { "name": "'renders with arrow correctly in up direction'" }, + { "name": "'renders with arrow correctly in down direction'" }, + { "name": "'renders with arrow correctly in left direction'" }, + { "name": "'renders with arrow correctly in right direction'" }, + { "name": "'renders with rounded and sharp corners'" }, + { "name": "'debugFillProperties works correctly'" } + ] + } + ], + "test/src/components\\top_app_bar\\extended_top_app_bar_test.dart": [] +} diff --git a/test/scripts/test_counter.dart b/test/scripts/test_counter.dart index f8a24def..7066ad3c 100644 --- a/test/scripts/test_counter.dart +++ b/test/scripts/test_counter.dart @@ -1,67 +1,258 @@ +// import 'dart:convert'; +// import 'dart:io'; + +// enum TestGroups { +// accessibility, +// content, +// dimensions, +// styling, +// interaction, +// golden, +// performance, +// } + +// void main() async { +// final testDirectory = Directory('test/src/components'); +// final outputDirectory = Directory('test/output'); +// if (!outputDirectory.existsSync()) { +// await outputDirectory.create(recursive: true); +// } + +// final testFiles = +// testDirectory.listSync(recursive: true).where((entity) => entity is File && entity.path.endsWith('_test.dart')); +// final Map> testCounts = {}; + +// for (final FileSystemEntity file in testFiles) { +// final String content = await File(file.path).readAsString(); + +// // final List content = await File(file.path).readAsLines(); +// final Map testGroups = _extractTestGroups(content); +// testCounts[file.path] = testGroups; +// } + +// final jsonOutput = jsonEncode(testCounts); +// final outputFile = File('${outputDirectory.path}/test_counts.json'); +// await outputFile.writeAsString(jsonOutput); + +// print('Test counts saved to ${outputFile.path}'); +// } + +// Map _extractTestGroups(String content) { +// final Map testGroups = {}; +// final groupRegex = RegExp(r"group\('([^']+)'"); +// final testRegex = RegExp(r"testWidgets\('([^']+)'"); +// final goldenTestRegex = RegExp(r'goldenTest\('); +// final debugFillPropertiesRegex = RegExp(r'debugFillPropertiesTests\('); + +// final groupMatches = groupRegex.allMatches(content); +// for (var groupMatch in groupMatches) { +// final groupName = groupMatch.group(1); +// print('groupMatch: $groupMatch'); +// if (groupName != null) { +// final groupContent = content.substring(groupMatch.end).split('});\r\n });').first; +// print('groupContent: $groupName + $groupContent'); + +// final testMatches = testRegex.allMatches(groupContent).toList() + +// goldenTestRegex.allMatches(groupContent).toList() + +// debugFillPropertiesRegex.allMatches(groupContent).toList(); +// if (!TestGroups.values +// .map((el) => el.name) +// .contains(groupName.split('Name').last.trim().split('Tests').first.trim().toLowerCase())) { +// testGroups['unorganised'] = testMatches.length; +// return testGroups; +// } +// testGroups[groupName.split('Name').last.trim()] = testMatches.length; +// } +// } + +// return testGroups; +// } + +// void main() async { +// final outputDirectory = Directory('test/output'); +// if (!outputDirectory.existsSync()) { +// await outputDirectory.create(recursive: true); +// } +// const filePath = 'test/src/components/accordion/accordion_test.dart'; +// final file = File(filePath); +// final contents = await file.readAsString(); +// final groupRegex = RegExp(r"group\('(.+?)', \(\) \{([\s\S]*?)\}\);", multiLine: true); +// // final groupRegex = RegExp(r"group\('(.+?)', \(\) \{([\s\S]+?)\}\);", multiLine: true); +// // final testRegex = RegExp(r"testWidgets\('(.+?)', \((.+?)\) async \{([\s\S]+?)\}\);", multiLine: true); +// // final testRegex = RegExp(r"testWidgets\('(.+?)', \((.+?)\) async \{([\s\S]*?)\}\);", multiLine: true); +// final testRegex = RegExp(r"testWidgets\('([^']+)'"); + +// final groups = >[]; + +// for (final groupMatch in groupRegex.allMatches(contents)) { +// final groupName = groupMatch.group(1); +// final groupBody = groupMatch.group(0); +// print('$groupName:::: $groupBody'); +// // final l = groupMatch.group(0); +// // print('groupMatch: $l'); + +// final tests = >[]; + +// for (final testMatch in testRegex.allMatches(groupBody!)) { +// final testName = testMatch.group(0); +// // final testBody = testMatch.group(3); +// // print('$testName'); + +// // final steps = testBody!.split(';').map((step) => step.trim()).where((step) => step.isNotEmpty).toList(); + +// tests.add({ +// 'name': testName, +// // 'steps': steps, +// }); +// } + +// groups.add({ +// 'group': groupName, +// 'tests': tests, +// }); +// } + +// final jsonOutput = jsonEncode(groups); +// print(jsonOutput); +// final outputFile = File('${outputDirectory.path}/test_groups.json'); +// await outputFile.writeAsString(jsonOutput); +// } + +// void main() async { +// final outputDirectory = Directory('test/output'); +// if (!outputDirectory.existsSync()) { +// await outputDirectory.create(recursive: true); +// } + +// const filePath = 'test/src/components/accordion/accordion_test.dart'; +// final file = File(filePath); +// final contents = await file.readAsString(); + +// final groupRegex = RegExp(r"group\('(.+?)', \(\) \{([\s\S]*?)\}\);", multiLine: true); +// final testRegex = RegExp(r"testWidgets\('(.+?)', \((.+?)\) async \{([\s\S]*?)\}\);", multiLine: true); + +// final groups = >[]; + +// for (final groupMatch in groupRegex.allMatches(contents)) { +// final groupName = groupMatch.group(1); +// final groupBody = groupMatch.group(2); + +// final tests = >[]; + +// for (final testMatch in testRegex.allMatches(groupBody!)) { +// final testName = testMatch.group(1); +// final testBody = testMatch.group(3); + +// final steps = testBody! +// .split(';') +// .map((step) => step.trim()) +// .where((step) => step.isNotEmpty) +// .toList(); + +// tests.add({ +// 'name': testName, +// 'steps': steps, +// }); +// } + +// groups.add({ +// 'group': groupName, +// 'tests': tests, +// }); +// } + +// final jsonOutput = jsonEncode(groups); +// print(jsonOutput); +// } + import 'dart:convert'; import 'dart:io'; -enum TestGroups { - accessibility, - content, - dimensions, - styling, - interaction, - golden, - performance, +import 'package:analyzer/dart/analysis/utilities.dart'; +import 'package:analyzer/dart/ast/ast.dart'; +import 'package:analyzer/dart/ast/visitor.dart'; + +class TestOutlineVisitor extends RecursiveAstVisitor { + final List> groups = []; + + @override + void visitMethodInvocation(MethodInvocation node) { + if (node.methodName.name == 'group') { + final groupName = node.argumentList.arguments.first.toString(); + final groupBody = node.argumentList.arguments.last; + + final tests = >[]; + + if (groupBody is FunctionExpression) { + final body = groupBody.body; + if (body is BlockFunctionBody) { + body.block.visitChildren(TestVisitor(tests)); + } + } + + groups.add({ + 'group': groupName, + 'tests': tests, + }); + } + super.visitMethodInvocation(node); + } +} + +class TestVisitor extends RecursiveAstVisitor { + TestVisitor(this.tests); + + final List> tests; + + @override + void visitMethodInvocation(MethodInvocation node) { + if (node.methodName.name == 'testWidgets') { + final testName = node.argumentList.arguments.first.toString(); + + tests.add({ + 'name': testName, + }); + } + super.visitMethodInvocation(node); + } } void main() async { - final testDirectory = Directory('test/src/components'); final outputDirectory = Directory('test/output'); if (!outputDirectory.existsSync()) { await outputDirectory.create(recursive: true); } - + final testDirectory = Directory('test/src/components'); final testFiles = testDirectory.listSync(recursive: true).where((entity) => entity is File && entity.path.endsWith('_test.dart')); - final Map> testCounts = {}; + final Map>> testGroups = {}; for (final FileSystemEntity file in testFiles) { - final String content = await File(file.path).readAsString(); - final Map testGroups = _extractTestGroups(content); - testCounts[file.path] = testGroups; + final contents = await File(file.path).readAsString(); + + final parseResult = parseString(content: contents); + final visitor = TestOutlineVisitor(); + parseResult.unit.visitChildren(visitor); + testGroups[file.path] = visitor.groups; } - final jsonOutput = jsonEncode(testCounts); - final outputFile = File('${outputDirectory.path}/test_counts.json'); - await outputFile.writeAsString(jsonOutput); + final jsonOutputGroups = jsonEncode(testGroups); + final outputFileGroups = File('${outputDirectory.path}/test_groups.json'); + await outputFileGroups.writeAsString(jsonOutputGroups); - print('Test counts saved to ${outputFile.path}'); -} + final Map> testCount = {}; -Map _extractTestGroups(String content) { - final Map testGroups = {}; - final groupRegex = RegExp(r"group\('([^']+)'"); - final testRegex = RegExp(r"testWidgets\('([^']+)'"); - final goldenTestRegex = RegExp(r'goldenTest\('); - final debugFillPropertiesRegex = RegExp(r'debugFillPropertiesTests\('); - - final groupMatches = groupRegex.allMatches(content); - for (var groupMatch in groupMatches) { - final groupName = groupMatch.group(1); - print('groupMatch: $groupMatch'); - if (groupName != null) { - final groupContent = content.substring(groupMatch.end).split('group(').first; - print('groupContent: $groupContent'); - - final testMatches = testRegex.allMatches(groupContent).toList() + - goldenTestRegex.allMatches(groupContent).toList() + - debugFillPropertiesRegex.allMatches(groupContent).toList(); - if (!TestGroups.values - .map((el) => el.name) - .contains(groupName.split('Name').last.trim().split('Tests').first.trim().toLowerCase())) { - testGroups['unorganised'] = testMatches.length; - return testGroups; - } - testGroups[groupName.split('Name').last.trim()] = testMatches.length; + testGroups.forEach((filePath, groups) { + final Map groupCounts = {}; + for (final group in groups) { + final groupName = group['group'] as String; + final tests = group['tests'] as List; + groupCounts[groupName] = tests.length; } - } - - return testGroups; + testCount[filePath] = groupCounts; + }); + final jsonOutput = jsonEncode(testCount); + print(jsonOutput); + final outputFile = File('${outputDirectory.path}/test_counts.json'); + await outputFile.writeAsString(jsonOutput); } From b2e34840997a959ca766b148ef0eaa98c9e913ee Mon Sep 17 00:00:00 2001 From: Daniel Eshkeri Date: Fri, 11 Oct 2024 16:55:22 +0100 Subject: [PATCH 08/16] docs: test_counter script improvements --- test/TESTING_README.mdx | 6 +- test/output/test_counts.json | 86 ---- test/output/test_groups.json | 269 ------------- test/output/test_table.mdx | 24 ++ test/scripts/test_counter.dart | 369 +++++++++--------- .../components/accordion/accordion_test.dart | 3 +- test/src/components/badge/indicator_test.dart | 2 +- test/src/components/badge/label_test.dart | 2 +- .../components/badge/priority_pill_test.dart | 2 +- .../components/badge/status_label_test.dart | 2 +- test/src/components/badge/tag_test.dart | 2 +- test/test_utils/utils.dart | 2 +- 12 files changed, 212 insertions(+), 557 deletions(-) delete mode 100644 test/output/test_counts.json delete mode 100644 test/output/test_groups.json create mode 100644 test/output/test_table.mdx diff --git a/test/TESTING_README.mdx b/test/TESTING_README.mdx index eb5a97bf..b33e066e 100644 --- a/test/TESTING_README.mdx +++ b/test/TESTING_README.mdx @@ -7,7 +7,7 @@ As you are writing tests think about helper function you could write and add the - For golden tests `goldenTest(GoldenFiles goldenFile, Widget widget, Type widgetType, String fileName, {bool darkMode = false})` - For debugFillProperties tests - `debugFillPropertiesTests(Widget widget, Map debugFillProperties)` + `debugFillPropertiesTest(Widget widget, Map debugFillProperties)` ### Groups @@ -54,7 +54,7 @@ void main() { final debugFillProperties = { '': '', }; - debugFillPropertiesTests( + debugFillPropertiesTest( widget, debugFillProperties, ); @@ -72,3 +72,5 @@ void main() { #### Visibility Excel Sheet https://zebra-my.sharepoint.com/:x:/p/de7924/Ea0l7BF7AzJJoBVPrg4cIswBZRyek6iNT3zzwDcLn-5ZGg?e=NTJIZU + +### Test Table diff --git a/test/output/test_counts.json b/test/output/test_counts.json deleted file mode 100644 index fab3c402..00000000 --- a/test/output/test_counts.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "test/src/components\\accordion\\accordion_test.dart": { - "'$componentName Accessibility Tests'": 0, - "'$componentName Content Tests'": 1, - "'$componentName Dimensions Tests'": 0, - "'$componentName Styling Tests'": 1, - "'$componentName Interaction Tests'": 2, - "'$componentName Golden Tests'": 0, - "'$componentName Performance Tests'": 0 - }, - "test/src/components\\badge\\indicator_test.dart": { - "'$componentName Accessibility Tests'": 0, - "'$componentName Content Tests'": 6, - "'$componentName Dimensions Tests'": 0, - "'$componentName Styling Tests'": 0, - "'$componentName Interaction Tests'": 0, - "'$componentName Golden Tests'": 0, - "'$componentName Performance Tests'": 0 - }, - "test/src/components\\badge\\label_test.dart": { - "'$componentName Accessibility Tests'": 0, - "'$componentName Content Tests'": 7, - "'$componentName Dimensions Tests'": 0, - "'$componentName Styling Tests'": 0, - "'$componentName Interaction Tests'": 0, - "'$componentName Golden Tests'": 0, - "'$componentName Performance Tests'": 0 - }, - "test/src/components\\badge\\priority_pill_test.dart": { - "'$componentName Accessibility Tests'": 0, - "'$componentName Content Tests'": 4, - "'$componentName Dimensions Tests'": 0, - "'$componentName Styling Tests'": 0, - "'$componentName Interaction Tests'": 0, - "'$componentName Golden Tests'": 0, - "'$componentName Performance Tests'": 0 - }, - "test/src/components\\badge\\status_label_test.dart": { - "'$componentName Accessibility Tests'": 0, - "'$componentName Content Tests'": 2, - "'$componentName Dimensions Tests'": 0, - "'$componentName Styling Tests'": 0, - "'$componentName Interaction Tests'": 0, - "'$componentName Golden Tests'": 0, - "'$componentName Performance Tests'": 0 - }, - "test/src/components\\badge\\tag_test.dart": { - "'$componentName Accessibility Tests'": 0, - "'$componentName Content Tests'": 2, - "'$componentName Dimensions Tests'": 0, - "'$componentName Styling Tests'": 0, - "'$componentName Interaction Tests'": 0, - "'$componentName Golden Tests'": 0, - "'$componentName Performance Tests'": 0 - }, - "test/src/components\\button\\button_test.dart": { "'ZetaButton Tests'": 1 }, - "test/src/components\\chat_item\\chat_item_test.dart": { - "'ZetaChatItem Tests'": 9 - }, - "test/src/components\\checkbox\\checkbox_test.dart": { - "'ZetaCheckbox Tests'": 6 - }, - "test/src/components\\chips\\chip_test.dart": { "'ZetaChip'": 5 }, - "test/src/components\\comms_button\\comms_button_test.dart": { - "'ZetaCommsButton Tests'": 9, - "'ZetaCommsButton Golden Tests'": 1 - }, - "test/src/components\\dialpad\\dialpad_test.dart": { - "'ZetaDialPad Tests'": 1 - }, - "test/src/components\\fabs\\fab_test.dart": { "'ZetaFAB Tests'": 2 }, - "test/src/components\\icon\\icon_test.dart": { "'Zeta Icon'": 12 }, - "test/src/components\\in_page_banner\\in_page_banner_test.dart": { - "'ZetaInPageBanner Tests'": 1 - }, - "test/src/components\\password\\password_input_test.dart": {}, - "test/src/components\\search_bar\\search_bar_test.dart": { - "'ZetaSearchBar'": 14 - }, - "test/src/components\\slider\\slider_test.dart": {}, - "test/src/components\\stepper input\\stepper_input_test.dart": {}, - "test/src/components\\tooltip\\tooltip_test.dart": { - "'ZetaTooltip Widget Tests'": 9 - }, - "test/src/components\\top_app_bar\\extended_top_app_bar_test.dart": {} -} diff --git a/test/output/test_groups.json b/test/output/test_groups.json deleted file mode 100644 index 08cf28b3..00000000 --- a/test/output/test_groups.json +++ /dev/null @@ -1,269 +0,0 @@ -{ - "test/src/components\\accordion\\accordion_test.dart": [ - { "group": "'$componentName Accessibility Tests'", "tests": [] }, - { - "group": "'$componentName Content Tests'", - "tests": [{ "name": "'Programatically change child'" }] - }, - { "group": "'$componentName Dimensions Tests'", "tests": [] }, - { - "group": "'$componentName Styling Tests'", - "tests": [{ "name": "'ZetaAccordion changes color on hover'" }] - }, - { - "group": "'$componentName Interaction Tests'", - "tests": [ - { "name": "'ZetaAccordion expands and collapses correctly'" }, - { "name": "'ZetaAccordion changes isOpen property correctly'" } - ] - }, - { "group": "'$componentName Golden Tests'", "tests": [] }, - { "group": "'$componentName Performance Tests'", "tests": [] } - ], - "test/src/components\\badge\\indicator_test.dart": [ - { "group": "'$componentName Accessibility Tests'", "tests": [] }, - { - "group": "'$componentName Content Tests'", - "tests": [ - { "name": "'Default constructor initializes with correct parameters'" }, - { "name": "'Copy with function works'" }, - { "name": "'Icon constructor initializes with correct parameters'" }, - { "name": "'Icon constructor with values'" }, - { - "name": "'Notification constructor initializes with correct parameters'" - }, - { "name": "'Notification constructor with values'" } - ] - }, - { "group": "'$componentName Dimensions Tests'", "tests": [] }, - { "group": "'$componentName Styling Tests'", "tests": [] }, - { "group": "'$componentName Interaction Tests'", "tests": [] }, - { "group": "'$componentName Golden Tests'", "tests": [] }, - { "group": "'$componentName Performance Tests'", "tests": [] } - ], - "test/src/components\\badge\\label_test.dart": [ - { "group": "'$componentName Accessibility Tests'", "tests": [] }, - { - "group": "'$componentName Content Tests'", - "tests": [ - { "name": "'Initializes with correct parameters'" }, - { "name": "'Positive status'" }, - { "name": "'Warning status'" }, - { "name": "'Negative status'" }, - { "name": "'Neutral status'" }, - { "name": "'Dark mode'" }, - { "name": "'Sharp'" } - ] - }, - { "group": "'$componentName Dimensions Tests'", "tests": [] }, - { "group": "'$componentName Styling Tests'", "tests": [] }, - { "group": "'$componentName Interaction Tests'", "tests": [] }, - { "group": "'$componentName Golden Tests'", "tests": [] }, - { "group": "'$componentName Performance Tests'", "tests": [] } - ], - "test/src/components\\badge\\priority_pill_test.dart": [ - { "group": "'$componentName Accessibility Tests'", "tests": [] }, - { - "group": "'$componentName Content Tests'", - "tests": [ - { "name": "'Initializes with correct label and index'" }, - { "name": "'High priority pill'" }, - { "name": "'Medium priority pill'" }, - { "name": "'Low priority pill'" } - ] - }, - { "group": "'$componentName Dimensions Tests'", "tests": [] }, - { "group": "'$componentName Styling Tests'", "tests": [] }, - { "group": "'$componentName Interaction Tests'", "tests": [] }, - { "group": "'$componentName Golden Tests'", "tests": [] }, - { "group": "'$componentName Performance Tests'", "tests": [] } - ], - "test/src/components\\badge\\status_label_test.dart": [ - { "group": "'$componentName Accessibility Tests'", "tests": [] }, - { - "group": "'$componentName Content Tests'", - "tests": [ - { "name": "'Initializes with correct properties'" }, - { "name": "'Initializes with correct label and custom icon'" } - ] - }, - { "group": "'$componentName Dimensions Tests'", "tests": [] }, - { "group": "'$componentName Styling Tests'", "tests": [] }, - { "group": "'$componentName Interaction Tests'", "tests": [] }, - { "group": "'$componentName Golden Tests'", "tests": [] }, - { "group": "'$componentName Performance Tests'", "tests": [] } - ], - "test/src/components\\badge\\tag_test.dart": [ - { "group": "'$componentName Accessibility Tests'", "tests": [] }, - { - "group": "'$componentName Content Tests'", - "tests": [ - { "name": "'Initializes right with correct parameters'" }, - { "name": "'Initializes left with correct parameters'" } - ] - }, - { "group": "'$componentName Dimensions Tests'", "tests": [] }, - { "group": "'$componentName Styling Tests'", "tests": [] }, - { "group": "'$componentName Interaction Tests'", "tests": [] }, - { "group": "'$componentName Golden Tests'", "tests": [] }, - { "group": "'$componentName Performance Tests'", "tests": [] } - ], - "test/src/components\\button\\button_test.dart": [ - { - "group": "'ZetaButton Tests'", - "tests": [{ "name": "'Initializes with correct Label'" }] - } - ], - "test/src/components\\chat_item\\chat_item_test.dart": [ - { - "group": "'ZetaChatItem Tests'", - "tests": [ - { "name": "'ZetaChatItem displays correctly'" }, - { "name": "'ZetaChatItem highlighted'" }, - { "name": "'ZetaChatItem slidable actions'" }, - { "name": "'ZetaChatItem with pale slidable button colors'" }, - { "name": "'ZetaChatItem with 2 pale buttons and 2 regular buttons'" }, - { "name": "'ZetaChatItem with custom leading widget'" }, - { "name": "'ZetaChatItem with custom slidable buttons'" }, - { "name": "'debugFillProperties works correctly'" }, - { "name": "'ZetaChatItem displays correctly'" } - ] - } - ], - "test/src/components\\checkbox\\checkbox_test.dart": [ - { - "group": "'ZetaCheckbox Tests'", - "tests": [ - { "name": "'Initializes with correct parameters'" }, - { "name": "'ZetaCheckbox changes state on tap'" }, - { "name": "\"Disabled ZetaCheckbox doesn't change state on tap\"" }, - { "name": "'ZetaCheckbox interaction'" }, - { "name": "'ZetaCheckbox UI changes on hover'" }, - { "name": "'debugFillProperties works correctly'" } - ] - } - ], - "test/src/components\\chips\\chip_test.dart": [ - { - "group": "'ZetaChip'", - "tests": [ - { "name": "'renders label correctly'" }, - { "name": "'triggers onTap callback when tapped'" }, - { "name": "'triggers onToggle callback when selected'" }, - { "name": "'renders leading widget correctly'" }, - { "name": "'renders trailing widget correctly'" } - ] - } - ], - "test/src/components\\comms_button\\comms_button_test.dart": [ - { - "group": "'ZetaCommsButton Tests'", - "tests": [ - { "name": "'Initializes with correct label'" }, - { "name": "'Initializes with correct icon'" }, - { "name": "'Initializes with correct type'" }, - { "name": "'Changes label, icon, and type when toggled'" }, - { "name": "'Button is not toggleable when onToggle is null'" }, - { "name": "'Button calls onPressed callback when pressed'" }, - { "name": "'debugFillProperties Test'" }, - { "name": "'Button meets accessibility requirements'" }, - { "name": "'Button meets accessibility requirements when toggled'" } - ] - }, - { - "group": "'ZetaCommsButton Golden Tests'", - "tests": [{ "name": "'ZetaCommsButton with type $type'" }] - } - ], - "test/src/components\\dialpad\\dialpad_test.dart": [ - { - "group": "'ZetaDialPad Tests'", - "tests": [ - { "name": "'Initializes with correct parameters and is enabled'" } - ] - } - ], - "test/src/components\\fabs\\fab_test.dart": [ - { - "group": "'ZetaFAB Tests'", - "tests": [ - { "name": "'Initializes with correct parameters'" }, - { "name": "'OnPressed callback'" } - ] - } - ], - "test/src/components\\icon\\icon_test.dart": [ - { - "group": "'Zeta Icon'", - "tests": [ - { "name": "'renders icon correctly'" }, - { "name": "'applies correct size to icon'" }, - { "name": "'applies correct color to icon'" }, - { "name": "'applies correct semantic label to icon'" }, - { "name": "'applies sharp family to icon'" }, - { "name": "'applies correct font family to icon'" }, - { "name": "'applies correct font family when rounded is false'" }, - { - "name": "'does not change fontFamily if specific rounded / sharp variant is requested'" - }, - { "name": "'apply() sets round icon font'" }, - { "name": "'apply() uses rounded from context'" }, - { - "name": "'apply() returns the same icon if not in ZetaIcons family'" - }, - { "name": "'debugFillProperties works correctly'" } - ] - } - ], - "test/src/components\\in_page_banner\\in_page_banner_test.dart": [ - { - "group": "'ZetaInPageBanner Tests'", - "tests": [{ "name": "'ZetaInPageBanner creation'" }] - } - ], - "test/src/components\\password\\password_input_test.dart": [], - "test/src/components\\search_bar\\search_bar_test.dart": [ - { - "group": "'ZetaSearchBar'", - "tests": [ - { "name": "'renders with default parameters'" }, - { "name": "'golden: renders initializes correctly'" }, - { "name": "'golden: renders size medium correctly'" }, - { "name": "'golden: renders size small correctly'" }, - { "name": "'golden: renders shape full correctly'" }, - { "name": "'golden: renders shape sharp correctly'" }, - { "name": "'sets initial value correctly'" }, - { "name": "'sets updated initial value correctly'" }, - { "name": "'triggers onChanged callback when text is entered'" }, - { - "name": "'triggers onSubmit callback when submit action is performed'" - }, - { - "name": "'triggers onSpeechToText callback when microphone button is pressed'" - }, - { "name": "'does not allow text input when disabled'" }, - { "name": "'speech-to-text button visibility'" }, - { "name": "'clear button functionality'" } - ] - } - ], - "test/src/components\\slider\\slider_test.dart": [], - "test/src/components\\stepper input\\stepper_input_test.dart": [], - "test/src/components\\tooltip\\tooltip_test.dart": [ - { - "group": "'ZetaTooltip Widget Tests'", - "tests": [ - { "name": "'renders with default properties'" }, - { "name": "'renders with custom color and padding'" }, - { "name": "'renders with custom text style'" }, - { "name": "'renders with arrow correctly in up direction'" }, - { "name": "'renders with arrow correctly in down direction'" }, - { "name": "'renders with arrow correctly in left direction'" }, - { "name": "'renders with arrow correctly in right direction'" }, - { "name": "'renders with rounded and sharp corners'" }, - { "name": "'debugFillProperties works correctly'" } - ] - } - ], - "test/src/components\\top_app_bar\\extended_top_app_bar_test.dart": [] -} diff --git a/test/output/test_table.mdx b/test/output/test_table.mdx new file mode 100644 index 00000000..00de9242 --- /dev/null +++ b/test/output/test_table.mdx @@ -0,0 +1,24 @@ +| Component | Accessibility | Content | Dimensions | Styling | Interaction | Golden | Performance | Unorganised | Total Tests | +| -------------------- | ------------- | ------- | ---------- | ------- | ----------- | ------ | ----------- | ----------- | ----------- | +| Accordion | 0 | 2 | 0 | 1 | 2 | 0 | 0 | 0 | 5 | +| Indicator | 0 | 7 | 0 | 0 | 0 | 5 | 0 | 0 | 12 | +| Label | 0 | 8 | 0 | 0 | 0 | 7 | 0 | 0 | 15 | +| Priority Pill | 0 | 5 | 0 | 0 | 0 | 4 | 0 | 0 | 9 | +| Status Label | 0 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | 5 | +| Tag | 0 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | 5 | +| Button | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 13 | 13 | +| Chat Item | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 9 | 9 | +| Checkbox | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 | 6 | +| Chip | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 | 6 | +| Comms Button | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 10 | 10 | +| Dialpad | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 4 | +| Fab | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 | 8 | +| Icon | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 12 | 12 | +| In Page Banner | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 | 6 | +| Password Input | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 4 | +| Search Bar | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 15 | 15 | +| Slider | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | +| Stepper Input | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 2 | +| Tooltip | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 9 | 9 | +| Extended Top App Bar | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 3 | +| Total Tests | 0 | 28 | 0 | 1 | 2 | 20 | 0 | 108 | 159 | diff --git a/test/scripts/test_counter.dart b/test/scripts/test_counter.dart index 7066ad3c..2a67e300 100644 --- a/test/scripts/test_counter.dart +++ b/test/scripts/test_counter.dart @@ -1,170 +1,3 @@ -// import 'dart:convert'; -// import 'dart:io'; - -// enum TestGroups { -// accessibility, -// content, -// dimensions, -// styling, -// interaction, -// golden, -// performance, -// } - -// void main() async { -// final testDirectory = Directory('test/src/components'); -// final outputDirectory = Directory('test/output'); -// if (!outputDirectory.existsSync()) { -// await outputDirectory.create(recursive: true); -// } - -// final testFiles = -// testDirectory.listSync(recursive: true).where((entity) => entity is File && entity.path.endsWith('_test.dart')); -// final Map> testCounts = {}; - -// for (final FileSystemEntity file in testFiles) { -// final String content = await File(file.path).readAsString(); - -// // final List content = await File(file.path).readAsLines(); -// final Map testGroups = _extractTestGroups(content); -// testCounts[file.path] = testGroups; -// } - -// final jsonOutput = jsonEncode(testCounts); -// final outputFile = File('${outputDirectory.path}/test_counts.json'); -// await outputFile.writeAsString(jsonOutput); - -// print('Test counts saved to ${outputFile.path}'); -// } - -// Map _extractTestGroups(String content) { -// final Map testGroups = {}; -// final groupRegex = RegExp(r"group\('([^']+)'"); -// final testRegex = RegExp(r"testWidgets\('([^']+)'"); -// final goldenTestRegex = RegExp(r'goldenTest\('); -// final debugFillPropertiesRegex = RegExp(r'debugFillPropertiesTests\('); - -// final groupMatches = groupRegex.allMatches(content); -// for (var groupMatch in groupMatches) { -// final groupName = groupMatch.group(1); -// print('groupMatch: $groupMatch'); -// if (groupName != null) { -// final groupContent = content.substring(groupMatch.end).split('});\r\n });').first; -// print('groupContent: $groupName + $groupContent'); - -// final testMatches = testRegex.allMatches(groupContent).toList() + -// goldenTestRegex.allMatches(groupContent).toList() + -// debugFillPropertiesRegex.allMatches(groupContent).toList(); -// if (!TestGroups.values -// .map((el) => el.name) -// .contains(groupName.split('Name').last.trim().split('Tests').first.trim().toLowerCase())) { -// testGroups['unorganised'] = testMatches.length; -// return testGroups; -// } -// testGroups[groupName.split('Name').last.trim()] = testMatches.length; -// } -// } - -// return testGroups; -// } - -// void main() async { -// final outputDirectory = Directory('test/output'); -// if (!outputDirectory.existsSync()) { -// await outputDirectory.create(recursive: true); -// } -// const filePath = 'test/src/components/accordion/accordion_test.dart'; -// final file = File(filePath); -// final contents = await file.readAsString(); -// final groupRegex = RegExp(r"group\('(.+?)', \(\) \{([\s\S]*?)\}\);", multiLine: true); -// // final groupRegex = RegExp(r"group\('(.+?)', \(\) \{([\s\S]+?)\}\);", multiLine: true); -// // final testRegex = RegExp(r"testWidgets\('(.+?)', \((.+?)\) async \{([\s\S]+?)\}\);", multiLine: true); -// // final testRegex = RegExp(r"testWidgets\('(.+?)', \((.+?)\) async \{([\s\S]*?)\}\);", multiLine: true); -// final testRegex = RegExp(r"testWidgets\('([^']+)'"); - -// final groups = >[]; - -// for (final groupMatch in groupRegex.allMatches(contents)) { -// final groupName = groupMatch.group(1); -// final groupBody = groupMatch.group(0); -// print('$groupName:::: $groupBody'); -// // final l = groupMatch.group(0); -// // print('groupMatch: $l'); - -// final tests = >[]; - -// for (final testMatch in testRegex.allMatches(groupBody!)) { -// final testName = testMatch.group(0); -// // final testBody = testMatch.group(3); -// // print('$testName'); - -// // final steps = testBody!.split(';').map((step) => step.trim()).where((step) => step.isNotEmpty).toList(); - -// tests.add({ -// 'name': testName, -// // 'steps': steps, -// }); -// } - -// groups.add({ -// 'group': groupName, -// 'tests': tests, -// }); -// } - -// final jsonOutput = jsonEncode(groups); -// print(jsonOutput); -// final outputFile = File('${outputDirectory.path}/test_groups.json'); -// await outputFile.writeAsString(jsonOutput); -// } - -// void main() async { -// final outputDirectory = Directory('test/output'); -// if (!outputDirectory.existsSync()) { -// await outputDirectory.create(recursive: true); -// } - -// const filePath = 'test/src/components/accordion/accordion_test.dart'; -// final file = File(filePath); -// final contents = await file.readAsString(); - -// final groupRegex = RegExp(r"group\('(.+?)', \(\) \{([\s\S]*?)\}\);", multiLine: true); -// final testRegex = RegExp(r"testWidgets\('(.+?)', \((.+?)\) async \{([\s\S]*?)\}\);", multiLine: true); - -// final groups = >[]; - -// for (final groupMatch in groupRegex.allMatches(contents)) { -// final groupName = groupMatch.group(1); -// final groupBody = groupMatch.group(2); - -// final tests = >[]; - -// for (final testMatch in testRegex.allMatches(groupBody!)) { -// final testName = testMatch.group(1); -// final testBody = testMatch.group(3); - -// final steps = testBody! -// .split(';') -// .map((step) => step.trim()) -// .where((step) => step.isNotEmpty) -// .toList(); - -// tests.add({ -// 'name': testName, -// 'steps': steps, -// }); -// } - -// groups.add({ -// 'group': groupName, -// 'tests': tests, -// }); -// } - -// final jsonOutput = jsonEncode(groups); -// print(jsonOutput); -// } - import 'dart:convert'; import 'dart:io'; @@ -172,33 +5,93 @@ import 'package:analyzer/dart/analysis/utilities.dart'; import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/dart/ast/visitor.dart'; -class TestOutlineVisitor extends RecursiveAstVisitor { +String getGroupName(MethodInvocation node) { + return node.argumentList.arguments.first + .toString() + .replaceAll("'", '') + .replaceAll(r'$componentName ', '') + .replaceAll(' Tests', ''); +} + +String getTestName(MethodInvocation node) { + return node.argumentList.arguments.first.toString().replaceAll("'", ''); +} + +String getMethodName(MethodInvocation node) { + return node.methodName.name; +} + +bool hasNullParent(MethodInvocation node) { + return node.parent!.parent!.thisOrAncestorMatching((node) => node is MethodInvocation) == null; +} + +bool methodIsOneOf(List methods, MethodInvocation node) { + return methods.contains(node.methodName.name); +} + +extension StringExtension on String { + String capitalize() { + if (isEmpty) return this; + return this[0].toUpperCase() + substring(1); + } + + String capitalizeEachWord() { + return split(' ').map((word) => word.capitalize()).join(' '); + } +} + +String getComponentNameFromTestPath(String path) { + return path.split(r'\').last.split('_test').first.replaceAll('_', ' ').capitalizeEachWord(); +} + +class TestGroupVisitor extends RecursiveAstVisitor { final List> groups = []; @override void visitMethodInvocation(MethodInvocation node) { - if (node.methodName.name == 'group') { - final groupName = node.argumentList.arguments.first.toString(); - final groupBody = node.argumentList.arguments.last; - - final tests = >[]; + if (hasNullParent(node)) { + if (methodIsOneOf(['group'], node)) { + final groupName = getGroupName(node); + final groupBody = node.argumentList.arguments.last; + + final tests = >[]; + + if (groupBody is FunctionExpression) { + final body = groupBody.body; + if (body is BlockFunctionBody) { + body.block.visitChildren(TestVisitor(tests)); + } + } - if (groupBody is FunctionExpression) { - final body = groupBody.body; - if (body is BlockFunctionBody) { - body.block.visitChildren(TestVisitor(tests)); + groups.add({ + 'group': groupName, + 'tests': tests, + }); + } else if (methodIsOneOf(['testWidgets', 'test', 'goldenTest', 'debugFillPropertiesTest'], node)) { + final testName = getTestName(node); + + if (groups.any((el) => el['group'] == 'unorganised')) { + final unorganisedGroup = groups.firstWhere((el) => el['group'] == 'unorganised'); + (unorganisedGroup['tests'] as List).add({ + 'name': testName, + }); + } else { + groups.add({ + 'group': 'unorganised', + 'tests': [ + { + 'name': testName, + }, + ], + }); } } - - groups.add({ - 'group': groupName, - 'tests': tests, - }); } super.visitMethodInvocation(node); } } +// Visitor to extract test names class TestVisitor extends RecursiveAstVisitor { TestVisitor(this.tests); @@ -206,42 +99,117 @@ class TestVisitor extends RecursiveAstVisitor { @override void visitMethodInvocation(MethodInvocation node) { - if (node.methodName.name == 'testWidgets') { - final testName = node.argumentList.arguments.first.toString(); - + if (methodIsOneOf(['testWidgets', 'test'], node)) { + final testName = getTestName(node); tests.add({ 'name': testName, }); + } else if (methodIsOneOf(['debugFillPropertiesTest'], node)) { + tests.add({ + 'name': getMethodName(node), + }); + } else if (methodIsOneOf(['goldenTest'], node)) { + tests.add({ + 'name': node.toString(), + }); } + super.visitMethodInvocation(node); } } +String generateMDX(Map> testCount) { + final List groupNames = [ + 'Accessibility', + 'Content', + 'Dimensions', + 'Styling', + 'Interaction', + 'Golden', + 'Performance', + 'unorganised', + ]; + + final List data = [ + '| Component | Accessibility | Content | Dimensions | Styling | Interaction | Golden | Performance | Unorganised | Total Tests |', + '| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |', + ]; + + testCount.forEach((filePath, groups) { + final componentName = getComponentNameFromTestPath(filePath); + final totalTests = groups.values.fold(0, (previousValue, element) => previousValue + element); + int otherGroups = 0; + groups.forEach((key, value) { + if (!groupNames.contains(key)) { + otherGroups += value; + } + }); + otherGroups += groups['unorganised'] ?? 0; + + data.add( + '| $componentName | ${groups['Accessibility'] ?? 0} | ${groups['Content'] ?? 0} | ${groups['Dimensions'] ?? 0} | ${groups['Styling'] ?? 0} | ${groups['Interaction'] ?? 0} | ${groups['Golden'] ?? 0} | ${groups['Performance'] ?? 0} | $otherGroups | $totalTests |', + ); + }); + + final Map groupTotals = { + 'Accessibility': 0, + 'Content': 0, + 'Dimensions': 0, + 'Styling': 0, + 'Interaction': 0, + 'Golden': 0, + 'Performance': 0, + 'unorganised': 0, + }; + + testCount.forEach((filePath, groups) { + groups.forEach((key, value) { + if (!groupNames.contains(key)) { + groupTotals['unorganised'] = groupTotals['unorganised']! + value; + } else { + groupTotals[key] = groupTotals[key]! + value; + } + }); + }); + + data.add( + '| Total Tests | ${groupTotals['Accessibility']} | ${groupTotals['Content']} | ${groupTotals['Dimensions']} | ${groupTotals['Styling']} | ${groupTotals['Interaction']} | ${groupTotals['Golden']} | ${groupTotals['Performance']} | ${groupTotals['unorganised']} | ${groupTotals.values.fold(0, (previousValue, element) => previousValue + element)} |', + ); + + return data.join('\n'); +} + void main() async { + // check for output directory and create if it doesn't exist final outputDirectory = Directory('test/output'); if (!outputDirectory.existsSync()) { await outputDirectory.create(recursive: true); } + + // get all test files final testDirectory = Directory('test/src/components'); final testFiles = testDirectory.listSync(recursive: true).where((entity) => entity is File && entity.path.endsWith('_test.dart')); final Map>> testGroups = {}; + // parse each test file and extract test groups for (final FileSystemEntity file in testFiles) { final contents = await File(file.path).readAsString(); final parseResult = parseString(content: contents); - final visitor = TestOutlineVisitor(); + final visitor = TestGroupVisitor(); parseResult.unit.visitChildren(visitor); testGroups[file.path] = visitor.groups; } - final jsonOutputGroups = jsonEncode(testGroups); - final outputFileGroups = File('${outputDirectory.path}/test_groups.json'); - await outputFileGroups.writeAsString(jsonOutputGroups); + // write test groups to file + // final jsonOutputGroups = jsonEncode(testGroups); + // final outputFileGroups = File('${outputDirectory.path}/test_groups.json'); + // await outputFileGroups.writeAsString(jsonOutputGroups); final Map> testCount = {}; + // count the number of tests in each group testGroups.forEach((filePath, groups) { final Map groupCounts = {}; for (final group in groups) { @@ -251,8 +219,23 @@ void main() async { } testCount[filePath] = groupCounts; }); - final jsonOutput = jsonEncode(testCount); - print(jsonOutput); - final outputFile = File('${outputDirectory.path}/test_counts.json'); - await outputFile.writeAsString(jsonOutput); + + // write test counts to file + // final jsonOutput = jsonEncode(testCount); + // final outputFile = File('${outputDirectory.path}/test_counts.json'); + // await outputFile.writeAsString(jsonOutput); + + // generate MDX table + final mdxOutput = generateMDX(testCount); + final mdxFile = File('${outputDirectory.path}/test_table.mdx'); + await mdxFile.writeAsString(mdxOutput); } + + + +/** TODO: + * - Abstract the code into functions + * - Add comments + * - Add error handling + * - GITHUB ACTION TO RUN THE SCRIPT + * */ diff --git a/test/src/components/accordion/accordion_test.dart b/test/src/components/accordion/accordion_test.dart index 0b05487c..312bab3e 100644 --- a/test/src/components/accordion/accordion_test.dart +++ b/test/src/components/accordion/accordion_test.dart @@ -9,6 +9,7 @@ import '../../../test_utils/utils.dart'; void main() { const String componentName = 'ZetaAccordion'; + group('$componentName Accessibility Tests', () {}); group('$componentName Content Tests', () { final debugFillProperties = { @@ -17,7 +18,7 @@ void main() { 'contained': 'false', 'isOpen': 'false', }; - debugFillPropertiesTests( + debugFillPropertiesTest( const ZetaAccordion( title: 'Title', ), diff --git a/test/src/components/badge/indicator_test.dart b/test/src/components/badge/indicator_test.dart index fad619c3..8869f23f 100644 --- a/test/src/components/badge/indicator_test.dart +++ b/test/src/components/badge/indicator_test.dart @@ -25,7 +25,7 @@ void main() { 'type': 'ZetaIndicatorType.icon', 'value': '1', }; - debugFillPropertiesTests( + debugFillPropertiesTest( const ZetaIndicator( color: Colors.orange, icon: Icons.abc, diff --git a/test/src/components/badge/label_test.dart b/test/src/components/badge/label_test.dart index 13e80518..28522281 100644 --- a/test/src/components/badge/label_test.dart +++ b/test/src/components/badge/label_test.dart @@ -22,7 +22,7 @@ void main() { 'status': 'positive', 'rounded': 'false', }; - debugFillPropertiesTests( + debugFillPropertiesTest( const ZetaLabel( label: 'Test label', rounded: false, diff --git a/test/src/components/badge/priority_pill_test.dart b/test/src/components/badge/priority_pill_test.dart index 45122e86..e70ddba4 100644 --- a/test/src/components/badge/priority_pill_test.dart +++ b/test/src/components/badge/priority_pill_test.dart @@ -27,7 +27,7 @@ void main() { 'type': 'urgent', 'size': 'large', }; - debugFillPropertiesTests( + debugFillPropertiesTest( const ZetaPriorityPill( label: 'Test label', rounded: false, diff --git a/test/src/components/badge/status_label_test.dart b/test/src/components/badge/status_label_test.dart index f01e2f78..35604625 100644 --- a/test/src/components/badge/status_label_test.dart +++ b/test/src/components/badge/status_label_test.dart @@ -23,7 +23,7 @@ void main() { 'customIcon': 'IconData(U+F04B6)', 'status': 'info', }; - debugFillPropertiesTests( + debugFillPropertiesTest( const ZetaStatusLabel( label: 'Test label', rounded: false, diff --git a/test/src/components/badge/tag_test.dart b/test/src/components/badge/tag_test.dart index 3f88a169..d3b9f3ad 100644 --- a/test/src/components/badge/tag_test.dart +++ b/test/src/components/badge/tag_test.dart @@ -21,7 +21,7 @@ void main() { 'rounded': 'false', 'direction': 'left', }; - debugFillPropertiesTests( + debugFillPropertiesTest( const ZetaTag( label: 'Test label', rounded: false, diff --git a/test/test_utils/utils.dart b/test/test_utils/utils.dart index da382c38..1056bba1 100644 --- a/test/test_utils/utils.dart +++ b/test/test_utils/utils.dart @@ -51,7 +51,7 @@ BuildContext getBuildContext(WidgetTester tester, Type type) { return tester.element(find.byType(type)); } -void debugFillPropertiesTests(Widget widget, Map properties) { +void debugFillPropertiesTest(Widget widget, Map properties) { testWidgets('debugFillProperties works correctly', (WidgetTester tester) async { final diagnostics = DiagnosticPropertiesBuilder(); widget.debugFillProperties(diagnostics); From 77fa8877e7e7cb527cff3be61b4485e386936a2a Mon Sep 17 00:00:00 2001 From: Daniel Eshkeri Date: Fri, 11 Oct 2024 17:01:56 +0100 Subject: [PATCH 09/16] test: moved script files to different PR --- test/TESTING_README.mdx | 76 ----------- test/output/test_table.mdx | 24 ---- test/scripts/test_counter.dart | 241 --------------------------------- 3 files changed, 341 deletions(-) delete mode 100644 test/TESTING_README.mdx delete mode 100644 test/output/test_table.mdx delete mode 100644 test/scripts/test_counter.dart diff --git a/test/TESTING_README.mdx b/test/TESTING_README.mdx deleted file mode 100644 index b33e066e..00000000 --- a/test/TESTING_README.mdx +++ /dev/null @@ -1,76 +0,0 @@ -# Testing Conventions Flutter Components - -### Helper Functions - -As you are writing tests think about helper function you could write and add them to the `test_utils/utils.dart` file. This will help you and others write tests faster and more consistently. - -- For golden tests - `goldenTest(GoldenFiles goldenFile, Widget widget, Type widgetType, String fileName, {bool darkMode = false})` -- For debugFillProperties tests - `debugFillPropertiesTest(Widget widget, Map debugFillProperties)` - -### Groups - -- Accessibility Tests - Semantic labels, touch areas, contrast ratios, etc. -- Content Tests - Finds the widget, parameter statuses, etc. -- Dimensions Tests - Size, padding, margin, alignment, etc. -- Styling Tests - Rendered colors, fonts, borders, radii etc. -- Interaction Tests - Gesture recognizers, taps, drags, etc. -- Golden Tests - Compares the rendered widget with the golden file. Use the `goldenTest()` function from test_utils/utils.dart. -- Performance Tests - Animation performance, rendering performance, data manupulation performance, etc. - -### Testing File Template - -``` -import 'dart:ui'; - -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:zeta_flutter/zeta_flutter.dart'; - -import '../../../test_utils/test_app.dart'; -import '../../../test_utils/tolerant_comparator.dart'; -import '../../../test_utils/utils.dart'; - -void main() { - const String componentName = 'ENTER_COMPONENT_NAME (e.g. ZetaButton)'; - const String parentFolder = 'ENTER_PARENT_FOLDER (e.g. button)'; - - const goldenFile = GoldenFiles(component: parentFolder); - setUpAll(() { - goldenFileComparator = TolerantComparator(goldenFile.uri); - }); - - group('$componentName Accessibility Tests', () {}); - group('$componentName Content Tests', () { - final debugFillProperties = { - '': '', - }; - debugFillPropertiesTest( - widget, - debugFillProperties, - ); - }); - group('$componentName Dimensions Tests', () {}); - group('$componentName Styling Tests', () {}); - group('$componentName Interaction Tests', () {}); - group('$componentName Golden Tests', () { - goldenTest(goldenFile, widget, widgetType, 'PNG_FILE_NAME'); - }); - group('$componentName Performance Tests', () {}); -} -``` - -#### Visibility Excel Sheet - -https://zebra-my.sharepoint.com/:x:/p/de7924/Ea0l7BF7AzJJoBVPrg4cIswBZRyek6iNT3zzwDcLn-5ZGg?e=NTJIZU - -### Test Table diff --git a/test/output/test_table.mdx b/test/output/test_table.mdx deleted file mode 100644 index 00de9242..00000000 --- a/test/output/test_table.mdx +++ /dev/null @@ -1,24 +0,0 @@ -| Component | Accessibility | Content | Dimensions | Styling | Interaction | Golden | Performance | Unorganised | Total Tests | -| -------------------- | ------------- | ------- | ---------- | ------- | ----------- | ------ | ----------- | ----------- | ----------- | -| Accordion | 0 | 2 | 0 | 1 | 2 | 0 | 0 | 0 | 5 | -| Indicator | 0 | 7 | 0 | 0 | 0 | 5 | 0 | 0 | 12 | -| Label | 0 | 8 | 0 | 0 | 0 | 7 | 0 | 0 | 15 | -| Priority Pill | 0 | 5 | 0 | 0 | 0 | 4 | 0 | 0 | 9 | -| Status Label | 0 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | 5 | -| Tag | 0 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | 5 | -| Button | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 13 | 13 | -| Chat Item | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 9 | 9 | -| Checkbox | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 | 6 | -| Chip | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 | 6 | -| Comms Button | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 10 | 10 | -| Dialpad | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 4 | -| Fab | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 | 8 | -| Icon | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 12 | 12 | -| In Page Banner | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 | 6 | -| Password Input | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 4 | -| Search Bar | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 15 | 15 | -| Slider | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | -| Stepper Input | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 2 | -| Tooltip | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 9 | 9 | -| Extended Top App Bar | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 3 | -| Total Tests | 0 | 28 | 0 | 1 | 2 | 20 | 0 | 108 | 159 | diff --git a/test/scripts/test_counter.dart b/test/scripts/test_counter.dart deleted file mode 100644 index 2a67e300..00000000 --- a/test/scripts/test_counter.dart +++ /dev/null @@ -1,241 +0,0 @@ -import 'dart:convert'; -import 'dart:io'; - -import 'package:analyzer/dart/analysis/utilities.dart'; -import 'package:analyzer/dart/ast/ast.dart'; -import 'package:analyzer/dart/ast/visitor.dart'; - -String getGroupName(MethodInvocation node) { - return node.argumentList.arguments.first - .toString() - .replaceAll("'", '') - .replaceAll(r'$componentName ', '') - .replaceAll(' Tests', ''); -} - -String getTestName(MethodInvocation node) { - return node.argumentList.arguments.first.toString().replaceAll("'", ''); -} - -String getMethodName(MethodInvocation node) { - return node.methodName.name; -} - -bool hasNullParent(MethodInvocation node) { - return node.parent!.parent!.thisOrAncestorMatching((node) => node is MethodInvocation) == null; -} - -bool methodIsOneOf(List methods, MethodInvocation node) { - return methods.contains(node.methodName.name); -} - -extension StringExtension on String { - String capitalize() { - if (isEmpty) return this; - return this[0].toUpperCase() + substring(1); - } - - String capitalizeEachWord() { - return split(' ').map((word) => word.capitalize()).join(' '); - } -} - -String getComponentNameFromTestPath(String path) { - return path.split(r'\').last.split('_test').first.replaceAll('_', ' ').capitalizeEachWord(); -} - -class TestGroupVisitor extends RecursiveAstVisitor { - final List> groups = []; - - @override - void visitMethodInvocation(MethodInvocation node) { - if (hasNullParent(node)) { - if (methodIsOneOf(['group'], node)) { - final groupName = getGroupName(node); - final groupBody = node.argumentList.arguments.last; - - final tests = >[]; - - if (groupBody is FunctionExpression) { - final body = groupBody.body; - if (body is BlockFunctionBody) { - body.block.visitChildren(TestVisitor(tests)); - } - } - - groups.add({ - 'group': groupName, - 'tests': tests, - }); - } else if (methodIsOneOf(['testWidgets', 'test', 'goldenTest', 'debugFillPropertiesTest'], node)) { - final testName = getTestName(node); - - if (groups.any((el) => el['group'] == 'unorganised')) { - final unorganisedGroup = groups.firstWhere((el) => el['group'] == 'unorganised'); - (unorganisedGroup['tests'] as List).add({ - 'name': testName, - }); - } else { - groups.add({ - 'group': 'unorganised', - 'tests': [ - { - 'name': testName, - }, - ], - }); - } - } - } - super.visitMethodInvocation(node); - } -} - -// Visitor to extract test names -class TestVisitor extends RecursiveAstVisitor { - TestVisitor(this.tests); - - final List> tests; - - @override - void visitMethodInvocation(MethodInvocation node) { - if (methodIsOneOf(['testWidgets', 'test'], node)) { - final testName = getTestName(node); - tests.add({ - 'name': testName, - }); - } else if (methodIsOneOf(['debugFillPropertiesTest'], node)) { - tests.add({ - 'name': getMethodName(node), - }); - } else if (methodIsOneOf(['goldenTest'], node)) { - tests.add({ - 'name': node.toString(), - }); - } - - super.visitMethodInvocation(node); - } -} - -String generateMDX(Map> testCount) { - final List groupNames = [ - 'Accessibility', - 'Content', - 'Dimensions', - 'Styling', - 'Interaction', - 'Golden', - 'Performance', - 'unorganised', - ]; - - final List data = [ - '| Component | Accessibility | Content | Dimensions | Styling | Interaction | Golden | Performance | Unorganised | Total Tests |', - '| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |', - ]; - - testCount.forEach((filePath, groups) { - final componentName = getComponentNameFromTestPath(filePath); - final totalTests = groups.values.fold(0, (previousValue, element) => previousValue + element); - int otherGroups = 0; - groups.forEach((key, value) { - if (!groupNames.contains(key)) { - otherGroups += value; - } - }); - otherGroups += groups['unorganised'] ?? 0; - - data.add( - '| $componentName | ${groups['Accessibility'] ?? 0} | ${groups['Content'] ?? 0} | ${groups['Dimensions'] ?? 0} | ${groups['Styling'] ?? 0} | ${groups['Interaction'] ?? 0} | ${groups['Golden'] ?? 0} | ${groups['Performance'] ?? 0} | $otherGroups | $totalTests |', - ); - }); - - final Map groupTotals = { - 'Accessibility': 0, - 'Content': 0, - 'Dimensions': 0, - 'Styling': 0, - 'Interaction': 0, - 'Golden': 0, - 'Performance': 0, - 'unorganised': 0, - }; - - testCount.forEach((filePath, groups) { - groups.forEach((key, value) { - if (!groupNames.contains(key)) { - groupTotals['unorganised'] = groupTotals['unorganised']! + value; - } else { - groupTotals[key] = groupTotals[key]! + value; - } - }); - }); - - data.add( - '| Total Tests | ${groupTotals['Accessibility']} | ${groupTotals['Content']} | ${groupTotals['Dimensions']} | ${groupTotals['Styling']} | ${groupTotals['Interaction']} | ${groupTotals['Golden']} | ${groupTotals['Performance']} | ${groupTotals['unorganised']} | ${groupTotals.values.fold(0, (previousValue, element) => previousValue + element)} |', - ); - - return data.join('\n'); -} - -void main() async { - // check for output directory and create if it doesn't exist - final outputDirectory = Directory('test/output'); - if (!outputDirectory.existsSync()) { - await outputDirectory.create(recursive: true); - } - - // get all test files - final testDirectory = Directory('test/src/components'); - final testFiles = - testDirectory.listSync(recursive: true).where((entity) => entity is File && entity.path.endsWith('_test.dart')); - final Map>> testGroups = {}; - - // parse each test file and extract test groups - for (final FileSystemEntity file in testFiles) { - final contents = await File(file.path).readAsString(); - - final parseResult = parseString(content: contents); - final visitor = TestGroupVisitor(); - parseResult.unit.visitChildren(visitor); - testGroups[file.path] = visitor.groups; - } - - // write test groups to file - // final jsonOutputGroups = jsonEncode(testGroups); - // final outputFileGroups = File('${outputDirectory.path}/test_groups.json'); - // await outputFileGroups.writeAsString(jsonOutputGroups); - - final Map> testCount = {}; - - // count the number of tests in each group - testGroups.forEach((filePath, groups) { - final Map groupCounts = {}; - for (final group in groups) { - final groupName = group['group'] as String; - final tests = group['tests'] as List; - groupCounts[groupName] = tests.length; - } - testCount[filePath] = groupCounts; - }); - - // write test counts to file - // final jsonOutput = jsonEncode(testCount); - // final outputFile = File('${outputDirectory.path}/test_counts.json'); - // await outputFile.writeAsString(jsonOutput); - - // generate MDX table - final mdxOutput = generateMDX(testCount); - final mdxFile = File('${outputDirectory.path}/test_table.mdx'); - await mdxFile.writeAsString(mdxOutput); -} - - - -/** TODO: - * - Abstract the code into functions - * - Add comments - * - Add error handling - * - GITHUB ACTION TO RUN THE SCRIPT - * */ From 644799b7afae29410055455d370abf05282fb0d4 Mon Sep 17 00:00:00 2001 From: Daniel Eshkeri Date: Fri, 11 Oct 2024 17:45:59 +0100 Subject: [PATCH 10/16] test: implemented helper function in avatar and banner tests --- test/src/components/avatar/avatar_test.dart | 182 ++++++++---------- .../avatar/golden/avatar_from_name_xs.png | Bin 3671 -> 3666 bytes .../avatar/golden/avatar_initials_xs.png | Bin 3671 -> 3666 bytes test/src/components/banner/banner_test.dart | 57 +++--- 4 files changed, 108 insertions(+), 131 deletions(-) diff --git a/test/src/components/avatar/avatar_test.dart b/test/src/components/avatar/avatar_test.dart index 9376f890..edd607dc 100644 --- a/test/src/components/avatar/avatar_test.dart +++ b/test/src/components/avatar/avatar_test.dart @@ -9,13 +9,15 @@ import '../../../test_utils/tolerant_comparator.dart'; import '../../../test_utils/utils.dart'; void main() { - const goldenFile = GoldenFiles(component: 'avatar'); + const String componentName = 'ZetaAvatar'; + const String parentFolder = 'avatar'; + const goldenFile = GoldenFiles(component: parentFolder); setUpAll(() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - group('ZetaAvatar Accessibility Tests', () { + group('$componentName Accessibility Tests', () { testWidgets('ZetaAvatar meets accessibility requirements', (WidgetTester tester) async { final SemanticsHandle handle = tester.ensureSemantics(); await tester.pumpWidget( @@ -43,7 +45,24 @@ void main() { }); }); - group('ZetaAvatar Content Tests', () { + group('$componentName Content Tests', () { + final debugFillProperties = { + 'size': 'ZetaAvatarSize.xl', + 'name': 'null', + 'specialStatus': 'null', + 'badge': 'null', + 'backgroundColor': 'null', + 'statusColor': 'null', + 'semanticUpperBadgeValue': '"upperBadge"', + 'semanticValue': '"avatar"', + 'semanticLowerBadgeValue': '"lowerBadge"', + 'initialTextStyle': 'null', + }; + debugFillPropertiesTest( + const ZetaAvatar(), + debugFillProperties, + ); + const names = [ 'John Doe', 'Jane Doe', @@ -96,7 +115,7 @@ void main() { } }); - group('ZetaAvatar Dimensions Tests', () { + group('$componentName Dimensions Tests', () { for (final size in ZetaAvatarSize.values) { testWidgets( 'ZetaAvatar size $size with upper badge', @@ -211,7 +230,7 @@ void main() { } }); - group('ZetaAvatar Styling Tests', () { + group('$componentName Styling Tests', () { for (final size in ZetaAvatarSize.values) { testWidgets('ZetaAvatar with initials $size text size is correct', (WidgetTester tester) async { await tester.pumpWidget( @@ -295,106 +314,65 @@ void main() { } }); - group('ZetaAvatar Interaction Tests', () {}); + group('$componentName Interaction Tests', () {}); - group('ZetaAvatar Golden Tests', () { + group('$componentName Golden Tests', () { for (final size in ZetaAvatarSize.values) { - testWidgets('ZetaAvatar default ${size.toString().split('.').last}', (WidgetTester tester) async { - await tester.pumpWidget( - TestApp( - home: ZetaAvatar( - size: size, - ), - ), - ); - - await expectLater( - find.byType(ZetaAvatar), - matchesGoldenFile(goldenFile.getFileUri('avatar_default_${size.toString().split('.').last}')), - ); - }); - - testWidgets('ZetaAvatar with initials', (WidgetTester tester) async { - await tester.pumpWidget( - TestApp( - home: ZetaAvatar.initials( - initials: 'AB', - size: size, - ), - ), - ); - - await expectLater( - find.byType(ZetaAvatar), - matchesGoldenFile(goldenFile.getFileUri('avatar_initials_${size.toString().split('.').last}')), - ); - }); - - testWidgets('ZetaAvatar with image', (WidgetTester tester) async { - await tester.pumpWidget( - TestApp( - home: ZetaAvatar.image( - image: Image.file(File('/assets/maxresdefault.jpg')), - size: size, - ), - ), - ); - - await expectLater( - find.byType(ZetaAvatar), - matchesGoldenFile(goldenFile.getFileUri('avatar_image_${size.toString().split('.').last}')), - ); - }); - - testWidgets('ZetaAvatar with fromName', (WidgetTester tester) async { - await tester.pumpWidget( - TestApp( - home: ZetaAvatar.fromName( - name: 'John Doe', - size: size, - ), - ), - ); - - await expectLater( - find.byType(ZetaAvatar), - matchesGoldenFile(goldenFile.getFileUri('avatar_from_name_${size.toString().split('.').last}')), - ); - }); - - testWidgets('ZetaAvatar with upper badge', (WidgetTester tester) async { - await tester.pumpWidget( - TestApp( - home: ZetaAvatar( - upperBadge: const ZetaAvatarBadge.notification(value: 3), - size: size, - ), - ), - ); - - await expectLater( - find.byType(ZetaAvatar), - matchesGoldenFile(goldenFile.getFileUri('avatar_upper_badge_${size.toString().split('.').last}')), - ); - }); - - testWidgets('ZetaAvatar with lower badge', (WidgetTester tester) async { - await tester.pumpWidget( - TestApp( - home: ZetaAvatar( - lowerBadge: const ZetaAvatarBadge.icon(icon: Icons.star), - size: size, - ), - ), - ); - - await expectLater( - find.byType(ZetaAvatar), - matchesGoldenFile(goldenFile.getFileUri('avatar_lower_badge_${size.toString().split('.').last}')), - ); - }); + goldenTest( + goldenFile, + ZetaAvatar( + size: size, + ), + ZetaAvatar, + 'avatar_default_${size.toString().split('.').last}', + ); + goldenTest( + goldenFile, + ZetaAvatar.initials( + initials: 'AB', + size: size, + ), + ZetaAvatar, + 'avatar_initials_${size.toString().split('.').last}', + ); + goldenTest( + goldenFile, + ZetaAvatar.image( + image: Image.file(File('/assets/maxresdefault.jpg')), + size: size, + ), + ZetaAvatar, + 'avatar_image_${size.toString().split('.').last}', + ); + goldenTest( + goldenFile, + ZetaAvatar.fromName( + name: 'John Doe', + size: size, + ), + ZetaAvatar, + 'avatar_from_name_${size.toString().split('.').last}', + ); + goldenTest( + goldenFile, + ZetaAvatar( + upperBadge: const ZetaAvatarBadge.notification(value: 3), + size: size, + ), + ZetaAvatar, + 'avatar_upper_badge_${size.toString().split('.').last}', + ); + goldenTest( + goldenFile, + ZetaAvatar( + lowerBadge: const ZetaAvatarBadge.icon(icon: Icons.star), + size: size, + ), + ZetaAvatar, + 'avatar_lower_badge_${size.toString().split('.').last}', + ); } }); - group('ZetaAvatar Performance Tests', () {}); + group('$componentName Performance Tests', () {}); } diff --git a/test/src/components/avatar/golden/avatar_from_name_xs.png b/test/src/components/avatar/golden/avatar_from_name_xs.png index ec8f22c79689751a94985fe9676a84f77eaab318..9f715e2a00a9a72d5d3ee6fc0b97ba178eb5cdf3 100644 GIT binary patch delta 654 zcmV;90&)G<9MT++Kz|MVNklo0ssKq zryu6P;rRRU@zUez{F?v(zA8PPa{&MVE^j_==oYFi%>@7exV(9do3GxorMUnA0GH?3Hvj;TnYXm)u%)>G005U~ z1(N{;6o2!y_6%Ow(p&%lfXkbw4L$X5X)XW&z~#-m4Q;~O?be2NqKV~p|naovghv0rz5007|np4T1LT!GkI{Qv-fyYT$z zzn|B+g=(5?zXAY&d-2Vq|HBHmP^~d0006L#SAS~{58+viax4G z#sB~Sw&%O2FP;P83WYFD;sXEx?$r;Ee?ROldqdTJcIE>B0PfjOPhsrl^XJQPjMMUK zgUr(ypM(bh0NlNI9|Qjy5T|8~<7td#8RM-UnOi_@%07*qoM6N<$f{l delta 678 zcmca4b6sYFLp>j(r;B4q#hkZyqw{XNF*saQT)HGWbNBzPTkd*^c)n>DQf^E>?zhC- z$%_3$yJEEQ{5><+mmhw(p{LwJKY7l%WS!Fz`hOpr9GkJsuRUf&i?HY$5aE(EkFJKv&pgcyX*Y~85nkm+w)GiT-o#Z=XW;Cdi~@YtG?tCvT@|cB8yq!H01H+y5>5N7H zggCZu={YTtZyO8}YENhUWO+xabc-xEQ0J*~#-RDSx=be@2*;JT7R64fx+tc$799v_5Xif&*%MezW)EdUq3(ARQhu;Fcj>6X1J|T zdTMS2kp2IeuI=~yOg*4Ozn)#rd)H~}(wz(p4A;%q7k<9#z0E`%X!0+a-#`P6K2H;q zg$k@`0IHE>1UfK<1!&>~K?Mc|hqQUu<{dN#s;CF)d6wzy|2KLT(A5RCpYxn&Zz$Wn zH65ty&ZRv|Z6l~ENH-+Ahm(O}&EuQ54j=!Z<7O!a zw130CbVj3E&gSTM$Fz+ zz>srz_xpvjmK&z6mIMZ%{s%4x1_lM?&8p1e+>-@Z^2Po$Gg?(loO^Z0Z=f3(JYD@< J);T3K0RZ^wBUS(a diff --git a/test/src/components/avatar/golden/avatar_initials_xs.png b/test/src/components/avatar/golden/avatar_initials_xs.png index ec8f22c79689751a94985fe9676a84f77eaab318..9f715e2a00a9a72d5d3ee6fc0b97ba178eb5cdf3 100644 GIT binary patch delta 654 zcmV;90&)G<9MT++Kz|MVNklo0ssKq zryu6P;rRRU@zUez{F?v(zA8PPa{&MVE^j_==oYFi%>@7exV(9do3GxorMUnA0GH?3Hvj;TnYXm)u%)>G005U~ z1(N{;6o2!y_6%Ow(p&%lfXkbw4L$X5X)XW&z~#-m4Q;~O?be2NqKV~p|naovghv0rz5007|np4T1LT!GkI{Qv-fyYT$z zzn|B+g=(5?zXAY&d-2Vq|HBHmP^~d0006L#SAS~{58+viax4G z#sB~Sw&%O2FP;P83WYFD;sXEx?$r;Ee?ROldqdTJcIE>B0PfjOPhsrl^XJQPjMMUK zgUr(ypM(bh0NlNI9|Qjy5T|8~<7td#8RM-UnOi_@%07*qoM6N<$f{l delta 678 zcmca4b6sYFLp>j(r;B4q#hkZyqw{XNF*saQT)HGWbNBzPTkd*^c)n>DQf^E>?zhC- z$%_3$yJEEQ{5><+mmhw(p{LwJKY7l%WS!Fz`hOpr9GkJsuRUf&i?HY$5aE(EkFJKv&pgcyX*Y~85nkm+w)GiT-o#Z=XW;Cdi~@YtG?tCvT@|cB8yq!H01H+y5>5N7H zggCZu={YTtZyO8}YENhUWO+xabc-xEQ0J*~#-RDSx=be@2*;JT7R64fx+tc$799v_5Xif&*%MezW)EdUq3(ARQhu;Fcj>6X1J|T zdTMS2kp2IeuI=~yOg*4Ozn)#rd)H~}(wz(p4A;%q7k<9#z0E`%X!0+a-#`P6K2H;q zg$k@`0IHE>1UfK<1!&>~K?Mc|hqQUu<{dN#s;CF)d6wzy|2KLT(A5RCpYxn&Zz$Wn zH65ty&ZRv|Z6l~ENH-+Ahm(O}&EuQ54j=!Z<7O!a zw130CbVj3E&gSTM$Fz+ zz>srz_xpvjmK&z6mIMZ%{s%4x1_lM?&8p1e+>-@Z^2Po$Gg?(loO^Z0Z=f3(JYD@< J);T3K0RZ^wBUS(a diff --git a/test/src/components/banner/banner_test.dart b/test/src/components/banner/banner_test.dart index c733a75f..7c827fa2 100644 --- a/test/src/components/banner/banner_test.dart +++ b/test/src/components/banner/banner_test.dart @@ -23,13 +23,16 @@ ZetaColorSwatch _backgroundColorFromType(BuildContext context, ZetaBannerStatus } void main() { - const goldenFile = GoldenFiles(component: 'banner'); + const String componentName = 'ZetaBanner'; + const String parentFolder = 'banner'; + + const goldenFile = GoldenFiles(component: parentFolder); setUpAll(() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - group('ZetaBanner Accessibility Tests', () { + group('$componentName Accessibility Tests', () { for (final type in ZetaBannerStatus.values) { testWidgets('meets contrast ratio guideline for $type', (WidgetTester tester) async { await tester.pumpWidget( @@ -118,7 +121,7 @@ void main() { }); }); - group('ZetaBanner Content Tests', () { + group('$componentName Content Tests', () { testWidgets('ZetaBanner title is correct', (WidgetTester tester) async { await tester.pumpWidget( TestApp( @@ -192,7 +195,7 @@ void main() { }); }); - group('ZetaBanner Dimension Tests', () { + group('$componentName Dimension Tests', () { testWidgets('icon is the correct size', (WidgetTester tester) async { await tester.pumpWidget( TestApp( @@ -256,7 +259,7 @@ void main() { }); }); - group('ZetaBanner Styling Tests', () { + group('$componentName Styling Tests', () { for (final type in ZetaBannerStatus.values) { testWidgets('title styles are correct for $type', (WidgetTester tester) async { await tester.pumpWidget( @@ -328,32 +331,28 @@ void main() { } }); - group('ZetaBanner Interaction Tests', () {}); + group('$componentName Interaction Tests', () {}); - group('ZetaBanner Golden Tests', () { + group('$componentName Golden Tests', () { for (final type in ZetaBannerStatus.values) { - testWidgets('ZetaBanner ${type.toString().split('.').last} golden', (WidgetTester tester) async { - await tester.pumpWidget( - TestApp( - home: Builder( - builder: (context) { - return ZetaBanner( - context: context, - title: 'Banner Title', - leadingIcon: Icons.info, - trailing: const ZetaIcon(Icons.chevron_right), - type: type, - ); - }, - ), - ), - ); - - await expectLater( - find.byType(ZetaBanner), - matchesGoldenFile(goldenFile.getFileUri('banner_${type.toString().split('.').last}')), - ); - }); + goldenTest( + goldenFile, + Builder( + builder: (context) { + return ZetaBanner( + context: context, + title: 'Banner Title', + leadingIcon: Icons.info, + trailing: const ZetaIcon(Icons.chevron_right), + type: type, + ); + }, + ), + ZetaBanner, + 'banner_${type.toString().split('.').last}', + ); } }); + + group('$componentName Performace Tests', () {}); } From 2580887b616b4c8913077d5ffa1cac6f9217be49 Mon Sep 17 00:00:00 2001 From: Daniel Eshkeri Date: Mon, 14 Oct 2024 17:03:26 +0100 Subject: [PATCH 11/16] tests: organised button, chat_item, and checkbox tests --- test/src/components/button/button_test.dart | 478 +++++++++--------- .../components/chat_item/chat_item_test.dart | 442 ++++++++++++---- .../golden/chat_item_slidable_actions.png | Bin 3424 -> 2975 bytes .../components/checkbox/checkbox_test.dart | 136 ++--- test/test_utils/utils.dart | 20 +- 5 files changed, 695 insertions(+), 381 deletions(-) diff --git a/test/src/components/button/button_test.dart b/test/src/components/button/button_test.dart index c14a9271..87d674b7 100644 --- a/test/src/components/button/button_test.dart +++ b/test/src/components/button/button_test.dart @@ -1,6 +1,5 @@ import 'dart:ui'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:zeta_flutter/zeta_flutter.dart'; @@ -10,13 +9,31 @@ import '../../../test_utils/tolerant_comparator.dart'; import '../../../test_utils/utils.dart'; void main() { - const goldenFile = GoldenFiles(component: 'button'); + const String componentName = 'ZetaButton'; + const String parentFolder = 'button'; + const goldenFile = GoldenFiles(component: parentFolder); setUpAll(() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - group('ZetaButton Tests', () { + group('$componentName Accessibility Tests', () {}); + + group('$componentName Content Tests', () { + final debugFillProperties = { + 'label': '"Test label"', + 'onPressed': 'null', + 'type': 'primary', + 'borderType': 'null', + 'size': 'medium', + 'leadingIcon': 'null', + 'trailingIcon': 'null', + }; + debugFillPropertiesTest( + const ZetaButton(label: 'Test label'), + debugFillProperties, + ); + testWidgets('Initializes with correct Label', (WidgetTester tester) async { await tester.pumpWidget( TestApp( @@ -26,255 +43,262 @@ void main() { expect(find.text('Test Button'), findsOneWidget); }); - }); - testWidgets('Triggers callback on tap', (WidgetTester tester) async { - bool callbackTriggered = false; - await tester.pumpWidget( - TestApp(home: ZetaButton(onPressed: () => callbackTriggered = true, label: 'Test Button')), - ); - await tester.tap(find.byType(ZetaButton)); - await tester.pump(); + testWidgets('Initializes primary with correct Label', (WidgetTester tester) async { + await tester.pumpWidget( + TestApp( + home: ZetaButton.primary(onPressed: () {}, label: 'Test Button'), + ), + ); - expect(callbackTriggered, isTrue); - }); + final buttonFinder = find.byType(ZetaButton); + final ZetaButton button = tester.firstWidget(buttonFinder); + expect(button.borderType, null); + expect(button.label, 'Test Button'); + expect(button.leadingIcon, null); + expect(button.trailingIcon, null); + expect(button.size, ZetaWidgetSize.medium); + expect(button.type, ZetaButtonType.primary); + }); - testWidgets('Initializes primary with correct Label', (WidgetTester tester) async { - await tester.pumpWidget( - TestApp( - home: ZetaButton.primary(onPressed: () {}, label: 'Test Button'), - ), - ); + testWidgets('Initializes secondary with correct Label', (WidgetTester tester) async { + await tester.pumpWidget( + TestApp( + home: ZetaButton.secondary( + onPressed: () {}, + label: 'Test Button', + leadingIcon: Icons.abc, + size: ZetaWidgetSize.small, + ), + ), + ); - final buttonFinder = find.byType(ZetaButton); - final ZetaButton button = tester.firstWidget(buttonFinder); - expect(button.borderType, null); - expect(button.label, 'Test Button'); - expect(button.leadingIcon, null); - expect(button.trailingIcon, null); - expect(button.size, ZetaWidgetSize.medium); - expect(button.type, ZetaButtonType.primary); + final buttonFinder = find.byType(ZetaButton); + final ZetaButton button = tester.firstWidget(buttonFinder); + expect(button.borderType, null); + expect(button.label, 'Test Button'); + expect(button.leadingIcon, Icons.abc); + expect(button.trailingIcon, null); + expect(button.size, ZetaWidgetSize.small); + expect(button.type, ZetaButtonType.secondary); + }); + testWidgets('Initializes positive with correct Label', (WidgetTester tester) async { + await tester.pumpWidget( + TestApp( + home: ZetaButton.positive(onPressed: () {}, label: 'Test Button', trailingIcon: Icons.abc), + ), + ); - await expectLater(find.byType(ZetaButton), matchesGoldenFile(goldenFile.getFileUri('button_primary'))); - }); - testWidgets('Initializes secondary with correct Label', (WidgetTester tester) async { - await tester.pumpWidget( - TestApp( - home: ZetaButton.secondary( - onPressed: () {}, - label: 'Test Button', - leadingIcon: Icons.abc, - size: ZetaWidgetSize.small, + final buttonFinder = find.byType(ZetaButton); + final ZetaButton button = tester.firstWidget(buttonFinder); + expect(button.borderType, null); + expect(button.label, 'Test Button'); + expect(button.leadingIcon, null); + expect(button.trailingIcon, Icons.abc); + expect(button.size, ZetaWidgetSize.medium); + expect(button.type, ZetaButtonType.positive); + }); + testWidgets('Initializes negative with correct Label', (WidgetTester tester) async { + await tester.pumpWidget( + TestApp( + home: ZetaButton.negative(onPressed: () {}, label: 'Test Button', size: ZetaWidgetSize.small), ), - ), - ); + ); - final buttonFinder = find.byType(ZetaButton); - final ZetaButton button = tester.firstWidget(buttonFinder); - expect(button.borderType, null); - expect(button.label, 'Test Button'); - expect(button.leadingIcon, Icons.abc); - expect(button.trailingIcon, null); - expect(button.size, ZetaWidgetSize.small); - expect(button.type, ZetaButtonType.secondary); - - await expectLater( - find.byType(ZetaButton), - matchesGoldenFile(goldenFile.getFileUri('button_secondary')), - ); - }); - testWidgets('Initializes positive with correct Label', (WidgetTester tester) async { - await tester.pumpWidget( - TestApp( - home: ZetaButton.positive(onPressed: () {}, label: 'Test Button', trailingIcon: Icons.abc), - ), - ); + final buttonFinder = find.byType(ZetaButton); + final ZetaButton button = tester.firstWidget(buttonFinder); + expect(button.borderType, null); + expect(button.label, 'Test Button'); + expect(button.leadingIcon, null); + expect(button.trailingIcon, null); + expect(button.size, ZetaWidgetSize.small); + expect(button.type, ZetaButtonType.negative); + }); + testWidgets('Initializes outline with correct Label', (WidgetTester tester) async { + await tester.pumpWidget( + TestApp( + home: ZetaButton.outline(onPressed: () {}, label: 'Test Button', size: ZetaWidgetSize.large), + ), + ); - final buttonFinder = find.byType(ZetaButton); - final ZetaButton button = tester.firstWidget(buttonFinder); - expect(button.borderType, null); - expect(button.label, 'Test Button'); - expect(button.leadingIcon, null); - expect(button.trailingIcon, Icons.abc); - expect(button.size, ZetaWidgetSize.medium); - expect(button.type, ZetaButtonType.positive); - - await expectLater( - find.byType(ZetaButton), - matchesGoldenFile(goldenFile.getFileUri('button_positive')), - ); - }); - testWidgets('Initializes negative with correct Label', (WidgetTester tester) async { - await tester.pumpWidget( - TestApp( - home: ZetaButton.negative(onPressed: () {}, label: 'Test Button', size: ZetaWidgetSize.small), - ), - ); + final buttonFinder = find.byType(ZetaButton); + final ZetaButton button = tester.firstWidget(buttonFinder); + expect(button.borderType, null); + expect(button.label, 'Test Button'); + expect(button.leadingIcon, null); + expect(button.trailingIcon, null); + expect(button.size, ZetaWidgetSize.large); + expect(button.type, ZetaButtonType.outline); + }); + testWidgets('Initializes outlineSubtle with correct Label', (WidgetTester tester) async { + await tester.pumpWidget( + const TestApp( + home: ZetaButton.outlineSubtle(label: 'Test Button', borderType: ZetaWidgetBorder.sharp), + ), + ); - final buttonFinder = find.byType(ZetaButton); - final ZetaButton button = tester.firstWidget(buttonFinder); - expect(button.borderType, null); - expect(button.label, 'Test Button'); - expect(button.leadingIcon, null); - expect(button.trailingIcon, null); - expect(button.size, ZetaWidgetSize.small); - expect(button.type, ZetaButtonType.negative); - - await expectLater( - find.byType(ZetaButton), - matchesGoldenFile(goldenFile.getFileUri('button_negative')), - ); - }); - testWidgets('Initializes outline with correct Label', (WidgetTester tester) async { - await tester.pumpWidget( - TestApp( - home: ZetaButton.outline(onPressed: () {}, label: 'Test Button', size: ZetaWidgetSize.large), - ), - ); + final buttonFinder = find.byType(ZetaButton); + final ZetaButton button = tester.firstWidget(buttonFinder); + expect(button.borderType, ZetaWidgetBorder.sharp); + expect(button.label, 'Test Button'); + expect(button.leadingIcon, null); + expect(button.trailingIcon, null); + expect(button.size, ZetaWidgetSize.medium); + expect(button.type, ZetaButtonType.outlineSubtle); + }); + testWidgets('Initializes text with correct Label', (WidgetTester tester) async { + await tester.pumpWidget( + TestApp( + home: ZetaButton.text(onPressed: () {}, label: 'Test Button', borderType: ZetaWidgetBorder.full), + ), + ); - final buttonFinder = find.byType(ZetaButton); - final ZetaButton button = tester.firstWidget(buttonFinder); - expect(button.borderType, null); - expect(button.label, 'Test Button'); - expect(button.leadingIcon, null); - expect(button.trailingIcon, null); - expect(button.size, ZetaWidgetSize.large); - expect(button.type, ZetaButtonType.outline); + final buttonFinder = find.byType(ZetaButton); + final ZetaButton button = tester.firstWidget(buttonFinder); + expect(button.borderType, ZetaWidgetBorder.full); + expect(button.label, 'Test Button'); + expect(button.leadingIcon, null); + expect(button.trailingIcon, null); + expect(button.size, ZetaWidgetSize.medium); + expect(button.type, ZetaButtonType.text); + }); - await expectLater(find.byType(ZetaButton), matchesGoldenFile(goldenFile.getFileUri('button_outline'))); - }); - testWidgets('Initializes outlineSubtle with correct Label', (WidgetTester tester) async { - await tester.pumpWidget( - const TestApp( - home: ZetaButton.outlineSubtle(label: 'Test Button', borderType: ZetaWidgetBorder.sharp), - ), - ); + testWidgets('Disabled button', (WidgetTester tester) async { + await tester.pumpWidget( + const TestApp( + home: ZetaButton.text(label: 'Test Button', borderType: ZetaWidgetBorder.full), + ), + ); - final buttonFinder = find.byType(ZetaButton); - final ZetaButton button = tester.firstWidget(buttonFinder); - expect(button.borderType, ZetaWidgetBorder.sharp); - expect(button.label, 'Test Button'); - expect(button.leadingIcon, null); - expect(button.trailingIcon, null); - expect(button.size, ZetaWidgetSize.medium); - expect(button.type, ZetaButtonType.outlineSubtle); - - await expectLater( - find.byType(ZetaButton), - matchesGoldenFile(goldenFile.getFileUri('button_outline_subtle')), - ); + final buttonFinder = find.byType(ZetaButton); + final ZetaButton button = tester.firstWidget(buttonFinder); + expect(button.borderType, ZetaWidgetBorder.full); + expect(button.label, 'Test Button'); + expect(button.leadingIcon, null); + expect(button.trailingIcon, null); + expect(button.onPressed, null); + expect(button.size, ZetaWidgetSize.medium); + expect(button.type, ZetaButtonType.text); + }); }); - testWidgets('Initializes text with correct Label', (WidgetTester tester) async { - await tester.pumpWidget( - TestApp( - home: ZetaButton.text(onPressed: () {}, label: 'Test Button', borderType: ZetaWidgetBorder.full), - ), - ); - final buttonFinder = find.byType(ZetaButton); - final ZetaButton button = tester.firstWidget(buttonFinder); - expect(button.borderType, ZetaWidgetBorder.full); - expect(button.label, 'Test Button'); - expect(button.leadingIcon, null); - expect(button.trailingIcon, null); - expect(button.size, ZetaWidgetSize.medium); - expect(button.type, ZetaButtonType.text); - - await expectLater( - find.byType(ZetaButton), - matchesGoldenFile(goldenFile.getFileUri('button_text')), - ); - }); + group('$componentName Dimensions Tests', () {}); - testWidgets('Disabled button', (WidgetTester tester) async { - await tester.pumpWidget( - const TestApp( - home: ZetaButton.text(label: 'Test Button', borderType: ZetaWidgetBorder.full), - ), - ); + group('$componentName Styling Tests', () { + testWidgets('Hover states are correct', (WidgetTester tester) async { + await tester.pumpWidget( + TestApp( + home: ZetaButton(label: 'Test Button', onPressed: () {}), + ), + ); - final buttonFinder = find.byType(ZetaButton); - final ZetaButton button = tester.firstWidget(buttonFinder); - expect(button.borderType, ZetaWidgetBorder.full); - expect(button.label, 'Test Button'); - expect(button.leadingIcon, null); - expect(button.trailingIcon, null); - expect(button.onPressed, null); - expect(button.size, ZetaWidgetSize.medium); - expect(button.type, ZetaButtonType.text); - - await expectLater( - find.byType(ZetaButton), - matchesGoldenFile(goldenFile.getFileUri('button_disabled')), - ); - }); - testWidgets('Interaction with button', (WidgetTester tester) async { - await tester.pumpWidget( - TestApp( - home: ZetaButton(label: 'Test Button', onPressed: () {}), - ), - ); + final buttonFinder = find.byType(ZetaButton); + final ZetaButton button = tester.firstWidget(buttonFinder); + + final filledButtonFinder = find.byType(FilledButton); + final FilledButton filledButton = tester.firstWidget(filledButtonFinder); - final buttonFinder = find.byType(ZetaButton); - final ZetaButton button = tester.firstWidget(buttonFinder); + final gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); + await gesture.addPointer(location: Offset.zero); + addTearDown(gesture.removePointer); + await tester.pump(); + await gesture.moveTo(tester.getCenter(find.byType(ZetaButton))); + await tester.pumpAndSettle(); - final filledButtonFinder = find.byType(FilledButton); - final FilledButton filledButton = tester.firstWidget(filledButtonFinder); + expect(filledButton.style?.backgroundColor?.resolve({WidgetState.hovered}), ZetaColorBase.blue.shade50); - final gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); - await gesture.addPointer(location: Offset.zero); - addTearDown(gesture.removePointer); - await tester.pump(); - await gesture.moveTo(tester.getCenter(find.byType(ZetaButton))); - await tester.pumpAndSettle(); + await gesture.down(tester.getCenter(find.byType(ZetaButton))); + await tester.pumpAndSettle(); + expect(filledButton.style?.backgroundColor?.resolve({WidgetState.pressed}), ZetaColorBase.blue.shade70); - expect(filledButton.style?.backgroundColor?.resolve({WidgetState.hovered}), ZetaColorBase.blue.shade50); + await gesture.up(); - await gesture.down(tester.getCenter(find.byType(ZetaButton))); - await tester.pumpAndSettle(); - expect(filledButton.style?.backgroundColor?.resolve({WidgetState.pressed}), ZetaColorBase.blue.shade70); + await tester.pumpAndSettle(); + expect(button.label, 'Test Button'); + expect(button.leadingIcon, null); + expect(button.trailingIcon, null); + expect(button.size, ZetaWidgetSize.medium); + }); + + testWidgets('Focus state is correct', (WidgetTester tester) async { + final FocusNode focusNode = FocusNode(); + await tester.pumpWidget( + TestApp( + home: ZetaButton(label: 'Test Button', onPressed: () {}, focusNode: focusNode), + ), + ); + final buttonFinder = find.byType(ZetaButton); + final ZetaButton button = tester.firstWidget(buttonFinder); + focusNode.requestFocus(); + await tester.pump(); + final filledButtonFinder = find.byType(FilledButton); + final FilledButton filledButton = tester.firstWidget(filledButtonFinder); + + expect(button.label, 'Test Button'); + expect(button.leadingIcon, null); + expect(button.trailingIcon, null); + expect(button.size, ZetaWidgetSize.medium); + expect( + filledButton.style?.side?.resolve({WidgetState.focused}), + BorderSide(color: ZetaColorBase.blue, width: ZetaBorders.medium), + ); + }); + }); - await gesture.up(); + group('$componentName Interaction Tests', () { + testWidgets('Triggers callback on tap', (WidgetTester tester) async { + bool callbackTriggered = false; + await tester.pumpWidget( + TestApp(home: ZetaButton(onPressed: () => callbackTriggered = true, label: 'Test Button')), + ); + await tester.tap(find.byType(ZetaButton)); + await tester.pump(); - await tester.pumpAndSettle(); - expect(button.label, 'Test Button'); - expect(button.leadingIcon, null); - expect(button.trailingIcon, null); - expect(button.size, ZetaWidgetSize.medium); + expect(callbackTriggered, isTrue); + }); }); - testWidgets('Interaction with button', (WidgetTester tester) async { - final FocusNode focusNode = FocusNode(); - await tester.pumpWidget( - TestApp( - home: ZetaButton(label: 'Test Button', onPressed: () {}, focusNode: focusNode), - ), + + group('$componentName Golden Tests', () { + goldenTest(goldenFile, ZetaButton.primary(onPressed: () {}, label: 'Test Button'), ZetaButton, 'button_primary'); + goldenTest( + goldenFile, + ZetaButton.secondary(onPressed: () {}, label: 'Test Button', leadingIcon: Icons.abc, size: ZetaWidgetSize.small), + ZetaButton, + 'button_secondary', ); - final buttonFinder = find.byType(ZetaButton); - final ZetaButton button = tester.firstWidget(buttonFinder); - focusNode.requestFocus(); - await tester.pump(); - final filledButtonFinder = find.byType(FilledButton); - final FilledButton filledButton = tester.firstWidget(filledButtonFinder); - - expect(button.label, 'Test Button'); - expect(button.leadingIcon, null); - expect(button.trailingIcon, null); - expect(button.size, ZetaWidgetSize.medium); - expect( - filledButton.style?.side?.resolve({WidgetState.focused}), - BorderSide(color: ZetaColorBase.blue, width: ZetaBorders.medium), + goldenTest( + goldenFile, + ZetaButton.positive(onPressed: () {}, label: 'Test Button', trailingIcon: Icons.abc), + ZetaButton, + 'button_positive', + ); + goldenTest( + goldenFile, + ZetaButton.negative(onPressed: () {}, label: 'Test Button', size: ZetaWidgetSize.small), + ZetaButton, + 'button_negative', + ); + goldenTest( + goldenFile, + ZetaButton.outline(onPressed: () {}, label: 'Test Button', size: ZetaWidgetSize.large), + ZetaButton, + 'button_outline', + ); + goldenTest(goldenFile, const ZetaButton.outlineSubtle(label: 'Test Button', borderType: ZetaWidgetBorder.sharp), + ZetaButton, 'button_outline_subtle'); + goldenTest( + goldenFile, + ZetaButton.text(onPressed: () {}, label: 'Test Button', borderType: ZetaWidgetBorder.full), + ZetaButton, + 'button_text', + ); + goldenTest( + goldenFile, + const ZetaButton.text(label: 'Test Button', borderType: ZetaWidgetBorder.full), + ZetaButton, + 'button_disabled', ); }); - testWidgets('debugFillProperties works correctly', (WidgetTester tester) async { - final diagnostics = DiagnosticPropertiesBuilder(); - const ZetaButton(label: 'Test label').debugFillProperties(diagnostics); - - expect(diagnostics.finder('label'), '"Test label"'); - expect(diagnostics.finder('onPressed'), 'null'); - expect(diagnostics.finder('type'), 'primary'); - expect(diagnostics.finder('borderType'), 'null'); - expect(diagnostics.finder('size'), 'medium'); - expect(diagnostics.finder('leadingIcon'), 'null'); - expect(diagnostics.finder('trailingIcon'), 'null'); - }); + + group('$componentName Performance Tests', () {}); } diff --git a/test/src/components/chat_item/chat_item_test.dart b/test/src/components/chat_item/chat_item_test.dart index 8bafbc00..0184fb7d 100644 --- a/test/src/components/chat_item/chat_item_test.dart +++ b/test/src/components/chat_item/chat_item_test.dart @@ -9,13 +9,68 @@ import '../../../test_utils/tolerant_comparator.dart'; import '../../../test_utils/utils.dart'; void main() { - const goldenFile = GoldenFiles(component: 'chat_item'); + const String componentName = 'ZetaChatItem'; + const String parentFolder = 'chat_item'; + const goldenFile = GoldenFiles(component: parentFolder); setUpAll(() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - group('ZetaChatItem Tests', () { + group('$componentName Accessibility Tests', () {}); + group('$componentName Content Tests', () { + final time = DateTime.now(); + final debugFillPropertiesChatItem = { + 'rounded': 'null', + 'highlighted': 'true', + 'time': time.toString(), + 'timeFormat': 'null', + 'enabledWarningIcon': 'true', + 'enabledNotificationIcon': 'true', + 'count': '1', + 'onTap': 'null', + 'starred': 'true', + 'onMenuMoreTap': 'null', + 'onCallTap': 'null', + 'onDeleteTap': 'null', + 'onPttTap': 'null', + 'explicitChildNodes': 'true', + 'paleButtonColors': 'null', + }; + debugFillPropertiesTest( + ZetaChatItem( + title: const Text('Title'), + subtitle: const Text('Subtitle'), + time: time, + leading: const ZetaAvatar(initials: 'AZ'), + slidableActions: [ + ZetaSlidableAction.menuMore(onPressed: () {}), + ZetaSlidableAction.call(onPressed: () {}), + ZetaSlidableAction.ptt(onPressed: () {}), + ZetaSlidableAction.delete(onPressed: () {}), + ], + count: 1, + enabledNotificationIcon: true, + highlighted: true, + enabledWarningIcon: true, + starred: true, + ), + debugFillPropertiesChatItem, + ); + final debugFillPropertiesSlidableAction = { + 'onPressed': 'null', + 'icon': 'IconData(U+0E5F9)', + 'foregroundColor': null, + 'backgroundColor': null, + 'color': ZetaColorBase.blue.toString(), + 'semanticLabel': 'null', + 'paleColor': 'false', + }; + debugFillPropertiesTest( + const ZetaSlidableAction(icon: Icons.star), + debugFillPropertiesSlidableAction, + ); + testWidgets('ZetaChatItem displays correctly', (WidgetTester tester) async { tester.view.devicePixelRatio = 1.0; tester.view.physicalSize = const Size(481, 480); @@ -64,11 +119,6 @@ void main() { await tester.tap(chatItemFinder); await tester.pumpAndSettle(); expect(tester.takeException(), isNull); - - await expectLater( - chatItemFinder, - matchesGoldenFile(goldenFile.getFileUri('chat_item_default')), - ); }); testWidgets('ZetaChatItem highlighted', (WidgetTester tester) async { @@ -119,11 +169,6 @@ void main() { await tester.tap(chatItemFinder); await tester.pumpAndSettle(); expect(tester.takeException(), isNull); - - await expectLater( - chatItemFinder, - matchesGoldenFile(goldenFile.getFileUri('chat_item_highlighted')), - ); }); testWidgets('ZetaChatItem slidable actions', (WidgetTester tester) async { @@ -181,11 +226,6 @@ void main() { await tester.tap(find.byIcon(ZetaIcons.delete_round)); await tester.pumpAndSettle(); expect(tester.takeException(), isNull); - - await expectLater( - chatItemFinder, - matchesGoldenFile(goldenFile.getFileUri('chat_item_slidable_actions')), - ); }); testWidgets('ZetaChatItem with pale slidable button colors', (WidgetTester tester) async { @@ -235,11 +275,6 @@ void main() { expect(find.byIcon(ZetaIcons.phone_round), findsOneWidget); expect(find.byIcon(ZetaIcons.ptt_round), findsOneWidget); expect(find.byIcon(ZetaIcons.delete_round), findsOneWidget); - - await expectLater( - chatItemFinder, - matchesGoldenFile(goldenFile.getFileUri('chat_item_pale_slidable_buttons')), - ); }); testWidgets('ZetaChatItem with 2 pale buttons and 2 regular buttons', (WidgetTester tester) async { @@ -323,11 +358,6 @@ void main() { await tester.tap(find.byIcon(Icons.message)); await tester.pumpAndSettle(); expect(tester.takeException(), isNull); - - await expectLater( - chatItemFinder, - matchesGoldenFile(goldenFile.getFileUri('chat_item_pale_and_regular_buttons')), - ); }); testWidgets('ZetaChatItem with custom leading widget', (WidgetTester tester) async { @@ -362,16 +392,9 @@ void main() { ), ); - final chatItemFinder = find.byType(ZetaChatItem); - // Verify that the custom leading widget is displayed correctly expect(find.byType(Container), findsOneWidget); expect(find.byWidgetPredicate((widget) => widget is Container && widget.color == Colors.blue), findsOneWidget); - - await expectLater( - chatItemFinder, - matchesGoldenFile(goldenFile.getFileUri('chat_item_custom_leading')), - ); }); testWidgets('ZetaChatItem with custom slidable buttons', (WidgetTester tester) async { @@ -425,60 +448,6 @@ void main() { await tester.tap(find.byIcon(Icons.delete)); await tester.pumpAndSettle(); expect(tester.takeException(), isNull); - - await expectLater( - chatItemFinder, - matchesGoldenFile(goldenFile.getFileUri('chat_item_custom_slidable_buttons')), - ); - }); - - testWidgets('debugFillProperties works correctly', (WidgetTester tester) async { - final diagnosticsZetaChatItem = DiagnosticPropertiesBuilder(); - final time = DateTime.now(); - ZetaChatItem( - title: const Text('Title'), - subtitle: const Text('Subtitle'), - time: time, - leading: const ZetaAvatar(initials: 'AZ'), - slidableActions: [ - ZetaSlidableAction.menuMore(onPressed: () {}), - ZetaSlidableAction.call(onPressed: () {}), - ZetaSlidableAction.ptt(onPressed: () {}), - ZetaSlidableAction.delete(onPressed: () {}), - ], - count: 1, - enabledNotificationIcon: true, - highlighted: true, - enabledWarningIcon: true, - starred: true, - ).debugFillProperties(diagnosticsZetaChatItem); - - expect(diagnosticsZetaChatItem.finder('rounded'), 'null'); - expect(diagnosticsZetaChatItem.finder('highlighted'), 'true'); - expect(diagnosticsZetaChatItem.finder('time'), time.toString()); - expect(diagnosticsZetaChatItem.finder('timeFormat'), 'null'); - expect(diagnosticsZetaChatItem.finder('enabledWarningIcon'), 'true'); - expect(diagnosticsZetaChatItem.finder('enabledNotificationIcon'), 'true'); - expect(diagnosticsZetaChatItem.finder('count'), '1'); - expect(diagnosticsZetaChatItem.finder('onTap'), 'null'); - expect(diagnosticsZetaChatItem.finder('starred'), 'true'); - expect(diagnosticsZetaChatItem.finder('onMenuMoreTap'), 'null'); - expect(diagnosticsZetaChatItem.finder('onCallTap'), 'null'); - expect(diagnosticsZetaChatItem.finder('onDeleteTap'), 'null'); - expect(diagnosticsZetaChatItem.finder('onPttTap'), 'null'); - expect(diagnosticsZetaChatItem.finder('explicitChildNodes'), 'true'); - expect(diagnosticsZetaChatItem.finder('paleButtonColors'), 'null'); - - final diagnosticsZetaSlidableAction = DiagnosticPropertiesBuilder(); - const ZetaSlidableAction(icon: Icons.star).debugFillProperties(diagnosticsZetaSlidableAction); - - expect(diagnosticsZetaSlidableAction.finder('onPressed'), 'null'); - expect(diagnosticsZetaSlidableAction.finder('icon'), 'IconData(U+0E5F9)'); - expect(diagnosticsZetaSlidableAction.finder('foregroundColor'), null); - expect(diagnosticsZetaSlidableAction.finder('backgroundColor'), null); - expect(diagnosticsZetaSlidableAction.finder('color'), ZetaColorBase.blue.toString()); - expect(diagnosticsZetaSlidableAction.finder('semanticLabel'), 'null'); - expect(diagnosticsZetaSlidableAction.finder('paleColor'), 'false'); }); testWidgets('ZetaChatItem displays correctly', (WidgetTester tester) async { @@ -541,11 +510,298 @@ void main() { await tester.tap(find.byIcon(ZetaIcons.delete_round)); await tester.pumpAndSettle(); expect(tester.takeException(), isNull); - - await expectLater( - chatItemFinder, - matchesGoldenFile(goldenFile.getFileUri('chat_item_small_screen_slidable_button')), - ); }); }); + group('$componentName Dimensions Tests', () {}); + group('$componentName Styling Tests', () {}); + group('$componentName Interaction Tests', () {}); + group('$componentName Golden Tests', () { + const title = Text('John Doe'); + const subtitle = Text('Hello, how are you?'); + final time = DateTime.now(); + + goldenTest( + goldenFile, + Scaffold( + body: Column( + children: [ + ZetaChatItem( + explicitChildNodes: false, + time: time, + enabledWarningIcon: true, + enabledNotificationIcon: true, + leading: const ZetaAvatar(initials: 'AZ'), + count: 100, + onTap: () {}, + paleButtonColors: true, + slidableActions: [ + ZetaSlidableAction.menuMore(onPressed: () {}), + ZetaSlidableAction.call(onPressed: () {}), + ZetaSlidableAction.ptt(onPressed: () {}), + ZetaSlidableAction.delete(onPressed: () {}), + ], + title: title, + subtitle: subtitle, + ), + ], + ), + ), + ZetaChatItem, + 'chat_item_default', + before: (tester) async { + tester.view.devicePixelRatio = 1.0; + tester.view.physicalSize = const Size(481, 480); + }, + ); + + goldenTest( + goldenFile, + Column( + children: [ + ZetaChatItem( + explicitChildNodes: false, + time: time, + enabledWarningIcon: true, + enabledNotificationIcon: true, + leading: const ZetaAvatar(initials: 'AZ'), + count: 100, + onTap: () {}, + paleButtonColors: false, + starred: true, + slidableActions: [ + ZetaSlidableAction.menuMore(onPressed: () {}), + ZetaSlidableAction.call(onPressed: () {}), + ZetaSlidableAction.ptt(onPressed: () {}), + ZetaSlidableAction.delete(onPressed: () {}), + ], + highlighted: true, + title: title, + subtitle: subtitle, + ), + ], + ), + ZetaChatItem, + 'chat_item_highlighted', + before: (tester) async { + tester.view.devicePixelRatio = 1.0; + tester.view.physicalSize = const Size(481, 480); + }, + ); + + goldenTest( + goldenFile, + Column( + children: [ + ZetaChatItem( + time: time, + leading: const ZetaAvatar(initials: 'AZ'), + slidableActions: [ + ZetaSlidableAction.menuMore(onPressed: () {}), + ZetaSlidableAction.call(onPressed: () {}), + ZetaSlidableAction.ptt(onPressed: () {}), + ZetaSlidableAction.delete(onPressed: () {}), + ], + title: title, + subtitle: subtitle, + ), + ], + ), + ZetaChatItem, + 'chat_item_slidable_actions', + before: (tester) async { + tester.view.devicePixelRatio = 1.0; + tester.view.physicalSize = const Size(481, 480); + }, + after: (tester) async { + final chatItemFinder = find.byType(ZetaChatItem); + await tester.drag(chatItemFinder, const Offset(-200, 0)); + await tester.pumpAndSettle(); + }, + ); + + goldenTest( + goldenFile, + Column( + children: [ + ZetaChatItem( + time: time, + leading: const ZetaAvatar(initials: 'AZ'), + paleButtonColors: true, + slidableActions: [ + ZetaSlidableAction.menuMore( + onPressed: () {}, + ), + ZetaSlidableAction.call( + onPressed: () {}, + ), + ZetaSlidableAction.ptt( + onPressed: () {}, + ), + ZetaSlidableAction.delete( + onPressed: () {}, + ), + ], + title: title, + subtitle: subtitle, + ), + ], + ), + ZetaChatItem, + 'chat_item_pale_slidable_buttons', + before: (tester) async { + tester.view.devicePixelRatio = 1.0; + tester.view.physicalSize = const Size(481, 480); + }, + after: (tester) async { + final chatItemFinder = find.byType(ZetaChatItem); + await tester.drag(chatItemFinder, const Offset(-200, 0)); + await tester.pumpAndSettle(); + }, + ); + + goldenTest( + goldenFile, + Column( + children: [ + ZetaChatItem( + time: time, + leading: const ZetaAvatar(initials: 'AZ'), + slidableActions: [ + ZetaSlidableAction( + onPressed: () {}, + paleColor: true, + icon: Icons.star, + ), + ZetaSlidableAction( + onPressed: () {}, + paleColor: true, + icon: Icons.delete, + ), + ZetaSlidableAction( + onPressed: () {}, + icon: Icons.call, + ), + ZetaSlidableAction( + onPressed: () {}, + icon: Icons.message, + ), + ], + title: title, + subtitle: subtitle, + ), + ], + ), + ZetaChatItem, + 'chat_item_pale_and_regular_buttons', + before: (tester) async { + tester.view.devicePixelRatio = 1.0; + tester.view.physicalSize = const Size(481, 480); + }, + after: (tester) async { + final chatItemFinder = find.byType(ZetaChatItem); + await tester.drag(chatItemFinder, const Offset(-200, 0)); + await tester.pumpAndSettle(); + }, + ); + + goldenTest( + goldenFile, + Column( + children: [ + ZetaChatItem( + time: time, + leading: Container( + width: 40, + height: 40, + color: Colors.blue, + ), + slidableActions: [ + ZetaSlidableAction.menuMore(onPressed: () {}), + ZetaSlidableAction.call(onPressed: () {}), + ZetaSlidableAction.ptt(onPressed: () {}), + ZetaSlidableAction.delete(onPressed: () {}), + ], + title: title, + subtitle: subtitle, + ), + ], + ), + ZetaChatItem, + 'chat_item_custom_leading', + before: (tester) async { + tester.view.devicePixelRatio = 1.0; + tester.view.physicalSize = const Size(481, 480); + }, + ); + + goldenTest( + goldenFile, + Column( + children: [ + ZetaChatItem( + time: time, + leading: const ZetaAvatar(initials: 'AZ'), + slidableActions: [ + ZetaSlidableAction( + onPressed: () {}, + color: ZetaColorBase.orange, + icon: Icons.star, + ), + ZetaSlidableAction( + onPressed: () {}, + color: ZetaColorBase.red, + icon: Icons.delete, + ), + ], + title: title, + subtitle: subtitle, + ), + ], + ), + ZetaChatItem, + 'chat_item_custom_slidable_buttons', + before: (tester) async { + tester.view.devicePixelRatio = 1.0; + tester.view.physicalSize = const Size(481, 480); + }, + after: (tester) async { + final chatItemFinder = find.byType(ZetaChatItem); + await tester.drag(chatItemFinder, const Offset(-200, 0)); + await tester.pumpAndSettle(); + }, + ); + + goldenTest( + goldenFile, + Column( + children: [ + ZetaChatItem( + time: time, + leading: const ZetaAvatar(initials: 'AZ'), + slidableActions: [ + ZetaSlidableAction.menuMore(onPressed: () {}), + ZetaSlidableAction.call(onPressed: () {}), + ZetaSlidableAction.ptt(onPressed: () {}), + ZetaSlidableAction.delete(onPressed: () {}), + ], + title: title, + count: 1, + subtitle: subtitle, + ), + ], + ), + ZetaChatItem, + 'chat_item_small_screen_slidable_button', + before: (tester) async { + tester.view.devicePixelRatio = 1.0; + tester.view.physicalSize = const Size(315, 480); + }, + after: (tester) async { + final chatItemFinder = find.byType(ZetaChatItem); + await tester.drag(chatItemFinder, const Offset(-200, 0)); + await tester.pumpAndSettle(); + }, + ); + }); + group('$componentName Performance Tests', () {}); } diff --git a/test/src/components/chat_item/golden/chat_item_slidable_actions.png b/test/src/components/chat_item/golden/chat_item_slidable_actions.png index 797a78f24e97b0068a080388e735bd8582c63cae..c990b5936d3ccb8f6d1feef7c3a05a31a3b4d34e 100644 GIT binary patch literal 2975 zcmeAS@N?(olHy`uVBq!ia0y~yV0;L~4>;I>B9p|ft_D(!#X;^)4C~IxyaaMsik&<| zIDnvrBc+3Zf!ov5#WAE}&fB}bJ+Y~>2OfUkwsmcSy-E#R4CCBet&^k-6BlzINnkEx zlon3vP;oQ7$U6B!Q@|spNt*(cta%Mp@)8zWuE8eopnL^Rst;K5d!*Y~IOBK+teuW$^NIm2aQk_c_LGA7%fqG{eYG z#`{>*X0v?h$6a&1A5VKfU(&oT_1E$52jc(PeB1xyj>V5-6AQmQxh?;*C;R3%-|2m^ z)9bU&+}~6FX6L`+;C{=3jKnwp5AS~bz}~-qvHG9Rn)PpIt0!L%l|J@ox}Dv(H+L+) z&M4>mQ}-wRzyGmA2M;HId@&nr)~>hF$B)GpKc4*gzU=fjJ4=0BX59L%T=V0=u8(JI zUvI8VJ9*cCzGQK=*!ilrKf~i>%5AsX&(54?v%9?RPUYdV>3hHZIoMiw{qmuWGUxAY zF1@q!^&5fxfB&pMZvXCAn%QNYoxg6*?=Af*@S#rs&yDp@i+rP3|E>R(YIIs>*0!+U z|9|*FSnl8LXPzp8Cv~rH*=m)>UvU$t{L#k8Cv`Swe7sR8$kx!s!R+AD z!l@H=*UQcKUrNB=rlyt?Y& z$;H*-U;k`fdVGE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S{(e#2r7m=JL=mRs(zuMr zB4;6LRqg$&+O$-^s@7DE&TmA%I$!zaR3w?_S9GxirP}YD_M_$6$phxW<4X!#;G6H4tZ>e>2kM`>>@Sb^?HG0f9?x;!aj~<}442CWU%Y7ejRx zJ&NBWUi<@8ay91eE2woM4Svg7haWgim%yfoot`_obdU6?+pChkh7b!%$zFTDQ~17s z>Y=d5&|m7V*8WexrG_a@!}BZ16JKdqJpt4lePV{rc&X(5STCU7+w(vb#PdMuzo7p! zhd$T-yFHy8oghp$E7_$QvVG9}y3yjLyMewF%U!lLAB)vn+HSGqRG1op{+67%j570` zm)Sy5eR9X(w4{7lDRX={WQMPIx4!ym(G>w*$*Io(!4Be{wu+2Amlawbo)){3!Ed@m zWK`r)qXU5WX!6nw$#^L|DhijDW-yG9Extu#seLs1GaUuE`von|GD~eWAIRorhon5M z_0RGreq9lGC2THNaD8uNOStk-UBHfv&BQN>J@4`}nF3v3@(89)h;*4#+O>?+jEbAq z{$wQ2aLt{@8XR@AaLSL{_BEoU{ed|2%^(||)*!&? z2kG;0%d;mm%$u3l#T3#`-Ao_N6**A1T;*E>`C$4_lJ?d20i=*YCv~!FU;z@!m1p{7 zQWD>s^}4sedRTxcQN$EyuPPwXX2IIH>*lSWz42GseN4@PBKi>#xK7#U9!CXsYB zN4c{bvZOq2Wb>RrWkV|;y@!GA4SI+ALT4!8A8rccX++15Xd-vJetf-Ml!eiOujU&Ux?@Pu!^k&sSc#}W7i(so7%^S&B^MBZ8U{0q>;_1Kwkc@1klSo6S|2i82W g=7Im82Y!|wn`E(jD)+q&{*r*CL{x$>{*%xC0e-vq=l}o! diff --git a/test/src/components/checkbox/checkbox_test.dart b/test/src/components/checkbox/checkbox_test.dart index c2c00c56..50cb7dd7 100644 --- a/test/src/components/checkbox/checkbox_test.dart +++ b/test/src/components/checkbox/checkbox_test.dart @@ -1,6 +1,5 @@ import 'dart:ui'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:zeta_flutter/src/components/checkbox/checkbox.dart'; @@ -11,13 +10,42 @@ import '../../../test_utils/tolerant_comparator.dart'; import '../../../test_utils/utils.dart'; void main() { - const goldenFile = GoldenFiles(component: 'checkbox'); + const String componentName = 'ZetaCheckbox'; + const String parentFolder = 'checkbox'; + const goldenFile = GoldenFiles(component: parentFolder); setUpAll(() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - group('ZetaCheckbox Tests', () { + group('$componentName Accessibility Tests', () {}); + group('$componentName Content Tests', () { + final debugFillPropertiesCheckbox = { + 'value': 'false', + 'label': 'null', + 'onChanged': 'null', + 'rounded': 'null', + 'useIndeterminate': 'false', + 'focusNode': 'null', + }; + debugFillPropertiesTest( + ZetaCheckbox(), + debugFillPropertiesCheckbox, + ); + final debugFillPropertiesCheckboxInternal = { + 'value': 'false', + 'label': 'null', + 'rounded': 'null', + 'useIndeterminate': 'false', + 'error': 'false', + 'disabled': 'false', + 'focusNode': 'null', + }; + debugFillPropertiesTest( + ZetaInternalCheckbox(onChanged: (_) {}), + debugFillPropertiesCheckboxInternal, + ); + testWidgets('Initializes with correct parameters', (WidgetTester tester) async { await tester.pumpWidget( TestApp( @@ -36,7 +64,10 @@ void main() { expect(checkbox.rounded, null); expect(checkbox.label, 'Test Checkbox'); }); - + }); + group('$componentName Dimensions Tests', () {}); + group('$componentName Styling Tests', () {}); + group('$componentName Interaction Tests', () { testWidgets('ZetaCheckbox changes state on tap', (WidgetTester tester) async { bool? checkboxValue = true; @@ -51,11 +82,6 @@ void main() { ), ); - final checkboxFinder = find.byType(ZetaCheckbox); - await expectLater( - checkboxFinder, - matchesGoldenFile(goldenFile.getFileUri('checkbox_enabled')), - ); await tester.tap(find.byType(ZetaCheckbox)); await tester.pump(); @@ -71,10 +97,7 @@ void main() { ); final checkboxFinder = find.byType(ZetaCheckbox); - await expectLater( - checkboxFinder, - matchesGoldenFile(goldenFile.getFileUri('checkbox_disabled')), - ); + await tester.tap(find.byType(ZetaCheckbox)); await tester.pump(); final ZetaCheckbox checkbox = tester.firstWidget(checkboxFinder); @@ -115,51 +138,46 @@ void main() { await tester.tap(find.byType(ZetaCheckbox)); await tester.pump(); }); - - testWidgets('ZetaCheckbox UI changes on hover', (WidgetTester tester) async { - await tester.pumpWidget( - TestApp( - home: ZetaCheckbox( - onChanged: (value) {}, - ), - ), - ); - - final checkboxFinder = find.byType(ZetaCheckbox); - - // Hover state - final gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); - await gesture.addPointer(location: Offset.zero); - addTearDown(gesture.removePointer); - await tester.pump(); - await gesture.moveTo(tester.getCenter(checkboxFinder)); - await tester.pumpAndSettle(); - await expectLater( - checkboxFinder, - matchesGoldenFile(goldenFile.getFileUri('checkbox_hover')), - ); - }); - - testWidgets('debugFillProperties works correctly', (WidgetTester tester) async { - final diagnostics = DiagnosticPropertiesBuilder(); - ZetaCheckbox().debugFillProperties(diagnostics); - - expect(diagnostics.finder('value'), 'false'); - expect(diagnostics.finder('label'), 'null'); - expect(diagnostics.finder('onChanged'), 'null'); - expect(diagnostics.finder('rounded'), 'null'); - expect(diagnostics.finder('useIndeterminate'), 'false'); - expect(diagnostics.finder('focusNode'), 'null'); - - final internalDiagnostics = DiagnosticPropertiesBuilder(); - ZetaInternalCheckbox(onChanged: (_) {}).debugFillProperties(internalDiagnostics); - expect(internalDiagnostics.finder('value'), 'false'); - expect(internalDiagnostics.finder('label'), 'null'); - expect(internalDiagnostics.finder('rounded'), 'null'); - expect(internalDiagnostics.finder('useIndeterminate'), 'false'); - expect(internalDiagnostics.finder('error'), 'false'); - expect(internalDiagnostics.finder('disabled'), 'false'); - expect(internalDiagnostics.finder('focusNode'), 'null'); - }); }); + group('$componentName Golden Tests', () { + goldenTest( + goldenFile, + ZetaCheckbox( + onChanged: (value) {}, + ), + ZetaCheckbox, + 'checkbox_hover', + after: (tester) async { + final checkboxFinder = find.byType(ZetaCheckbox); + + // Hover state + final gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); + await gesture.addPointer(location: Offset.zero); + addTearDown(gesture.removePointer); + await tester.pump(); + await gesture.moveTo(tester.getCenter(checkboxFinder)); + await tester.pumpAndSettle(); + }, + ); + + goldenTest( + goldenFile, + ZetaCheckbox( + value: true, + onChanged: print, + ), + ZetaCheckbox, + 'checkbox_enabled', + ); + + goldenTest( + goldenFile, + ZetaCheckbox( + value: true, + ), + ZetaCheckbox, + 'checkbox_disabled', + ); + }); + group('$componentName Performance Tests', () {}); } diff --git a/test/test_utils/utils.dart b/test/test_utils/utils.dart index 1056bba1..65e5b1c9 100644 --- a/test/test_utils/utils.dart +++ b/test/test_utils/utils.dart @@ -31,8 +31,20 @@ class GoldenFiles { } } -void goldenTest(GoldenFiles goldenFile, Widget widget, Type widgetType, String fileName, {bool darkMode = false}) { +void goldenTest( + GoldenFiles goldenFile, + Widget widget, + Type widgetType, + String fileName, { + Future Function(WidgetTester)? before, + Future Function(WidgetTester)? after, + bool darkMode = false, +}) { testWidgets('$fileName golden', (WidgetTester tester) async { + if (before != null) { + await before(tester); + } + await tester.pumpWidget( TestApp( themeMode: darkMode ? ThemeMode.dark : ThemeMode.light, @@ -40,6 +52,10 @@ void goldenTest(GoldenFiles goldenFile, Widget widget, Type widgetType, String f ), ); + if (after != null) { + await after(tester); + } + await expectLater( find.byType(widgetType), matchesGoldenFile(goldenFile.getFileUri(fileName)), @@ -51,7 +67,7 @@ BuildContext getBuildContext(WidgetTester tester, Type type) { return tester.element(find.byType(type)); } -void debugFillPropertiesTest(Widget widget, Map properties) { +void debugFillPropertiesTest(Widget widget, Map properties) { testWidgets('debugFillProperties works correctly', (WidgetTester tester) async { final diagnostics = DiagnosticPropertiesBuilder(); widget.debugFillProperties(diagnostics); From ec0e7109c92c5ef19a6f02b22bd544bb0223db1e Mon Sep 17 00:00:00 2001 From: Daniel Eshkeri Date: Mon, 14 Oct 2024 17:38:03 +0100 Subject: [PATCH 12/16] tests: organised tests for chip and comms button --- test/src/components/chips/chip_test.dart | 72 +++++-- .../comms_button/comms_button_test.dart | 194 +++++++++--------- .../golden/CommsButton_default.png | Bin 6293 -> 0 bytes test/src/components/dialpad/dialpad_test.dart | 4 + 4 files changed, 149 insertions(+), 121 deletions(-) delete mode 100644 test/src/components/comms_button/golden/CommsButton_default.png diff --git a/test/src/components/chips/chip_test.dart b/test/src/components/chips/chip_test.dart index 0d1eb2d1..fa97e52c 100644 --- a/test/src/components/chips/chip_test.dart +++ b/test/src/components/chips/chip_test.dart @@ -1,11 +1,33 @@ +import 'dart:ui'; + +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:zeta_flutter/zeta_flutter.dart'; import '../../../test_utils/test_app.dart'; +import '../../../test_utils/tolerant_comparator.dart'; +import '../../../test_utils/utils.dart'; void main() { - group('ZetaChip', () { + const String componentName = 'ZetaChip'; + const String parentFolder = 'chips'; + + const goldenFile = GoldenFiles(component: parentFolder); + setUpAll(() { + goldenFileComparator = TolerantComparator(goldenFile.uri); + }); + + group('$componentName Accessibility Tests', () {}); + group('$componentName Content Tests', () { + // final debugFillProperties = { + // '': '', + // }; + // debugFillPropertiesTest( + // widget, + // debugFillProperties, + // ); + testWidgets('renders label correctly', (WidgetTester tester) async { await tester.pumpWidget( const TestApp(home: ZetaChip(label: 'Test Chip')), @@ -13,7 +35,10 @@ void main() { expect(find.text('Test Chip'), findsOneWidget); }); - + }); + group('$componentName Dimensions Tests', () {}); + group('$componentName Styling Tests', () {}); + group('$componentName Interaction Tests', () { testWidgets('triggers onTap callback when tapped', (WidgetTester tester) async { bool tapped = false; @@ -72,30 +97,33 @@ void main() { expect(find.byIcon(Icons.close), findsOneWidget); }); - }); + testWidgets('ZetaChip changes selected property correctly', (WidgetTester tester) async { + bool selected = false; + StateSetter? setState; - testWidgets('ZetaChip changes selected property correctly', (WidgetTester tester) async { - bool selected = false; - StateSetter? setState; - - await tester.pumpWidget( - TestApp( - home: StatefulBuilder( - builder: (context, setState2) { - setState = setState2; - return ZetaChip(label: 'Chip', selected: selected); - }, + await tester.pumpWidget( + TestApp( + home: StatefulBuilder( + builder: (context, setState2) { + setState = setState2; + return ZetaChip(label: 'Chip', selected: selected); + }, + ), ), - ), - ); + ); - final Finder iconFinder = find.byIcon(ZetaIcons.check_mark_round); - expect(iconFinder, findsNothing); + final Finder iconFinder = find.byIcon(ZetaIcons.check_mark_round); + expect(iconFinder, findsNothing); - // Change isOpen property to true - setState?.call(() => selected = true); - await tester.pumpAndSettle(); + // Change isOpen property to true + setState?.call(() => selected = true); + await tester.pumpAndSettle(); - expect(iconFinder, findsOne); + expect(iconFinder, findsOne); + }); + }); + group('$componentName Golden Tests', () { + // goldenTest(goldenFile, widget, widgetType, 'PNG_FILE_NAME'); }); + group('$componentName Performance Tests', () {}); } diff --git a/test/src/components/comms_button/comms_button_test.dart b/test/src/components/comms_button/comms_button_test.dart index 0322682e..d3ae6d1d 100644 --- a/test/src/components/comms_button/comms_button_test.dart +++ b/test/src/components/comms_button/comms_button_test.dart @@ -1,19 +1,96 @@ -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:zeta_flutter/zeta_flutter.dart'; + import '../../../test_utils/test_app.dart'; import '../../../test_utils/tolerant_comparator.dart'; import '../../../test_utils/utils.dart'; void main() { - const goldenFile = GoldenFiles(component: 'comms_button'); + const String componentName = 'ZetaCommsButton'; + const String parentFolder = 'comms_button'; + const goldenFile = GoldenFiles(component: parentFolder); setUpAll(() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - group('ZetaCommsButton Tests', () { + group('$componentName Accessibility Tests', () { + testWidgets('Button meets accessibility requirements', (WidgetTester tester) async { + final SemanticsHandle handle = tester.ensureSemantics(); + await tester.pumpWidget( + const TestApp( + home: ZetaCommsButton( + label: 'Label', + semanticLabel: 'Phone', + icon: ZetaIcons.phone, + type: ZetaCommsButtonType.positive, + ), + ), + ); + await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); + await expectLater(tester, meetsGuideline(iOSTapTargetGuideline)); + await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); + await expectLater(tester, meetsGuideline(textContrastGuideline)); + + handle.dispose(); + }); + + testWidgets('Button meets accessibility requirements when toggled', (WidgetTester tester) async { + final SemanticsHandle handle = tester.ensureSemantics(); + await tester.pumpWidget( + TestApp( + home: ZetaCommsButton( + label: 'Label', + semanticLabel: 'Phone', + icon: ZetaIcons.phone, + type: ZetaCommsButtonType.positive, + toggledLabel: 'Toggled Label', + toggledIcon: ZetaIcons.end_call, + toggledType: ZetaCommsButtonType.negative, + onToggle: (isToggled) {}, + ), + ), + ); + await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); + await expectLater(tester, meetsGuideline(iOSTapTargetGuideline)); + await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); + await expectLater(tester, meetsGuideline(textContrastGuideline)); + + await tester.tap(find.byType(ZetaCommsButton)); + await tester.pumpAndSettle(); + + await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); + await expectLater(tester, meetsGuideline(iOSTapTargetGuideline)); + await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); + await expectLater(tester, meetsGuideline(textContrastGuideline)); + + handle.dispose(); + }); + }); + group('$componentName Content Tests', () { + final debugFillProperties = { + 'label': '"Label"', + 'onPressed': 'null', + 'onToggle': 'null', + 'toggledIcon': 'null', + 'toggledLabel': 'null', + 'toggleType': null, + 'focusNode': 'null', + 'semanticLabel': 'null', + 'type': 'positive', + 'size': 'medium', + 'icon': 'IconData(U+0E16B)', + }; + debugFillPropertiesTest( + const ZetaCommsButton( + label: 'Label', + icon: ZetaIcons.phone, + type: ZetaCommsButtonType.positive, + ), + debugFillProperties, + ); + testWidgets('Initializes with correct label', (WidgetTester tester) async { await tester.pumpWidget( const TestApp( @@ -22,11 +99,6 @@ void main() { ); expect(find.text('Label'), findsOneWidget); - - await expectLater( - find.byType(ZetaCommsButton), - matchesGoldenFile(goldenFile.getFileUri('CommsButton_default')), - ); }); testWidgets('Initializes with correct icon', (WidgetTester tester) async { @@ -133,99 +205,23 @@ void main() { expect(pressed, isTrue); }); - - testWidgets('debugFillProperties Test', (WidgetTester tester) async { - final diagnostic = DiagnosticPropertiesBuilder(); - const ZetaCommsButton( - label: 'Label', - icon: ZetaIcons.phone, - type: ZetaCommsButtonType.positive, - ).debugFillProperties(diagnostic); - - expect(diagnostic.finder('label'), '"Label"'); - expect(diagnostic.finder('onPressed'), 'null'); - expect(diagnostic.finder('onToggle'), 'null'); - expect(diagnostic.finder('toggledIcon'), 'null'); - expect(diagnostic.finder('toggledLabel'), 'null'); - expect(diagnostic.finder('toggleType'), null); - expect(diagnostic.finder('focusNode'), 'null'); - expect(diagnostic.finder('semanticLabel'), 'null'); - expect(diagnostic.finder('type'), 'positive'); - expect(diagnostic.finder('size'), 'medium'); - expect(diagnostic.finder('icon'), 'IconData(U+0E16B)'); - }); - - testWidgets('Button meets accessibility requirements', (WidgetTester tester) async { - final SemanticsHandle handle = tester.ensureSemantics(); - await tester.pumpWidget( - const TestApp( - home: ZetaCommsButton( - label: 'Label', - semanticLabel: 'Phone', - icon: ZetaIcons.phone, - type: ZetaCommsButtonType.positive, - ), - ), - ); - await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); - await expectLater(tester, meetsGuideline(iOSTapTargetGuideline)); - await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); - await expectLater(tester, meetsGuideline(textContrastGuideline)); - - handle.dispose(); - }); - - testWidgets('Button meets accessibility requirements when toggled', (WidgetTester tester) async { - final SemanticsHandle handle = tester.ensureSemantics(); - await tester.pumpWidget( - TestApp( - home: ZetaCommsButton( - label: 'Label', - semanticLabel: 'Phone', - icon: ZetaIcons.phone, - type: ZetaCommsButtonType.positive, - toggledLabel: 'Toggled Label', - toggledIcon: ZetaIcons.end_call, - toggledType: ZetaCommsButtonType.negative, - onToggle: (isToggled) {}, - ), - ), - ); - await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); - await expectLater(tester, meetsGuideline(iOSTapTargetGuideline)); - await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); - await expectLater(tester, meetsGuideline(textContrastGuideline)); - - await tester.tap(find.byType(ZetaCommsButton)); - await tester.pumpAndSettle(); - - await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); - await expectLater(tester, meetsGuideline(iOSTapTargetGuideline)); - await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); - await expectLater(tester, meetsGuideline(textContrastGuideline)); - - handle.dispose(); - }); }); - - group('ZetaCommsButton Golden Tests', () { + group('$componentName Dimensions Tests', () {}); + group('$componentName Styling Tests', () {}); + group('$componentName Interaction Tests', () {}); + group('$componentName Golden Tests', () { for (final type in ZetaCommsButtonType.values) { - testWidgets('ZetaCommsButton with type $type', (WidgetTester tester) async { - await tester.pumpWidget( - TestApp( - home: ZetaCommsButton( - label: 'Label', - icon: ZetaIcons.phone, - type: type, - ), - ), - ); - - await expectLater( - find.byType(ZetaCommsButton), - matchesGoldenFile(goldenFile.getFileUri('CommsButton_${type.name}')), - ); - }); + goldenTest( + goldenFile, + ZetaCommsButton( + label: 'Label', + icon: ZetaIcons.phone, + type: type, + ), + ZetaCommsButton, + 'CommsButton_${type.name}', + ); } }); + group('$componentName Performance Tests', () {}); } diff --git a/test/src/components/comms_button/golden/CommsButton_default.png b/test/src/components/comms_button/golden/CommsButton_default.png deleted file mode 100644 index 3f4c2f7354bb91acf0bc3d256c9faebf71ec5d94..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6293 zcmeH~`Cn6K_Qx+p#a4uwG8PdKtPw`p1`v=fKhe?0&0~}APA8? zOIuV%2_PUK28b3x!V(H$ha{{CVM$~SA=~!>U-KV)e;e}4y*Ih{KF>MlbKd8Zhd;SH z?f>e~R}cj4hdY0N9)c8gA?S-=_U-}S6vo`W2@VR8=bg?#<#a6`xY!kW27X~L_$2NP z{5J$0bbx>V-Gw;(A~WV_dW8ZStO>;}Lt_-Zt;6{#Mba(fXu4@!>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L;{n)jq)x}4p9SLSb%se0kEh4e4Z_G8A!>xMtCLepUx0-BF zw3)gaNVp;WwY?)CL7I~j1zbYvstN$2PyVjEEjW&mx5@0`$3m*SQ8dPtjW;+XGu*5= zSXgjw0W{$y?iV$*+ekAybDC8=1Eh9PEt69Z#_1jsDk+VW(WtAiQ$K U!yeuQEH?!I!TtO4Gk$mf51myUZvX%Q diff --git a/test/src/components/dialpad/dialpad_test.dart b/test/src/components/dialpad/dialpad_test.dart index f85a2d54..33bf66fe 100644 --- a/test/src/components/dialpad/dialpad_test.dart +++ b/test/src/components/dialpad/dialpad_test.dart @@ -25,6 +25,10 @@ void main() { await tester.pumpWidget( TestApp( + // before: (tester) async { + // tester.view.devicePixelRatio = 1.0; + // tester.view.physicalSize = const Size(481, 480); + // }, screenSize: const Size(1000, 1000), home: ZetaDialPad( onNumber: (value) => number += value, From 889164bf621d0ad8cee781a9f6981a309be44564 Mon Sep 17 00:00:00 2001 From: Daniel Eshkeri Date: Tue, 15 Oct 2024 14:37:30 +0100 Subject: [PATCH 13/16] tests: organised chat item, checkbox, chip, dialpad, fab, icon, in page banner, password, search bar, slider, stepper input, and, tooltip --- .../{TESTING_README.mdx => TESTING_README.md} | 30 +- test/src/components/badge/label_test.dart | 2 +- .../components/badge/priority_pill_test.dart | 15 - test/src/components/button/button_test.dart | 8 +- .../components/chat_item/chat_item_test.dart | 17 +- .../components/checkbox/checkbox_test.dart | 2 +- test/src/components/chips/chip_test.dart | 3 - test/src/components/dialpad/dialpad_test.dart | 333 ++++++++++-------- .../dialpad/golden/dialpad_disabled.png | Bin 11188 -> 8944 bytes .../dialpad/golden/dialpad_enabled.png | Bin 11188 -> 8944 bytes .../dialpad/golden/dialpadbutton.png | Bin 4708 -> 4315 bytes test/src/components/fab/fab_test.dart | 271 ++++++++++++++ test/src/components/fabs/fab_test.dart | 219 ------------ .../components/fabs/golden/FAB_default.png | Bin 4754 -> 0 bytes .../components/fabs/golden/FAB_disabled.png | Bin 4446 -> 0 bytes .../components/fabs/golden/FAB_inverse.png | Bin 4352 -> 0 bytes .../components/fabs/golden/FAB_pressed.png | Bin 4883 -> 0 bytes .../components/fabs/golden/FAB_secondary.png | Bin 3599 -> 0 bytes test/src/components/icon/icon_test.dart | 104 +++--- .../in_page_banner/in_page_banner_test.dart | 228 +++++++----- .../password/password_input_test.dart | 159 +++++---- .../search_bar/search_bar_test.dart | 180 ++++------ test/src/components/slider/slider_test.dart | 78 ++-- .../stepper input/stepper_input_test.dart | 62 ---- .../stepper_input/stepper_input_test.dart | 95 +++++ test/src/components/tooltip/tooltip_test.dart | 226 ++++++------ test/test_utils/utils.dart | 30 +- 27 files changed, 1143 insertions(+), 919 deletions(-) rename test/{TESTING_README.mdx => TESTING_README.md} (82%) create mode 100644 test/src/components/fab/fab_test.dart delete mode 100644 test/src/components/fabs/fab_test.dart delete mode 100644 test/src/components/fabs/golden/FAB_default.png delete mode 100644 test/src/components/fabs/golden/FAB_disabled.png delete mode 100644 test/src/components/fabs/golden/FAB_inverse.png delete mode 100644 test/src/components/fabs/golden/FAB_pressed.png delete mode 100644 test/src/components/fabs/golden/FAB_secondary.png delete mode 100644 test/src/components/stepper input/stepper_input_test.dart create mode 100644 test/src/components/stepper_input/stepper_input_test.dart diff --git a/test/TESTING_README.mdx b/test/TESTING_README.md similarity index 82% rename from test/TESTING_README.mdx rename to test/TESTING_README.md index 0789e872..a9e4f8eb 100644 --- a/test/TESTING_README.mdx +++ b/test/TESTING_README.md @@ -11,24 +11,34 @@ As you are writing tests think about helper function you could write and add the ### Groups -- Accessibility Tests +- **Accessibility Tests** Semantic labels, touch areas, contrast ratios, etc. -- Content Tests - Finds the widget, parameter statuses, etc. -- Dimensions Tests - Size, padding, margin, alignment, etc. -- Styling Tests + +- **Content Tests** + Finds the widget, parameter statuses, etc. + Checking for the value of props and attributes of the widget. Checking for the presence of widgets. + +- **Dimensions Tests** + Size, padding, margin, alignment, etc. + getSize(). + +- **Styling Tests** Rendered colors, fonts, borders, radii etc. -- Interaction Tests + Checking the style of widgets and child widgets. + +- **Interaction Tests** Gesture recognizers, taps, drags, etc. -- Golden Tests + For example, using a boolean to check if the widgets interaction function runs. + +- **Golden Tests** Compares the rendered widget with the golden file. Use the `goldenTest()` function from test_utils/utils.dart. -- Performance Tests + +- **Performance Tests** Animation performance, rendering performance, data manupulation performance, etc. ### Testing File Template -``` +```dart import 'dart:ui'; import 'package:flutter/foundation.dart'; diff --git a/test/src/components/badge/label_test.dart b/test/src/components/badge/label_test.dart index 28522281..ec6d7c23 100644 --- a/test/src/components/badge/label_test.dart +++ b/test/src/components/badge/label_test.dart @@ -130,7 +130,7 @@ void main() { ZetaLabel, 'label_neutral', ); - goldenTest(goldenFile, const ZetaLabel(label: 'Test Label'), ZetaLabel, 'label_dark', darkMode: true); + goldenTest(goldenFile, const ZetaLabel(label: 'Test Label'), ZetaLabel, 'label_dark', themeMode: ThemeMode.dark); goldenTest(goldenFile, const ZetaLabel(label: 'Test Label', rounded: false), ZetaLabel, 'label_sharp'); }); group('$componentName Performance Tests', () {}); diff --git a/test/src/components/badge/priority_pill_test.dart b/test/src/components/badge/priority_pill_test.dart index e70ddba4..44302011 100644 --- a/test/src/components/badge/priority_pill_test.dart +++ b/test/src/components/badge/priority_pill_test.dart @@ -84,11 +84,6 @@ void main() { expect(zetaPriorityPill.size, ZetaPriorityPillSize.small); expect(find.text('test label'), findsOneWidget); - - await expectLater( - find.byType(ZetaPriorityPill), - matchesGoldenFile(goldenFile.getFileUri('priority_pill_high')), - ); }); testWidgets('Medium priority pill', (WidgetTester tester) async { await tester.pumpWidget( @@ -104,11 +99,6 @@ void main() { final ZetaPriorityPill zetaPriorityPill = tester.firstWidget(zetaPriorityPillFinder); expect(zetaPriorityPill.type, ZetaPriorityPillType.medium); expect(zetaPriorityPill.isBadge, true); - - await expectLater( - find.byType(ZetaPriorityPill), - matchesGoldenFile(goldenFile.getFileUri('priority_pill_medium')), - ); }); testWidgets('Low priority pill', (WidgetTester tester) async { await tester.pumpWidget( @@ -126,11 +116,6 @@ void main() { expect(zetaPriorityPill.type, ZetaPriorityPillType.low); expect(zetaPriorityPill.isBadge, true); expect(zetaPriorityPill.size, ZetaPriorityPillSize.small); - - await expectLater( - find.byType(ZetaPriorityPill), - matchesGoldenFile(goldenFile.getFileUri('priority_pill_low')), - ); }); }); group('$componentName Dimensions Tests', () {}); diff --git a/test/src/components/button/button_test.dart b/test/src/components/button/button_test.dart index 87d674b7..4e4ddb9b 100644 --- a/test/src/components/button/button_test.dart +++ b/test/src/components/button/button_test.dart @@ -284,8 +284,12 @@ void main() { ZetaButton, 'button_outline', ); - goldenTest(goldenFile, const ZetaButton.outlineSubtle(label: 'Test Button', borderType: ZetaWidgetBorder.sharp), - ZetaButton, 'button_outline_subtle'); + goldenTest( + goldenFile, + const ZetaButton.outlineSubtle(label: 'Test Button', borderType: ZetaWidgetBorder.sharp), + ZetaButton, + 'button_outline_subtle', + ); goldenTest( goldenFile, ZetaButton.text(onPressed: () {}, label: 'Test Button', borderType: ZetaWidgetBorder.full), diff --git a/test/src/components/chat_item/chat_item_test.dart b/test/src/components/chat_item/chat_item_test.dart index 0184fb7d..43ee381c 100644 --- a/test/src/components/chat_item/chat_item_test.dart +++ b/test/src/components/chat_item/chat_item_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:intl/intl.dart'; @@ -520,7 +519,7 @@ void main() { const subtitle = Text('Hello, how are you?'); final time = DateTime.now(); - goldenTest( + goldenTestWithCallbacks( goldenFile, Scaffold( body: Column( @@ -554,7 +553,7 @@ void main() { }, ); - goldenTest( + goldenTestWithCallbacks( goldenFile, Column( children: [ @@ -588,7 +587,7 @@ void main() { }, ); - goldenTest( + goldenTestWithCallbacks( goldenFile, Column( children: [ @@ -619,7 +618,7 @@ void main() { }, ); - goldenTest( + goldenTestWithCallbacks( goldenFile, Column( children: [ @@ -659,7 +658,7 @@ void main() { }, ); - goldenTest( + goldenTestWithCallbacks( goldenFile, Column( children: [ @@ -704,7 +703,7 @@ void main() { }, ); - goldenTest( + goldenTestWithCallbacks( goldenFile, Column( children: [ @@ -734,7 +733,7 @@ void main() { }, ); - goldenTest( + goldenTestWithCallbacks( goldenFile, Column( children: [ @@ -771,7 +770,7 @@ void main() { }, ); - goldenTest( + goldenTestWithCallbacks( goldenFile, Column( children: [ diff --git a/test/src/components/checkbox/checkbox_test.dart b/test/src/components/checkbox/checkbox_test.dart index 50cb7dd7..54e28a1d 100644 --- a/test/src/components/checkbox/checkbox_test.dart +++ b/test/src/components/checkbox/checkbox_test.dart @@ -140,7 +140,7 @@ void main() { }); }); group('$componentName Golden Tests', () { - goldenTest( + goldenTestWithCallbacks( goldenFile, ZetaCheckbox( onChanged: (value) {}, diff --git a/test/src/components/chips/chip_test.dart b/test/src/components/chips/chip_test.dart index fa97e52c..eed6dd86 100644 --- a/test/src/components/chips/chip_test.dart +++ b/test/src/components/chips/chip_test.dart @@ -1,6 +1,3 @@ -import 'dart:ui'; - -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:zeta_flutter/zeta_flutter.dart'; diff --git a/test/src/components/dialpad/dialpad_test.dart b/test/src/components/dialpad/dialpad_test.dart index 33bf66fe..2b9aa942 100644 --- a/test/src/components/dialpad/dialpad_test.dart +++ b/test/src/components/dialpad/dialpad_test.dart @@ -1,6 +1,5 @@ import 'dart:ui'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:zeta_flutter/zeta_flutter.dart'; @@ -10,13 +9,65 @@ import '../../../test_utils/tolerant_comparator.dart'; import '../../../test_utils/utils.dart'; void main() { - const goldenFile = GoldenFiles(component: 'dialpad'); + const String componentName = 'ZetaDialPad'; + const String parentFolder = 'dialpad'; + const goldenFile = GoldenFiles(component: parentFolder); setUpAll(() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - group('ZetaDialPad Tests', () { + group('$componentName Accessibility Tests', () {}); + + group('$componentName Content Tests', () { + final debugFillProperties = { + 'onNumber': 'null', + 'onText': 'null', + 'buttonsPerRow': '3', + 'buttonValues': '{1: , 2: ABC, 3: DEF, 4: GHI, 5: JKL, 6: MNO, 7: PQRS, 8: TUV, 9: WXYZ, *: , 0: +, #: }', + }; + debugFillPropertiesTest( + const ZetaDialPad(), + debugFillProperties, + ); + + final debugFillPropertiesSingleButton = { + 'primary': '"1"', + 'secondary': '""', + 'onTap': 'null', + 'topPadding': '3.0', + }; + debugFillPropertiesTest( + const ZetaDialPadButton(primary: '1'), + debugFillPropertiesSingleButton, + ); + }); + + group('$componentName Dimensions Tests', () {}); + + group('$componentName Styling Tests', () { + testWidgets('Hover styles for button are correct', (WidgetTester tester) async { + await tester.pumpWidget( + const TestApp( + screenSize: Size(1000, 1000), + home: ZetaDialPadButton(primary: '1'), + ), + ); + final buttonFinder = find.byType(ZetaDialPadButton); + final inkwellFinder = find.byType(InkWell); + final InkWell inkWell = tester.firstWidget(inkwellFinder); + + final gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); + await gesture.addPointer(location: Offset.zero); + await tester.pump(); + await gesture.moveTo(tester.getCenter(buttonFinder)); + await tester.pumpAndSettle(); + + expect(inkWell.overlayColor?.resolve({WidgetState.hovered}), ZetaColorBase.cool.shade20); + }); + }); + + group('$componentName Interaction Tests', () { testWidgets('Initializes with correct parameters and is enabled', (WidgetTester tester) async { String number = ''; String text = ''; @@ -25,10 +76,6 @@ void main() { await tester.pumpWidget( TestApp( - // before: (tester) async { - // tester.view.devicePixelRatio = 1.0; - // tester.view.physicalSize = const Size(481, 480); - // }, screenSize: const Size(1000, 1000), home: ZetaDialPad( onNumber: (value) => number += value, @@ -127,163 +174,139 @@ void main() { /// Allow all timers to end in text debounce await debounceWait(); + }); - await expectLater( - dialPadFinder, - matchesGoldenFile(goldenFile.getFileUri('dialpad_enabled')), + testWidgets('Initializes with correct parameters and is disabled', (WidgetTester tester) async { + const String number = ''; + const String text = ''; + + Future debounceWait() => tester.binding.delayed(const Duration(milliseconds: 500)); + + await tester.pumpWidget( + const TestApp( + screenSize: Size(1000, 1000), + home: ZetaDialPad(), + ), ); - }); - }); - testWidgets('Initializes with correct parameters and is disabled', (WidgetTester tester) async { - const String number = ''; - const String text = ''; + final dialPadFinder = find.byType(ZetaDialPad); + final buttonFinder = find.byType(ZetaDialPadButton); - Future debounceWait() => tester.binding.delayed(const Duration(milliseconds: 500)); + final oneFinder = find.byWidgetPredicate((widget) => widget is ZetaDialPadButton && widget.primary == '1'); + final twoFinder = find.byWidgetPredicate((widget) => widget is ZetaDialPadButton && widget.primary == '2'); + final threeFinder = find.byWidgetPredicate((widget) => widget is ZetaDialPadButton && widget.primary == '3'); + final starFinder = find.byWidgetPredicate((widget) => widget is ZetaDialPadButton && widget.primary == '*'); + final hashFinder = find.byWidgetPredicate((widget) => widget is ZetaDialPadButton && widget.primary == '#'); - await tester.pumpWidget( - const TestApp( - screenSize: Size(1000, 1000), - home: ZetaDialPad(), - ), - ); - final dialPadFinder = find.byType(ZetaDialPad); - final buttonFinder = find.byType(ZetaDialPadButton); - - final oneFinder = find.byWidgetPredicate((widget) => widget is ZetaDialPadButton && widget.primary == '1'); - final twoFinder = find.byWidgetPredicate((widget) => widget is ZetaDialPadButton && widget.primary == '2'); - final threeFinder = find.byWidgetPredicate((widget) => widget is ZetaDialPadButton && widget.primary == '3'); - final starFinder = find.byWidgetPredicate((widget) => widget is ZetaDialPadButton && widget.primary == '*'); - final hashFinder = find.byWidgetPredicate((widget) => widget is ZetaDialPadButton && widget.primary == '#'); - - final ZetaDialPad dialPad = tester.firstWidget(dialPadFinder); - final List dialPadButtons = tester.widgetList(buttonFinder).toList(); - - final ZetaDialPadButton one = tester.firstWidget(oneFinder); - final ZetaDialPadButton two = tester.firstWidget(twoFinder); - final ZetaDialPadButton three = tester.firstWidget(threeFinder); - - /// Dial Pad built correctly. - expect(dialPad.buttonsPerRow, 3); - expect(dialPadButtons.length, 12); - - /// Dial Pad buttons built correctly. - expect(one.primary, '1'); - expect(one.secondary, ''); - expect(two.primary, '2'); - expect(two.secondary, 'ABC'); - expect(three.primary, '3'); - expect(three.secondary, 'DEF'); - - /// Tap button with only number. - await tester.tap(oneFinder); - await tester.pump(); - expect(number, ''); - - /// Tap button with number and text. - await tester.tap(twoFinder); - await tester.pump(); - await debounceWait(); - expect(number, ''); - expect(text, ''); - - /// Tap different button. - await tester.tap(threeFinder); - await tester.pump(); - await debounceWait(); - expect(number, ''); - expect(text, ''); - - /// Tap text button twice. - await tester.tap(twoFinder); - await tester.tap(twoFinder); - await tester.pump(); - await debounceWait(); - expect(text, ''); - - /// Tap text button thrice. - await tester.tap(twoFinder); - await tester.tap(twoFinder); - await tester.tap(twoFinder); - await tester.pump(); - await debounceWait(); - expect(text, ''); - - /// Tap different text buttons to ensure debounce is cancelled. - await tester.tap(twoFinder); - await tester.tap(threeFinder); - await tester.tap(twoFinder); - await tester.pump(); - await debounceWait(); - expect(text, ''); - - /// Tap text button more times than there is options to ensure it loops around correctly. - await tester.tap(threeFinder); - await tester.tap(threeFinder); - await tester.tap(threeFinder); - await tester.tap(threeFinder); - await tester.tap(threeFinder); - await tester.tap(threeFinder); - await tester.tap(oneFinder); - await tester.pump(); - expect(text, ''); - - /// Tap buttons with symbols - await tester.ensureVisible(starFinder); - await tester.tap(starFinder); - await tester.tap(hashFinder); - await tester.pump(); - expect(number, ''); - - /// Allow all timers to end in text debounce - await debounceWait(); - - await expectLater( - dialPadFinder, - matchesGoldenFile(goldenFile.getFileUri('dialpad_disabled')), - ); - }); - testWidgets('ZetaDialPadButton interaction', (WidgetTester tester) async { - await tester.pumpWidget( - const TestApp( - screenSize: Size(1000, 1000), - home: ZetaDialPadButton(primary: '1'), - ), - ); - final buttonFinder = find.byType(ZetaDialPadButton); - final inkwellFinder = find.byType(InkWell); - final InkWell inkWell = tester.firstWidget(inkwellFinder); + final ZetaDialPad dialPad = tester.firstWidget(dialPadFinder); + final List dialPadButtons = tester.widgetList(buttonFinder).toList(); - final gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); - await gesture.addPointer(location: Offset.zero); - await tester.pump(); - await gesture.moveTo(tester.getCenter(buttonFinder)); - await tester.pumpAndSettle(); + final ZetaDialPadButton one = tester.firstWidget(oneFinder); + final ZetaDialPadButton two = tester.firstWidget(twoFinder); + final ZetaDialPadButton three = tester.firstWidget(threeFinder); - expect(inkWell.overlayColor?.resolve({WidgetState.hovered}), ZetaColorBase.cool.shade20); + /// Dial Pad built correctly. + expect(dialPad.buttonsPerRow, 3); + expect(dialPadButtons.length, 12); - await expectLater( - buttonFinder, - matchesGoldenFile(goldenFile.getFileUri('dialpadbutton')), - ); - }); + /// Dial Pad buttons built correctly. + expect(one.primary, '1'); + expect(one.secondary, ''); + expect(two.primary, '2'); + expect(two.secondary, 'ABC'); + expect(three.primary, '3'); + expect(three.secondary, 'DEF'); - testWidgets('debugFillProperties works correctly', (WidgetTester tester) async { - final diagnostics = DiagnosticPropertiesBuilder(); - const ZetaDialPad().debugFillProperties(diagnostics); + /// Tap button with only number. + await tester.tap(oneFinder); + await tester.pump(); + expect(number, ''); - expect(diagnostics.finder('onNumber'), 'null'); - expect(diagnostics.finder('onText'), 'null'); - expect(diagnostics.finder('buttonsPerRow'), '3'); - expect( - diagnostics.finder('buttonValues'), - '{1: , 2: ABC, 3: DEF, 4: GHI, 5: JKL, 6: MNO, 7: PQRS, 8: TUV, 9: WXYZ, *: , 0: +, #: }', - ); + /// Tap button with number and text. + await tester.tap(twoFinder); + await tester.pump(); + await debounceWait(); + expect(number, ''); + expect(text, ''); + + /// Tap different button. + await tester.tap(threeFinder); + await tester.pump(); + await debounceWait(); + expect(number, ''); + expect(text, ''); + + /// Tap text button twice. + await tester.tap(twoFinder); + await tester.tap(twoFinder); + await tester.pump(); + await debounceWait(); + expect(text, ''); + + /// Tap text button thrice. + await tester.tap(twoFinder); + await tester.tap(twoFinder); + await tester.tap(twoFinder); + await tester.pump(); + await debounceWait(); + expect(text, ''); + + /// Tap different text buttons to ensure debounce is cancelled. + await tester.tap(twoFinder); + await tester.tap(threeFinder); + await tester.tap(twoFinder); + await tester.pump(); + await debounceWait(); + expect(text, ''); + + /// Tap text button more times than there is options to ensure it loops around correctly. + await tester.tap(threeFinder); + await tester.tap(threeFinder); + await tester.tap(threeFinder); + await tester.tap(threeFinder); + await tester.tap(threeFinder); + await tester.tap(threeFinder); + await tester.tap(oneFinder); + await tester.pump(); + expect(text, ''); + + /// Tap buttons with symbols + await tester.ensureVisible(starFinder); + await tester.tap(starFinder); + await tester.tap(hashFinder); + await tester.pump(); + expect(number, ''); + + /// Allow all timers to end in text debounce + await debounceWait(); + }); + }); - final internalDiagnostics = DiagnosticPropertiesBuilder(); - const ZetaDialPadButton(primary: '1').debugFillProperties(internalDiagnostics); - expect(internalDiagnostics.finder('primary'), '"1"'); - expect(internalDiagnostics.finder('secondary'), '""'); - expect(internalDiagnostics.finder('onTap'), 'null'); - expect(internalDiagnostics.finder('topPadding'), '3.0'); + group('$componentName Golden Tests', () { + goldenTest( + goldenFile, + const ZetaDialPad( + onNumber: print, + onText: print, + ), + ZetaDialPad, + 'dialpad_enabled', + screenSize: const Size(1000, 1000), + ); + goldenTest( + goldenFile, + const ZetaDialPad(), + ZetaDialPad, + 'dialpad_disabled', + screenSize: const Size(1000, 1000), + ); + goldenTest( + goldenFile, + const ZetaDialPadButton(primary: '1'), + ZetaDialPadButton, + 'dialpadbutton', + screenSize: const Size(1000, 1000), + ); }); + + group('$componentName Performance Tests', () {}); } diff --git a/test/src/components/dialpad/golden/dialpad_disabled.png b/test/src/components/dialpad/golden/dialpad_disabled.png index 5ee42187fe4268ea5ce61ab1da2bb74cea5c4acc..2e70f9684a5b9acdaa7b08d32d0641753a4bc297 100644 GIT binary patch literal 8944 zcmeI2Ygkj)wuTp4rCurpTf8A~Py`i0Q31nETLdkF8!HIPttg;!69GZ)Ej<-Ph>D65 zAg!@rgMb(nh=i01A|Q!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-ZxfS>1MB{L@B1?m{-?R{|B2-PiDJlqmf=6k@Mjm~{=eIUtwI@hNwpNt2l_dH P2IRP@rAf)rv)BF$Tg3QZ diff --git a/test/src/components/dialpad/golden/dialpad_enabled.png b/test/src/components/dialpad/golden/dialpad_enabled.png index 5ee42187fe4268ea5ce61ab1da2bb74cea5c4acc..2e70f9684a5b9acdaa7b08d32d0641753a4bc297 100644 GIT binary patch literal 8944 zcmeI2Ygkj)wuTp4rCurpTf8A~Py`i0Q31nETLdkF8!HIPttg;!69GZ)Ej<-Ph>D65 zAg!@rgMb(nh=i01A|Q!K1tW$?B9{;#h8RK;Le5wwR;v5iPfzzgd!HZm#{$V*i#f*} zbG+X-78!qYb^2)b;@Jp-e6)R=!!87wu8$zoJU^TXKgm1x%@O#b7PZUiGo*~B!-fBR z5cS#i-50A5d$&Cd!@!q^y0bq-kkgK8Y6$YkSRX+)=XHOn_?k62qEWJa zbenym!iPYmZWwdZmLW)7ZtP|RN!{@7EsJM-01qUj!t)M&@-ZwTYuYpfx#IS}AIwZo z?>)+h&W<*udmp_Wv+{V~SyHL%P38yjsxbA=h@6u++Rv zv|XIycH+ct>>^4Lz-_uk%{seR=5=L)SGc-E!?_m z$^#CGZ1vwCx3g~5j*Lq;&RHeE_2%(oh<_3}Ha6BJ_~4EVQtri-&dMt;SRLso-p3{! zBq@hZz2VvPT^F_12d<19gXg*82qvXz=J4@QRH@Q08qV_{WBO?||Ikxb#b(ePJWuKwhHSZd< zLsDBihodnNiTb0}r?i6k(U{Vj7mdGtmX$uv&NO59^%ZeV4uyw@2LuNfa~J9z&udb~%m5!bz5{C%-V`|8C45X27`GTCL<>3(#I2!3#Wo2b#RMdQmZ#mca z?X9(vyEK}sx3~8O+={w}h6cxc<}K`vCusO;*65!&abjJ8>wXK|M%=-yKH>2lD{`!? ztPWzD%Wu3LRN!hfPeX&#+mhS5VlM%oEM1wMoo&J9+9?l=XVwT^VXiZeP{yN=Ms0y0 z{2H_LZqIeDG5&#FbATR#?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M$Qx}AoT(I z3E(0$D()^7gAJAbAkxH&j0vvKZyUDnwrK# zEl7= z99&ab?1@H$(Zhrd5B|5Zavm@y*jo981uSh?qf8`)lGKel0z*mr!od_}z z>0&_1vwJJ}1{9!%U{nBV!|^B>)gJ}tTvQ*psvGdlgu`+mze+14F)%?v@+=k$#$?Py zz(N3O1KVq#2x81^_6>Kxs}|es0{9P1htxBUIpXjyCi^m}y9xZ^k%pUgMs);c`h7No zJQ_q6)v%zX3``p1&-sU{{`PKU^%bb?1?Yz}o%%9~vRoRu7MRW4VgzhXQ!_6W@#Z*r z>uw~-ZxfS>1MB{L@B1?m{-?R{|B2-PiDJlqmf=6k@Mjm~{=eIUtwI@hNwpNt2l_dH P2IRP@rAf)rv)BF$Tg3QZ diff --git a/test/src/components/dialpad/golden/dialpadbutton.png b/test/src/components/dialpad/golden/dialpadbutton.png index 7bbc925e25b8127a7558cc62e7e3f9cc4306d4e2..efb8765e5ae7bc476f4a3d1f77798bfd9fa81061 100644 GIT binary patch literal 4315 zcmeHK>r)d~6u$|KP>N#52S{QPr!%%z3nB_pd1*CBTcG2kg`&V1gz_j6Q4?Yy(T<`L zi8dW0f@G8_DI&y}3WNj@kwj}EV|k<+6LdBy6#^PGK*+0i{m_4)_$~Wk@7%lh{?0kS zbAD%c&wP^pRVvrGpww3xQYD4Ti3qK^#84m zTgY9X>b=AKtROBKQE$YpSaQ-}uncJR(j%p%9Rvt{{KTJ z$4(PxdWi0~2QIR%b-7G^d{-F&&$Y!^EC5;Fz5ty6hy*|!g#$sBVdh{lo641>i$#VD zx_kNa0H;Bt45H@e=Z`LzB`UH3xO6$~CUjA)ZrTCO9%%W#sot=*DzWn@d~}y0i0Cy-=%kg+_MMXse-53%QqU`SO9tZ~@ zvrgU8(gI^RV`WB1SW)AjNyC&ge^=9#CX;C(ZJj_Mpt9NQ(PaSKEQ0J59Xz=9QD2|P z@N78N zj}6V}JUk0oT4W0%1rVZw0s{k)(b2r8+v)$z&N6F+LS9{6-MfR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7y=Fl(V;y&D3OsJ851xi+4S4YHHku8s~8OcEu)JNhDZ8Egpv1}mu3wtMO~;d) z!)9}e?QsOa??*Vhwp6zWY!TQZuti{tz!rfm0$T*O2>iJSOy~`I&XeYO7}_oPFAh$h Lz#ixNU%B^xa#P#` diff --git a/test/src/components/fab/fab_test.dart b/test/src/components/fab/fab_test.dart new file mode 100644 index 00000000..31f4adc7 --- /dev/null +++ b/test/src/components/fab/fab_test.dart @@ -0,0 +1,271 @@ +import 'dart:ui'; + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:zeta_flutter/zeta_flutter.dart'; + +import '../../../test_utils/test_app.dart'; +import '../../../test_utils/tolerant_comparator.dart'; +import '../../../test_utils/utils.dart'; + +void main() { + const String componentName = 'ZetaFAB'; + const String parentFolder = 'fab'; + + const goldenFile = GoldenFiles(component: parentFolder); + setUpAll(() { + goldenFileComparator = TolerantComparator(goldenFile.uri); + }); + + group('$componentName Accessibility Tests', () {}); + + group('$componentName Content Tests', () { + final debugFillProperties = { + 'label': 'null', + 'onPressed': 'null', + 'type': 'primary', + 'size': 'small', + 'shape': 'full', + 'icon': 'IconData(U+0E009)', + 'initiallyExpanded': 'false', + 'focusNode': 'null', + }; + debugFillPropertiesTest( + const ZetaFAB(), + debugFillProperties, + ); + + testWidgets('Initializes with correct parameters', (WidgetTester tester) async { + final scrollController = ScrollController(); + await tester.pumpWidget( + TestApp( + home: ZetaFAB(scrollController: scrollController, label: 'Label', onPressed: () {}), + ), + ); + + expect(find.byType(ZetaFAB), findsOneWidget); + }); + + testWidgets('Icon Test', (WidgetTester tester) async { + final scrollController = ScrollController(); + await tester.pumpWidget( + TestApp( + home: ZetaFAB( + scrollController: scrollController, + onPressed: () {}, + type: ZetaFabType.inverse, + shape: ZetaWidgetBorder.rounded, + size: ZetaFabSize.large, + ), + ), + ); + expect(find.byIcon(ZetaIcons.add_round), findsOneWidget); + final fabFinder = find.byType(ZetaFAB); + final ZetaFAB fab = tester.firstWidget(fabFinder); + + expect(fab.expanded, false); + expect(fab.type, ZetaFabType.inverse); + expect(fab.shape, ZetaWidgetBorder.rounded); + }); + + testWidgets('Expanded', (WidgetTester tester) async { + await tester.pumpWidget( + TestApp( + home: ZetaFAB( + expanded: true, + onPressed: () {}, + label: 'Label', + type: ZetaFabType.secondary, + shape: ZetaWidgetBorder.sharp, + ), + ), + ); + + final fabFinder = find.byType(ZetaFAB); + final ZetaFAB fab = tester.firstWidget(fabFinder); + + expect(fab.expanded, true); + expect(fab.type, ZetaFabType.secondary); + expect(fab.shape, ZetaWidgetBorder.sharp); + }); + + testWidgets('Disabled FAB', (WidgetTester tester) async { + final scrollController = ScrollController(); + await tester.pumpWidget( + TestApp( + home: ZetaFAB(scrollController: scrollController, label: 'Disabled'), + ), + ); + + final fabFinder = find.byType(ZetaFAB); + final ZetaFAB fab = tester.firstWidget(fabFinder); + + expect(fab.onPressed, isNull); + expect(fab.type, ZetaFabType.primary); + expect(fab.shape, ZetaWidgetBorder.full); + }); + + testWidgets('Label is correct', (WidgetTester tester) async { + final scrollController = ScrollController(); + StateSetter? setState; + bool expanded = false; + + await tester.pumpWidget( + TestApp( + home: StatefulBuilder( + builder: (context, setState2) { + setState = setState2; + return ZetaFAB( + scrollController: scrollController, + expanded: expanded, + label: 'Label', + onPressed: () {}, + ); + }, + ), + ), + ); + + final labelFinder = find.text('Label'); + + expect(labelFinder, findsOne); + + setState?.call(() => expanded = true); + + await tester.pumpAndSettle(); + expect(labelFinder, findsOne); + }); + }); + + group('$componentName Dimensions Tests', () {}); + + group('$componentName Styling Tests', () { + testWidgets('hover colours are correct', (WidgetTester tester) async { + final FocusNode node = FocusNode(); + + await tester.pumpWidget( + TestApp( + home: ZetaFAB( + expanded: true, + onPressed: () {}, + label: 'Label', + type: ZetaFabType.secondary, + shape: ZetaWidgetBorder.sharp, + focusNode: node, + ), + ), + ); + + final fabFinder = find.byType(ZetaFAB); + final ZetaFAB fab = tester.firstWidget(fabFinder); + final filledButtonFinder = find.byType(FilledButton); + final FilledButton filledButton = tester.firstWidget(filledButtonFinder); + + expect(fab.expanded, true); + expect(fab.type, ZetaFabType.secondary); + expect(fab.shape, ZetaWidgetBorder.sharp); + + final gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); + await gesture.addPointer(location: Offset.zero); + await tester.pumpAndSettle(); + await gesture.moveTo(tester.getCenter(fabFinder)); + await tester.pumpAndSettle(); + + expect(filledButton.style?.backgroundColor?.resolve({WidgetState.hovered}), ZetaColorBase.yellow.shade70); + + await gesture.moveTo(Offset.zero); + await tester.pumpAndSettle(); + + node.requestFocus(); + await tester.pumpAndSettle(); + expect( + filledButton.style?.side?.resolve({WidgetState.focused}), + BorderSide(color: ZetaColorBase.blue[50]!, width: ZetaBorders.medium), + ); + }); + }); + + group('$componentName Interaction Tests', () { + testWidgets('OnPressed callback', (WidgetTester tester) async { + bool isPressed = false; + final scrollController = ScrollController(); + + await tester.pumpWidget( + TestApp( + home: ZetaFAB(scrollController: scrollController, label: 'Label', onPressed: () => isPressed = true), + ), + ); + final TestGesture e = await tester.press(find.byType(ZetaFAB)); + + await tester.pumpAndSettle(); + + await e.up(); + expect(isPressed, isTrue); + }); + }); + + group('$componentName Golden Tests', () { + goldenTest( + goldenFile, + ZetaFAB( + scrollController: ScrollController(), + label: 'Label', + onPressed: () {}, + ), + ZetaFAB, + 'FAB_default', + ); + goldenTestWithCallbacks( + goldenFile, + ZetaFAB(scrollController: ScrollController(), label: 'Label', onPressed: () => {}), + ZetaFAB, + 'FAB_pressed', + after: (tester) async { + await tester.press(find.byType(ZetaFAB)); + await tester.pumpAndSettle(); + }, + ); + goldenTest( + goldenFile, + ZetaFAB( + scrollController: ScrollController(), + onPressed: () {}, + type: ZetaFabType.inverse, + shape: ZetaWidgetBorder.rounded, + size: ZetaFabSize.large, + ), + ZetaFAB, + 'FAB_inverse', + ); + goldenTestWithCallbacks( + goldenFile, + ZetaFAB(scrollController: ScrollController(), label: 'Label', onPressed: () => {}), + ZetaFAB, + 'FAB_pressed', + after: (tester) async { + await tester.press(find.byType(ZetaFAB)); + await tester.pumpAndSettle(); + }, + ); + goldenTest( + goldenFile, + ZetaFAB( + expanded: true, + onPressed: () {}, + label: 'Label', + type: ZetaFabType.secondary, + shape: ZetaWidgetBorder.sharp, + ), + ZetaFAB, + 'FAB_secondary', + ); + goldenTest( + goldenFile, + ZetaFAB(scrollController: ScrollController(), label: 'Disabled'), + ZetaFAB, + 'FAB_disabled', + ); + }); + + group('$componentName Performance Tests', () {}); +} diff --git a/test/src/components/fabs/fab_test.dart b/test/src/components/fabs/fab_test.dart deleted file mode 100644 index f82fd5ed..00000000 --- a/test/src/components/fabs/fab_test.dart +++ /dev/null @@ -1,219 +0,0 @@ -import 'dart:ui'; - -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:zeta_flutter/zeta_flutter.dart'; -import '../../../test_utils/test_app.dart'; -import '../../../test_utils/tolerant_comparator.dart'; -import '../../../test_utils/utils.dart'; - -void main() { - const goldenFile = GoldenFiles(component: 'fab'); - - setUpAll(() { - goldenFileComparator = TolerantComparator(goldenFile.uri); - }); - - group('ZetaFAB Tests', () { - testWidgets('Initializes with correct parameters', (WidgetTester tester) async { - final scrollController = ScrollController(); - await tester.pumpWidget( - TestApp( - home: ZetaFAB(scrollController: scrollController, label: 'Label', onPressed: () {}), - ), - ); - - expect(find.byType(ZetaFAB), findsOneWidget); - - await expectLater( - find.byType(ZetaFAB), - matchesGoldenFile(goldenFile.getFileUri('FAB_default')), - ); - }); - - testWidgets('OnPressed callback', (WidgetTester tester) async { - bool isPressed = false; - final scrollController = ScrollController(); - - await tester.pumpWidget( - TestApp( - home: ZetaFAB(scrollController: scrollController, label: 'Label', onPressed: () => isPressed = true), - ), - ); - final TestGesture e = await tester.press(find.byType(ZetaFAB)); - - await tester.pumpAndSettle(); - - await expectLater( - find.byType(ZetaFAB), - matchesGoldenFile(goldenFile.getFileUri('FAB_pressed')), - ); - - await e.up(); - expect(isPressed, isTrue); - }); - }); - - testWidgets('Icon Test', (WidgetTester tester) async { - final scrollController = ScrollController(); - await tester.pumpWidget( - TestApp( - home: ZetaFAB( - scrollController: scrollController, - onPressed: () {}, - type: ZetaFabType.inverse, - shape: ZetaWidgetBorder.rounded, - size: ZetaFabSize.large, - ), - ), - ); - expect(find.byIcon(ZetaIcons.add_round), findsOneWidget); - final fabFinder = find.byType(ZetaFAB); - final ZetaFAB fab = tester.firstWidget(fabFinder); - - expect(fab.expanded, false); - expect(fab.type, ZetaFabType.inverse); - expect(fab.shape, ZetaWidgetBorder.rounded); - - await expectLater( - find.byType(ZetaFAB), - matchesGoldenFile(goldenFile.getFileUri('FAB_inverse')), - ); - }); - - testWidgets('Expanded', (WidgetTester tester) async { - await tester.pumpWidget( - TestApp( - home: ZetaFAB( - expanded: true, - onPressed: () {}, - label: 'Label', - type: ZetaFabType.secondary, - shape: ZetaWidgetBorder.sharp, - ), - ), - ); - - final fabFinder = find.byType(ZetaFAB); - final ZetaFAB fab = tester.firstWidget(fabFinder); - - expect(fab.expanded, true); - expect(fab.type, ZetaFabType.secondary); - expect(fab.shape, ZetaWidgetBorder.sharp); - - await expectLater( - find.byType(ZetaFAB), - matchesGoldenFile(goldenFile.getFileUri('FAB_secondary')), - ); - }); - testWidgets('ZetaFAB interactive', (WidgetTester tester) async { - final FocusNode node = FocusNode(); - - await tester.pumpWidget( - TestApp( - home: ZetaFAB( - expanded: true, - onPressed: () {}, - label: 'Label', - type: ZetaFabType.secondary, - shape: ZetaWidgetBorder.sharp, - focusNode: node, - ), - ), - ); - - final fabFinder = find.byType(ZetaFAB); - final ZetaFAB fab = tester.firstWidget(fabFinder); - final filledButtonFinder = find.byType(FilledButton); - final FilledButton filledButton = tester.firstWidget(filledButtonFinder); - - expect(fab.expanded, true); - expect(fab.type, ZetaFabType.secondary); - expect(fab.shape, ZetaWidgetBorder.sharp); - - final gesture = await tester.createGesture(kind: PointerDeviceKind.mouse); - await gesture.addPointer(location: Offset.zero); - await tester.pumpAndSettle(); - await gesture.moveTo(tester.getCenter(fabFinder)); - await tester.pumpAndSettle(); - - expect(filledButton.style?.backgroundColor?.resolve({WidgetState.hovered}), ZetaColorBase.yellow.shade70); - - await gesture.moveTo(Offset.zero); - await tester.pumpAndSettle(); - - node.requestFocus(); - await tester.pumpAndSettle(); - expect( - filledButton.style?.side?.resolve({WidgetState.focused}), - BorderSide(color: ZetaColorBase.blue[50]!, width: ZetaBorders.medium), - ); - }); - - testWidgets('Disabled FAB', (WidgetTester tester) async { - final scrollController = ScrollController(); - await tester.pumpWidget( - TestApp( - home: ZetaFAB(scrollController: scrollController, label: 'Disabled'), - ), - ); - - final fabFinder = find.byType(ZetaFAB); - final ZetaFAB fab = tester.firstWidget(fabFinder); - - expect(fab.onPressed, isNull); - expect(fab.type, ZetaFabType.primary); - expect(fab.shape, ZetaWidgetBorder.full); - - await expectLater( - find.byType(ZetaFAB), - matchesGoldenFile(goldenFile.getFileUri('FAB_disabled')), - ); - }); - - testWidgets('debugFillProperties works correctly', (WidgetTester tester) async { - final diagnostics = DiagnosticPropertiesBuilder(); - const ZetaFAB().debugFillProperties(diagnostics); - - expect(diagnostics.finder('label'), 'null'); - expect(diagnostics.finder('onPressed'), 'null'); - expect(diagnostics.finder('type'), 'primary'); - expect(diagnostics.finder('size'), 'small'); - expect(diagnostics.finder('shape'), 'full'); - expect(diagnostics.finder('icon'), 'IconData(U+0E009)'); - expect(diagnostics.finder('initiallyExpanded'), 'false'); - expect(diagnostics.finder('focusNode'), 'null'); - }); - - testWidgets('Label is correct', (WidgetTester tester) async { - final scrollController = ScrollController(); - StateSetter? setState; - bool expanded = false; - - await tester.pumpWidget( - TestApp( - home: StatefulBuilder( - builder: (context, setState2) { - setState = setState2; - return ZetaFAB( - scrollController: scrollController, - expanded: expanded, - label: 'Label', - onPressed: () {}, - ); - }, - ), - ), - ); - - final labelFinder = find.text('Label'); - - expect(labelFinder, findsOne); - - setState?.call(() => expanded = true); - - await tester.pumpAndSettle(); - expect(labelFinder, findsOne); - }); -} diff --git a/test/src/components/fabs/golden/FAB_default.png b/test/src/components/fabs/golden/FAB_default.png deleted file mode 100644 index 8ab4dac26b1a97669fe4749481a7a4ce46ed0c4c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4754 zcmeH}>sM1(8pd}50?JKsbwmV0WfUz8j0NN#E}}pcQbkCp1W;ID3<)X(Dj@`6Dj)(n zZ9(o>I-&_ANDAS8mq^tBB_tx3R8fH(2*nW60FgP&tTlhZe9ZoG&OYlod%y4RefGO{ z?$<$n`nyba0RZ#^{C&>>pkV<35~rgDe<@AQyb3=MiRb)$0E=(B08ca%eFDzwz#~m3 zCI zo4B%mdq2N?2g&_=r_4BOt)5QxM4{5kKyd5C2Gzp^fal@jG>vyF(@Sl#H!8|-bLjL| z;p5W#MkaaFE7=NBYl7(`8OF3ukzleYcLu=bM54jn+Dej0zuTNWX>P(6uKMIZ^>KUu zDi+^;gHl23^J4oUK-B&cO2#7TrJ#8E0Q-Uz#jU@x(`N`@(VBX z2^V~EdP1G~1Ys!ps03oRrOPC3YaZ5A54aeor8J{t=HsVYB zXhj{9HR!~Liy{rfY5w(Q5=edoPUx7OQaoi?5G0ICw?!8*Np7{!ZItwJGd=}?q=`J_ zf7mQisaJkeeR%%b4n-KBTTX2jMZ;?kbXa%|t_=&ayX-^VswiXHAx<-H5h#_6qME84F;E$>#O?G3hf6qIk#^sP&2P2E}Iuv)R$ z$t9Sn^}%y%p0%(p`<~M+p5wz#2}I%WH1ZAvsMgR%zKi;}-d`%uV;Vs7#`Oy&CW}>D zQp**kFfMH1l$sd=7svW3-cuphRbF#x6m zrDaa~!YFzOv66dpyU21{vR_K=rL%4GKlery0?^~ldXoHz%}?#`rCgkl_W15KFG3;*$u9<62m!om7?MmU z{m`m)ID zVTR#iOlTq8NZ0TaflL(aMxHJ*rn+0AjS359dkloyFuJZvC8=8vv!FdM;lIgtU*ucf zIzXBG%+hg0oOcapV@ri@xABYI0ccx1RO~vFp2Q({MLB!u<_%01kcCUd>k4g9y%CYj z9_Iz27;LVG1*!7;G(V@0??a}hpF6^f9>7E~J z4aTu{MiubhG)O-g^OnoqT=|RQy zcn(Y4(Z)yjQX>I)R+5;pIXv4wDX)PKjt9N0Zo|B+F83(&;D4L03*2-K%bn*{<^Ze? zbZER&9)1`r>EazGKA%6IkG988rf{L$C&?a9+VNC3Pxr(mfqzZGeu7}sGT$|sRCD}) zJ)Xotf@*G?kp=8*&PwAl0s&X?I06a4fX;3JEKb3G1;>z@0Oag}HC}fBEV!fzTX(mm z7XTT?YN?ulnt+;snt+;snt+;snt+;sn!x{&z$abSledV%18!6BO&kQA4Dx09L}mUP D)R5gM diff --git a/test/src/components/fabs/golden/FAB_disabled.png b/test/src/components/fabs/golden/FAB_disabled.png deleted file mode 100644 index 24e1062f26bee35450fec28d77f284b33d665c59..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4446 zcmeH}`%}_c7{*_`B)KJ(ZM14=xmjD2=}b58bkp1owF_mI+M3B);&lZB6}F4j4=RQ)}e~r${sj$gIo~Swp-)D4S&~px^~Gkle5PH|&p`U(THOeP+&?&v~9R=W0|$ z*kVT)M*vtHzHiS#09y|Ln`ra`q;i9DJ{_4*SqH;*0jJY#1X5Bk7~-Rob$>8E}0sm9KqvVSROc zR9#l}L+3vtiP8ENj6RL07>x>ZDX8S}^T>^6b+fQpSkG~<)|gxhZbeF*r91*b&Xe=% z+TRaJ5`ybKrT80v0C2naD2@4JY`jLy+g6%KrqU~0u)RFOreSVO2dN>jlqlVDie(2+ zesXfUE_7G7o{8PAAtXD!c*7$E@uPb_WghUi1J!s_7IRT+RBw%OxT6p51^C z9`qZdyUTNCDQ3<E<>$#J8gT1BO({PC;N9*H=3ey5lT&Ib0{5AL7 z%}q(CST=yStihXv^)m6W$~k3QscD)O68zGKF=tf7c(XB?-ZR=(Lktt3>`DdOHMlml zX8Lhpe5F!YqY$TReF5%9qTWpBDQg=~No?XfE^7>Zo&Zr5xR#hS3dTs@c{wn&A+BCi zG00%(2UiwU9;uPFv{?>Hw}e?Fd4ui-;j8;?tf09*hKQ{24+#-X>U73fuMoNfS#<2{EDpBID@%{@7VvIWX6 z6ujsj!@Qlg#c`FL1}E^T>RI)D`7fL-fh`o?Q=0KFoYyoVBAHQu#pn3bP&VLG&1YVT#11C>R4=!{9P~ph|T^@m}iajau4xq}B^2oTUi)kE=dRVKC5b^yI)@3%aE(-?` z^K?vA>dUz^&fgF)KEdi(u%if=d~{R0hTX?N~6S9(!Xm0zmhw04M_>n*RsE@rt!D)HsJgTl<@Un6B4PfKw%|-OJjsx6pcZ^GHIO$3 zBUZ&9H)Le-NLZ?ZZ;QLdmPp!gC}5hFdk~3OEJ-F`d!zoZ+-(i793Xv7zIPEXx%RxC zNc)`PHxD^?qGl~?a&oWuV|npMO~(BbIn%bFx`-I}Mm5dy?tzyxD`9*_Op?;Zlo((Z zPcZ)MnvY3F^3hCOL;LNz-p#RX$YF=Kv;C8}R|DDtV+hi24Vx{)J?dW#fYDLii$u}h z)zxatu1>0f3psVhZ2V`nYe*m~AjNo8m5|%af$xg8Y$HUcfwL zyn{MOl>HYhj#Btthn+*f@eZ}@+O;z-tXLG3JqWPhN0j*-uIp*c7Bn}wJZ&$DSZA2c zOun@fm|^caQ4_}oF-WIQX6oUuF03M#(kS<9uT4ImPk%b|g6(@QM{`!t-;>0xA5D$F z;PUquXBAZ|CXda(Q03ylRC~~)l>zwt^_S8xgmUS#2(JBljr{h Dy$(uB diff --git a/test/src/components/fabs/golden/FAB_inverse.png b/test/src/components/fabs/golden/FAB_inverse.png deleted file mode 100644 index 41bf5c0f2bb19182a90763d2cac9cf67d3ab9219..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4352 zcmeHJX;2eq82&<}poo#7YB?fUuUa`oNu)r6B1*9ZtmqJp1)Mk>$}I{3HbFWH)|l8L zAXgZVh6x}Tkwb%oA_V1%ILIN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>Vb|Pu<)Z)2RUpFn6v|Q41>GS^*wK~%3=zpxEEDL1A^B?G6qtm6ZR)EKTFSioc HfaJdcV>>IR diff --git a/test/src/components/fabs/golden/FAB_pressed.png b/test/src/components/fabs/golden/FAB_pressed.png deleted file mode 100644 index 10365d1177bd0e25fb188f97bef163c7039ead94..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4883 zcmeH~X;hO}8pkh-f*|TRl|=}lbw+0fSwv_Q2%(}djDvJ!3m^nVma-T?)<6ihwMZ2g z90ftcRznGfNCClw1W+U{n1GQ)2q9Q0n1m21yhH*debIiIGxKpi=6<=$dG0;W`Q7LL zzvq^GdBo4mWV;Cfz|8;e2af_^UG;?jF@Wk-+0smlQ zxD^jD=_?!_3@#a(z|8i6>IBHdl{1X~w> zL$o!@m~U3zNJ_l0r*1t`lMznY^u+Z>+5?Ytm->IPO@lDNpk4bo z2I1}=Y;`eVG)>v_)evD^l;$3#B;(Ys9^DsEjdHmIYC0)-r~sG=QfEVm4J~6m7IY zHj`d0)vNoPwe+F6lCUHT`rX4$*l=Wl{Q4+6j>r!Jpu%S-!fscwpWIY39;GFyVjY`g zpG7)(c6hBUY8XlLm6QemoQ?kZH}6HStUKeYXQQCL+N&i2-$Dz)EbVvCWJJ_T^x8ph zGZM@$Gm%S&R>kGBO!)TncE z7$H9zo*H^bIBwH6qNZ4=L7kP-PyQSGs)r`#myx zF!v#@Kh76ooEN_2UW&&2B7A#GNX2xetp2-Nb)vzSlia(K$1g0DtmL`5xUZ60v#T+# zE}`eu1fHg+JbmJEjADe8`QlRde62y29LHu82$a<_0Nx!d8iU>i1t=@Z!f5*&*y=Ni zR77lMO5K!-JoouuuDW=oGp5=pT2U^Ohbc(u6zs0nh@X-cCY|K!NcLVSXS0oU^Rmk9 zrFC>GVU)fB0NNX$`Ydhi`1|K0MD3N4ZBzgTJZVaFZjCQToO!vGIX%=+MFyZ}w@@wR zbE?LBcDE#G_q3P*@5l%Y(lUi$(AxK^?;tv>k29waoQbrCLaD_+b}CCA?)tb-uzg=4 zRcbcyS@Fe9ZfHGF6n-abvM-HqU2%wP4jV|@aW(1z>=qSu0_tsk_YK5pUY@=A?~yss zPwSw`*MCHKOo-@=yUm@6!#~*O4>95p`B5$clPv&@4l{k@&LNx?Oa9pO+7tO zgP^%RGk0a32|sxYz*94ty;Fo(px3|4Jttx2i0yf7?ONko#u2O5Nt&+E z(u;x0a&56K=BTw+Ch_n*eE}oLa zxbxVWr>3KX09bZ3>S#-rkGNwxh99|8QS!~Mn^_wo+cS@+GCNt%AOLDYLZIvRJUW?7 zX>h)p+FiiX?tmfCLPFX#V~?N?yhcpvaQ1NsAB;pUx7t^d^x*Y`Y8rCz%Z}zG%x&1(wiAe01z(-a~7y5=KWEYld-sdm>*P4 z6yA&2NBU?ETb(vsUYd`{5W~sRudVN1ec4 zN`sm9tslDMP!%drC|MM9C{JPpz%Aik7nclm2YP~}vTarsq=zA_ZTwT~KE*R-IkHye zSSXR@*lhqNuB8h=BbD&$;1hz%LP@K(*;o1MAhu~Z2ub2xgSZNdkGe%Q!cp6;s(uu8 zGaJ?V(54mpf3~?ac-1ZRh2~(+;%cWt4!@KJAJ&14a9rcj)QE_HN~c-v+?BKfvnnz5v%R zIALfEz?L1}02EoSMf4fNm2c-;1j}ZRzM(EuM?gnFM?gnFM?gnFM?gnFM?gp5|4U#h Z3={fmy&l&R{)GeJf9S};<^wTb{|4I!Gm!uQ diff --git a/test/src/components/fabs/golden/FAB_secondary.png b/test/src/components/fabs/golden/FAB_secondary.png deleted file mode 100644 index 40f2cf3ba1d760f5282a78a9f44b82509eaf100d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3599 zcmeAS@N?(olHy`uVBq!ia0y~yU{+vYV2a>i1B%QlYbpRzjKx9jP7LeL$-D$|Sc;uI zLpXq-h9ji|sA;FCi(^Q|oVRzayXT}zG(0R%FZcb>prJYGnDb;O4yP{BU`|GFPwgd_ z{B*XS@ec^Paf|aGV}0`>GqI>!M-(De7F2Mg@f&YT+B);+j&$|v*snI{zi%_Y|JyKn zeyx!hvtQ=>XLCPZJ8S*g4(KB3tZna@fsT0I&cMjPV8q12z;J>?fPq0l*@1zfp$E61 z^=iEvdq4cyvF-aqk#tG>H}#f%a{oM<}pcoS*qpclK(>|W*jcR)G*x_k2c?`q8< za)qqiFe^5H5?%BE_pfg0<@?-9pI+U5{I`7l?<41DP<7@f%MP?p9 zdGg_ndv$3qfByWFawhF|_U!+^&o_U(!##cay#HUPzds&czFyy!pMl|Y0m3zeJPZyR zpMU-@@?-YfuG_PzeAWGZB`;rH>1StPIJe;>^OLjE^1ge87#J$Nb~LdvFrO*r}| zrK{LyAJE4Z)nWUZN(<`iYyQ2wCXx;e>v=`em8{ttXZUYSxyqV7FaGMT`TPtADouX6 zzi7QL|L@6Kpst(+y*12CKw6CvNT#rGFfdFIRA69maBBd@nIt)aH?3@JV%GcyM)854 z4|u6yAcgK3)lPO)jt1Rm&{3;c7)?u~X=yYqQC_`{=A+SkG@6e_Vm_K#&luktl~{Py RXb}Stc)I$ztaD0e0swT;O2hyF diff --git a/test/src/components/icon/icon_test.dart b/test/src/components/icon/icon_test.dart index 05cbbb5e..d7f1dc9b 100644 --- a/test/src/components/icon/icon_test.dart +++ b/test/src/components/icon/icon_test.dart @@ -1,28 +1,61 @@ -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:zeta_flutter/zeta_flutter.dart'; import '../../../test_utils/test_app.dart'; +import '../../../test_utils/tolerant_comparator.dart'; import '../../../test_utils/utils.dart'; void main() { - group('Zeta Icon', () { - testWidgets('renders icon correctly', (WidgetTester tester) async { - await tester.pumpWidget(const TestApp(home: ZetaIcon(ZetaIcons.add_round))); + const String componentName = 'ZetaIcon'; + const String parentFolder = 'icon'; + + const goldenFile = GoldenFiles(component: parentFolder); + setUpAll(() { + goldenFileComparator = TolerantComparator(goldenFile.uri); + }); + + group('$componentName Accessibility Tests', () { + testWidgets('applies correct semantic label to icon', (WidgetTester tester) async { + const String semanticLabel = 'Add Icon'; + await tester.pumpWidget(const TestApp(home: ZetaIcon(ZetaIcons.add_round, semanticLabel: semanticLabel))); final iconFinder = find.byIcon(ZetaIcons.add_round); - expect(iconFinder, findsOneWidget); + final iconWidget = tester.widget(iconFinder); + expect(iconWidget.semanticLabel, equals(semanticLabel)); }); + }); + group('$componentName Content Tests', () { + final debugFillProperties = { + 'icon': 'IconData(U+0E045)', + 'rounded': 'false', + 'size': '10.0', + 'fill': 'null', + 'weight': 'null', + 'grade': 'null', + 'opticalSize': 'null', + 'color': 'null', + 'shadows': 'null', + 'semanticLabel': '"Cached"', + 'textDirection': 'null', + 'applyTextScaling': 'null', + }; + debugFillPropertiesTest( + const ZetaIcon( + ZetaIcons.cached, + rounded: false, + size: 10, + semanticLabel: 'Cached', + ), + debugFillProperties, + ); - testWidgets('applies correct size to icon', (WidgetTester tester) async { - const double iconSize = 24; - await tester.pumpWidget(const TestApp(home: ZetaIcon(ZetaIcons.add_round, size: iconSize))); + testWidgets('renders icon correctly', (WidgetTester tester) async { + await tester.pumpWidget(const TestApp(home: ZetaIcon(ZetaIcons.add_round))); final iconFinder = find.byIcon(ZetaIcons.add_round); - final iconWidget = tester.widget(iconFinder); - expect(iconWidget.size, equals(iconSize)); + expect(iconFinder, findsOneWidget); }); - testWidgets('applies correct color to icon', (WidgetTester tester) async { + testWidgets('color value is correct', (WidgetTester tester) async { const Color iconColor = Colors.red; await tester.pumpWidget(const TestApp(home: ZetaIcon(ZetaIcons.add_round, color: iconColor))); final iconFinder = find.byIcon(ZetaIcons.add_round); @@ -30,14 +63,6 @@ void main() { expect(iconWidget.color, equals(iconColor)); }); - testWidgets('applies correct semantic label to icon', (WidgetTester tester) async { - const String semanticLabel = 'Add Icon'; - await tester.pumpWidget(const TestApp(home: ZetaIcon(ZetaIcons.add_round, semanticLabel: semanticLabel))); - final iconFinder = find.byIcon(ZetaIcons.add_round); - final iconWidget = tester.widget(iconFinder); - expect(iconWidget.semanticLabel, equals(semanticLabel)); - }); - testWidgets('applies sharp family to icon', (WidgetTester tester) async { await tester.pumpWidget( const TestApp( @@ -58,7 +83,18 @@ void main() { expect(iconFinderRound, findsOneWidget); expect(iconFinderSharp, findsExactly(1)); }); - + }); + group('$componentName Dimensions Tests', () { + testWidgets('applies correct size to icon', (WidgetTester tester) async { + const double iconSize = 24; + await tester.pumpWidget(const TestApp(home: ZetaIcon(ZetaIcons.add_round, size: iconSize))); + final iconFinder = find.byIcon(ZetaIcons.add_round); + final sizeOfIcon = tester.getSize(iconFinder); + expect(sizeOfIcon.width, equals(iconSize)); + expect(sizeOfIcon.height, equals(iconSize)); + }); + }); + group('$componentName Styling Tests', () { testWidgets('applies correct font family to icon', (WidgetTester tester) async { await tester.pumpWidget(const TestApp(home: ZetaIcon(ZetaIcons.add_round))); final iconFinder = find.byIcon(ZetaIcons.add_round); @@ -145,28 +181,10 @@ void main() { final iconWidget = tester.widget(iconFinder); expect(iconWidget.icon?.fontFamily, equals('MaterialIcons')); }); - - testWidgets('debugFillProperties works correctly', (WidgetTester tester) async { - final diagnostics = DiagnosticPropertiesBuilder(); - const ZetaIcon( - ZetaIcons.cached, - rounded: false, - size: 10, - semanticLabel: 'Cached', - ).debugFillProperties(diagnostics); - - expect(diagnostics.finder('icon'), 'IconData(U+0E045)'); - expect(diagnostics.finder('rounded'), 'false'); - expect(diagnostics.finder('size'), '10.0'); - expect(diagnostics.finder('fill'), 'null'); - expect(diagnostics.finder('weight'), 'null'); - expect(diagnostics.finder('grade'), 'null'); - expect(diagnostics.finder('opticalSize'), 'null'); - expect(diagnostics.finder('color'), 'null'); - expect(diagnostics.finder('shadows'), 'null'); - expect(diagnostics.finder('semanticLabel'), '"Cached"'); - expect(diagnostics.finder('textDirection'), 'null'); - expect(diagnostics.finder('applyTextScaling'), 'null'); - }); }); + group('$componentName Interaction Tests', () {}); + group('$componentName Golden Tests', () { + // goldenTest(goldenFile, widget, widgetType, 'PNG_FILE_NAME'); + }); + group('$componentName Performance Tests', () {}); } diff --git a/test/src/components/in_page_banner/in_page_banner_test.dart b/test/src/components/in_page_banner/in_page_banner_test.dart index 4c825515..930c4617 100644 --- a/test/src/components/in_page_banner/in_page_banner_test.dart +++ b/test/src/components/in_page_banner/in_page_banner_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:zeta_flutter/zeta_flutter.dart'; @@ -8,120 +7,175 @@ import '../../../test_utils/tolerant_comparator.dart'; import '../../../test_utils/utils.dart'; void main() { - const goldenFile = GoldenFiles(component: 'in_page_banner'); + const String componentName = 'ZetaInPageBanner'; + const String parentFolder = 'in_page_banner'; + const goldenFile = GoldenFiles(component: parentFolder); setUpAll(() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - group('ZetaInPageBanner Tests', () { - testWidgets('ZetaInPageBanner creation', (WidgetTester tester) async { + group('$componentName Accessibility Tests', () {}); + group('$componentName Content Tests', () { + final debugFillProperties = { + 'onClose': 'null', + 'status': 'info', + 'title': 'null', + 'customIcon': 'null', + }; + debugFillPropertiesTest( + const ZetaInPageBanner(content: Placeholder()), + debugFillProperties, + ); + + testWidgets('renders correct icon and text', (WidgetTester tester) async { await tester.pumpWidget( const TestApp( home: ZetaInPageBanner(content: Text('Test'), title: 'Title'), ), ); - final Finder decoratedBoxFinder = find.byType(DecoratedBox); - final DecoratedBox box = tester.firstWidget(decoratedBoxFinder); - expect(find.byType(ZetaInPageBanner), findsOneWidget); expect(find.text('Test'), findsOneWidget); + }); + + testWidgets("ZetaInPageBanner shows 'close icon' correctly", (WidgetTester tester) async { + await tester.pumpWidget( + TestApp(home: ZetaInPageBanner(content: const Text('Test'), onClose: () {}, status: ZetaWidgetStatus.negative)), + ); + + expect(find.byIcon(ZetaIcons.close_round), findsOneWidget); + }); + + testWidgets("ZetaInPageBanner hides 'close icon' correctly", (WidgetTester tester) async { + await tester.pumpWidget( + const TestApp(home: ZetaInPageBanner(content: Text('Test'), status: ZetaWidgetStatus.positive)), + ); + expect(find.byIcon(ZetaIcons.close_round), findsNothing); + }); + }); + group('$componentName Dimensions Tests', () {}); + group('$componentName Styling Tests', () { + testWidgets('default background colour is correct', (WidgetTester tester) async { + await tester.pumpWidget( + const TestApp( + home: ZetaInPageBanner(content: Text('Test'), title: 'Title'), + ), + ); + final Finder decoratedBoxFinder = find.byType(DecoratedBox); + final DecoratedBox box = tester.firstWidget(decoratedBoxFinder); expect(box.decoration.runtimeType, BoxDecoration); final BoxDecoration decoration = box.decoration as BoxDecoration; expect(decoration.color, ZetaColorBase.purple.shade10); + }); - await expectLater( - find.byType(ZetaInPageBanner), - matchesGoldenFile(goldenFile.getFileUri('in_page_banner_default')), + testWidgets('negative background colour is correct', (WidgetTester tester) async { + await tester.pumpWidget( + TestApp(home: ZetaInPageBanner(content: const Text('Test'), onClose: () {}, status: ZetaWidgetStatus.negative)), ); + + final Finder decoratedBoxFinder = find.byType(DecoratedBox); + final DecoratedBox box = tester.firstWidget(decoratedBoxFinder); + expect(box.decoration.runtimeType, BoxDecoration); + final BoxDecoration decoration = box.decoration as BoxDecoration; + expect(decoration.color, ZetaColorBase.red.shade10); }); - }); - testWidgets("ZetaInPageBanner shows 'close icon' correctly", (WidgetTester tester) async { - await tester.pumpWidget( - TestApp(home: ZetaInPageBanner(content: const Text('Test'), onClose: () {}, status: ZetaWidgetStatus.negative)), - ); + testWidgets('positive background colour is correct', (WidgetTester tester) async { + await tester.pumpWidget( + const TestApp(home: ZetaInPageBanner(content: Text('Test'), status: ZetaWidgetStatus.positive)), + ); - expect(find.byIcon(ZetaIcons.close_round), findsOneWidget); - final Finder decoratedBoxFinder = find.byType(DecoratedBox); - final DecoratedBox box = tester.firstWidget(decoratedBoxFinder); - expect(box.decoration.runtimeType, BoxDecoration); - final BoxDecoration decoration = box.decoration as BoxDecoration; - expect(decoration.color, ZetaColorBase.red.shade10); - await expectLater( - find.byType(ZetaInPageBanner), - matchesGoldenFile(goldenFile.getFileUri('in_page_banner_negative')), - ); - }); + final Finder decoratedBoxFinder = find.byType(DecoratedBox); + final DecoratedBox box = tester.firstWidget(decoratedBoxFinder); + expect(box.decoration.runtimeType, BoxDecoration); + final BoxDecoration decoration = box.decoration as BoxDecoration; + expect(decoration.color, ZetaColorBase.green.shade10); + }); - testWidgets("ZetaInPageBanner hides 'close icon' correctly", (WidgetTester tester) async { - await tester.pumpWidget( - const TestApp(home: ZetaInPageBanner(content: Text('Test'), status: ZetaWidgetStatus.positive)), - ); - expect(find.byIcon(ZetaIcons.close_round), findsNothing); - final Finder decoratedBoxFinder = find.byType(DecoratedBox); - final DecoratedBox box = tester.firstWidget(decoratedBoxFinder); - expect(box.decoration.runtimeType, BoxDecoration); - final BoxDecoration decoration = box.decoration as BoxDecoration; - expect(decoration.color, ZetaColorBase.green.shade10); - await expectLater( - find.byType(ZetaInPageBanner), - matchesGoldenFile(goldenFile.getFileUri('in_page_banner_positive')), - ); - }); + testWidgets('neutral background colour is correct', (WidgetTester tester) async { + await tester.pumpWidget( + const TestApp(home: ZetaInPageBanner(content: Text('Test'), status: ZetaWidgetStatus.neutral)), + ); - testWidgets('ZetaInPageBanner button callbacks work', (WidgetTester tester) async { - bool onPressed = false; - final key = GlobalKey(); - await tester.pumpWidget( - TestApp( - home: ZetaInPageBanner( - content: const Text('Test'), - status: ZetaWidgetStatus.neutral, - actions: [ - ZetaButton( - label: 'Test button', - onPressed: () => onPressed = true, - key: key, - ), - ], + final Finder decoratedBoxFinder = find.byType(DecoratedBox); + final DecoratedBox box = tester.firstWidget(decoratedBoxFinder); + expect(box.decoration.runtimeType, BoxDecoration); + final BoxDecoration decoration = box.decoration as BoxDecoration; + expect(decoration.color, ZetaColorBase.cool.shade10); + }); + }); + group('$componentName Interaction Tests', () { + testWidgets('button callback works', (WidgetTester tester) async { + bool onPressed = false; + final key = GlobalKey(); + await tester.pumpWidget( + TestApp( + home: ZetaInPageBanner( + content: const Text('Test'), + status: ZetaWidgetStatus.neutral, + actions: [ + ZetaButton( + label: 'Test button', + onPressed: () => onPressed = true, + key: key, + ), + ], + ), ), - ), - ); + ); - final Finder decoratedBoxFinder = find.byType(DecoratedBox); - final DecoratedBox box = tester.firstWidget(decoratedBoxFinder); - expect(box.decoration.runtimeType, BoxDecoration); - final BoxDecoration decoration = box.decoration as BoxDecoration; - expect(decoration.color, ZetaColorBase.cool.shade10); + await tester.tap(find.byKey(key)); + await tester.pumpAndSettle(); + expect(onPressed, isTrue); + }); - await tester.tap(find.byKey(key)); - await tester.pumpAndSettle(); - expect(onPressed, isTrue); + testWidgets("ZetaInPageBanner 'close' icon tap test", (WidgetTester tester) async { + bool closeIconIsTapped = false; + await tester.pumpWidget( + TestApp(home: ZetaInPageBanner(onClose: () => closeIconIsTapped = true, content: const Text('Test'))), + ); + final closeIcon = find.byIcon(ZetaIcons.close_round); + await tester.tap(closeIcon); + await tester.pump(); + expect(closeIconIsTapped, isTrue); + }); + }); - await expectLater( - find.byType(ZetaInPageBanner), - matchesGoldenFile(goldenFile.getFileUri('in_page_banner_buttons')), + group('$componentName Golden Tests', () { + goldenTest( + goldenFile, + const ZetaInPageBanner(content: Text('Test'), title: 'Title'), + ZetaInPageBanner, + 'in_page_banner_default', ); - }); - testWidgets("ZetaInPageBanner 'close' icon tap test", (WidgetTester tester) async { - bool closeIconIsTapped = false; - await tester.pumpWidget( - TestApp(home: ZetaInPageBanner(onClose: () => closeIconIsTapped = true, content: const Text('Test'))), + goldenTest( + goldenFile, + ZetaInPageBanner(content: const Text('Test'), onClose: () {}, status: ZetaWidgetStatus.negative), + ZetaInPageBanner, + 'in_page_banner_negative', + ); + goldenTest( + goldenFile, + const ZetaInPageBanner(content: Text('Test'), status: ZetaWidgetStatus.positive), + ZetaInPageBanner, + 'in_page_banner_positive', + ); + goldenTest( + goldenFile, + ZetaInPageBanner( + content: const Text('Test'), + status: ZetaWidgetStatus.neutral, + actions: [ + ZetaButton( + label: 'Test button', + onPressed: () {}, + ), + ], + ), + ZetaInPageBanner, + 'in_page_banner_buttons', ); - final closeIcon = find.byIcon(ZetaIcons.close_round); - await tester.tap(closeIcon); - await tester.pump(); - expect(closeIconIsTapped, isTrue); - }); - testWidgets('debugFillProperties works correctly', (WidgetTester tester) async { - final diagnostics = DiagnosticPropertiesBuilder(); - const ZetaInPageBanner(content: Placeholder()).debugFillProperties(diagnostics); - - expect(diagnostics.finder('onClose'), 'null'); - expect(diagnostics.finder('status'), 'info'); - expect(diagnostics.finder('title'), 'null'); - expect(diagnostics.finder('customIcon'), 'null'); }); + group('$componentName Performance Tests', () {}); } diff --git a/test/src/components/password/password_input_test.dart b/test/src/components/password/password_input_test.dart index 57dbbd28..3fe66c3c 100644 --- a/test/src/components/password/password_input_test.dart +++ b/test/src/components/password/password_input_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:zeta_flutter/zeta_flutter.dart'; @@ -8,87 +7,113 @@ import '../../../test_utils/tolerant_comparator.dart'; import '../../../test_utils/utils.dart'; void main() { - const goldenFile = GoldenFiles(component: 'password'); + const String componentName = 'ZetaPasswordInput'; + const String parentFolder = 'password'; + const goldenFile = GoldenFiles(component: parentFolder); setUpAll(() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - testWidgets('ZetaPasswordInput initializes correctly', (WidgetTester tester) async { - await tester.pumpWidget( - TestApp( - home: ZetaPasswordInput(), - ), + group('$componentName Accessibility Tests', () {}); + group('$componentName Content Tests', () { + final debugFillProperties = { + 'size': 'medium', + 'placeholder': 'null', + 'label': 'null', + 'hintText': 'null', + 'errorText': 'null', + 'semanticLabel': 'null', + 'showSemanticLabel': 'null', + 'obscureSemanticLabel': 'null', + }; + debugFillPropertiesTest( + ZetaPasswordInput(), + debugFillProperties, ); - expect(find.byType(ZetaPasswordInput), findsOneWidget); - await expectLater( - find.byType(ZetaPasswordInput), - matchesGoldenFile(goldenFile.getFileUri('password_default')), - ); - }); + testWidgets('ZetaPasswordInput initializes correctly', (WidgetTester tester) async { + await tester.pumpWidget( + TestApp( + home: ZetaPasswordInput(), + ), + ); + expect(find.byType(ZetaPasswordInput), findsOneWidget); + }); - testWidgets('Test password visibility', (WidgetTester tester) async { - await tester.pumpWidget( - TestApp( - home: ZetaPasswordInput(), - ), - ); - final obscureIconOff = find.byIcon(ZetaIcons.visibility_off_round); - expect(obscureIconOff, findsOneWidget); - await tester.tap(obscureIconOff); - await tester.pump(); + testWidgets('obscure icon in rendered correctly', (WidgetTester tester) async { + await tester.pumpWidget( + TestApp( + home: ZetaPasswordInput(), + ), + ); + final obscureIconOff = find.byIcon(ZetaIcons.visibility_off_round); + expect(obscureIconOff, findsOneWidget); + await tester.tap(obscureIconOff); + await tester.pump(); - final obscureIconOn = find.byIcon(ZetaIcons.visibility_round); - expect(obscureIconOn, findsOneWidget); - }); + final obscureIconOn = find.byIcon(ZetaIcons.visibility_round); + expect(obscureIconOn, findsOneWidget); + }); - testWidgets('Test error message visibility', (WidgetTester tester) async { - String? testValidator(String? value) { - final regExp = RegExp(r'\d'); - if (value != null && regExp.hasMatch(value)) return 'Error'; - return null; - } + testWidgets('Test error message visibility', (WidgetTester tester) async { + String? testValidator(String? value) { + final regExp = RegExp(r'\d'); + if (value != null && regExp.hasMatch(value)) return 'Error'; + return null; + } - final controller = TextEditingController()..text = 'password123'; - final formKey = GlobalKey(); + final controller = TextEditingController()..text = 'password123'; + final formKey = GlobalKey(); - await tester.pumpWidget( - TestApp( - home: Form( - key: formKey, - child: ZetaPasswordInput( - controller: controller, - validator: testValidator, - rounded: false, + await tester.pumpWidget( + TestApp( + home: Form( + key: formKey, + child: ZetaPasswordInput( + controller: controller, + validator: testValidator, + rounded: false, + ), ), ), - ), - ); - formKey.currentState?.validate(); - await tester.pump(); - - // There will be two matches for the error text as the form field itself contains a hidden one. - expect(find.text('Error'), findsExactly(2)); - final obscureIconOn = find.byIcon(ZetaIcons.visibility_off_sharp); - expect(obscureIconOn, findsOneWidget); + ); + formKey.currentState?.validate(); + await tester.pump(); - await expectLater( - find.byType(ZetaPasswordInput), - matchesGoldenFile(goldenFile.getFileUri('password_error')), - ); + // There will be two matches for the error text as the form field itself contains a hidden one. + expect(find.text('Error'), findsExactly(2)); + final obscureIconOn = find.byIcon(ZetaIcons.visibility_off_sharp); + expect(obscureIconOn, findsOneWidget); + }); }); - testWidgets('Test debugFillProperties', (WidgetTester tester) async { - final diagnostics = DiagnosticPropertiesBuilder(); - ZetaPasswordInput().debugFillProperties(diagnostics); - - expect(diagnostics.finder('size'), 'medium'); - expect(diagnostics.finder('placeholder'), 'null'); - expect(diagnostics.finder('label'), 'null'); - expect(diagnostics.finder('hintText'), 'null'); - expect(diagnostics.finder('errorText'), 'null'); - expect(diagnostics.finder('semanticLabel'), 'null'); - expect(diagnostics.finder('showSemanticLabel'), 'null'); - expect(diagnostics.finder('obscureSemanticLabel'), 'null'); + group('$componentName Dimensions Tests', () {}); + group('$componentName Styling Tests', () {}); + group('$componentName Interaction Tests', () {}); + group('$componentName Golden Tests', () { + goldenTest(goldenFile, ZetaPasswordInput(), ZetaPasswordInput, 'password_default'); + final formKey = GlobalKey(); + goldenTestWithCallbacks( + goldenFile, + Form( + key: formKey, + child: ZetaPasswordInput( + controller: TextEditingController()..text = 'password123', + validator: (String? value) { + final regExp = RegExp(r'\d'); + if (value != null && regExp.hasMatch(value)) return 'Error'; + return null; + }, + rounded: false, + ), + ), + ZetaPasswordInput, + 'password_error', + after: (tester) async { + formKey.currentState?.validate(); + await tester.pump(); + }, + ); }); + group('$componentName Performance Tests', () {}); } diff --git a/test/src/components/search_bar/search_bar_test.dart b/test/src/components/search_bar/search_bar_test.dart index 120b326a..720598a6 100644 --- a/test/src/components/search_bar/search_bar_test.dart +++ b/test/src/components/search_bar/search_bar_test.dart @@ -26,8 +26,10 @@ abstract class ISearchBarEvents { ]) void main() { late MockISearchBarEvents callbacks; - const goldenFile = GoldenFiles(component: 'search_bar'); + const String componentName = 'ZetaSearchBar'; + const String parentFolder = 'search_bar'; + const goldenFile = GoldenFiles(component: parentFolder); setUpAll(() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); @@ -36,8 +38,25 @@ void main() { callbacks = MockISearchBarEvents(); }); - group('ZetaSearchBar', () { - testWidgets('renders with default parameters', (WidgetTester tester) async { + group('$componentName Accessibility Tests', () {}); + group('$componentName Content Tests', () { + final debugFillProperties = { + 'size': 'medium', + 'shape': 'rounded', + 'placeholder': 'null', + 'textInputAction': 'null', + 'onSpeechToText': 'null', + 'showSpeechToText': 'true', + 'focusNode': 'null', + 'microphoneSemanticLabel': 'null', + 'clearSemanticLabel': 'null', + }; + debugFillPropertiesTest( + ZetaSearchBar(), + debugFillProperties, + ); + + testWidgets('renders text field', (WidgetTester tester) async { await tester.pumpWidget( TestApp( home: Scaffold( @@ -50,82 +69,6 @@ void main() { expect(find.byType(TextField), findsOneWidget); }); - testWidgets('golden: renders initializes correctly', (WidgetTester tester) async { - await tester.pumpWidget( - TestApp( - home: ZetaSearchBar(), - ), - ); - expect(find.byType(ZetaSearchBar), findsOneWidget); - - await expectLater( - find.byType(ZetaSearchBar), - matchesGoldenFile(goldenFile.getFileUri('search_bar_default')), - ); - }); - - testWidgets('golden: renders size medium correctly', (WidgetTester tester) async { - await tester.pumpWidget( - TestApp( - home: ZetaSearchBar(), - ), - ); - expect(find.byType(ZetaSearchBar), findsOneWidget); - - await expectLater( - find.byType(ZetaSearchBar), - matchesGoldenFile(goldenFile.getFileUri('search_bar_medium')), - ); - }); - - testWidgets('golden: renders size small correctly', (WidgetTester tester) async { - await tester.pumpWidget( - TestApp( - home: ZetaSearchBar( - size: ZetaWidgetSize.small, - ), - ), - ); - expect(find.byType(ZetaSearchBar), findsOneWidget); - - await expectLater( - find.byType(ZetaSearchBar), - matchesGoldenFile(goldenFile.getFileUri('search_bar_small')), - ); - }); - - testWidgets('golden: renders shape full correctly', (WidgetTester tester) async { - await tester.pumpWidget( - TestApp( - home: ZetaSearchBar( - shape: ZetaWidgetBorder.full, - ), - ), - ); - expect(find.byType(ZetaSearchBar), findsOneWidget); - - await expectLater( - find.byType(ZetaSearchBar), - matchesGoldenFile(goldenFile.getFileUri('search_bar_full')), - ); - }); - - testWidgets('golden: renders shape sharp correctly', (WidgetTester tester) async { - await tester.pumpWidget( - TestApp( - home: ZetaSearchBar( - shape: ZetaWidgetBorder.sharp, - ), - ), - ); - expect(find.byType(ZetaSearchBar), findsOneWidget); - - await expectLater( - find.byType(ZetaSearchBar), - matchesGoldenFile(goldenFile.getFileUri('search_bar_sharp')), - ); - }); - testWidgets('sets initial value correctly', (WidgetTester tester) async { const initialValue = 'Initial value'; @@ -168,6 +111,25 @@ void main() { expect(find.text(updatedValue), findsOneWidget); }); + testWidgets('speech-to-text button visibility', (WidgetTester tester) async { + await tester.pumpWidget( + TestApp( + home: Scaffold( + body: ZetaSearchBar( + showSpeechToText: false, + ), + ), + ), + ); + + await tester.pumpAndSettle(); + expect(find.byIcon(ZetaIcons.search), findsNothing); + expect(find.byIcon(ZetaIcons.microphone), findsNothing); + }); + }); + group('$componentName Dimensions Tests', () {}); + group('$componentName Styling Tests', () {}); + group('$componentName Interaction Tests', () { testWidgets('triggers onChanged callback when text is entered', (WidgetTester tester) async { await tester.pumpWidget( TestApp( @@ -237,22 +199,6 @@ void main() { expect(find.text('Disabled input'), findsNothing); }); - testWidgets('speech-to-text button visibility', (WidgetTester tester) async { - await tester.pumpWidget( - TestApp( - home: Scaffold( - body: ZetaSearchBar( - showSpeechToText: false, - ), - ), - ), - ); - - await tester.pumpAndSettle(); - expect(find.byIcon(ZetaIcons.search), findsNothing); - expect(find.byIcon(ZetaIcons.microphone), findsNothing); - }); - testWidgets('clear button functionality', (WidgetTester tester) async { await tester.pumpWidget( TestApp( @@ -273,20 +219,34 @@ void main() { verify(callbacks.onChange.call('')).called(1); }); - - test('debugFillProperties', () { - final diagnostics = DiagnosticPropertiesBuilder(); - ZetaSearchBar().debugFillProperties(diagnostics); - - expect(diagnostics.finder('size'), 'medium'); - expect(diagnostics.finder('shape'), 'rounded'); - expect(diagnostics.finder('placeholder'), 'null'); - expect(diagnostics.finder('textInputAction'), 'null'); - expect(diagnostics.finder('onSpeechToText'), 'null'); - expect(diagnostics.finder('showSpeechToText'), 'true'); - expect(diagnostics.finder('focusNode'), 'null'); - expect(diagnostics.finder('microphoneSemanticLabel'), 'null'); - expect(diagnostics.finder('clearSemanticLabel'), 'null'); - }); }); + group('$componentName Golden Tests', () { + goldenTest(goldenFile, ZetaSearchBar(), ZetaSearchBar, 'search_bar_default'); + goldenTest(goldenFile, ZetaSearchBar(), ZetaSearchBar, 'search_bar_medium'); + goldenTest( + goldenFile, + ZetaSearchBar( + size: ZetaWidgetSize.small, + ), + ZetaSearchBar, + 'search_bar_small', + ); + goldenTest( + goldenFile, + ZetaSearchBar( + shape: ZetaWidgetBorder.full, + ), + ZetaSearchBar, + 'search_bar_full', + ); + goldenTest( + goldenFile, + ZetaSearchBar( + shape: ZetaWidgetBorder.sharp, + ), + ZetaSearchBar, + 'search_bar_sharp', + ); + }); + group('$componentName Performance Tests', () {}); } diff --git a/test/src/components/slider/slider_test.dart b/test/src/components/slider/slider_test.dart index 70522376..f6f5adca 100644 --- a/test/src/components/slider/slider_test.dart +++ b/test/src/components/slider/slider_test.dart @@ -3,33 +3,67 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:zeta_flutter/zeta_flutter.dart'; import '../../../test_utils/test_app.dart'; +import '../../../test_utils/tolerant_comparator.dart'; +import '../../../test_utils/utils.dart'; void main() { - testWidgets('ZetaSlider min/max values', (WidgetTester tester) async { - const double sliderValue = 0.5; - double? changedValue; - - await tester.pumpWidget( - TestApp( - home: ZetaSlider( - value: sliderValue, - onChange: (value) { - changedValue = value; - }, + const String componentName = 'ZetaSlider'; + const String parentFolder = 'slider'; + + const goldenFile = GoldenFiles(component: parentFolder); + setUpAll(() { + goldenFileComparator = TolerantComparator(goldenFile.uri); + }); + + group('$componentName Accessibility Tests', () {}); + + group('$componentName Content Tests', () { + // final debugFillProperties = { + // '': '', + // }; + // debugFillPropertiesTest( + // widget, + // debugFillProperties, + // ); + }); + + group('$componentName Dimensions Tests', () {}); + + group('$componentName Styling Tests', () {}); + + group('$componentName Interaction Tests', () { + testWidgets('ZetaSlider min/max values', (WidgetTester tester) async { + const double sliderValue = 0.5; + double? changedValue; + + await tester.pumpWidget( + TestApp( + home: ZetaSlider( + value: sliderValue, + onChange: (value) { + changedValue = value; + }, + ), ), - ), - ); + ); - final slider = tester.widget(find.byType(Slider)); - expect(slider.min, 0.0); - expect(slider.max, 1.0); + final slider = tester.widget(find.byType(Slider)); + expect(slider.min, 0.0); + expect(slider.max, 1.0); - // Drag the slider to the minimum value - await tester.drag(find.byType(Slider), const Offset(-400, 0)); - expect(changedValue, 0.0); + // Drag the slider to the minimum value + await tester.drag(find.byType(Slider), const Offset(-400, 0)); + expect(changedValue, 0.0); - // Drag the slider to the maximum value - await tester.drag(find.byType(Slider), const Offset(400, 0)); - expect(changedValue, 1.0); + // Drag the slider to the maximum value + await tester.drag(find.byType(Slider), const Offset(400, 0)); + expect(changedValue, 1.0); + }); }); + + group('$componentName Golden Tests', () { + // goldenTest(goldenFile, widget, widgetType, 'PNG_FILE_NAME'); + }); + + group('$componentName Performance Tests', () {}); } diff --git a/test/src/components/stepper input/stepper_input_test.dart b/test/src/components/stepper input/stepper_input_test.dart deleted file mode 100644 index 53c4b4c1..00000000 --- a/test/src/components/stepper input/stepper_input_test.dart +++ /dev/null @@ -1,62 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:zeta_flutter/src/components/stepper_input/stepper_input.dart'; -import 'package:zeta_flutter/zeta_flutter.dart'; - -import '../../../test_utils/test_app.dart'; - -void main() { - testWidgets('ZetaStepperInput increases value when increment button is pressed', (WidgetTester tester) async { - int value = 0; - await tester.pumpWidget( - TestApp( - home: ZetaStepperInput( - value: value, - onChange: (newValue) { - value = newValue; - }, - ), - ), - ); - - expect(value, 0); - - await tester.tap(find.byIcon(ZetaIcons.add_round)); - await tester.pump(); - - expect(value, 1); - }); - - testWidgets('ZetaStepperInput increases value when programatically changed', (WidgetTester tester) async { - int value = 0; - StateSetter? setState; - await tester.pumpWidget( - StatefulBuilder( - builder: (context, setState2) { - setState = setState2; - - return TestApp( - home: ZetaStepperInput( - value: value, - onChange: (newValue) { - value = newValue; - }, - ), - ); - }, - ), - ); - - final ZetaStepperInputState stepperInputState = tester.state(find.byType(ZetaStepperInput)); - - expect(value, stepperInputState.value); - - setState?.call(() { - value = 1; - }); - - await tester.pump(); - - expect(value, stepperInputState.value); - }); -} diff --git a/test/src/components/stepper_input/stepper_input_test.dart b/test/src/components/stepper_input/stepper_input_test.dart new file mode 100644 index 00000000..3058e0e6 --- /dev/null +++ b/test/src/components/stepper_input/stepper_input_test.dart @@ -0,0 +1,95 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:zeta_flutter/src/components/stepper_input/stepper_input.dart'; +import 'package:zeta_flutter/zeta_flutter.dart'; + +import '../../../test_utils/test_app.dart'; +import '../../../test_utils/tolerant_comparator.dart'; +import '../../../test_utils/utils.dart'; + +void main() { + const String componentName = 'ZetaStepperInput'; + const String parentFolder = 'stepper_input'; + + const goldenFile = GoldenFiles(component: parentFolder); + setUpAll(() { + goldenFileComparator = TolerantComparator(goldenFile.uri); + }); + + group('$componentName Accessibility Tests', () {}); + group('$componentName Content Tests', () { + // final debugFillProperties = { + // '': '', + // }; + // debugFillPropertiesTest( + // widget, + // debugFillProperties, + // ); + + testWidgets('ZetaStepperInput increases value when programatically changed', (WidgetTester tester) async { + int value = 0; + StateSetter? setState; + await tester.pumpWidget( + StatefulBuilder( + builder: (context, setState2) { + setState = setState2; + + return TestApp( + home: ZetaStepperInput( + value: value, + onChange: (newValue) { + value = newValue; + }, + ), + ); + }, + ), + ); + + final ZetaStepperInputState stepperInputState = tester.state(find.byType(ZetaStepperInput)); + + expect(value, stepperInputState.value); + + setState?.call(() { + value = 1; + }); + + await tester.pump(); + + expect(value, stepperInputState.value); + }); + }); + + group('$componentName Dimensions Tests', () {}); + + group('$componentName Styling Tests', () {}); + + group('$componentName Interaction Tests', () { + testWidgets('ZetaStepperInput increases value when increment button is pressed', (WidgetTester tester) async { + int value = 0; + await tester.pumpWidget( + TestApp( + home: ZetaStepperInput( + value: value, + onChange: (newValue) { + value = newValue; + }, + ), + ), + ); + + expect(value, 0); + + await tester.tap(find.byIcon(ZetaIcons.add_round)); + await tester.pump(); + + expect(value, 1); + }); + }); + + group('$componentName Golden Tests', () { + // goldenTest(goldenFile, widget, widgetType, 'PNG_FILE_NAME'); + }); + + group('$componentName Performance Tests', () {}); +} diff --git a/test/src/components/tooltip/tooltip_test.dart b/test/src/components/tooltip/tooltip_test.dart index b1c5284f..17790a42 100644 --- a/test/src/components/tooltip/tooltip_test.dart +++ b/test/src/components/tooltip/tooltip_test.dart @@ -15,15 +15,56 @@ import 'tooltip_test.mocks.dart'; MockSpec(), ]) void main() { + const String componentName = 'ZetaTooltip'; + const String parentFolder = 'tooltip'; + final mockZeta = MockZeta(); when(mockZeta.radius).thenReturn(const ZetaRadiiAA(primitives: ZetaPrimitivesLight())); - const goldenFile = GoldenFiles(component: 'tooltip'); + const goldenFile = GoldenFiles(component: parentFolder); setUpAll(() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - group('ZetaTooltip Widget Tests', () { + group('$componentName Accessibility Tests', () {}); + group('$componentName Content Tests', () { + final debugFillProperties = { + 'rounded': 'null', + 'padding': 'EdgeInsets.all(8.0)', + 'color': 'MaterialColor(primary value: Color(0xffffc107))', + 'textStyle': 'TextStyle(inherit: true, size: 9.0)', + 'arrowDirection': 'down', + 'maxWidth': '170.0', + }; + debugFillPropertiesTest( + const ZetaTooltip( + padding: EdgeInsets.all(8), + color: Colors.amber, + textStyle: TextStyle(fontSize: 9), + maxWidth: 170, + child: Text('Rounded tooltip'), + ), + debugFillProperties, + ); + + testWidgets('debugFillProperties works correctly', (WidgetTester tester) async { + final diagnostics = DiagnosticPropertiesBuilder(); + const ZetaTooltip( + padding: EdgeInsets.all(8), + color: Colors.amber, + textStyle: TextStyle(fontSize: 9), + maxWidth: 170, + child: Text('Rounded tooltip'), + ).debugFillProperties(diagnostics); + + expect(diagnostics.finder('rounded'), 'null'); + expect(diagnostics.finder('padding'), 'EdgeInsets.all(8.0)'); + expect(diagnostics.finder('color').toLowerCase(), contains(Colors.amber.hexCode.toLowerCase())); + expect(diagnostics.finder('textStyle'), contains('size: 9.0')); + expect(diagnostics.finder('arrowDirection'), 'down'); + expect(diagnostics.finder('maxWidth'), '170.0'); + }); + testWidgets('renders with default properties', (WidgetTester tester) async { await tester.pumpWidget( const TestApp( @@ -38,13 +79,13 @@ void main() { expect(find.text('Tooltip text'), findsOneWidget); expect(find.byType(ZetaTooltip), findsOneWidget); }); - - testWidgets('renders with custom color and padding', (WidgetTester tester) async { + }); + group('$componentName Dimensions Tests', () { + testWidgets('renders with custom padding', (WidgetTester tester) async { await tester.pumpWidget( const TestApp( home: Scaffold( body: ZetaTooltip( - color: Colors.red, padding: EdgeInsets.all(20), child: Text('Tooltip text'), ), @@ -52,23 +93,38 @@ void main() { ), ); - final tooltipBox = tester.widget( + final padding = tester.widget( find.descendant( of: find.byType(ZetaTooltip), - matching: find.byType(DecoratedBox), + matching: find.byType(Padding), ), ); - expect((tooltipBox.decoration as BoxDecoration).color, Colors.red); + expect(padding.padding, const EdgeInsets.all(20)); + }); + }); + group('$componentName Styling Tests', () { + testWidgets('renders with custom color', (WidgetTester tester) async { + await tester.pumpWidget( + const TestApp( + home: Scaffold( + body: ZetaTooltip( + color: Colors.red, + padding: EdgeInsets.all(20), + child: Text('Tooltip text'), + ), + ), + ), + ); - final padding = tester.widget( + final tooltipBox = tester.widget( find.descendant( of: find.byType(ZetaTooltip), - matching: find.byType(Padding), + matching: find.byType(DecoratedBox), ), ); - expect(padding.padding, const EdgeInsets.all(20)); + expect((tooltipBox.decoration as BoxDecoration).color, Colors.red); }); testWidgets('renders with custom text style', (WidgetTester tester) async { @@ -99,89 +155,6 @@ void main() { expect(textSpan.style?.color, Colors.blue); }); - testWidgets('renders with arrow correctly in up direction', (WidgetTester tester) async { - await tester.pumpWidget( - const TestApp( - home: Scaffold( - body: ZetaTooltip( - arrowDirection: ZetaTooltipArrowDirection.up, - child: Text('Tooltip up'), - ), - ), - ), - ); - - expect(find.text('Tooltip up'), findsOneWidget); - - // Verifying the CustomPaint with different arrow directions. - await expectLater( - find.byType(ZetaTooltip), - matchesGoldenFile(goldenFile.getFileUri('arrow_up')), - ); - }); - - testWidgets('renders with arrow correctly in down direction', (WidgetTester tester) async { - await tester.pumpWidget( - const TestApp( - home: Scaffold( - body: ZetaTooltip( - child: Text('Tooltip down'), - ), - ), - ), - ); - - expect(find.text('Tooltip down'), findsOneWidget); - - // Verifying the CustomPaint with different arrow directions. - await expectLater( - find.byType(ZetaTooltip), - matchesGoldenFile(goldenFile.getFileUri('arrow_down')), - ); - }); - - testWidgets('renders with arrow correctly in left direction', (WidgetTester tester) async { - await tester.pumpWidget( - const TestApp( - home: Scaffold( - body: ZetaTooltip( - arrowDirection: ZetaTooltipArrowDirection.left, - child: Text('Tooltip left'), - ), - ), - ), - ); - - expect(find.text('Tooltip left'), findsOneWidget); - - // Verifying the CustomPaint with different arrow directions. - await expectLater( - find.byType(ZetaTooltip), - matchesGoldenFile(goldenFile.getFileUri('arrow_left')), - ); - }); - - testWidgets('renders with arrow correctly in right direction', (WidgetTester tester) async { - await tester.pumpWidget( - const TestApp( - home: Scaffold( - body: ZetaTooltip( - arrowDirection: ZetaTooltipArrowDirection.right, - child: Text('Tooltip right'), - ), - ), - ), - ); - - expect(find.text('Tooltip right'), findsOneWidget); - - // Verifying the CustomPaint with different arrow directions. - await expectLater( - find.byType(ZetaTooltip), - matchesGoldenFile(goldenFile.getFileUri('arrow_right')), - ); - }); - testWidgets('renders with rounded and sharp corners', (WidgetTester tester) async { await tester.pumpWidget( const TestApp( @@ -221,23 +194,52 @@ void main() { expect((roundedTooltipBox.decoration as BoxDecoration).borderRadius, mockZeta.radius.minimal); expect((sharpTooltipBox.decoration as BoxDecoration).borderRadius, null); }); - - testWidgets('debugFillProperties works correctly', (WidgetTester tester) async { - final diagnostics = DiagnosticPropertiesBuilder(); - const ZetaTooltip( - padding: EdgeInsets.all(8), - color: Colors.amber, - textStyle: TextStyle(fontSize: 9), - maxWidth: 170, - child: Text('Rounded tooltip'), - ).debugFillProperties(diagnostics); - - expect(diagnostics.finder('rounded'), 'null'); - expect(diagnostics.finder('padding'), 'EdgeInsets.all(8.0)'); - expect(diagnostics.finder('color').toLowerCase(), contains(Colors.amber.hexCode.toLowerCase())); - expect(diagnostics.finder('textStyle'), contains('size: 9.0')); - expect(diagnostics.finder('arrowDirection'), 'down'); - expect(diagnostics.finder('maxWidth'), '170.0'); - }); }); + group('$componentName Interaction Tests', () {}); + group('$componentName Golden Tests', () { + goldenTest( + goldenFile, + const Scaffold( + body: ZetaTooltip( + arrowDirection: ZetaTooltipArrowDirection.up, + child: Text('Tooltip up'), + ), + ), + ZetaTooltip, + 'arrow_up', + ); + goldenTest( + goldenFile, + const Scaffold( + body: ZetaTooltip( + child: Text('Tooltip down'), + ), + ), + ZetaTooltip, + 'arrow_down', + ); + goldenTest( + goldenFile, + const Scaffold( + body: ZetaTooltip( + arrowDirection: ZetaTooltipArrowDirection.left, + child: Text('Tooltip left'), + ), + ), + ZetaTooltip, + 'arrow_left', + ); + goldenTest( + goldenFile, + const Scaffold( + body: ZetaTooltip( + arrowDirection: ZetaTooltipArrowDirection.right, + child: Text('Tooltip right'), + ), + ), + ZetaTooltip, + 'arrow_right', + ); + }); + group('$componentName Performance Tests', () {}); } diff --git a/test/test_utils/utils.dart b/test/test_utils/utils.dart index 65e5b1c9..5117d045 100644 --- a/test/test_utils/utils.dart +++ b/test/test_utils/utils.dart @@ -3,8 +3,8 @@ import 'dart:io'; import 'package:collection/collection.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:path/path.dart'; import 'package:flutter_test/flutter_test.dart'; +import 'package:path/path.dart'; import '../test_utils/test_app.dart'; extension Util on DiagnosticPropertiesBuilder { @@ -32,6 +32,32 @@ class GoldenFiles { } void goldenTest( + GoldenFiles goldenFile, + Widget widget, + Type widgetType, + String fileName, { + ThemeMode themeMode = ThemeMode.system, + Size? screenSize, + bool? rounded, +}) { + testWidgets('$fileName golden', (WidgetTester tester) async { + await tester.pumpWidget( + TestApp( + screenSize: screenSize, + themeMode: themeMode, + rounded: rounded, + home: widget, + ), + ); + + await expectLater( + find.byType(widgetType), + matchesGoldenFile(goldenFile.getFileUri(fileName)), + ); + }); +} + +void goldenTestWithCallbacks( GoldenFiles goldenFile, Widget widget, Type widgetType, @@ -39,6 +65,7 @@ void goldenTest( Future Function(WidgetTester)? before, Future Function(WidgetTester)? after, bool darkMode = false, + Size? screenSize, }) { testWidgets('$fileName golden', (WidgetTester tester) async { if (before != null) { @@ -47,6 +74,7 @@ void goldenTest( await tester.pumpWidget( TestApp( + screenSize: screenSize, themeMode: darkMode ? ThemeMode.dark : ThemeMode.light, home: widget, ), From 5dd7680addbe0d6dd156b38df14e03901f536efd Mon Sep 17 00:00:00 2001 From: github-actions Date: Tue, 15 Oct 2024 13:40:45 +0000 Subject: [PATCH 14/16] chore(automated): Lint commit and format --- test/src/components/search_bar/search_bar_test.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/test/src/components/search_bar/search_bar_test.dart b/test/src/components/search_bar/search_bar_test.dart index 720598a6..8e517c0a 100644 --- a/test/src/components/search_bar/search_bar_test.dart +++ b/test/src/components/search_bar/search_bar_test.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; From 57c1ef41b66a3240cc6a2ec3fbc886f140dc79a8 Mon Sep 17 00:00:00 2001 From: Daniel Eshkeri Date: Tue, 15 Oct 2024 15:08:12 +0100 Subject: [PATCH 15/16] fix: removed '$componentName' from all test files --- test/TESTING_README.md | 15 +++++------ test/scripts/output/test_table.md | 26 +++++++++++++++++++ test/scripts/test_counter.dart | 19 ++++++++------ test/scripts/utils/utils.dart | 20 ++++++-------- .../components/accordion/accordion_test.dart | 16 +++++------- test/src/components/avatar/avatar_test.dart | 15 +++++------ test/src/components/badge/indicator_test.dart | 15 +++++------ test/src/components/badge/label_test.dart | 15 +++++------ .../components/badge/priority_pill_test.dart | 15 +++++------ .../components/badge/status_label_test.dart | 15 +++++------ test/src/components/badge/tag_test.dart | 15 +++++------ test/src/components/banner/banner_test.dart | 15 +++++------ test/src/components/button/button_test.dart | 15 +++++------ .../components/chat_item/chat_item_test.dart | 15 +++++------ .../components/checkbox/checkbox_test.dart | 15 +++++------ test/src/components/chips/chip_test.dart | 15 +++++------ .../comms_button/comms_button_test.dart | 15 +++++------ test/src/components/dialpad/dialpad_test.dart | 15 +++++------ test/src/components/fab/fab_test.dart | 15 +++++------ test/src/components/icon/icon_test.dart | 15 +++++------ .../in_page_banner/in_page_banner_test.dart | 15 +++++------ .../password/password_input_test.dart | 15 +++++------ .../search_bar/search_bar_test.dart | 15 +++++------ test/src/components/slider/slider_test.dart | 15 +++++------ .../stepper_input/stepper_input_test.dart | 15 +++++------ test/src/components/tooltip/tooltip_test.dart | 15 +++++------ 26 files changed, 206 insertions(+), 205 deletions(-) create mode 100644 test/scripts/output/test_table.md diff --git a/test/TESTING_README.md b/test/TESTING_README.md index a9e4f8eb..a98b8042 100644 --- a/test/TESTING_README.md +++ b/test/TESTING_README.md @@ -51,7 +51,6 @@ import '../../../test_utils/tolerant_comparator.dart'; import '../../../test_utils/utils.dart'; void main() { - const String componentName = 'ENTER_COMPONENT_NAME (e.g. ZetaButton)'; const String parentFolder = 'ENTER_PARENT_FOLDER (e.g. button)'; const goldenFile = GoldenFiles(component: parentFolder); @@ -59,8 +58,8 @@ void main() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - group('$componentName Accessibility Tests', () {}); - group('$componentName Content Tests', () { + group('Accessibility Tests', () {}); + group('Content Tests', () { final debugFillProperties = { '': '', }; @@ -69,13 +68,13 @@ void main() { debugFillProperties, ); }); - group('$componentName Dimensions Tests', () {}); - group('$componentName Styling Tests', () {}); - group('$componentName Interaction Tests', () {}); - group('$componentName Golden Tests', () { + group('Dimensions Tests', () {}); + group('Styling Tests', () {}); + group('Interaction Tests', () {}); + group('Golden Tests', () { goldenTest(goldenFile, widget, widgetType, 'PNG_FILE_NAME'); }); - group('$componentName Performance Tests', () {}); + group('Performance Tests', () {}); } ``` diff --git a/test/scripts/output/test_table.md b/test/scripts/output/test_table.md new file mode 100644 index 00000000..06d85966 --- /dev/null +++ b/test/scripts/output/test_table.md @@ -0,0 +1,26 @@ +| Component | Accessibility | Content | Dimensions | Styling | Interaction | Golden | Performance | Unorganised | Total Tests | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| Accordion | 0 | 2 | 0 | 1 | 2 | 0 | 0 | 0 | 5 | +| Avatar | 1 | 3 | 6 | 5 | 0 | 6 | 0 | 0 | 21 | +| Indicator | 0 | 7 | 0 | 0 | 0 | 5 | 0 | 0 | 12 | +| Label | 0 | 8 | 0 | 0 | 0 | 7 | 0 | 0 | 15 | +| Priority Pill | 0 | 5 | 0 | 0 | 0 | 4 | 0 | 0 | 9 | +| Status Label | 0 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | 5 | +| Tag | 0 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | 5 | +| Banner | 3 | 4 | 0 | 3 | 0 | 1 | 0 | 3 | 14 | +| Button | 0 | 10 | 0 | 2 | 1 | 8 | 0 | 0 | 21 | +| Chat Item | 0 | 10 | 0 | 0 | 0 | 0 | 0 | 0 | 10 | +| Checkbox | 0 | 3 | 0 | 0 | 3 | 2 | 0 | 0 | 8 | +| Chip | 0 | 1 | 0 | 0 | 5 | 0 | 0 | 0 | 6 | +| Comms Button | 2 | 7 | 0 | 0 | 0 | 1 | 0 | 0 | 10 | +| Dialpad | 0 | 2 | 0 | 1 | 2 | 3 | 0 | 0 | 8 | +| Fab | 0 | 6 | 0 | 1 | 1 | 4 | 0 | 0 | 12 | +| Icon | 1 | 4 | 1 | 6 | 0 | 0 | 0 | 0 | 12 | +| In Page Banner | 0 | 4 | 0 | 4 | 2 | 4 | 0 | 0 | 14 | +| Password Input | 0 | 4 | 0 | 0 | 0 | 1 | 0 | 0 | 5 | +| Search Bar | 0 | 5 | 0 | 0 | 5 | 5 | 0 | 0 | 15 | +| Slider | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | +| Stepper Input | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 2 | +| Tooltip | 0 | 3 | 1 | 3 | 0 | 4 | 0 | 0 | 11 | +| Extended Top App Bar | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 3 | +| Total Tests | 7 | 95 | 8 | 26 | 23 | 59 | 0 | 6 | 224 | \ No newline at end of file diff --git a/test/scripts/test_counter.dart b/test/scripts/test_counter.dart index 72dafe74..a74a69d3 100644 --- a/test/scripts/test_counter.dart +++ b/test/scripts/test_counter.dart @@ -124,7 +124,7 @@ class TestVisitor extends RecursiveAstVisitor { } } -/// Generates an MDX (Markdown Extended) table representation of the test counts. +/// Generates an MD (Markdown) table representation of the test counts. /// /// The function takes a nested map where the outer map's keys are test group names, /// and the inner map's keys are test names with their corresponding integer counts. @@ -139,7 +139,7 @@ class TestVisitor extends RecursiveAstVisitor { /// ``` /// /// Example output: -/// ```mdx +/// ```md /// | Component | Accessibility | Content | Dimensions | Styling | Interaction | Golden | Performance | Unorganised | Total Tests | /// | ----------- | ------------- | ------- | ---------- | ------- | ----------- | ------ | ----------- | ----------- | ----------- | /// | Banner | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | @@ -151,8 +151,8 @@ class TestVisitor extends RecursiveAstVisitor { /// of test names with their corresponding counts. /// /// Returns: -/// - A string in MDX format representing the test counts in a table with totals. -String generateMDX(Map> testCount) { +/// - A string in MD format representing the test counts in a table with totals. +String generateMD(Map> testCount) { final Map groupTotals = { 'Accessibility': 0, 'Content': 0, @@ -228,14 +228,17 @@ void main() async { final TestGroups testGroups = await parseTestFiles(testFiles); // write test groups to file - await writeJSONToFile('${outputDirectory.path}/test_groups.json', testGroups); + // await writeJSONToFile('${outputDirectory.path}/test_groups.json', testGroups); // count the number of tests in each group final TestCount testCount = countTests(testGroups); // write test counts to file - await writeJSONToFile('${outputDirectory.path}/test_counts.json', testCount); + // await writeJSONToFile('${outputDirectory.path}/test_counts.json', testCount); - // generate MDX table - await writeMDXToFile('${outputDirectory.path}/test_table.mdx', generateMDX(testCount)); + // generate MD table + await writeMDToFile('${outputDirectory.path}/test_table.md', generateMD(testCount)); + + // ignore: avoid_print + print('Test table generated successfully!'); } diff --git a/test/scripts/utils/utils.dart b/test/scripts/utils/utils.dart index bcfc30c3..d5796eb3 100644 --- a/test/scripts/utils/utils.dart +++ b/test/scripts/utils/utils.dart @@ -58,11 +58,7 @@ extension NodeExtension on MethodInvocation { /// Returns: /// A [String] containing the sanitized name of the group. String getGroupName() { - return argumentList.arguments.first - .toString() - .replaceAll("'", '') - .replaceAll(r'$componentName ', '') - .replaceAll(' Tests', ''); + return argumentList.arguments.first.toString().replaceAll("'", '').replaceAll(' Tests', ''); } /// Retrieves and sanitizes the name of the test. @@ -185,16 +181,16 @@ Future writeJSONToFile(String path, dynamic content) async { await outputFileGroups.writeAsString(jsonOutputGroups); } -/// Writes the given MDX data to a file at the specified path. +/// Writes the given MD data to a file at the specified path. /// -/// This function asynchronously writes the provided MDX data to a file +/// This function asynchronously writes the provided MD data to a file /// located at the given path. If the file does not exist, it will be created. /// -/// [path] The file path where the MDX data should be written. -/// [mdxData] The MDX data to write to the file. -Future writeMDXToFile(String path, String mdxData) async { - final mdxFile = File(path); - await mdxFile.writeAsString(mdxData); +/// [path] The file path where the MD data should be written. +/// [mdData] The MD data to write to the file. +Future writeMDToFile(String path, String mdData) async { + final mdFile = File(path); + await mdFile.writeAsString(mdData); } extension ListExtension on List { diff --git a/test/src/components/accordion/accordion_test.dart b/test/src/components/accordion/accordion_test.dart index 312bab3e..6ad08458 100644 --- a/test/src/components/accordion/accordion_test.dart +++ b/test/src/components/accordion/accordion_test.dart @@ -8,10 +8,8 @@ import '../../../test_utils/test_app.dart'; import '../../../test_utils/utils.dart'; void main() { - const String componentName = 'ZetaAccordion'; - - group('$componentName Accessibility Tests', () {}); - group('$componentName Content Tests', () { + group('Accessibility Tests', () {}); + group('Content Tests', () { final debugFillProperties = { 'title': '"Title"', 'rounded': 'null', @@ -50,8 +48,8 @@ void main() { expect(accordionContent, findsNothing); }); }); - group('$componentName Dimensions Tests', () {}); - group('$componentName Styling Tests', () { + group('Dimensions Tests', () {}); + group('Styling Tests', () { testWidgets('ZetaAccordion changes color on hover', (WidgetTester tester) async { await tester.pumpWidget( const TestApp( @@ -83,7 +81,7 @@ void main() { expect(textButton.style!.side?.resolve({WidgetState.focused})?.color, ZetaColorBase.blue.shade50); }); }); - group('$componentName Interaction Tests', () { + group('Interaction Tests', () { testWidgets('ZetaAccordion expands and collapses correctly', (WidgetTester tester) async { await tester.pumpWidget( const TestApp( @@ -158,6 +156,6 @@ void main() { expect(sizeTransition.sizeFactor.value, 0); }); }); - group('$componentName Golden Tests', () {}); - group('$componentName Performance Tests', () {}); + group('Golden Tests', () {}); + group('Performance Tests', () {}); } diff --git a/test/src/components/avatar/avatar_test.dart b/test/src/components/avatar/avatar_test.dart index edd607dc..7e02d661 100644 --- a/test/src/components/avatar/avatar_test.dart +++ b/test/src/components/avatar/avatar_test.dart @@ -9,7 +9,6 @@ import '../../../test_utils/tolerant_comparator.dart'; import '../../../test_utils/utils.dart'; void main() { - const String componentName = 'ZetaAvatar'; const String parentFolder = 'avatar'; const goldenFile = GoldenFiles(component: parentFolder); @@ -17,7 +16,7 @@ void main() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - group('$componentName Accessibility Tests', () { + group('Accessibility Tests', () { testWidgets('ZetaAvatar meets accessibility requirements', (WidgetTester tester) async { final SemanticsHandle handle = tester.ensureSemantics(); await tester.pumpWidget( @@ -45,7 +44,7 @@ void main() { }); }); - group('$componentName Content Tests', () { + group('Content Tests', () { final debugFillProperties = { 'size': 'ZetaAvatarSize.xl', 'name': 'null', @@ -115,7 +114,7 @@ void main() { } }); - group('$componentName Dimensions Tests', () { + group('Dimensions Tests', () { for (final size in ZetaAvatarSize.values) { testWidgets( 'ZetaAvatar size $size with upper badge', @@ -230,7 +229,7 @@ void main() { } }); - group('$componentName Styling Tests', () { + group('Styling Tests', () { for (final size in ZetaAvatarSize.values) { testWidgets('ZetaAvatar with initials $size text size is correct', (WidgetTester tester) async { await tester.pumpWidget( @@ -314,9 +313,9 @@ void main() { } }); - group('$componentName Interaction Tests', () {}); + group('Interaction Tests', () {}); - group('$componentName Golden Tests', () { + group('Golden Tests', () { for (final size in ZetaAvatarSize.values) { goldenTest( goldenFile, @@ -374,5 +373,5 @@ void main() { } }); - group('$componentName Performance Tests', () {}); + group('Performance Tests', () {}); } diff --git a/test/src/components/badge/indicator_test.dart b/test/src/components/badge/indicator_test.dart index 8869f23f..12f768e5 100644 --- a/test/src/components/badge/indicator_test.dart +++ b/test/src/components/badge/indicator_test.dart @@ -6,7 +6,6 @@ import '../../../test_utils/tolerant_comparator.dart'; import '../../../test_utils/utils.dart'; void main() { - const String componentName = 'ZetaIndicator'; const String parentFolder = 'badge'; const goldenFile = GoldenFiles(component: parentFolder); @@ -14,8 +13,8 @@ void main() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - group('$componentName Accessibility Tests', () {}); - group('$componentName Content Tests', () { + group('Accessibility Tests', () {}); + group('Content Tests', () { final debugFillProperties = { 'color': 'MaterialColor(primary value: Color(0xffff9800))', 'icon': 'IconData(U+F04B6)', @@ -154,10 +153,10 @@ void main() { expect(indicator.color, Colors.green); }); }); - group('$componentName Dimensions Tests', () {}); - group('$componentName Styling Tests', () {}); - group('$componentName Interaction Tests', () {}); - group('$componentName Golden Tests', () { + group('Dimensions Tests', () {}); + group('Styling Tests', () {}); + group('Interaction Tests', () {}); + group('Golden Tests', () { goldenTest(goldenFile, const ZetaIndicator(), ZetaIndicator, 'indicator_default'); goldenTest(goldenFile, const ZetaIndicator.icon(), ZetaIndicator, 'indicator_icon_default'); goldenTest( @@ -185,5 +184,5 @@ void main() { 'indicator_notification_values', ); }); - group('$componentName Performance Tests', () {}); + group('Performance Tests', () {}); } diff --git a/test/src/components/badge/label_test.dart b/test/src/components/badge/label_test.dart index ec6d7c23..ee6fa91e 100644 --- a/test/src/components/badge/label_test.dart +++ b/test/src/components/badge/label_test.dart @@ -7,7 +7,6 @@ import '../../../test_utils/tolerant_comparator.dart'; import '../../../test_utils/utils.dart'; void main() { - const String componentName = 'ZetaLabel'; const String parentFolder = 'badge'; const goldenFile = GoldenFiles(component: parentFolder); @@ -15,8 +14,8 @@ void main() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - group('$componentName Accessibility Tests', () {}); - group('$componentName Content Tests', () { + group('Accessibility Tests', () {}); + group('Content Tests', () { final debugFillProperties = { 'label': '"Test label"', 'status': 'positive', @@ -101,10 +100,10 @@ void main() { expect(label.rounded, false); }); }); - group('$componentName Dimensions Tests', () {}); - group('$componentName Styling Tests', () {}); - group('$componentName Interaction Tests', () {}); - group('$componentName Golden Tests', () { + group('Dimensions Tests', () {}); + group('Styling Tests', () {}); + group('Interaction Tests', () {}); + group('Golden Tests', () { goldenTest(goldenFile, const ZetaLabel(label: 'Test Label'), ZetaLabel, 'label_default'); goldenTest( goldenFile, @@ -133,5 +132,5 @@ void main() { goldenTest(goldenFile, const ZetaLabel(label: 'Test Label'), ZetaLabel, 'label_dark', themeMode: ThemeMode.dark); goldenTest(goldenFile, const ZetaLabel(label: 'Test Label', rounded: false), ZetaLabel, 'label_sharp'); }); - group('$componentName Performance Tests', () {}); + group('Performance Tests', () {}); } diff --git a/test/src/components/badge/priority_pill_test.dart b/test/src/components/badge/priority_pill_test.dart index 44302011..0c4b281f 100644 --- a/test/src/components/badge/priority_pill_test.dart +++ b/test/src/components/badge/priority_pill_test.dart @@ -7,7 +7,6 @@ import '../../../test_utils/tolerant_comparator.dart'; import '../../../test_utils/utils.dart'; void main() { - const String componentName = 'ZetaPriorityPill'; const String parentFolder = 'badge'; const goldenFile = GoldenFiles(component: parentFolder); @@ -15,8 +14,8 @@ void main() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - group('$componentName Accessibility Tests', () {}); - group('$componentName Content Tests', () { + group('Accessibility Tests', () {}); + group('Content Tests', () { final debugFillProperties = { 'label': '"Test label"', 'rounded': 'false', @@ -118,10 +117,10 @@ void main() { expect(zetaPriorityPill.size, ZetaPriorityPillSize.small); }); }); - group('$componentName Dimensions Tests', () {}); - group('$componentName Styling Tests', () {}); - group('$componentName Interaction Tests', () {}); - group('$componentName Golden Tests', () { + group('Dimensions Tests', () {}); + group('Styling Tests', () {}); + group('Interaction Tests', () {}); + group('Golden Tests', () { goldenTest(goldenFile, const ZetaPriorityPill(), ZetaPriorityPill, 'priority_pill_default'); goldenTest( goldenFile, @@ -155,5 +154,5 @@ void main() { 'priority_pill_low', ); }); - group('$componentName Performance Tests', () {}); + group('Performance Tests', () {}); } diff --git a/test/src/components/badge/status_label_test.dart b/test/src/components/badge/status_label_test.dart index 35604625..2198a529 100644 --- a/test/src/components/badge/status_label_test.dart +++ b/test/src/components/badge/status_label_test.dart @@ -7,7 +7,6 @@ import '../../../test_utils/tolerant_comparator.dart'; import '../../../test_utils/utils.dart'; void main() { - const String componentName = 'ZetaStatusLabel'; const String parentFolder = 'badge'; const goldenFile = GoldenFiles(component: parentFolder); @@ -15,8 +14,8 @@ void main() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - group('$componentName Accessibility Tests', () {}); - group('$componentName Content Tests', () { + group('Accessibility Tests', () {}); + group('Content Tests', () { final debugFillProperties = { 'label': '"Test label"', 'rounded': 'false', @@ -54,10 +53,10 @@ void main() { expect(find.byIcon(Icons.person), findsOneWidget); }); }); - group('$componentName Dimensions Tests', () {}); - group('$componentName Styling Tests', () {}); - group('$componentName Interaction Tests', () {}); - group('$componentName Golden Tests', () { + group('Dimensions Tests', () {}); + group('Styling Tests', () {}); + group('Interaction Tests', () {}); + group('Golden Tests', () { goldenTest(goldenFile, const ZetaStatusLabel(label: 'Test Label'), ZetaStatusLabel, 'status_label_default'); goldenTest( goldenFile, @@ -69,5 +68,5 @@ void main() { 'status_label_custom', ); }); - group('$componentName Performance Tests', () {}); + group('Performance Tests', () {}); } diff --git a/test/src/components/badge/tag_test.dart b/test/src/components/badge/tag_test.dart index d3b9f3ad..c7990a11 100644 --- a/test/src/components/badge/tag_test.dart +++ b/test/src/components/badge/tag_test.dart @@ -6,7 +6,6 @@ import '../../../test_utils/tolerant_comparator.dart'; import '../../../test_utils/utils.dart'; void main() { - const String componentName = 'ZetaTag'; const String parentFolder = 'badge'; const goldenFile = GoldenFiles(component: parentFolder); @@ -14,8 +13,8 @@ void main() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - group('$componentName Accessibility Tests', () {}); - group('$componentName Content Tests', () { + group('Accessibility Tests', () {}); + group('Content Tests', () { final debugFillProperties = { 'label': '"Test label"', 'rounded': 'false', @@ -47,12 +46,12 @@ void main() { expect(find.byType(ZetaTag), findsOneWidget); }); }); - group('$componentName Dimensions Tests', () {}); - group('$componentName Styling Tests', () {}); - group('$componentName Interaction Tests', () {}); - group('$componentName Golden Tests', () { + group('Dimensions Tests', () {}); + group('Styling Tests', () {}); + group('Interaction Tests', () {}); + group('Golden Tests', () { goldenTest(goldenFile, const ZetaTag.right(label: 'Tag', rounded: false), ZetaTag, 'tag_right'); goldenTest(goldenFile, const ZetaTag.left(label: 'Tag', rounded: true), ZetaTag, 'tag_left'); }); - group('$componentName Performance Tests', () {}); + group('Performance Tests', () {}); } diff --git a/test/src/components/banner/banner_test.dart b/test/src/components/banner/banner_test.dart index 7c827fa2..44d69c56 100644 --- a/test/src/components/banner/banner_test.dart +++ b/test/src/components/banner/banner_test.dart @@ -23,7 +23,6 @@ ZetaColorSwatch _backgroundColorFromType(BuildContext context, ZetaBannerStatus } void main() { - const String componentName = 'ZetaBanner'; const String parentFolder = 'banner'; const goldenFile = GoldenFiles(component: parentFolder); @@ -32,7 +31,7 @@ void main() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - group('$componentName Accessibility Tests', () { + group('Accessibility Tests', () { for (final type in ZetaBannerStatus.values) { testWidgets('meets contrast ratio guideline for $type', (WidgetTester tester) async { await tester.pumpWidget( @@ -121,7 +120,7 @@ void main() { }); }); - group('$componentName Content Tests', () { + group('Content Tests', () { testWidgets('ZetaBanner title is correct', (WidgetTester tester) async { await tester.pumpWidget( TestApp( @@ -195,7 +194,7 @@ void main() { }); }); - group('$componentName Dimension Tests', () { + group('Dimension Tests', () { testWidgets('icon is the correct size', (WidgetTester tester) async { await tester.pumpWidget( TestApp( @@ -259,7 +258,7 @@ void main() { }); }); - group('$componentName Styling Tests', () { + group('Styling Tests', () { for (final type in ZetaBannerStatus.values) { testWidgets('title styles are correct for $type', (WidgetTester tester) async { await tester.pumpWidget( @@ -331,9 +330,9 @@ void main() { } }); - group('$componentName Interaction Tests', () {}); + group('Interaction Tests', () {}); - group('$componentName Golden Tests', () { + group('Golden Tests', () { for (final type in ZetaBannerStatus.values) { goldenTest( goldenFile, @@ -354,5 +353,5 @@ void main() { } }); - group('$componentName Performace Tests', () {}); + group('Performace Tests', () {}); } diff --git a/test/src/components/button/button_test.dart b/test/src/components/button/button_test.dart index 4e4ddb9b..fb72ec0e 100644 --- a/test/src/components/button/button_test.dart +++ b/test/src/components/button/button_test.dart @@ -9,7 +9,6 @@ import '../../../test_utils/tolerant_comparator.dart'; import '../../../test_utils/utils.dart'; void main() { - const String componentName = 'ZetaButton'; const String parentFolder = 'button'; const goldenFile = GoldenFiles(component: parentFolder); @@ -17,9 +16,9 @@ void main() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - group('$componentName Accessibility Tests', () {}); + group('Accessibility Tests', () {}); - group('$componentName Content Tests', () { + group('Content Tests', () { final debugFillProperties = { 'label': '"Test label"', 'onPressed': 'null', @@ -182,9 +181,9 @@ void main() { }); }); - group('$componentName Dimensions Tests', () {}); + group('Dimensions Tests', () {}); - group('$componentName Styling Tests', () { + group('Styling Tests', () { testWidgets('Hover states are correct', (WidgetTester tester) async { await tester.pumpWidget( TestApp( @@ -245,7 +244,7 @@ void main() { }); }); - group('$componentName Interaction Tests', () { + group('Interaction Tests', () { testWidgets('Triggers callback on tap', (WidgetTester tester) async { bool callbackTriggered = false; await tester.pumpWidget( @@ -258,7 +257,7 @@ void main() { }); }); - group('$componentName Golden Tests', () { + group('Golden Tests', () { goldenTest(goldenFile, ZetaButton.primary(onPressed: () {}, label: 'Test Button'), ZetaButton, 'button_primary'); goldenTest( goldenFile, @@ -304,5 +303,5 @@ void main() { ); }); - group('$componentName Performance Tests', () {}); + group('Performance Tests', () {}); } diff --git a/test/src/components/chat_item/chat_item_test.dart b/test/src/components/chat_item/chat_item_test.dart index 43ee381c..e72a00bf 100644 --- a/test/src/components/chat_item/chat_item_test.dart +++ b/test/src/components/chat_item/chat_item_test.dart @@ -8,7 +8,6 @@ import '../../../test_utils/tolerant_comparator.dart'; import '../../../test_utils/utils.dart'; void main() { - const String componentName = 'ZetaChatItem'; const String parentFolder = 'chat_item'; const goldenFile = GoldenFiles(component: parentFolder); @@ -16,8 +15,8 @@ void main() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - group('$componentName Accessibility Tests', () {}); - group('$componentName Content Tests', () { + group('Accessibility Tests', () {}); + group('Content Tests', () { final time = DateTime.now(); final debugFillPropertiesChatItem = { 'rounded': 'null', @@ -511,10 +510,10 @@ void main() { expect(tester.takeException(), isNull); }); }); - group('$componentName Dimensions Tests', () {}); - group('$componentName Styling Tests', () {}); - group('$componentName Interaction Tests', () {}); - group('$componentName Golden Tests', () { + group('Dimensions Tests', () {}); + group('Styling Tests', () {}); + group('Interaction Tests', () {}); + group('Golden Tests', () { const title = Text('John Doe'); const subtitle = Text('Hello, how are you?'); final time = DateTime.now(); @@ -802,5 +801,5 @@ void main() { }, ); }); - group('$componentName Performance Tests', () {}); + group('Performance Tests', () {}); } diff --git a/test/src/components/checkbox/checkbox_test.dart b/test/src/components/checkbox/checkbox_test.dart index 54e28a1d..b718cef9 100644 --- a/test/src/components/checkbox/checkbox_test.dart +++ b/test/src/components/checkbox/checkbox_test.dart @@ -10,7 +10,6 @@ import '../../../test_utils/tolerant_comparator.dart'; import '../../../test_utils/utils.dart'; void main() { - const String componentName = 'ZetaCheckbox'; const String parentFolder = 'checkbox'; const goldenFile = GoldenFiles(component: parentFolder); @@ -18,8 +17,8 @@ void main() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - group('$componentName Accessibility Tests', () {}); - group('$componentName Content Tests', () { + group('Accessibility Tests', () {}); + group('Content Tests', () { final debugFillPropertiesCheckbox = { 'value': 'false', 'label': 'null', @@ -65,9 +64,9 @@ void main() { expect(checkbox.label, 'Test Checkbox'); }); }); - group('$componentName Dimensions Tests', () {}); - group('$componentName Styling Tests', () {}); - group('$componentName Interaction Tests', () { + group('Dimensions Tests', () {}); + group('Styling Tests', () {}); + group('Interaction Tests', () { testWidgets('ZetaCheckbox changes state on tap', (WidgetTester tester) async { bool? checkboxValue = true; @@ -139,7 +138,7 @@ void main() { await tester.pump(); }); }); - group('$componentName Golden Tests', () { + group('Golden Tests', () { goldenTestWithCallbacks( goldenFile, ZetaCheckbox( @@ -179,5 +178,5 @@ void main() { 'checkbox_disabled', ); }); - group('$componentName Performance Tests', () {}); + group('Performance Tests', () {}); } diff --git a/test/src/components/chips/chip_test.dart b/test/src/components/chips/chip_test.dart index eed6dd86..9a9781e2 100644 --- a/test/src/components/chips/chip_test.dart +++ b/test/src/components/chips/chip_test.dart @@ -7,7 +7,6 @@ import '../../../test_utils/tolerant_comparator.dart'; import '../../../test_utils/utils.dart'; void main() { - const String componentName = 'ZetaChip'; const String parentFolder = 'chips'; const goldenFile = GoldenFiles(component: parentFolder); @@ -15,8 +14,8 @@ void main() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - group('$componentName Accessibility Tests', () {}); - group('$componentName Content Tests', () { + group('Accessibility Tests', () {}); + group('Content Tests', () { // final debugFillProperties = { // '': '', // }; @@ -33,9 +32,9 @@ void main() { expect(find.text('Test Chip'), findsOneWidget); }); }); - group('$componentName Dimensions Tests', () {}); - group('$componentName Styling Tests', () {}); - group('$componentName Interaction Tests', () { + group('Dimensions Tests', () {}); + group('Styling Tests', () {}); + group('Interaction Tests', () { testWidgets('triggers onTap callback when tapped', (WidgetTester tester) async { bool tapped = false; @@ -119,8 +118,8 @@ void main() { expect(iconFinder, findsOne); }); }); - group('$componentName Golden Tests', () { + group('Golden Tests', () { // goldenTest(goldenFile, widget, widgetType, 'PNG_FILE_NAME'); }); - group('$componentName Performance Tests', () {}); + group('Performance Tests', () {}); } diff --git a/test/src/components/comms_button/comms_button_test.dart b/test/src/components/comms_button/comms_button_test.dart index d3ae6d1d..2ff9c648 100644 --- a/test/src/components/comms_button/comms_button_test.dart +++ b/test/src/components/comms_button/comms_button_test.dart @@ -7,7 +7,6 @@ import '../../../test_utils/tolerant_comparator.dart'; import '../../../test_utils/utils.dart'; void main() { - const String componentName = 'ZetaCommsButton'; const String parentFolder = 'comms_button'; const goldenFile = GoldenFiles(component: parentFolder); @@ -15,7 +14,7 @@ void main() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - group('$componentName Accessibility Tests', () { + group('Accessibility Tests', () { testWidgets('Button meets accessibility requirements', (WidgetTester tester) async { final SemanticsHandle handle = tester.ensureSemantics(); await tester.pumpWidget( @@ -68,7 +67,7 @@ void main() { handle.dispose(); }); }); - group('$componentName Content Tests', () { + group('Content Tests', () { final debugFillProperties = { 'label': '"Label"', 'onPressed': 'null', @@ -206,10 +205,10 @@ void main() { expect(pressed, isTrue); }); }); - group('$componentName Dimensions Tests', () {}); - group('$componentName Styling Tests', () {}); - group('$componentName Interaction Tests', () {}); - group('$componentName Golden Tests', () { + group('Dimensions Tests', () {}); + group('Styling Tests', () {}); + group('Interaction Tests', () {}); + group('Golden Tests', () { for (final type in ZetaCommsButtonType.values) { goldenTest( goldenFile, @@ -223,5 +222,5 @@ void main() { ); } }); - group('$componentName Performance Tests', () {}); + group('Performance Tests', () {}); } diff --git a/test/src/components/dialpad/dialpad_test.dart b/test/src/components/dialpad/dialpad_test.dart index 2b9aa942..b4f5cc7e 100644 --- a/test/src/components/dialpad/dialpad_test.dart +++ b/test/src/components/dialpad/dialpad_test.dart @@ -9,7 +9,6 @@ import '../../../test_utils/tolerant_comparator.dart'; import '../../../test_utils/utils.dart'; void main() { - const String componentName = 'ZetaDialPad'; const String parentFolder = 'dialpad'; const goldenFile = GoldenFiles(component: parentFolder); @@ -17,9 +16,9 @@ void main() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - group('$componentName Accessibility Tests', () {}); + group('Accessibility Tests', () {}); - group('$componentName Content Tests', () { + group('Content Tests', () { final debugFillProperties = { 'onNumber': 'null', 'onText': 'null', @@ -43,9 +42,9 @@ void main() { ); }); - group('$componentName Dimensions Tests', () {}); + group('Dimensions Tests', () {}); - group('$componentName Styling Tests', () { + group('Styling Tests', () { testWidgets('Hover styles for button are correct', (WidgetTester tester) async { await tester.pumpWidget( const TestApp( @@ -67,7 +66,7 @@ void main() { }); }); - group('$componentName Interaction Tests', () { + group('Interaction Tests', () { testWidgets('Initializes with correct parameters and is enabled', (WidgetTester tester) async { String number = ''; String text = ''; @@ -281,7 +280,7 @@ void main() { }); }); - group('$componentName Golden Tests', () { + group('Golden Tests', () { goldenTest( goldenFile, const ZetaDialPad( @@ -308,5 +307,5 @@ void main() { ); }); - group('$componentName Performance Tests', () {}); + group('Performance Tests', () {}); } diff --git a/test/src/components/fab/fab_test.dart b/test/src/components/fab/fab_test.dart index 31f4adc7..2820f8ef 100644 --- a/test/src/components/fab/fab_test.dart +++ b/test/src/components/fab/fab_test.dart @@ -9,7 +9,6 @@ import '../../../test_utils/tolerant_comparator.dart'; import '../../../test_utils/utils.dart'; void main() { - const String componentName = 'ZetaFAB'; const String parentFolder = 'fab'; const goldenFile = GoldenFiles(component: parentFolder); @@ -17,9 +16,9 @@ void main() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - group('$componentName Accessibility Tests', () {}); + group('Accessibility Tests', () {}); - group('$componentName Content Tests', () { + group('Content Tests', () { final debugFillProperties = { 'label': 'null', 'onPressed': 'null', @@ -137,9 +136,9 @@ void main() { }); }); - group('$componentName Dimensions Tests', () {}); + group('Dimensions Tests', () {}); - group('$componentName Styling Tests', () { + group('Styling Tests', () { testWidgets('hover colours are correct', (WidgetTester tester) async { final FocusNode node = FocusNode(); @@ -185,7 +184,7 @@ void main() { }); }); - group('$componentName Interaction Tests', () { + group('Interaction Tests', () { testWidgets('OnPressed callback', (WidgetTester tester) async { bool isPressed = false; final scrollController = ScrollController(); @@ -204,7 +203,7 @@ void main() { }); }); - group('$componentName Golden Tests', () { + group('Golden Tests', () { goldenTest( goldenFile, ZetaFAB( @@ -267,5 +266,5 @@ void main() { ); }); - group('$componentName Performance Tests', () {}); + group('Performance Tests', () {}); } diff --git a/test/src/components/icon/icon_test.dart b/test/src/components/icon/icon_test.dart index d7f1dc9b..3afa42bd 100644 --- a/test/src/components/icon/icon_test.dart +++ b/test/src/components/icon/icon_test.dart @@ -7,7 +7,6 @@ import '../../../test_utils/tolerant_comparator.dart'; import '../../../test_utils/utils.dart'; void main() { - const String componentName = 'ZetaIcon'; const String parentFolder = 'icon'; const goldenFile = GoldenFiles(component: parentFolder); @@ -15,7 +14,7 @@ void main() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - group('$componentName Accessibility Tests', () { + group('Accessibility Tests', () { testWidgets('applies correct semantic label to icon', (WidgetTester tester) async { const String semanticLabel = 'Add Icon'; await tester.pumpWidget(const TestApp(home: ZetaIcon(ZetaIcons.add_round, semanticLabel: semanticLabel))); @@ -24,7 +23,7 @@ void main() { expect(iconWidget.semanticLabel, equals(semanticLabel)); }); }); - group('$componentName Content Tests', () { + group('Content Tests', () { final debugFillProperties = { 'icon': 'IconData(U+0E045)', 'rounded': 'false', @@ -84,7 +83,7 @@ void main() { expect(iconFinderSharp, findsExactly(1)); }); }); - group('$componentName Dimensions Tests', () { + group('Dimensions Tests', () { testWidgets('applies correct size to icon', (WidgetTester tester) async { const double iconSize = 24; await tester.pumpWidget(const TestApp(home: ZetaIcon(ZetaIcons.add_round, size: iconSize))); @@ -94,7 +93,7 @@ void main() { expect(sizeOfIcon.height, equals(iconSize)); }); }); - group('$componentName Styling Tests', () { + group('Styling Tests', () { testWidgets('applies correct font family to icon', (WidgetTester tester) async { await tester.pumpWidget(const TestApp(home: ZetaIcon(ZetaIcons.add_round))); final iconFinder = find.byIcon(ZetaIcons.add_round); @@ -182,9 +181,9 @@ void main() { expect(iconWidget.icon?.fontFamily, equals('MaterialIcons')); }); }); - group('$componentName Interaction Tests', () {}); - group('$componentName Golden Tests', () { + group('Interaction Tests', () {}); + group('Golden Tests', () { // goldenTest(goldenFile, widget, widgetType, 'PNG_FILE_NAME'); }); - group('$componentName Performance Tests', () {}); + group('Performance Tests', () {}); } diff --git a/test/src/components/in_page_banner/in_page_banner_test.dart b/test/src/components/in_page_banner/in_page_banner_test.dart index 930c4617..f29bffed 100644 --- a/test/src/components/in_page_banner/in_page_banner_test.dart +++ b/test/src/components/in_page_banner/in_page_banner_test.dart @@ -7,7 +7,6 @@ import '../../../test_utils/tolerant_comparator.dart'; import '../../../test_utils/utils.dart'; void main() { - const String componentName = 'ZetaInPageBanner'; const String parentFolder = 'in_page_banner'; const goldenFile = GoldenFiles(component: parentFolder); @@ -15,8 +14,8 @@ void main() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - group('$componentName Accessibility Tests', () {}); - group('$componentName Content Tests', () { + group('Accessibility Tests', () {}); + group('Content Tests', () { final debugFillProperties = { 'onClose': 'null', 'status': 'info', @@ -53,8 +52,8 @@ void main() { expect(find.byIcon(ZetaIcons.close_round), findsNothing); }); }); - group('$componentName Dimensions Tests', () {}); - group('$componentName Styling Tests', () { + group('Dimensions Tests', () {}); + group('Styling Tests', () { testWidgets('default background colour is correct', (WidgetTester tester) async { await tester.pumpWidget( const TestApp( @@ -105,7 +104,7 @@ void main() { expect(decoration.color, ZetaColorBase.cool.shade10); }); }); - group('$componentName Interaction Tests', () { + group('Interaction Tests', () { testWidgets('button callback works', (WidgetTester tester) async { bool onPressed = false; final key = GlobalKey(); @@ -142,7 +141,7 @@ void main() { }); }); - group('$componentName Golden Tests', () { + group('Golden Tests', () { goldenTest( goldenFile, const ZetaInPageBanner(content: Text('Test'), title: 'Title'), @@ -177,5 +176,5 @@ void main() { 'in_page_banner_buttons', ); }); - group('$componentName Performance Tests', () {}); + group('Performance Tests', () {}); } diff --git a/test/src/components/password/password_input_test.dart b/test/src/components/password/password_input_test.dart index 3fe66c3c..c67a7ad6 100644 --- a/test/src/components/password/password_input_test.dart +++ b/test/src/components/password/password_input_test.dart @@ -7,7 +7,6 @@ import '../../../test_utils/tolerant_comparator.dart'; import '../../../test_utils/utils.dart'; void main() { - const String componentName = 'ZetaPasswordInput'; const String parentFolder = 'password'; const goldenFile = GoldenFiles(component: parentFolder); @@ -15,8 +14,8 @@ void main() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - group('$componentName Accessibility Tests', () {}); - group('$componentName Content Tests', () { + group('Accessibility Tests', () {}); + group('Content Tests', () { final debugFillProperties = { 'size': 'medium', 'placeholder': 'null', @@ -87,10 +86,10 @@ void main() { expect(obscureIconOn, findsOneWidget); }); }); - group('$componentName Dimensions Tests', () {}); - group('$componentName Styling Tests', () {}); - group('$componentName Interaction Tests', () {}); - group('$componentName Golden Tests', () { + group('Dimensions Tests', () {}); + group('Styling Tests', () {}); + group('Interaction Tests', () {}); + group('Golden Tests', () { goldenTest(goldenFile, ZetaPasswordInput(), ZetaPasswordInput, 'password_default'); final formKey = GlobalKey(); goldenTestWithCallbacks( @@ -115,5 +114,5 @@ void main() { }, ); }); - group('$componentName Performance Tests', () {}); + group('Performance Tests', () {}); } diff --git a/test/src/components/search_bar/search_bar_test.dart b/test/src/components/search_bar/search_bar_test.dart index 720598a6..af4b1561 100644 --- a/test/src/components/search_bar/search_bar_test.dart +++ b/test/src/components/search_bar/search_bar_test.dart @@ -26,7 +26,6 @@ abstract class ISearchBarEvents { ]) void main() { late MockISearchBarEvents callbacks; - const String componentName = 'ZetaSearchBar'; const String parentFolder = 'search_bar'; const goldenFile = GoldenFiles(component: parentFolder); @@ -38,8 +37,8 @@ void main() { callbacks = MockISearchBarEvents(); }); - group('$componentName Accessibility Tests', () {}); - group('$componentName Content Tests', () { + group('Accessibility Tests', () {}); + group('Content Tests', () { final debugFillProperties = { 'size': 'medium', 'shape': 'rounded', @@ -127,9 +126,9 @@ void main() { expect(find.byIcon(ZetaIcons.microphone), findsNothing); }); }); - group('$componentName Dimensions Tests', () {}); - group('$componentName Styling Tests', () {}); - group('$componentName Interaction Tests', () { + group('Dimensions Tests', () {}); + group('Styling Tests', () {}); + group('Interaction Tests', () { testWidgets('triggers onChanged callback when text is entered', (WidgetTester tester) async { await tester.pumpWidget( TestApp( @@ -220,7 +219,7 @@ void main() { verify(callbacks.onChange.call('')).called(1); }); }); - group('$componentName Golden Tests', () { + group('Golden Tests', () { goldenTest(goldenFile, ZetaSearchBar(), ZetaSearchBar, 'search_bar_default'); goldenTest(goldenFile, ZetaSearchBar(), ZetaSearchBar, 'search_bar_medium'); goldenTest( @@ -248,5 +247,5 @@ void main() { 'search_bar_sharp', ); }); - group('$componentName Performance Tests', () {}); + group('Performance Tests', () {}); } diff --git a/test/src/components/slider/slider_test.dart b/test/src/components/slider/slider_test.dart index f6f5adca..5c11e203 100644 --- a/test/src/components/slider/slider_test.dart +++ b/test/src/components/slider/slider_test.dart @@ -7,7 +7,6 @@ import '../../../test_utils/tolerant_comparator.dart'; import '../../../test_utils/utils.dart'; void main() { - const String componentName = 'ZetaSlider'; const String parentFolder = 'slider'; const goldenFile = GoldenFiles(component: parentFolder); @@ -15,9 +14,9 @@ void main() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - group('$componentName Accessibility Tests', () {}); + group('Accessibility Tests', () {}); - group('$componentName Content Tests', () { + group('Content Tests', () { // final debugFillProperties = { // '': '', // }; @@ -27,11 +26,11 @@ void main() { // ); }); - group('$componentName Dimensions Tests', () {}); + group('Dimensions Tests', () {}); - group('$componentName Styling Tests', () {}); + group('Styling Tests', () {}); - group('$componentName Interaction Tests', () { + group('Interaction Tests', () { testWidgets('ZetaSlider min/max values', (WidgetTester tester) async { const double sliderValue = 0.5; double? changedValue; @@ -61,9 +60,9 @@ void main() { }); }); - group('$componentName Golden Tests', () { + group('Golden Tests', () { // goldenTest(goldenFile, widget, widgetType, 'PNG_FILE_NAME'); }); - group('$componentName Performance Tests', () {}); + group('Performance Tests', () {}); } diff --git a/test/src/components/stepper_input/stepper_input_test.dart b/test/src/components/stepper_input/stepper_input_test.dart index 3058e0e6..95b97b06 100644 --- a/test/src/components/stepper_input/stepper_input_test.dart +++ b/test/src/components/stepper_input/stepper_input_test.dart @@ -8,7 +8,6 @@ import '../../../test_utils/tolerant_comparator.dart'; import '../../../test_utils/utils.dart'; void main() { - const String componentName = 'ZetaStepperInput'; const String parentFolder = 'stepper_input'; const goldenFile = GoldenFiles(component: parentFolder); @@ -16,8 +15,8 @@ void main() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - group('$componentName Accessibility Tests', () {}); - group('$componentName Content Tests', () { + group('Accessibility Tests', () {}); + group('Content Tests', () { // final debugFillProperties = { // '': '', // }; @@ -60,11 +59,11 @@ void main() { }); }); - group('$componentName Dimensions Tests', () {}); + group('Dimensions Tests', () {}); - group('$componentName Styling Tests', () {}); + group('Styling Tests', () {}); - group('$componentName Interaction Tests', () { + group('Interaction Tests', () { testWidgets('ZetaStepperInput increases value when increment button is pressed', (WidgetTester tester) async { int value = 0; await tester.pumpWidget( @@ -87,9 +86,9 @@ void main() { }); }); - group('$componentName Golden Tests', () { + group('Golden Tests', () { // goldenTest(goldenFile, widget, widgetType, 'PNG_FILE_NAME'); }); - group('$componentName Performance Tests', () {}); + group('Performance Tests', () {}); } diff --git a/test/src/components/tooltip/tooltip_test.dart b/test/src/components/tooltip/tooltip_test.dart index 17790a42..ef2e6efc 100644 --- a/test/src/components/tooltip/tooltip_test.dart +++ b/test/src/components/tooltip/tooltip_test.dart @@ -15,7 +15,6 @@ import 'tooltip_test.mocks.dart'; MockSpec(), ]) void main() { - const String componentName = 'ZetaTooltip'; const String parentFolder = 'tooltip'; final mockZeta = MockZeta(); @@ -26,8 +25,8 @@ void main() { goldenFileComparator = TolerantComparator(goldenFile.uri); }); - group('$componentName Accessibility Tests', () {}); - group('$componentName Content Tests', () { + group('Accessibility Tests', () {}); + group('Content Tests', () { final debugFillProperties = { 'rounded': 'null', 'padding': 'EdgeInsets.all(8.0)', @@ -80,7 +79,7 @@ void main() { expect(find.byType(ZetaTooltip), findsOneWidget); }); }); - group('$componentName Dimensions Tests', () { + group('Dimensions Tests', () { testWidgets('renders with custom padding', (WidgetTester tester) async { await tester.pumpWidget( const TestApp( @@ -103,7 +102,7 @@ void main() { expect(padding.padding, const EdgeInsets.all(20)); }); }); - group('$componentName Styling Tests', () { + group('Styling Tests', () { testWidgets('renders with custom color', (WidgetTester tester) async { await tester.pumpWidget( const TestApp( @@ -195,8 +194,8 @@ void main() { expect((sharpTooltipBox.decoration as BoxDecoration).borderRadius, null); }); }); - group('$componentName Interaction Tests', () {}); - group('$componentName Golden Tests', () { + group('Interaction Tests', () {}); + group('Golden Tests', () { goldenTest( goldenFile, const Scaffold( @@ -241,5 +240,5 @@ void main() { 'arrow_right', ); }); - group('$componentName Performance Tests', () {}); + group('Performance Tests', () {}); } From 2b1c2b83eeaad54c105a2461340974419bc486de Mon Sep 17 00:00:00 2001 From: Daniel Eshkeri Date: Tue, 15 Oct 2024 15:08:56 +0100 Subject: [PATCH 16/16] fix: removed analyzer from dependencies --- pubspec.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 2fb925de..946dd016 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -21,7 +21,6 @@ environment: flutter: ">=3.16.0" dependencies: - analyzer: ^6.7.0 collection: ^1.18.0 equatable: ^2.0.5 flutter: