Skip to content

Commit

Permalink
Write test cases for copy annotation text feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Aman Kumar committed Mar 28, 2024
1 parent 9c6be91 commit 01c472f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/html-reporter/src/testCaseView.spec.tsx
Expand Up @@ -64,7 +64,11 @@ const testCase: TestCase = {

test('should render test case', async ({ mount }) => {
const component = await mount(<TestCaseView projectNames={['chromium', 'webkit']} test={testCase} run={0} anchor=''></TestCaseView>);
await expect(component.getByText('Annotation text', { exact: false }).first()).toBeVisible();
const firstAnnotationElement = component.getByText('Annotation text', { exact: false }).first();
await expect(firstAnnotationElement).toBeVisible();
await expect(component.getByTestId('annotation-copy-button').first()).not.toBeVisible();
await firstAnnotationElement.hover();
await expect(component.getByTestId('annotation-copy-button').first()).toBeVisible();
await component.getByText('Annotations').click();
await expect(component.getByText('Annotation text')).not.toBeVisible();
await expect(component.getByText('Outer step')).toBeVisible();
Expand Down
2 changes: 1 addition & 1 deletion packages/html-reporter/src/testCaseView.tsx
Expand Up @@ -78,7 +78,7 @@ function TestCaseAnnotationView({ annotation: { type, description } }: { annotat
<div className='test-case-annotation'>
<span style={{ fontWeight: 'bold', display: 'inline-block', marginBlock: '3px' }}>{type}</span>
{description && <span>: {renderAnnotationDescription(description)}</span>}
<span id='annotation-copy-button'>{description && <CopyToClipboard value={description} />}</span>
<span id='annotation-copy-button' data-testid='annotation-copy-button' >{description && <CopyToClipboard value={description} />}</span>
</div>
);
}
Expand Down

0 comments on commit 01c472f

Please sign in to comment.