From 4bb159b9fc7ebe0ecc7618cf01750ddb2a0191f2 Mon Sep 17 00:00:00 2001 From: Stephanie Hong <41085564+JelloBagel@users.noreply.github.com> Date: Tue, 3 Dec 2024 13:58:29 -0800 Subject: [PATCH] chore(BaseStyles): Add vrt tests (#5346) * Add tests for basestyles * Add changeset * test(vrt): update snapshots * Add snapshot * Remove changeset --------- Co-authored-by: JelloBagel --- ...yles-Dev-Default-dark-colorblind-linux.png | Bin 0 -> 4722 bytes ...seStyles-Dev-Default-dark-dimmed-linux.png | Bin 0 -> 4722 bytes ...s-Dev-Default-dark-high-contrast-linux.png | Bin 0 -> 4735 bytes .../BaseStyles-Dev-Default-dark-linux.png | Bin 0 -> 4722 bytes ...yles-Dev-Default-dark-tritanopia-linux.png | Bin 0 -> 4722 bytes ...les-Dev-Default-light-colorblind-linux.png | Bin 0 -> 4738 bytes ...-Dev-Default-light-high-contrast-linux.png | Bin 0 -> 4735 bytes .../BaseStyles-Dev-Default-light-linux.png | Bin 0 -> 4738 bytes ...les-Dev-Default-light-tritanopia-linux.png | Bin 0 -> 4738 bytes e2e/components/BaseStyles.test.ts | 44 ++++++++++++++++++ packages/react/src/BaseStyles.dev.stories.tsx | 11 +++++ .../react/src/__tests__/BaseStyles.test.tsx | 33 +++++++++++++ .../__snapshots__/BaseStyles.test.tsx.snap | 19 ++++++++ 13 files changed, 107 insertions(+) create mode 100644 .playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-dark-colorblind-linux.png create mode 100644 .playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-dark-dimmed-linux.png create mode 100644 .playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-dark-high-contrast-linux.png create mode 100644 .playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-dark-linux.png create mode 100644 .playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-dark-tritanopia-linux.png create mode 100644 .playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-light-colorblind-linux.png create mode 100644 .playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-light-high-contrast-linux.png create mode 100644 .playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-light-linux.png create mode 100644 .playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-light-tritanopia-linux.png create mode 100644 e2e/components/BaseStyles.test.ts create mode 100644 packages/react/src/BaseStyles.dev.stories.tsx create mode 100644 packages/react/src/__tests__/BaseStyles.test.tsx create mode 100644 packages/react/src/__tests__/__snapshots__/BaseStyles.test.tsx.snap diff --git a/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-dark-colorblind-linux.png b/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-dark-colorblind-linux.png new file mode 100644 index 0000000000000000000000000000000000000000..37c22f9b6eb1bb1f2c969686f7145fcbccff1f88 GIT binary patch literal 4722 zcmeAS@N?(olHy`uVBq!ia0y~yVEzKc3>-{A5muMoRzQleILO_JVcj{ImkbO-I-V|$ zAr*7p-u3O7n=0AxFnEJ-;xb;}Bg;g4=9XME;@PUEx@mH0^N}Mfg_3pi8vD3=)?A%? zP~gH;Ud|=g{;kOE`N*CWac$Fzw>~0Arkzn(yOu@#EzfGcQbW(+D=(8CW$dVqwd{Vs z=l<`#mD9@oiq1uDO}qPxk%8gE!}8PrtAVb0u;2L(GlN6R4t9nHjzWG02Ej*i3=B#~ zY#A6_I)Dl~1imvc2q?Z|WKeJ-SK;Z--?iuM|IeNt_iOr5+3)xNUoU=c_xk{|d0pB0 zdG6`=s?eV*J7d}4b z+}^LFqx0sL>BpzByWd5WA8&MKZ*OaxW|dn~^5ww6X7PVz4b-eO-RtKk3Pn!`H<~@~~CQ*T1=P<%_tw+Pvy-H=p*hGccGhOg;AZ z%$YOh^J_l+nz}Z6Tix&7_apb*+xORa`Tv5fjc?eS5B~i8JUu=Ay`*%s*1O~HrRUF@ z6{qtXXr2B4dp9?yA3t_%nz=Ls!<{+PB)@|gtORYWn?V8E^(X4w%3yW#+N_eYv}bQ-8h5W>{eFM_$48Sk z+Lcyi-QM;)Y<=9`A7yWEZJlkNZ&&;4i`N-oWQJ-Beg7SQr~dbc58vlkKAX33qwj39 zw{z$GxvRZC=l;Ihm4Eg3eK_Qvzx!>qzrC%M)vnan)1KFTIK1=p^nMx3O;Ed!{Js7B z-oHynj?9(c{rSbleFx8TU-C0>Mr;5$=&k*-=0qIm-~Hm zRp@FpHMM^q-|f~m1O`*c+NjNWC*SV`W<+@85j=ypFzu1PyKu}Y9e*YqtS32 z4M*~8v(eNuntDc44~?3NqnT?obB$)M(ac4~-sfnMGFqezha%;N`uvioM?!bM_yHUv OVeoYIb6Mw<&;$VU3wf6S literal 0 HcmV?d00001 diff --git a/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-dark-dimmed-linux.png b/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-dark-dimmed-linux.png new file mode 100644 index 0000000000000000000000000000000000000000..00f46281bf45ef81a68bc96e95219602f70fd99b GIT binary patch literal 4722 zcmeAS@N?(olHy`uVBq!ia0y~yVEzKc3>-{A5muMoRzQleILO_JVcj{ImkbO-I-V|$ zAr*7p-Z|SJS}uFwVYJK}gB5{^mk%}=GxMtG?Ap3}*TxNbyNe1!&9ADxYMNxAtIt`g z%&fBZR%`F$(~FjFv_5_8*gw`R4^N4LK<61jMhU`cX$KATE_CT%KDs3Nar^U=v2*^M zdq3}YY~8z)JHIz>yxY&iz|io&UfS+0Baq?Wwu7CafuoS0fkE(*90P;W5nBcZmyT)% zh7N)63=9H_?-&^robE6)IJA(f@S4!~_IcJOwMD<~i+z7{^YgR(dv|u1zdyde{Qtkd z`EzO?zx#OR%$Z<+o1JYS7yW;74(a62+2Pgzn&ag8{K>`;n$ay;dQ@G zE$**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M^q-|f~m1O`*c+NjNWC*SV`W<+@85j=ypFzu1PyKu}Y9e*YqtS32 z4M*~8v(eNuntDc44~?3NqnT?obB$)M(ac4~-sfnMGFqezha%;N`uvioM?!bM_yHUv OVeoYIb6Mw<&;$VU3wf6S literal 0 HcmV?d00001 diff --git a/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-dark-tritanopia-linux.png b/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-dark-tritanopia-linux.png new file mode 100644 index 0000000000000000000000000000000000000000..37c22f9b6eb1bb1f2c969686f7145fcbccff1f88 GIT binary patch literal 4722 zcmeAS@N?(olHy`uVBq!ia0y~yVEzKc3>-{A5muMoRzQleILO_JVcj{ImkbO-I-V|$ zAr*7p-u3O7n=0AxFnEJ-;xb;}Bg;g4=9XME;@PUEx@mH0^N}Mfg_3pi8vD3=)?A%? zP~gH;Ud|=g{;kOE`N*CWac$Fzw>~0Arkzn(yOu@#EzfGcQbW(+D=(8CW$dVqwd{Vs z=l<`#mD9@oiq1uDO}qPxk%8gE!}8PrtAVb0u;2L(GlN6R4t9nHjzWG02Ej*i3=B#~ zY#A6_I)Dl~1imvc2q?Z|WKeJ-SK;Z--?iuM|IeNt_iOr5+3)xNUoU=c_xk{|d0pB0 zdG6`=s?eV*J7d}4b z+}^LFqx0sL>BpzByWd5WA8&MKZ*OaxW|dn~^5ww6X7PVz4b-eO-RtKk3Pn!`H<~@~~CQ*T1=P<%_tw+Pvy-H=p*hGccGhOg;AZ z%$YOh^J_l+nz}Z6Tix&7_apb*+xORa`Tv5fjc?eS5B~i8JUu=Ay`*%s*1O~HrRUF@ z6{qtXXr2B4dp9?yA3t_%nz=Ls!<{+PB)@|gtORYWn?V8E^(X4w%3yW#+N_eYv}bQ-8h5W>{eFM_$48Sk z+Lcyi-QM;)Y<=9`A7yWEZJlkNZ&&;4i`N-oWQJ-Beg7SQr~dbc58vlkKAX33qwj39 zw{z$GxvRZC=l;Ihm4Eg3eK_Qvzx!>qzrC%M)vnan)1KFTIK1=p^nMx3O;Ed!{Js7B z-oHynj?9(c{rSbleFx8TU-C0>Mr;5$=&k*-=0qIm-~Hm zRp@FpHMM^q-|f~m1O`*c+NjNWC*SV`W<+@85j=ypFzu1PyKu}Y9e*YqtS32 z4M*~8v(eNuntDc44~?3NqnT?obB$)M(ac4~-sfnMGFqezha%;N`uvioM?!bM_yHUv OVeoYIb6Mw<&;$VU3wf6S literal 0 HcmV?d00001 diff --git a/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-light-colorblind-linux.png b/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-light-colorblind-linux.png new file mode 100644 index 0000000000000000000000000000000000000000..c72be79709825e54427f3470ce174c129cadb862 GIT binary patch literal 4738 zcmeAS@N?(olHy`uVBq!ia0y~yVEzKc3>-{A5muMoRzQleILO_JVcj{ImkbO-Hl8ky zAr*7p-i=>zuT=KH$Mo5|Z*G2j=+?Ar=dwBzi>e#A z_iEY0;`gTgs``7(_q+Xv2Rdv(H~pI&4|l|on4^C$E>7N^_xsGR-r3iB;=b=ZU;nYy zet*Tszy3Bqe@Ab7S95;W*XwKUZpeMUww+IY=Hi143=6WR75=}K{okr~VP~iD^LP6y zUR}91ce`GM!T*KK)%@@7|Nb5xck|=R+y5;sEiY%DpKGx*`TE=Z=#7syy35slNoQ|A z{P0`s_PJJHr{6pabkg)?r_;XQ_?SLFcKbtS&f!4-M{#VmMS^j+Gt-sgia^~a5k55nA`?cwF`{B;cPN?T1kNrKW8@uPnuioo-%imu= z7awCIb8buh$w{g}<~*L%JS#-ITtUMs{8%Ryn5o)>U(>uei_&Q z`}6el^s`&)@7~JhmzSJ9r>6AR>z9|8|Nn8P^WxU*=SgM^3@c_$-f@3p?dzGw!sT~s z&)>Lw+;5Ie<$q@Wx-ZG*cBL;q`1~$^d!y{zo144e|2$O;H2>ku$ML^D#deGHZ_lax z>s`Re(9k_&@{aoBx7XLaIIwT}|6kj6=ijQk{LKH~qv`v9UF5Id@UZrE`mOz0S5Gw7 z+SmR2DW3P^$JzNiQg2_ma^(B4L2}&OKfFiSPnHd;9u+3O)eg&9A|0h$F z$f=)gMopwn@iQ8Zqv1$?Y-7~a5Qs`X0Fl9HJZ7o*x4K{QbvoE5m2N& ay6<56Ku4$MzAkXQgu&C*&t;ucLK6VMVTYRl literal 0 HcmV?d00001 diff --git a/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-light-high-contrast-linux.png b/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-light-high-contrast-linux.png new file mode 100644 index 0000000000000000000000000000000000000000..616a524b0a2352bdaa0e12027df6d38562588462 GIT binary patch literal 4735 zcmeAS@N?(olHy`uVBq!ia0y~yVEzKc3>-{A5muMoRzQleILO_JVcj{ImkbO-mYyz- zAr*7p-hI3JUa9PXkJ+;qZ+JaN_vS6%=x359iZ9Zv{Q{%Ux@~q85K@#$nvo5n#tUym+zYJ-tICHPfO@2zLvm#?Bzkm*;j8iH>s$GqFDqxq z*L*xLey{$)f%WG3H>+NrNIk52I`2l+N`mLx zo$~X$udl6taNK_9*J-o=zy24yd%v{|-~0XFe|L-P%ki+;|2b%TI(*&U_y26~|2cO3 zxfw8AV_Kd`d{0geuX%61`&_(b*_)f|YrbY1U-!4GEVvx{*f`Z*g6G=0SYxxYqZ1dq zr+5EO=aap)<6$#cqV4d*Utix_7Jb=XJe!w+LC>$a=l8>c9~1fW>+U*s|0}(61Z^ZNR$KYrAlVPjwj{Vep|djF2cUtV6`UR!s3 zqO!aHoF9kZmf!h#?|W{=tCf-W^L{>^8*f$o?2LHX8yjGJY)n3X@6*iNZtm{(-)}}g zPc~y7Jb_V>+l{+Qyk%Wi&KA8r2a!oB(b zU$%-{A5muMoRzQleILO_JVcj{ImkbO-Hl8ky zAr*7p-i=>zuT=KH$Mo5|Z*G2j=+?Ar=dwBzi>e#A z_iEY0;`gTgs``7(_q+Xv2Rdv(H~pI&4|l|on4^C$E>7N^_xsGR-r3iB;=b=ZU;nYy zet*Tszy3Bqe@Ab7S95;W*XwKUZpeMUww+IY=Hi143=6WR75=}K{okr~VP~iD^LP6y zUR}91ce`GM!T*KK)%@@7|Nb5xck|=R+y5;sEiY%DpKGx*`TE=Z=#7syy35slNoQ|A z{P0`s_PJJHr{6pabkg)?r_;XQ_?SLFcKbtS&f!4-M{#VmMS^j+Gt-sgia^~a5k55nA`?cwF`{B;cPN?T1kNrKW8@uPnuioo-%imu= z7awCIb8buh$w{g}<~*L%JS#-ITtUMs{8%Ryn5o)>U(>uei_&Q z`}6el^s`&)@7~JhmzSJ9r>6AR>z9|8|Nn8P^WxU*=SgM^3@c_$-f@3p?dzGw!sT~s z&)>Lw+;5Ie<$q@Wx-ZG*cBL;q`1~$^d!y{zo144e|2$O;H2>ku$ML^D#deGHZ_lax z>s`Re(9k_&@{aoBx7XLaIIwT}|6kj6=ijQk{LKH~qv`v9UF5Id@UZrE`mOz0S5Gw7 z+SmR2DW3P^$JzNiQg2_ma^(B4L2}&OKfFiSPnHd;9u+3O)eg&9A|0h$F z$f=)gMopwn@iQ8Zqv1$?Y-7~a5Qs`X0Fl9HJZ7o*x4K{QbvoE5m2N& ay6<56Ku4$MzAkXQgu&C*&t;ucLK6VMVTYRl literal 0 HcmV?d00001 diff --git a/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-light-tritanopia-linux.png b/.playwright/snapshots/components/BaseStyles.test.ts-snapshots/BaseStyles-Dev-Default-light-tritanopia-linux.png new file mode 100644 index 0000000000000000000000000000000000000000..c72be79709825e54427f3470ce174c129cadb862 GIT binary patch literal 4738 zcmeAS@N?(olHy`uVBq!ia0y~yVEzKc3>-{A5muMoRzQleILO_JVcj{ImkbO-Hl8ky zAr*7p-i=>zuT=KH$Mo5|Z*G2j=+?Ar=dwBzi>e#A z_iEY0;`gTgs``7(_q+Xv2Rdv(H~pI&4|l|on4^C$E>7N^_xsGR-r3iB;=b=ZU;nYy zet*Tszy3Bqe@Ab7S95;W*XwKUZpeMUww+IY=Hi143=6WR75=}K{okr~VP~iD^LP6y zUR}91ce`GM!T*KK)%@@7|Nb5xck|=R+y5;sEiY%DpKGx*`TE=Z=#7syy35slNoQ|A z{P0`s_PJJHr{6pabkg)?r_;XQ_?SLFcKbtS&f!4-M{#VmMS^j+Gt-sgia^~a5k55nA`?cwF`{B;cPN?T1kNrKW8@uPnuioo-%imu= z7awCIb8buh$w{g}<~*L%JS#-ITtUMs{8%Ryn5o)>U(>uei_&Q z`}6el^s`&)@7~JhmzSJ9r>6AR>z9|8|Nn8P^WxU*=SgM^3@c_$-f@3p?dzGw!sT~s z&)>Lw+;5Ie<$q@Wx-ZG*cBL;q`1~$^d!y{zo144e|2$O;H2>ku$ML^D#deGHZ_lax z>s`Re(9k_&@{aoBx7XLaIIwT}|6kj6=ijQk{LKH~qv`v9UF5Id@UZrE`mOz0S5Gw7 z+SmR2DW3P^$JzNiQg2_ma^(B4L2}&OKfFiSPnHd;9u+3O)eg&9A|0h$F z$f=)gMopwn@iQ8Zqv1$?Y-7~a5Qs`X0Fl9HJZ7o*x4K{QbvoE5m2N& ay6<56Ku4$MzAkXQgu&C*&t;ucLK6VMVTYRl literal 0 HcmV?d00001 diff --git a/e2e/components/BaseStyles.test.ts b/e2e/components/BaseStyles.test.ts new file mode 100644 index 00000000000..22735f58ea5 --- /dev/null +++ b/e2e/components/BaseStyles.test.ts @@ -0,0 +1,44 @@ +import {test, expect} from '@playwright/test' +import {visit} from '../test-helpers/storybook' +import {themes} from '../test-helpers/themes' + +const stories = [ + { + id: 'behaviors-basestyles-dev--default', + title: 'Dev Default', + }, +] as const + +test.describe('BaseStyles', () => { + for (const story of stories) { + test.describe(story.title, () => { + for (const theme of themes) { + test.describe(theme, () => { + test('default @vrt', async ({page}) => { + await visit(page, { + id: story.id, + globals: { + colorScheme: theme, + }, + }) + + // Default state + expect(await page.screenshot({animations: 'disabled'})).toMatchSnapshot( + `BaseStyles.${story.title}.${theme}.png`, + ) + }) + + test('axe @aat', async ({page}) => { + await visit(page, { + id: story.id, + globals: { + colorScheme: theme, + }, + }) + await expect(page).toHaveNoViolations() + }) + }) + } + }) + } +}) diff --git a/packages/react/src/BaseStyles.dev.stories.tsx b/packages/react/src/BaseStyles.dev.stories.tsx new file mode 100644 index 00000000000..d313f089009 --- /dev/null +++ b/packages/react/src/BaseStyles.dev.stories.tsx @@ -0,0 +1,11 @@ +import {BaseStyles} from '.' +import type {Meta} from '@storybook/react' +import React from 'react' +import type {ComponentProps} from './utils/types' + +export default { + title: 'Behaviors/BaseStyles/Dev', + component: BaseStyles, +} as Meta> + +export const Default = () => Hello diff --git a/packages/react/src/__tests__/BaseStyles.test.tsx b/packages/react/src/__tests__/BaseStyles.test.tsx new file mode 100644 index 00000000000..e7608955463 --- /dev/null +++ b/packages/react/src/__tests__/BaseStyles.test.tsx @@ -0,0 +1,33 @@ +import {render} from '@testing-library/react' +import MatchMediaMock from 'jest-matchmedia-mock' +import 'jest-styled-components' +import React from 'react' +import {BaseStyles} from '..' + +let matchMedia: MatchMediaMock + +describe('BaseStyles', () => { + beforeAll(() => { + matchMedia = new MatchMediaMock() + }) + + afterEach(() => { + matchMedia.clear() + }) + + it('has default styles', () => { + const {container} = render() + expect(container).toMatchSnapshot() + }) + + it('respects styling props', () => { + const styles = { + color: '#f00', + fontFamily: 'Arial', + lineHeight: '3.5', + } + + const {container} = render() + expect(container.children[0]).toHaveStyle({color: '#f00', 'font-family': 'Arial', 'line-height': '3.5'}) + }) +}) diff --git a/packages/react/src/__tests__/__snapshots__/BaseStyles.test.tsx.snap b/packages/react/src/__tests__/__snapshots__/BaseStyles.test.tsx.snap new file mode 100644 index 00000000000..18c719e6bff --- /dev/null +++ b/packages/react/src/__tests__/__snapshots__/BaseStyles.test.tsx.snap @@ -0,0 +1,19 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`BaseStyles has default styles 1`] = ` +.c0 { + font-family: normal; + line-height: default; + color: fg.default; +} + +
+
+
+`;