Skip to content

Commit

Permalink
Chat: add testcafe test for customization demo (DevExpress#28458)
Browse files Browse the repository at this point in the history
Co-authored-by: EugeniyKiyashko <[email protected]>
  • Loading branch information
1 parent ad2e892 commit d1fa0a8
Show file tree
Hide file tree
Showing 24 changed files with 76 additions and 1 deletion.
67 changes: 67 additions & 0 deletions apps/demos/testing/widgets/chat/Customization.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { createScreenshotsComparer } from 'devextreme-screenshot-comparer';
import { Selector } from 'testcafe';
import { runManualTest } from '../../../utils/visual-tests/matrix-test-helper';
import { testScreenshot } from '../../../utils/visual-tests/helpers/theme-utils';

fixture('Chat.Customization')
.page('http://localhost:8080/')
.before(async (ctx) => {
ctx.initialWindowSize = [900, 800];
});

runManualTest('Chat', 'Customization', ['jQuery'], (test) => {
test('Customization', async (t) => {
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);

await t
.click('#day-headers-format')
.click(Selector('.dx-list-item').nth(2))
.wait(500);

await testScreenshot(t, takeScreenshot, `chat_customization_day_headers_format_is_changed.png`);

await t
.click('#show-day-headers');

await testScreenshot(t, takeScreenshot, 'chat_customization_day_headers_is_hidden.png');

await t
.click('#show-avatar');

await testScreenshot(t, takeScreenshot, 'chat_customization_avatar_is_hidden.png');

await t
.click('#show-avatar');

await t
.click('#show-user-name');

await testScreenshot(t, takeScreenshot, 'chat_customization_username_is_hidden.png');

await t
.click('#show-user-name');

await t
.click('#message-timestamp-format')
.click(Selector('.dx-list-item').nth(5))
.wait(500);

await testScreenshot(t, takeScreenshot, `chat_customization_message_timestamp_format_is_changed.png`);

await t
.click('#show-message-timestamp');

await testScreenshot(t, takeScreenshot, 'chat_customization_message_timestamps_is_hidden.png');

await t
.typeText('.dx-texteditor-input','testing')
.pressKey('enter')
.click('#chat-disabled');

await testScreenshot(t, takeScreenshot, 'chat_customization_is_disabled_after_sent.png');

await t
.expect(compareResults.isValid())
.ok(compareResults.errorMessages());
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const testStub = {
page() { return this; },
},
page() { return this; },
clientScripts() { return this; }
};

function updateChanges(value, options) {
Expand Down
9 changes: 8 additions & 1 deletion apps/demos/utils/visual-tests/matrix-test-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,14 @@ export function runManualTestCore(testObject, product, demo, framework, callback
return;
}

const test = testObject.page(`http://localhost:8080/apps/demos/Demos/${product}/${demo}/${framework}/`);
const clientScriptSource = globalReadFrom(__dirname, `../../Demos/${product}/${demo}/client-script.js`, (x) => [{ content: x }]) || [];

const test = testObject
.clientScripts([
{ module: 'mockdate' },
...clientScriptSource
])
.page(`http://localhost:8080/apps/demos/Demos/${product}/${demo}/${framework}/`);

test.before?.(async (t) => {
const [width, height] = t.fixtureCtx.initialWindowSize;
Expand Down

0 comments on commit d1fa0a8

Please sign in to comment.