Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: perform e2e rebase test (#33390)

Pavel Feldmanfc0ce7046b03
diff --git a/packages/html-reporter/src/chip.spec.tsx b/packages/html-reporter/src/chip.spec.tsx
index 3a0cfe908a..8c88fee071 100644
--- a/packages/html-reporter/src/chip.spec.tsx
+++ b/packages/html-reporter/src/chip.spec.tsx
@@ -48,3 +48,14 @@ test('setExpanded is called', async ({ mount }) => {
await component.getByText('Title').click();
expect(expandedValues).toEqual([true]);
});
+
+test('setExpanded should work', async ({ mount }) => {
+ const component = await mount(<AutoChip header='Title' initialExpanded={false}>
+ Body
+ </AutoChip>);
+ await component.getByText('Title').click();
+ await expect(component).toMatchAriaSnapshot(`
+ - button "Title" [expanded]
+ - region: Body
+ `);
+});
diff --git a/packages/html-reporter/src/chip.tsx b/packages/html-reporter/src/chip.tsx
index 8f4badf97f..537c439eb0 100644
--- a/packages/html-reporter/src/chip.tsx
+++ b/packages/html-reporter/src/chip.tsx
@@ -32,6 +32,8 @@ export const Chip: React.FC<{
}> = ({ header, expanded, setExpanded, children, noInsets, dataTestId, targetRef }) => {
return <div className='chip' data-testid={dataTestId} ref={targetRef}>
<div
+ role='button'
+ aria-expanded={!!expanded}
className={clsx('chip-header', setExpanded && ' expanded-' + expanded)}
onClick={() => setExpanded?.(!expanded)}
title={typeof header === 'string' ? header : undefined}>
@@ -39,7 +41,7 @@ export const Chip: React.FC<{
{setExpanded && !expanded && icons.rightArrow()}
{header}
</div>
- {(!setExpanded || expanded) && <div className={clsx('chip-body', noInsets && 'chip-body-no-insets')}>{children}</div>}
+ {(!setExpanded || expanded) && <div role='region' className={clsx('chip-body', noInsets && 'chip-body-no-insets')}>{children}</div>}
</div>;
};
diff --git a/tests/playwright-test/update-aria-snapshot.spec.ts b/tests/playwright-test/update-aria-snapshot.spec.ts
index 24b417c744..c9c9b0056e 100644
--- a/tests/playwright-test/update-aria-snapshot.spec.ts
+++ b/tests/playwright-test/update-aria-snapshot.spec.ts
@@ -16,6 +16,7 @@
import * as fs from 'fs';
import { test, expect, playwrightCtConfigText } from './playwright-test-fixtures';
+import { execSync } from 'child_process';
test.describe.configure({ mode: 'parallel' });
@@ -47,6 +48,10 @@ test('should update snapshot with the update-snapshots flag', async ({ runInline
});
`);
+
+ execSync(`patch -p1 < ${patchPath}`, { cwd: testInfo.outputPath() });
+ const result2 = await runInlineTest({});
+ expect(result2.exitCode).toBe(0);
});
test('should update missing snapshots', async ({ runInlineTest }, testInfo) => {
@@ -76,6 +81,10 @@ test('should update missing snapshots', async ({ runInlineTest }, testInfo) => {
});
`);
+
+ execSync(`patch -p1 < ${patchPath}`, { cwd: testInfo.outputPath() });
+ const result2 = await runInlineTest({});
+ expect(result2.exitCode).toBe(0);
});
test('should generate baseline with regex', async ({ runInlineTest }, testInfo) => {
@@ -126,6 +135,10 @@ test('should generate baseline with regex', async ({ runInlineTest }, testInfo)
});
`);
+
+ execSync(`patch -p1 < ${patchPath}`, { cwd: testInfo.outputPath() });
+ const result2 = await runInlineTest({});
+ expect(result2.exitCode).toBe(0);
});
test('should generate baseline with special characters', async ({ runInlineTest }, testInfo) => {
@@ -168,6 +181,10 @@ test('should generate baseline with special characters', async ({ runInlineTest
});
`);
+
+ execSync(`patch -p1 < ${patchPath}`, { cwd: testInfo.outputPath() });
+ const result2 = await runInlineTest({});
+ expect(result2.exitCode).toBe(0);
});
test('should update missing snapshots in tsx', async ({ runInlineTest }, testInfo) => {
@@ -207,6 +224,10 @@ test('should update missing snapshots in tsx', async ({ runInlineTest }, testInf
});
`);
+
+ execSync(`patch -p1 < ${patchPath}`, { cwd: testInfo.outputPath() });
+ const result2 = await runInlineTest({});
+ expect(result2.exitCode).toBe(0);
});
test('should update multiple files', async ({ runInlineTest }, testInfo) => {
@@ -269,6 +290,10 @@ test('should update multiple files', async ({ runInlineTest }, testInfo) => {
});
`);
+
+ execSync(`patch -p1 < ${patchPath}`, { cwd: testInfo.outputPath() });
+ const result2 = await runInlineTest({});
+ expect(result2.exitCode).toBe(0);
});
test('should generate baseline for input values', async ({ runInlineTest }, testInfo) => {
@@ -298,4 +323,8 @@ test('should generate baseline for input values', async ({ runInlineTest }, test
});
`);
+
+ execSync(`patch -p1 < ${patchPath}`, { cwd: testInfo.outputPath() });
+ const result2 = await runInlineTest({});
+ expect(result2.exitCode).toBe(0);
});