|
| 1 | +import { createScreenshotsComparer } from 'devextreme-screenshot-comparer'; |
| 2 | +import { Selector } from 'testcafe'; |
| 3 | +import { runManualTest } from '../../../utils/visual-tests/matrix-test-helper'; |
| 4 | +import { testScreenshot } from '../../../utils/visual-tests/helpers/theme-utils'; |
| 5 | + |
| 6 | +fixture('Chat.Customization') |
| 7 | + .page('http://localhost:8080/') |
| 8 | + .before(async (ctx) => { |
| 9 | + ctx.initialWindowSize = [900, 800]; |
| 10 | + }); |
| 11 | + |
| 12 | +runManualTest('Chat', 'Customization', ['jQuery'], (test) => { |
| 13 | + test('Customization', async (t) => { |
| 14 | + const { takeScreenshot, compareResults } = createScreenshotsComparer(t); |
| 15 | + |
| 16 | + await t |
| 17 | + .click('#day-headers-format') |
| 18 | + .click(Selector('.dx-list-item').nth(2)) |
| 19 | + .wait(500); |
| 20 | + |
| 21 | + await testScreenshot(t, takeScreenshot, `chat_customization_day_headers_format_is_changed.png`); |
| 22 | + |
| 23 | + await t |
| 24 | + .click('#show-day-headers'); |
| 25 | + |
| 26 | + await testScreenshot(t, takeScreenshot, 'chat_customization_day_headers_is_hidden.png'); |
| 27 | + |
| 28 | + await t |
| 29 | + .click('#show-avatar'); |
| 30 | + |
| 31 | + await testScreenshot(t, takeScreenshot, 'chat_customization_avatar_is_hidden.png'); |
| 32 | + |
| 33 | + await t |
| 34 | + .click('#show-avatar'); |
| 35 | + |
| 36 | + await t |
| 37 | + .click('#show-user-name'); |
| 38 | + |
| 39 | + await testScreenshot(t, takeScreenshot, 'chat_customization_username_is_hidden.png'); |
| 40 | + |
| 41 | + await t |
| 42 | + .click('#show-user-name'); |
| 43 | + |
| 44 | + await t |
| 45 | + .click('#message-timestamp-format') |
| 46 | + .click(Selector('.dx-list-item').nth(5)) |
| 47 | + .wait(500); |
| 48 | + |
| 49 | + await testScreenshot(t, takeScreenshot, `chat_customization_message_timestamp_format_is_changed.png`); |
| 50 | + |
| 51 | + await t |
| 52 | + .click('#show-message-timestamp'); |
| 53 | + |
| 54 | + await testScreenshot(t, takeScreenshot, 'chat_customization_message_timestamps_is_hidden.png'); |
| 55 | + |
| 56 | + await t |
| 57 | + .typeText('.dx-texteditor-input','testing') |
| 58 | + .pressKey('enter') |
| 59 | + .click('#chat-disabled'); |
| 60 | + |
| 61 | + await testScreenshot(t, takeScreenshot, 'chat_customization_is_disabled_after_sent.png'); |
| 62 | + |
| 63 | + await t |
| 64 | + .expect(compareResults.isValid()) |
| 65 | + .ok(compareResults.errorMessages()); |
| 66 | + }); |
| 67 | +}); |
0 commit comments