diff --git a/.playwright/snapshots/components/Text.test.ts-snapshots/Text-LightWeight-linux.png b/.playwright/snapshots/components/Text.test.ts-snapshots/Text-LightWeight-linux.png new file mode 100644 index 00000000000..d037ee600a1 Binary files /dev/null and b/.playwright/snapshots/components/Text.test.ts-snapshots/Text-LightWeight-linux.png differ diff --git a/.playwright/snapshots/components/Text.test.ts-snapshots/Text-Medium-linux.png b/.playwright/snapshots/components/Text.test.ts-snapshots/Text-Medium-linux.png index d037ee600a1..5a7357f3279 100644 Binary files a/.playwright/snapshots/components/Text.test.ts-snapshots/Text-Medium-linux.png and b/.playwright/snapshots/components/Text.test.ts-snapshots/Text-Medium-linux.png differ diff --git a/.playwright/snapshots/components/Text.test.ts-snapshots/Text-MediumWeight-linux.png b/.playwright/snapshots/components/Text.test.ts-snapshots/Text-MediumWeight-linux.png new file mode 100644 index 00000000000..d037ee600a1 Binary files /dev/null and b/.playwright/snapshots/components/Text.test.ts-snapshots/Text-MediumWeight-linux.png differ diff --git a/.playwright/snapshots/components/Text.test.ts-snapshots/Text-NormalWeight-linux.png b/.playwright/snapshots/components/Text.test.ts-snapshots/Text-NormalWeight-linux.png new file mode 100644 index 00000000000..d037ee600a1 Binary files /dev/null and b/.playwright/snapshots/components/Text.test.ts-snapshots/Text-NormalWeight-linux.png differ diff --git a/.playwright/snapshots/components/Text.test.ts-snapshots/Text-SemiboldWeight-linux.png b/.playwright/snapshots/components/Text.test.ts-snapshots/Text-SemiboldWeight-linux.png new file mode 100644 index 00000000000..6fcee4fa33a Binary files /dev/null and b/.playwright/snapshots/components/Text.test.ts-snapshots/Text-SemiboldWeight-linux.png differ diff --git a/e2e/components/Text.test.ts b/e2e/components/Text.test.ts index 36c3960baae..031a4adf876 100644 --- a/e2e/components/Text.test.ts +++ b/e2e/components/Text.test.ts @@ -1,150 +1,61 @@ import {test, expect} from '@playwright/test' import {visit} from '../test-helpers/storybook' +const stories = [ + { + title: 'Default', + id: 'components-text--default', + }, + { + title: 'Small', + id: 'components-text-features--size-small', + }, + { + title: 'Medium', + id: 'components-text-features--size-medium', + }, + { + title: 'Large', + id: 'components-text-features--size-large', + }, + { + title: 'LightWeight', + id: 'components-text-features--light-weight', + }, + { + title: 'NormalWeight', + id: 'components-text-features--normal-weight', + }, + { + title: 'MediumWeight', + id: 'components-text-features--medium-weight', + }, + { + title: 'SemiboldWeight', + id: 'components-text-features--semibold-weight', + }, +] as const + // only testing light theme because this component is only concerned with text size and weight test.describe('Text', () => { - test.describe('Default', () => { - test('default @vrt', async ({page}) => { - await visit(page, { - id: 'components-text--default', - }) - - // Default state - expect(await page.screenshot()).toMatchSnapshot(`Text.Default.png`) - }) - - test('axe @aat', async ({page}) => { - await visit(page, { - id: 'components-text--default', - }) - await expect(page).toHaveNoViolations() - }) - }) - - test.describe('Small', () => { - test('default @vrt', async ({page}) => { - await visit(page, { - id: 'components-text-features--size-small', - }) - - // Default state - expect(await page.screenshot()).toMatchSnapshot(`Text.Small.png`) - }) - - test('axe @aat', async ({page}) => { - await visit(page, { - id: 'components-text-features--size-small', - }) - await expect(page).toHaveNoViolations() - }) - }) + for (const story of stories) { + test.describe(story.title, () => { + test('default @vrt', async ({page}) => { + await visit(page, { + id: story.id, + }) - test.describe('Medium', () => { - test('default @vrt', async ({page}) => { - await visit(page, { - id: 'components-text-features--size-medium', + // Default state + expect(await page.screenshot()).toMatchSnapshot(`Text.${story.title}.png`) }) - // Default state - expect(await page.screenshot()).toMatchSnapshot(`Text.Medium.png`) - }) - - test('axe @aat', async ({page}) => { - await visit(page, { - id: 'components-text-features--size-medium', - }) - await expect(page).toHaveNoViolations() - }) - }) - - test.describe('Large', () => { - test('default @vrt', async ({page}) => { - await visit(page, { - id: 'components-text-features--size-large', - }) - - // Default state - expect(await page.screenshot()).toMatchSnapshot(`Text.Large.png`) - }) - - test('axe @aat', async ({page}) => { - await visit(page, { - id: 'components-text-features--size-large', - }) - await expect(page).toHaveNoViolations() - }) - }) - - test.describe('LightWeight', () => { - test('default @vrt', async ({page}) => { - await visit(page, { - id: 'components-text-features--light-weight', - }) - - // Default state - expect(await page.screenshot()).toMatchSnapshot(`Text.Light.png`) - }) - - test('axe @aat', async ({page}) => { - await visit(page, { - id: 'components-text-features--light-weight', - }) - await expect(page).toHaveNoViolations() - }) - }) - - test.describe('NormalWeight', () => { - test('default @vrt', async ({page}) => { - await visit(page, { - id: 'components-text-features--normal-weight', - }) - - // Default state - expect(await page.screenshot()).toMatchSnapshot(`Text.Normal.png`) - }) - - test('axe @aat', async ({page}) => { - await visit(page, { - id: 'components-text-features--normal-weight', - }) - await expect(page).toHaveNoViolations() - }) - }) - - test.describe('MediumWeight', () => { - test('default @vrt', async ({page}) => { - await visit(page, { - id: 'components-text-features--medium-weight', - }) - - // Default state - expect(await page.screenshot()).toMatchSnapshot(`Text.Medium.png`) - }) - - test('axe @aat', async ({page}) => { - await visit(page, { - id: 'components-text-features--medium-weight', - }) - await expect(page).toHaveNoViolations() - }) - }) - - test.describe('SemiboldWeight', () => { - test('default @vrt', async ({page}) => { - await visit(page, { - id: 'components-text-features--semibold-weight', - }) - - // Default state - expect(await page.screenshot()).toMatchSnapshot(`Text.Semibold.png`) - }) - - test('axe @aat', async ({page}) => { - await visit(page, { - id: 'components-text-features--semibold-weight', + test('axe @aat', async ({page}) => { + await visit(page, { + id: story.id, + }) + await expect(page).toHaveNoViolations() }) - await expect(page).toHaveNoViolations() }) - }) + } }) diff --git a/package-lock.json b/package-lock.json index 44f9e461428..1d353e01dd9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -292,7 +292,7 @@ "name": "example-app-router", "version": "0.0.0", "dependencies": { - "@primer/react": "36.27.0", + "@primer/react": "37.0.0-rc.0", "next": "^14.1.0", "react": "^18.3.1", "react-dom": "^18.3.1", @@ -311,7 +311,7 @@ "react-dom": "^18.3.1" }, "devDependencies": { - "@primer/react": "36.27.0", + "@primer/react": "37.0.0-rc.0", "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", "@typescript-eslint/eslint-plugin": "^7.11.0", @@ -329,7 +329,7 @@ "name": "example-consumer-test", "version": "0.0.0", "dependencies": { - "@primer/react": "*", + "@primer/react": "37.0.0-rc.0", "@types/react": "^18.2.14", "@types/react-dom": "^18.2.19", "@types/styled-components": "^5.1.11", @@ -355,7 +355,7 @@ "version": "0.0.0", "dependencies": { "@primer/octicons-react": "19.x", - "@primer/react": "36.27.0", + "@primer/react": "37.0.0-rc.0", "next": "^14.1.0", "react": "^18.3.1", "react-dom": "^18.3.1", @@ -60996,7 +60996,7 @@ }, "packages/react": { "name": "@primer/react", - "version": "36.27.0", + "version": "37.0.0-rc.0", "license": "MIT", "dependencies": { "@github/combobox-nav": "^2.1.5",