mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
feat(html-reporter): add file name copy button (#32652)
This commit is contained in:
parent
f6219e6e79
commit
c216c25a1d
@ -47,6 +47,7 @@
|
|||||||
flex: none;
|
flex: none;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 0 8px 8px;
|
padding: 0 8px 8px;
|
||||||
|
line-height: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.test-case-path {
|
.test-case-path {
|
||||||
|
|||||||
@ -81,9 +81,9 @@ test('should render copy buttons for annotations', async ({ mount, page, context
|
|||||||
|
|
||||||
const component = await mount(<TestCaseView projectNames={['chromium', 'webkit']} test={testCase} run={0} anchor=''></TestCaseView>);
|
const component = await mount(<TestCaseView projectNames={['chromium', 'webkit']} test={testCase} run={0} anchor=''></TestCaseView>);
|
||||||
await expect(component.getByText('Annotation text', { exact: false }).first()).toBeVisible();
|
await expect(component.getByText('Annotation text', { exact: false }).first()).toBeVisible();
|
||||||
component.getByText('Annotation text', { exact: false }).first().hover();
|
await component.getByText('Annotation text', { exact: false }).first().hover();
|
||||||
await expect(component.getByLabel('Copy to clipboard').first()).toBeVisible();
|
await expect(component.locator('.test-case-annotation').getByLabel('Copy to clipboard').first()).toBeVisible();
|
||||||
await component.getByLabel('Copy to clipboard').first().click();
|
await component.locator('.test-case-annotation').getByLabel('Copy to clipboard').first().click();
|
||||||
const handle = await page.evaluateHandle(() => navigator.clipboard.readText());
|
const handle = await page.evaluateHandle(() => navigator.clipboard.readText());
|
||||||
const clipboardContent = await handle.jsonValue();
|
const clipboardContent = await handle.jsonValue();
|
||||||
expect(clipboardContent).toBe('Annotation text');
|
expect(clipboardContent).toBe('Annotation text');
|
||||||
|
|||||||
@ -50,7 +50,11 @@ export const TestCaseView: React.FC<{
|
|||||||
{test && <div className='test-case-path'>{test.path.join(' › ')}</div>}
|
{test && <div className='test-case-path'>{test.path.join(' › ')}</div>}
|
||||||
{test && <div className='test-case-title'>{test?.title}</div>}
|
{test && <div className='test-case-title'>{test?.title}</div>}
|
||||||
{test && <div className='hbox'>
|
{test && <div className='hbox'>
|
||||||
<div className='test-case-location'>{test.location.file}:{test.location.line}</div>
|
<div className='test-case-location'>
|
||||||
|
<CopyToClipboardContainer value={`${test?.location.file}:${test?.location.line}`}>
|
||||||
|
{test.location.file}:{test.location.line}
|
||||||
|
</CopyToClipboardContainer>
|
||||||
|
</div>
|
||||||
<div style={{ flex: 'auto' }}></div>
|
<div style={{ flex: 'auto' }}></div>
|
||||||
<div className='test-case-duration'>{msToString(test.duration)}</div>
|
<div className='test-case-duration'>{msToString(test.duration)}</div>
|
||||||
</div>}
|
</div>}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user