-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy pathImageOverlay.spec.tsx
More file actions
55 lines (52 loc) · 2.03 KB
/
ImageOverlay.spec.tsx
File metadata and controls
55 lines (52 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import React from 'react';
import { expect } from '@playwright/experimental-ct-react';
import { test as betaTest } from './FlavoredBaseTest';
import { ImageOverlay, Message, MessageThread } from '../../src';
betaTest.describe('ImageOverlay tests', () => {
betaTest.skip(({ isBetaBuild }) => !isBetaBuild, 'The tests should be run for beta flavor only');
const messages: Message[] = [
{
messageType: 'chat',
senderId: 'user3',
content:
'<p>How should I design my new house?</p><p><img alt="image" src="images/inlineImageExample1.png" itemscope="png" width="166" height="250" id="SomeImageId1" style="vertical-align:bottom; aspect-ratio: 166 / 250;"></p><p><img alt="image" src="images/inlineImageExample2.png" itemscope="png" width="374" height="250" id="SomeImageId2" style="vertical-align:bottom; aspect-ratio: 374 / 250"></p><p> </p>',
senderDisplayName: 'Miguel Garcia',
messageId: Math.random().toString(),
createdOn: new Date('2019-04-13T00:00:00.000+08:09'),
mine: false,
attached: false,
contentType: 'html'
},
{
messageType: 'chat',
senderId: 'user2',
senderDisplayName: 'Robert Tolbert',
messageId: Math.random().toString(),
content: 'Cool, I love the second one!',
createdOn: new Date('2019-04-13T00:00:00.000+08:10'),
mine: true,
attached: false,
contentType: 'text'
}
];
betaTest('ImageOverlay should be shown correctly when loading', async ({ mount }) => {
const component = await mount(
<div>
<MessageThread userId={'1'} messages={messages} />
{
<ImageOverlay
isOpen={true}
imageSrc={''}
title="Image"
onDismiss={() => {}}
onDownloadButtonClicked={() => {}}
/>
}
</div>
);
await component.evaluate(() => document.fonts.ready);
await expect(component).toHaveScreenshot('image-overlay-loading-stage.png');
});
});