From e05a5d4c869bcac60851fdc673451354b75f6a5d Mon Sep 17 00:00:00 2001 From: Max Skanvik <179694889+max-umain@users.noreply.github.com> Date: Mon, 16 Dec 2024 17:32:27 +0100 Subject: [PATCH] test(radio-button): add darkmode screenshot test and refactor folder structure --- .../test/default/darkmode/index.html | 29 ++++++++++++++++++ .../test/default/darkmode/radio-button.e2e.ts | 20 ++++++++++++ ...abel-text-2-render-on-the-page-1-linux.png | Bin 0 -> 7540 bytes .../radio-button/test/default/index.html | 25 --------------- .../test/default/lightmode/index.html | 29 ++++++++++++++++++ .../{ => lightmode}/radio-button.e2e.ts | 6 ++-- ...bel-text-2-render-on-the-page-1-linux.png} | Bin .../test/disabled/radio-button.e2e.ts | 4 ++- 8 files changed, 85 insertions(+), 28 deletions(-) create mode 100644 packages/core/src/components/radio-button/test/default/darkmode/index.html create mode 100644 packages/core/src/components/radio-button/test/default/darkmode/radio-button.e2e.ts create mode 100644 packages/core/src/components/radio-button/test/default/darkmode/radio-button.e2e.ts-snapshots/TdsRadioButton-component-tests-default-darkmod-5ba5b-text-1-and-Label-text-2-render-on-the-page-1-linux.png delete mode 100644 packages/core/src/components/radio-button/test/default/index.html create mode 100644 packages/core/src/components/radio-button/test/default/lightmode/index.html rename packages/core/src/components/radio-button/test/default/{ => lightmode}/radio-button.e2e.ts (91%) rename packages/core/src/components/radio-button/test/default/{radio-button.e2e.ts-snapshots/TdsRadioButton-component-tests-Radio-buttons-w-dd5e3-text-1-and-Label-text-2-render-on-the-page-1-linux.png => lightmode/radio-button.e2e.ts-snapshots/TdsRadioButton-component-tests-default-lightmo-8ea18-text-1-and-Label-text-2-render-on-the-page-1-linux.png} (100%) diff --git a/packages/core/src/components/radio-button/test/default/darkmode/index.html b/packages/core/src/components/radio-button/test/default/darkmode/index.html new file mode 100644 index 000000000..3dea2d08f --- /dev/null +++ b/packages/core/src/components/radio-button/test/default/darkmode/index.html @@ -0,0 +1,29 @@ + + + + + Textarea - Basic + + + + + + + +
Label text 1
+
+ + +
Label text 2
+
+ + diff --git a/packages/core/src/components/radio-button/test/default/darkmode/radio-button.e2e.ts b/packages/core/src/components/radio-button/test/default/darkmode/radio-button.e2e.ts new file mode 100644 index 000000000..b28f0cb43 --- /dev/null +++ b/packages/core/src/components/radio-button/test/default/darkmode/radio-button.e2e.ts @@ -0,0 +1,20 @@ +import { expect } from '@playwright/test'; +import { test } from 'stencil-playwright'; + +const componentTestPath = 'src/components/radio-button/test/default/darkmode/index.html'; + +test.describe.parallel('TdsRadioButton component tests default darkmode', () => { + test.beforeEach(async ({ page }) => { + await page.goto(componentTestPath); + }); + + test('Radio buttons with Label text = "Label text 1" and "Label text 2" render on the page', async ({ + page, + }) => { + const radioButton1 = page.locator('tds-radio-button', { hasText: 'Label text 1' }); + const radioButton2 = page.locator('tds-radio-button', { hasText: 'Label text 2' }); + await expect(radioButton1).toBeVisible(); + await expect(radioButton2).toBeVisible(); + await expect(page).toHaveScreenshot({ maxDiffPixelRatio: 0 }); + }); +}); diff --git a/packages/core/src/components/radio-button/test/default/darkmode/radio-button.e2e.ts-snapshots/TdsRadioButton-component-tests-default-darkmod-5ba5b-text-1-and-Label-text-2-render-on-the-page-1-linux.png b/packages/core/src/components/radio-button/test/default/darkmode/radio-button.e2e.ts-snapshots/TdsRadioButton-component-tests-default-darkmod-5ba5b-text-1-and-Label-text-2-render-on-the-page-1-linux.png new file mode 100644 index 0000000000000000000000000000000000000000..2a5213899669dd241a991d14ef9d4fd3c3426e4c GIT binary patch literal 7540 zcmeH~SyYo*w#Tu#H7ej;YN3G8bzLQv6hyBGmNIAyQsM=w7=p+Uz!DTlQUYNLNi4C7 zDh8vC3Nl5Ym_i5&LLd+V$e>IC0)#092oNBIkT859<2|hIhhD3D_0xU04}1^j?1%I1 zoc-IwKi}`)yE^H7Zt%I5mX^--?;PBd}(vCQ^UcUWk(BaQdkq0v$bk;ju9zOV=(0AV#UCTM@ zw_=g=@!@gH^6L6)4(;dT%~Ecq-s3@GbDy8CZ~5xL*s#^*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QC(ZqCs>&-WDG@lxKi2ZzlCTh za7o9|Dsgl6o}S(2``V;m6J@i>B8Ut9Tn^z@DEUq%HIWP5^uEQuY;<3PRhAcR_#YI; z&9;rk#4W+Z4I2$FnGG{t`c%Rx;JsPPIkYdITh502b3{`OY_pmW&i{evfbh42rC)^n zE7`%&F^a{j>^0H_$+lX%-<=7rfv_nCGeyd2rbD9#xPov5PQ9aFXH$ZyfLHozmPZO5 zQ#(@inHqI>6l*7_=Y@F%`642!&kJ)RJS+^=6eOF*injWaberbqe$Ei*xF7BydsURU z=2<1mwnP)PqOmvc>faPu-CevWw!p`7=@=YQGfi!@;P_c`>FE1tZ)=xAB zAUo_zi!vi+~Zm zD)0`FKp?U51x7|yL(ESi;tR9Wr?2s%`LRswRQ7q&|1^u$SCW$9m^CGs1To>$kx5v% zf25>^q?A3R3Ht2GU4w=!a(VgkG-Fa5;&B?t!l64o2Is>zyKk`c3~V-AlZ~eXQKCV( zQle)_C{K3-Uob7YuEeHJ@*yS}^Hiu3rj8koW>*ykZG2^$B^z6nk9Di@B z-+29fev;nWbVVq!G(S-p`VJijh$6+syI&U?=HCTODwTr&r*SR&6yBIMPY;icZpt{z zUegBT#R?+q*2e21*}oO9XP}!R#OJ}u7DS#|3)meF?yY+S_6Y0|*dwq - - - - - Textarea - Basic - - - - - - - -
Label text 1
-
- - -
Label text 2
-
- - - \ No newline at end of file diff --git a/packages/core/src/components/radio-button/test/default/lightmode/index.html b/packages/core/src/components/radio-button/test/default/lightmode/index.html new file mode 100644 index 000000000..c09425847 --- /dev/null +++ b/packages/core/src/components/radio-button/test/default/lightmode/index.html @@ -0,0 +1,29 @@ + + + + + Textarea - Basic + + + + + + + +
Label text 1
+
+ + +
Label text 2
+
+ + diff --git a/packages/core/src/components/radio-button/test/default/radio-button.e2e.ts b/packages/core/src/components/radio-button/test/default/lightmode/radio-button.e2e.ts similarity index 91% rename from packages/core/src/components/radio-button/test/default/radio-button.e2e.ts rename to packages/core/src/components/radio-button/test/default/lightmode/radio-button.e2e.ts index be820600a..eea365c07 100644 --- a/packages/core/src/components/radio-button/test/default/radio-button.e2e.ts +++ b/packages/core/src/components/radio-button/test/default/lightmode/radio-button.e2e.ts @@ -1,11 +1,13 @@ import { expect } from '@playwright/test'; import { test } from 'stencil-playwright'; -test.describe.parallel('TdsRadioButton component tests', () => { +const componentTestPath = 'src/components/radio-button/test/default/lightmode/index.html'; + +test.describe.parallel('TdsRadioButton component tests default lightmode', () => { test.beforeEach(async ({ page }) => { // Navigate to the index.html page where your component is rendered // Adjust the path to the index.html as necessary based on your project structure - await page.goto('src/components/radio-button/test/default/index.html'); + await page.goto(componentTestPath); }); test('Radio buttons with Label text = "Label text 1" and "Label text 2" render on the page', async ({ diff --git a/packages/core/src/components/radio-button/test/default/radio-button.e2e.ts-snapshots/TdsRadioButton-component-tests-Radio-buttons-w-dd5e3-text-1-and-Label-text-2-render-on-the-page-1-linux.png b/packages/core/src/components/radio-button/test/default/lightmode/radio-button.e2e.ts-snapshots/TdsRadioButton-component-tests-default-lightmo-8ea18-text-1-and-Label-text-2-render-on-the-page-1-linux.png similarity index 100% rename from packages/core/src/components/radio-button/test/default/radio-button.e2e.ts-snapshots/TdsRadioButton-component-tests-Radio-buttons-w-dd5e3-text-1-and-Label-text-2-render-on-the-page-1-linux.png rename to packages/core/src/components/radio-button/test/default/lightmode/radio-button.e2e.ts-snapshots/TdsRadioButton-component-tests-default-lightmo-8ea18-text-1-and-Label-text-2-render-on-the-page-1-linux.png diff --git a/packages/core/src/components/radio-button/test/disabled/radio-button.e2e.ts b/packages/core/src/components/radio-button/test/disabled/radio-button.e2e.ts index f01f9e902..8a2f57ec1 100644 --- a/packages/core/src/components/radio-button/test/disabled/radio-button.e2e.ts +++ b/packages/core/src/components/radio-button/test/disabled/radio-button.e2e.ts @@ -1,9 +1,11 @@ import { expect } from '@playwright/test'; import { test } from 'stencil-playwright'; +const componentTestPath = 'src/components/radio-button/test/disabled/index.html'; + test.describe.parallel('Radio button - disabled state', () => { test.beforeEach(async ({ page }) => { - await page.goto('src/components/radio-button/test/disabled/index.html'); + await page.goto(componentTestPath); }); test('Radio buttons with Label text = "Label text 1" and "Label text 2" renders on the page', async ({