|
1 | 1 | import { createScreenshotsComparer } from 'devextreme-screenshot-comparer'; |
2 | 2 | import Chat from 'devextreme-testcafe-models/chat'; |
3 | 3 | import { ClientFunction } from 'testcafe'; |
4 | | -import { User } from 'devextreme/ui/chat'; |
| 4 | +import { Message, User } from 'devextreme/ui/chat'; |
5 | 5 | import TabPanel from 'devextreme-testcafe-models/tabPanel'; |
6 | 6 | import { createUser, generateMessages, getLongText } from './data'; |
7 | 7 | import url from '../../helpers/getPageUrl'; |
8 | 8 | import { createWidget } from '../../helpers/createWidget'; |
9 | 9 | import { testScreenshot } from '../../helpers/themeUtils'; |
| 10 | +import { insertStylesheetRulesToPage } from '../../helpers/domUtils'; |
10 | 11 |
|
11 | 12 | fixture.disablePageReloads`ChatMessageList` |
12 | 13 | .page(url(__dirname, '../container.html')); |
@@ -152,6 +153,37 @@ test('Messagelist should scrolled to the latest messages after being rendered in |
152 | 153 | }); |
153 | 154 | }); |
154 | 155 |
|
| 156 | +test('Messagelist with loadindicator appearance on initial loading', async (t) => { |
| 157 | + const { takeScreenshot, compareResults } = createScreenshotsComparer(t); |
| 158 | + const chat = new Chat('#container'); |
| 159 | + |
| 160 | + await chat.repaint(); |
| 161 | + await testScreenshot(t, takeScreenshot, 'Messagelist loadindicator position on initial loading.png', { element: '#container' }); |
| 162 | + |
| 163 | + await t |
| 164 | + .expect(compareResults.isValid()) |
| 165 | + .ok(compareResults.errorMessages()); |
| 166 | +}).before(async () => { |
| 167 | + await insertStylesheetRulesToPage('.dx-loadindicator-content, .dx-loadindicator-icon, .dx-loadindicator-segment, .dx-loadindicator-segment-inner { animation-play-state: paused !important; }'); |
| 168 | + |
| 169 | + await createWidget('dxChat', () => { |
| 170 | + const data: Message[] = []; |
| 171 | + |
| 172 | + return { |
| 173 | + dataSource: new (window as any).DevExpress.data.CustomStore({ |
| 174 | + key: 'id', |
| 175 | + load: () => new Promise<Message[]>((resolve) => { |
| 176 | + setTimeout(() => { |
| 177 | + resolve(data); |
| 178 | + }, 3000); |
| 179 | + }), |
| 180 | + }), |
| 181 | + width: 400, |
| 182 | + height: 600, |
| 183 | + }; |
| 184 | + }); |
| 185 | +}); |
| 186 | + |
155 | 187 | test('Messagelist with messageTemplate', async (t) => { |
156 | 188 | const chat = new Chat('#container'); |
157 | 189 | const { takeScreenshot, compareResults } = createScreenshotsComparer(t); |
|
0 commit comments