Skip to content

Commit

Permalink
Revert "Chat: Make screenshot test stable"
Browse files Browse the repository at this point in the history
This reverts commit f61f89a.
  • Loading branch information
marker dao ® committed Dec 11, 2024
1 parent 00acb58 commit e328982
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 253 deletions.
17 changes: 2 additions & 15 deletions e2e/testcafe-devextreme/tests/chat/alertList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ test.clientScripts([
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
const chat = new Chat('#container');

await testScreenshot(t, takeScreenshot, 'Alertlist with one error.png', {
element: '#container',
themeChanged: async () => {
await chat.repaint();
},
});
await testScreenshot(t, takeScreenshot, 'Alertlist with one error.png', { element: '#container' });

await chat.option('alerts', [
{ id: 1, message: 'Error Message 1. Error Description...' },
Expand All @@ -35,9 +30,6 @@ test.clientScripts([
compactCallBack: async () => {
await chat.repaint();
},
themeChanged: async () => {
await chat.repaint();
},
});

const darkTheme = getFullThemeName().replace('light', 'dark');
Expand All @@ -51,12 +43,7 @@ test.clientScripts([

await chat.option('rtlEnabled', true);

await testScreenshot(t, takeScreenshot, 'Alertlist appearance in RTL mode.png', {
element: '#container',
themeChanged: async () => {
await chat.repaint();
},
});
await testScreenshot(t, takeScreenshot, 'Alertlist appearance in RTL mode.png', { element: '#container' });

await t
.expect(compareResults.isValid())
Expand Down
25 changes: 4 additions & 21 deletions e2e/testcafe-devextreme/tests/chat/avatar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,9 @@ fixture.disablePageReloads`ChatAvatar`

test('Chat: avatar', async (t) => {
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
const chat = new Chat('#chat');
await testScreenshot(t, takeScreenshot, 'Avatar with two word initials.png', { element: '#chat' });

await testScreenshot(t, takeScreenshot, 'Avatar with two word initials.png', {
element: '#chat',
themeChanged: async () => {
await chat.repaint();
},
});
const chat = new Chat('#chat');

const userFirst = createUser(1, 'First', avatarUrl);
const userSecond = createUser(2, 'Second', avatarUrl);
Expand All @@ -27,12 +22,7 @@ test('Chat: avatar', async (t) => {

await chat.option('items', items);

await testScreenshot(t, takeScreenshot, 'Avatar with image.png', {
element: '#chat',
themeChanged: async () => {
await chat.repaint();
},
});
await testScreenshot(t, takeScreenshot, 'Avatar with image.png', { element: '#chat' });

await t
.expect(compareResults.isValid())
Expand All @@ -55,14 +45,7 @@ test('Chat: avatar', async (t) => {

test('Chat: showAvatar set to false', async (t) => {
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
const chat = new Chat('#chat');

await testScreenshot(t, takeScreenshot, 'Avatar with showAvatar set to false.png', {
element: '#chat',
themeChanged: async () => {
await chat.repaint();
},
});
await testScreenshot(t, takeScreenshot, 'Avatar with showAvatar set to false.png', { element: '#chat' });

await t
.expect(compareResults.isValid())
Expand Down
28 changes: 4 additions & 24 deletions e2e/testcafe-devextreme/tests/chat/messageBox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,16 @@ test('Chat: messagebox', async (t) => {
const longText = getLongText(false, 5);

await chat.focus();
await testScreenshot(t, takeScreenshot, 'Messagebox when chat has focus.png', {
element: '#chat',
themeChanged: async () => {
await chat.repaint();
},
});
await testScreenshot(t, takeScreenshot, 'Messagebox when chat has focus.png', { element: '#chat' });

await t.typeText(chat.getInput(), shortText);
await testScreenshot(t, takeScreenshot, 'Messagebox when input contains short text.png', {
element: '#chat',
themeChanged: async () => {
await chat.repaint();
},
});
await testScreenshot(t, takeScreenshot, 'Messagebox when input contains short text.png', { element: '#chat' });

await t.typeText(chat.getInput(), longText);
await testScreenshot(t, takeScreenshot, 'Messagebox when input contains long text.png', {
element: '#chat',
themeChanged: async () => {
await chat.repaint();
},
});
await testScreenshot(t, takeScreenshot, 'Messagebox when input contains long text.png', { element: '#chat' });

await t.pressKey('tab');
await testScreenshot(t, takeScreenshot, 'Messagebox when send button has focus.png', {
element: '#chat',
themeChanged: async () => {
await chat.repaint();
},
});
await testScreenshot(t, takeScreenshot, 'Messagebox when send button has focus.png', { element: '#chat' });

await t
.expect(compareResults.isValid())
Expand Down
14 changes: 2 additions & 12 deletions e2e/testcafe-devextreme/tests/chat/messageBubble.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,12 @@ test('Chat: messagebubble', async (t) => {
let items = generateMessages(2, userFirst, userSecond, true, false, 2);

await chat.option({ items, user: userSecond });
await testScreenshot(t, takeScreenshot, 'Bubbles with long text.png', {
element: '#chat',
themeChanged: async () => {
await chat.repaint();
},
});
await testScreenshot(t, takeScreenshot, 'Bubbles with long text.png', { element: '#chat' });

items = generateMessages(2, userFirst, userSecond, true, true, 2);

await chat.option({ items });
await testScreenshot(t, takeScreenshot, 'Bubbles with long text with line breaks.png', {
element: '#chat',
themeChanged: async () => {
await chat.repaint();
},
});
await testScreenshot(t, takeScreenshot, 'Bubbles with long text with line breaks.png', { element: '#chat' });

await t
.expect(compareResults.isValid())
Expand Down
54 changes: 7 additions & 47 deletions e2e/testcafe-devextreme/tests/chat/messageGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,11 @@ fixture.disablePageReloads`ChatMessageGroup`

test('Chat: messagegroup, avatar rendering', async (t) => {
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
const chat = new Chat('#chat');

await testScreenshot(t, takeScreenshot, 'Avatar has correct position.png', {
element: '#chat',
themeChanged: async () => {
await chat.repaint();
},
});
await testScreenshot(t, takeScreenshot, 'Avatar has correct position.png', { element: '#chat' });

await setStyleAttribute(Selector(AVATAR_SELECTOR), 'width: 64px; height: 64px');
await testScreenshot(t, takeScreenshot, 'Avatar sizes do not affect indentation between bubbles.png', {
element: '#chat',
themeChanged: async () => {
await chat.repaint();
},
});
await testScreenshot(t, takeScreenshot, 'Avatar sizes do not affect indentation between bubbles.png', { element: '#chat' });

await t
.expect(compareResults.isValid())
Expand All @@ -54,14 +43,8 @@ test('Chat: messagegroup, avatar rendering', async (t) => {

test('Chat: messagegroup, information', async (t) => {
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
const chat = new Chat('#chat');

await testScreenshot(t, takeScreenshot, 'Information row with long user name.png', {
element: '#chat',
themeChanged: async () => {
await chat.repaint();
},
});
await testScreenshot(t, takeScreenshot, 'Information row with long user name.png', { element: '#chat' });

await t
.expect(compareResults.isValid())
Expand Down Expand Up @@ -93,42 +76,22 @@ test('Chat: messagegroup, bubbles', async (t) => {
let items = generateMessages(1, userFirst, userSecond, false, false, 4, 2);

await chat.option({ items, user: userSecond });
await testScreenshot(t, takeScreenshot, 'Messagegroup with 1 bubble.png', {
element: '#chat',
themeChanged: async () => {
await chat.repaint();
},
});
await testScreenshot(t, takeScreenshot, 'Messagegroup with 1 bubble.png', { element: '#chat' });

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

await chat.option({ items });
await testScreenshot(t, takeScreenshot, 'Messagegroup with 2 bubbles.png', {
element: '#chat',
themeChanged: async () => {
await chat.repaint();
},
});
await testScreenshot(t, takeScreenshot, 'Messagegroup with 2 bubbles.png', { element: '#chat' });

items = generateMessages(3, userFirst, userSecond, false, false, 4, 2);

await chat.option({ items });
await testScreenshot(t, takeScreenshot, 'Messagegroup with 3 bubbles.png', {
element: '#chat',
themeChanged: async () => {
await chat.repaint();
},
});
await testScreenshot(t, takeScreenshot, 'Messagegroup with 3 bubbles.png', { element: '#chat' });

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

await chat.option({ items });
await testScreenshot(t, takeScreenshot, 'Messagegroup with 4 bubbles.png', {
element: '#chat',
themeChanged: async () => {
await chat.repaint();
},
});
await testScreenshot(t, takeScreenshot, 'Messagegroup with 4 bubbles.png', { element: '#chat' });

await t
.expect(compareResults.isValid())
Expand Down Expand Up @@ -163,9 +126,6 @@ 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
Loading

0 comments on commit e328982

Please sign in to comment.