Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: issue with long snapshot names for screenreader tests #3030

Merged
merged 4 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion showcases/playwright.screen-reader.macos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import defaultScreenReaderConfig from './playwright.screen-reader';
const config: PlaywrightTestConfig = {
...defaultScreenReaderConfig,
snapshotPathTemplate:
'{snapshotDir}/{testFileDir}/macos/{projectName}/{testName}{ext}',
'{snapshotDir}/{testFileDir}/macos/{projectName}/{arg}{ext}',
projects: [
{
name: 'webkit',
Expand Down
2 changes: 1 addition & 1 deletion showcases/playwright.screen-reader.windows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import defaultScreenReaderConfig from './playwright.screen-reader';
const config: PlaywrightTestConfig = {
...defaultScreenReaderConfig,
snapshotPathTemplate:
'{snapshotDir}/{testFileDir}/windows/{projectName}/{testName}{ext}',
'{snapshotDir}/{testFileDir}/windows/{projectName}/{arg}{ext}',
projects: [
{
name: 'chromium',
Expand Down
4 changes: 4 additions & 0 deletions showcases/screen-reader/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ export type ScreenReaderTestType = TestType<

export type DefaultTestType = {
test?: ScreenReaderTestType;
/**
* Should be very short because this will be the name for the output
*/
title: string;
description: string;
url: string;
testFn?: (
voiceOver?: VoiceOverPlaywright,
Expand Down
1 change: 1 addition & 0 deletions showcases/screen-reader/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export const testDefault = (defaultTestType: DefaultTestType) => {
'&color=neutral-bg-basic-level-1&density=regular'
};

const trimTitleForShortSnapshotName = title.slice(0, 10);
if (isWin()) {
test?.(title, async ({ page, nvda }, { retry }) => {
await runTest({
Expand Down
4 changes: 3 additions & 1 deletion showcases/screen-reader/tests/badge.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ const test = getTest();
test.describe('DBBadge', () => {
testDefault({
test,
title: 'should have texts inline or as data-label attributes (next())',
title: 'default',
description:
'should have texts inline or as data-label attributes (next())',
url: './#/06/badge?page=placement',
async testFn(voiceOver, nvda) {
if (nvda) {
Expand Down
6 changes: 4 additions & 2 deletions showcases/screen-reader/tests/button.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ const test = getTest();
test.describe('DBButton', () => {
testDefault({
test,
title: 'should not have icon in screen reader (next())',
title: 'next()',
description: 'should not have icon in screen reader (next())',
url: './#/02/button?page=content',
async testFn(voiceOver, nvda) {
if (nvda) {
Expand All @@ -21,7 +22,8 @@ test.describe('DBButton', () => {
});
testDefault({
test,
title: 'should not have icon in screen reader (tab)',
title: 'tab',
description: 'should not have icon in screen reader (tab)',
url: './#/02/button?page=content',
async testFn(voiceOver, nvda) {
if (voiceOver) {
Expand Down
3 changes: 2 additions & 1 deletion showcases/screen-reader/tests/drawer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ const test = getTest();
test.describe('DBDrawer', () => {
testDefault({
test,
title: 'should autofocus',
title: 'autofocus',
description: 'should autofocus',
url: './#/01/drawer?page=density',
async testFn(voiceOver, nvda) {
const screenReader = voiceOver ?? nvda;
Expand Down
6 changes: 4 additions & 2 deletions showcases/screen-reader/tests/input.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ const test = getTest();
test.describe('DBInput', () => {
testDefault({
test,
title: 'should have message and label (next())',
title: 'next()',
description: 'should have message and label (next())',
url: './#/03/input?page=variant%20helper%20message',
async testFn(voiceOver, nvda) {
if (nvda) {
Expand All @@ -24,7 +25,8 @@ test.describe('DBInput', () => {
// We don't test default "next" here because we will be locked inside the textarea
testDefault({
test,
title: 'should have message and label (tab)',
title: 'tab',
description: 'should have message and label (tab)',
url: './#/03/input?page=variant%20helper%20message',
async testFn(voiceOver, nvda) {
if (voiceOver) {
Expand Down
6 changes: 4 additions & 2 deletions showcases/screen-reader/tests/radio.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ const test = getTest();
test.describe('DBRadio', () => {
testDefault({
test,
title: 'should label duplicated (next())',
title: 'next()',
description: 'should label duplicated (next())',
url: './#/03/radio?page=density',
async testFn(voiceOver, nvda) {
if (nvda) {
Expand All @@ -27,7 +28,8 @@ test.describe('DBRadio', () => {
});
testDefault({
test,
title: 'should label duplicated (arrows)',
title: 'arrows',
description: 'should label duplicated (arrows)',
url: './#/03/radio?page=density',
async testFn(voiceOver, nvda) {
if (voiceOver) {
Expand Down
Loading