Skip to content

Commit

Permalink
feat(etalons && repaint): Update etalon && Add repaint to the before …
Browse files Browse the repository at this point in the history
…hook
  • Loading branch information
marker dao ® committed Dec 11, 2024
1 parent a8a6aae commit 51d4f74
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 22 deletions.
5 changes: 4 additions & 1 deletion e2e/testcafe-devextreme/tests/chat/alertList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,16 @@ test.clientScripts([
text: 'Message text 5',
}];

return createWidget('dxChat', {
await createWidget('dxChat', {
items,
user: userFirst,
width: 400,
height: 600,
alerts: [{ id: 1, message: 'Error Message 1. Error Description...' }],
});

const chat = new Chat('#container');
await chat.repaint();
}).after(async () => {
await ClientFunction(() => {
(window as any).MockDate.reset();
Expand Down
10 changes: 8 additions & 2 deletions e2e/testcafe-devextreme/tests/chat/avatar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,15 @@ test('Chat: avatar', async (t) => {

const items = generateMessages(2, userFirst, userSecond, false, false, 2);

return createWidget('dxChat', {
await createWidget('dxChat', {
width: 400,
height: 600,
user: userSecond,
items,
}, '#chat');

const chat = new Chat('#chat');
await chat.repaint();
});

test('Chat: showAvatar set to false', async (t) => {
Expand All @@ -58,11 +61,14 @@ test('Chat: showAvatar set to false', async (t) => {

const items = generateMessages(2, userFirst, userSecond, false, false, 2);

return createWidget('dxChat', {
await createWidget('dxChat', {
width: 400,
height: 600,
user: userSecond,
items,
showAvatar: false,
}, '#chat');

const chat = new Chat('#chat');
await chat.repaint();
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion e2e/testcafe-devextreme/tests/chat/messageBox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ test('Chat: messagebox', async (t) => {
}).before(async () => {
await appendElementTo('#container', 'div', 'chat');

return createWidget('dxChat', {
await createWidget('dxChat', {
width: 400,
height: 600,
}, '#chat');

const chat = new Chat('#chat');
await chat.repaint();
});
5 changes: 4 additions & 1 deletion e2e/testcafe-devextreme/tests/chat/messageBubble.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ test('Chat: messagebubble', async (t) => {
}).before(async () => {
await appendElementTo('#container', 'div', 'chat');

return createWidget('dxChat', {
await createWidget('dxChat', {
width: 400,
height: 650,
}, '#chat');

const chat = new Chat('#chat');
await chat.repaint();
});
18 changes: 15 additions & 3 deletions e2e/testcafe-devextreme/tests/chat/messageGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,14 @@ test('Chat: messagegroup, avatar rendering', async (t) => {
const userFirst = createUser(1, 'First');
const items = generateMessages(3, userFirst);

return createWidget('dxChat', {
await createWidget('dxChat', {
width: 400,
height: 600,
items,
}, '#chat');

const chat = new Chat('#chat');
await chat.repaint();
});

test('Chat: messagegroup, information', async (t) => {
Expand All @@ -57,12 +60,15 @@ test('Chat: messagegroup, information', async (t) => {

const items = generateMessages(2, userFirst, userSecond, false, false, 2);

return createWidget('dxChat', {
await createWidget('dxChat', {
width: 400,
height: 600,
user: userSecond,
items,
}, '#chat');

const chat = new Chat('#chat');
await chat.repaint();
});

test('Chat: messagegroup, bubbles', async (t) => {
Expand Down Expand Up @@ -99,10 +105,13 @@ test('Chat: messagegroup, bubbles', async (t) => {
}).before(async () => {
await appendElementTo('#container', 'div', 'chat');

return createWidget('dxChat', {
await createWidget('dxChat', {
width: 400,
height: 600,
}, '#chat');

const chat = new Chat('#chat');
await chat.repaint();
});

test('Messagegroup scenarios in disabled state', async (t) => {
Expand All @@ -126,6 +135,9 @@ test('Messagegroup scenarios in disabled state', async (t) => {
width: 250,
height: 400,
}, chatId);

const chat = new Chat(chatId);
await chat.repaint();
});

await testScreenshot(t, takeScreenshot, 'Messagegroup appearance in disabled state.png', { element: '#container' });
Expand Down
43 changes: 33 additions & 10 deletions e2e/testcafe-devextreme/tests/chat/messageList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,15 @@ test('Messagelist empty view scenarios', async (t) => {
await t
.expect(compareResults.isValid())
.ok(compareResults.errorMessages());
}).before(async () => createWidget('dxChat', {
width: 400,
height: 600,
}));
}).before(async () => {
await createWidget('dxChat', {
width: 400,
height: 600,
});

const chat = new Chat('#container');
await chat.repaint();
});

test('Messagelist appearance with scrollbar', async (t) => {
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
Expand Down Expand Up @@ -100,7 +105,7 @@ test('Messagelist appearance with scrollbar', async (t) => {

const items = generateMessages(17, userFirst, userSecond, true, false, 2);

return createWidget('dxChat', {
await createWidget('dxChat', {
items,
user: userSecond,
width: 400,
Expand All @@ -112,6 +117,9 @@ test('Messagelist appearance with scrollbar', async (t) => {
component.renderMessage(message);
},
});

const chat = new Chat('#container');
await chat.repaint();
});

test('Messagelist should scrolled to the latest messages after being rendered inside an invisible element', async (t) => {
Expand All @@ -133,7 +141,7 @@ test('Messagelist should scrolled to the latest messages after being rendered in

const items = generateMessages(17, userFirst, userSecond, true, false, 2);

return createWidget('dxTabPanel', {
await createWidget('dxTabPanel', {
width: 400,
height: 500,
deferRendering: true,
Expand All @@ -145,12 +153,15 @@ test('Messagelist should scrolled to the latest messages after being rendered in
}, {
title: 'Tab_2',
collapsible: true,
template: ClientFunction(() => ($('<div>') as any).dxChat({
template: ClientFunction(() => ($('<div id="chat">') as any).dxChat({
items,
user: userSecond,
}), { dependencies: { items, userSecond } }),
}],
});

const chat = new Chat('#chat');
await chat.repaint();
});

test('Messagelist with loadindicator appearance on initial loading', async (t) => {
Expand Down Expand Up @@ -182,6 +193,9 @@ test('Messagelist with loadindicator appearance on initial loading', async (t) =
height: 600,
};
});

const chat = new Chat('#container');
await chat.repaint();
});

test('Messagelist with messageTemplate', async (t) => {
Expand Down Expand Up @@ -213,7 +227,7 @@ test('Messagelist with messageTemplate', async (t) => {
text: 'CCC',
}];

return createWidget('dxChat', {
await createWidget('dxChat', {
items,
user: userFirst,
width: 400,
Expand All @@ -227,6 +241,9 @@ test('Messagelist with messageTemplate', async (t) => {
$('<div>').text(`${message.author.name} says: ${message.text}`).appendTo(container);
},
});

const chat = new Chat('#container');
await chat.repaint();
});

test('Messagelist options showDayHeaders, showUserName and showMessageTimestamp set to false work', async (t) => {
Expand Down Expand Up @@ -256,7 +273,7 @@ test('Messagelist options showDayHeaders, showUserName and showMessageTimestamp
text: 'CCC',
}];

return createWidget('dxChat', {
await createWidget('dxChat', {
items,
user: userFirst,
width: 400,
Expand All @@ -265,6 +282,9 @@ test('Messagelist options showDayHeaders, showUserName and showMessageTimestamp
showUserName: false,
showMessageTimestamp: false,
});

const chat = new Chat('#container');
await chat.repaint();
});

fixture`ChatMessageList: dayHeaders`
Expand Down Expand Up @@ -314,12 +334,15 @@ test.clientScripts([
text: 'EEE',
}];

return createWidget('dxChat', {
await createWidget('dxChat', {
items,
user: userSecond,
width: 400,
height: 600,
});

const chat = new Chat('#container');
await chat.repaint();
}).after(async () => {
await ClientFunction(() => {
(window as any).MockDate.reset();
Expand Down
16 changes: 12 additions & 4 deletions e2e/testcafe-devextreme/tests/chat/typingIndicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ test('Chat: typing indicator with emptyview', async (t) => {
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);

const chat = new Chat('#container');
await chat.repaint();

await testScreenshot(t, takeScreenshot, 'Typing indicator with emptyview.png', {
element: '#container',
Expand Down Expand Up @@ -44,11 +43,14 @@ test('Chat: typing indicator with emptyview', async (t) => {
{ name: 'Elodie Montclair' },
];

return createWidget('dxChat', {
await createWidget('dxChat', {
width: 400,
height: 600,
typingUsers,
});

const chat = new Chat('#container');
await chat.repaint();
});

test('Chat: typing indicator with a lot of items', async (t) => {
Expand All @@ -70,13 +72,16 @@ test('Chat: typing indicator with a lot of items', async (t) => {

const typingUsers = [userFirst];

return createWidget('dxChat', {
await createWidget('dxChat', {
user: userSecond,
width: 400,
height: 600,
items,
typingUsers,
}, '#chat');

const chat = new Chat('#chat');
await chat.repaint();
});

test('Chat: typing indicator', async (t) => {
Expand Down Expand Up @@ -120,11 +125,14 @@ test('Chat: typing indicator', async (t) => {

const typingUsers = [userFirst];

return createWidget('dxChat', {
await createWidget('dxChat', {
user: userSecond,
width: 400,
height: 600,
items,
typingUsers,
}, '#chat');

const chat = new Chat('#chat');
await chat.repaint();
});

0 comments on commit 51d4f74

Please sign in to comment.