11import { createScreenshotsComparer } from 'devextreme-screenshot-comparer' ;
22import Chat from 'devextreme-testcafe-models/chat' ;
3- import { getShortText , getLongText , createUser } from './data' ;
3+ import {
4+ getShortText , getLongText , createUser , attachments ,
5+ } from './data' ;
46import url from '../../../helpers/getPageUrl' ;
57import { createWidget } from '../../../helpers/createWidget' ;
68import { testScreenshot } from '../../../helpers/themeUtils' ;
@@ -9,85 +11,97 @@ import { appendElementTo } from '../../../helpers/domUtils';
911fixture . disablePageReloads `ChatMessageBox`
1012 . page ( url ( __dirname , '../../container.html' ) ) ;
1113
12- test ( 'Chat: messagebox' , async ( t ) => {
13- const { takeScreenshot, compareResults } = createScreenshotsComparer ( t ) ;
14+ // test('Chat: messagebox', async (t) => {
15+ // const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
1416
15- const chat = new Chat ( '#chat' ) ;
17+ // const chat = new Chat('#chat');
1618
17- const shortText = getShortText ( ) ;
18- const longText = getLongText ( false , 5 ) ;
19+ // const shortText = getShortText();
20+ // const longText = getLongText(false, 5);
1921
20- await chat . focus ( ) ;
21- await testScreenshot ( t , takeScreenshot , 'Messagebox when chat has focus.png' , { element : '#chat' } ) ;
22+ // await chat.focus();
23+ // await testScreenshot(t, takeScreenshot, 'Messagebox when chat has focus.png', { element: '#chat' });
2224
23- await t . typeText ( chat . getInput ( ) , shortText ) ;
24- await testScreenshot ( t , takeScreenshot , 'Messagebox when input contains short text.png' , { element : '#chat' } ) ;
25+ // await t.typeText(chat.getInput(), shortText);
26+ // await testScreenshot(t, takeScreenshot, 'Messagebox when input contains short text.png', { element: '#chat' });
2527
26- await t . typeText ( chat . getInput ( ) , longText ) ;
27- await testScreenshot ( t , takeScreenshot , 'Messagebox when input contains long text.png' , { element : '#chat' } ) ;
28+ // await t.typeText(chat.getInput(), longText);
29+ // await testScreenshot(t, takeScreenshot, 'Messagebox when input contains long text.png', { element: '#chat' });
2830
29- await t . pressKey ( 'tab' ) ;
30- await testScreenshot ( t , takeScreenshot , 'Messagebox when send button has focus.png' , { element : '#chat' } ) ;
31+ // await t.pressKey('tab');
32+ // await testScreenshot(t, takeScreenshot, 'Messagebox when send button has focus.png', { element: '#chat' });
3133
32- await t
33- . expect ( compareResults . isValid ( ) )
34- . ok ( compareResults . errorMessages ( ) ) ;
35- } ) . before ( async ( ) => {
36- await appendElementTo ( '#container' , 'div' , 'chat' ) ;
34+ // await t
35+ // .expect(compareResults.isValid())
36+ // .ok(compareResults.errorMessages());
37+ // }).before(async () => {
38+ // await appendElementTo('#container', 'div', 'chat');
3739
38- return createWidget ( 'dxChat' , {
39- width : 400 ,
40- height : 600 ,
41- } , '#chat' ) ;
42- } ) ;
40+ // return createWidget('dxChat', {
41+ // width: 400,
42+ // height: 600,
43+ // }, '#chat');
44+ // });
4345
44- test ( 'Chat: messagebox with editing preview' , async ( t ) => {
45- const { takeScreenshot, compareResults } = createScreenshotsComparer ( t ) ;
46+ // test('Chat: messagebox with editing preview', async (t) => {
47+ // const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
4648
47- const chat = new Chat ( '#chat' ) ;
49+ // const chat = new Chat('#chat');
4850
49- await t . rightClick ( chat . getMessage ( 0 ) ) ;
50- await t . click ( chat . getContextMenuItem ( 0 ) ) ;
51+ // await t.rightClick(chat.getMessage(0));
52+ // await t.click(chat.getContextMenuItem(0));
5153
52- await testScreenshot ( t , takeScreenshot , 'Messagebox with editing preview.png' , {
53- element : '#chat' ,
54- } ) ;
54+ // await testScreenshot(t, takeScreenshot, 'Messagebox with editing preview.png', {
55+ // element: '#chat',
56+ // });
5557
56- await t
57- . expect ( compareResults . isValid ( ) )
58- . ok ( compareResults . errorMessages ( ) ) ;
59- } ) . before ( async ( ) => {
60- await appendElementTo ( '#container' , 'div' , 'chat' ) ;
58+ // await t
59+ // .expect(compareResults.isValid())
60+ // .ok(compareResults.errorMessages());
61+ // }).before(async () => {
62+ // await appendElementTo('#container', 'div', 'chat');
6163
62- const userFirst = createUser ( 1 , 'First' ) ;
63- const userSecond = createUser ( 2 , 'Second' ) ;
64+ // const userFirst = createUser(1, 'First');
65+ // const userSecond = createUser(2, 'Second');
6466
65- const items = [ {
66- author : userFirst ,
67- text : 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.' ,
68- } , {
69- author : userSecond ,
70- text : 'Short message' ,
71- } ] ;
67+ // const items = [{
68+ // author: userFirst,
69+ // text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
70+ // }, {
71+ // author: userSecond,
72+ // text: 'Short message',
73+ // }];
7274
73- return createWidget ( 'dxChat' , {
74- items,
75- user : userFirst ,
76- editing : {
77- allowUpdating : true ,
78- } ,
79- width : 400 ,
80- height : 600 ,
81- } , '#chat' ) ;
82- } ) ;
75+ // return createWidget('dxChat', {
76+ // items,
77+ // user: userFirst,
78+ // editing: {
79+ // allowUpdating: true,
80+ // },
81+ // width: 400,
82+ // height: 600,
83+ // }, '#chat');
84+ // });
8385
84- test ( 'Chat: messagebox with attach button ' , async ( t ) => {
86+ test ( 'Chat: messagebox with attachments and informer ' , async ( t ) => {
8587 const { takeScreenshot, compareResults } = createScreenshotsComparer ( t ) ;
8688
8789 const chat = new Chat ( '#chat' ) ;
8890
91+ await t . typeText ( chat . getInput ( ) , getLongText ( false , 4 ) ) ;
92+ await chat . option ( {
93+ fileUploaderOptions : {
94+ value : [
95+ ...attachments ,
96+ ...attachments ,
97+ ...attachments ,
98+ ] ,
99+ } ,
100+ } ) ;
101+
89102 await chat . focus ( ) ;
90- await testScreenshot ( t , takeScreenshot , 'Messagebox with attach button.png' , { element : '#chat' } ) ;
103+ await t . debug ( ) ;
104+ await testScreenshot ( t , takeScreenshot , 'Messagebox with attachments and informer.png' , { element : '#chat' } ) ;
91105
92106 await t
93107 . expect ( compareResults . isValid ( ) )
@@ -96,8 +110,7 @@ test('Chat: messagebox with attach button', async (t) => {
96110 await appendElementTo ( '#container' , 'div' , 'chat' ) ;
97111
98112 return createWidget ( 'dxChat' , {
99- width : 400 ,
113+ width : 812 ,
100114 height : 600 ,
101- fileUploaderOptions : { } ,
102115 } , '#chat' ) ;
103116} ) ;
0 commit comments