Skip to content

Commit

Permalink
CI: make testcafe tests stable (#28707)
Browse files Browse the repository at this point in the history
  • Loading branch information
EugeniyKiyashko authored Jan 15, 2025
1 parent 7c52858 commit 2f4cacb
Show file tree
Hide file tree
Showing 157 changed files with 427 additions and 339 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/testcafe_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,10 @@ jobs:
{ componentFolder: "scheduler/timezones", name: "scheduler (America/Los_Angeles)", timezone: "America/Los_Angeles" },
{ componentFolder: "form", name: "form (1/2)", indices: "1/2" },
{ componentFolder: "form", name: "form (2/2)", indices: "2/2" },
{ componentFolder: "form", name: "form - material (1/2)", theme: 'material.blue.light', indices: "1/2" },
{ componentFolder: "form", name: "form - material (2/2)", theme: 'material.blue.light', indices: "2/2" },
{ componentFolder: "form", name: "form - material (1/4)", theme: 'material.blue.light', indices: "1/4" },
{ componentFolder: "form", name: "form - material (2/4)", theme: 'material.blue.light', indices: "2/4" },
{ componentFolder: "form", name: "form - material (3/4)", theme: 'material.blue.light', indices: "3/4" },
{ componentFolder: "form", name: "form - material (4/4)", theme: 'material.blue.light', indices: "4/4" },
{ componentFolder: "form", name: "form - fluent (1/2)", theme: 'fluent.blue.light', indices: "1/2" },
{ componentFolder: "form", name: "form - fluent (2/2)", theme: 'fluent.blue.light', indices: "2/2" },
{ componentFolder: "editors", name: "editors (1/2)", indices: "1/2" },
Expand Down
19 changes: 19 additions & 0 deletions apps/demos/testing/common.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ const SKIPPED_TESTS = {
],
VectorMap: [
{ demo: 'Palette', themes: [THEME.material] },
{ demo: 'Overview', themes: [THEME.material] },
{ demo: 'PieMarkers', themes: [THEME.material] },
{ demo: 'AreaWithLabelsAndTwoLegends', themes: [THEME.material] },
{ demo: 'CustomAnnotations', themes: [THEME.material] },
{ demo: 'CustomProjection', themes: [THEME.material] },
{ demo: 'MultipleLayers', themes: [THEME.material] },
Expand All @@ -136,9 +139,12 @@ const SKIPPED_TESTS = {
Charts: [
{ demo: 'PiesWithEqualSize', themes: [THEME.material] },
{ demo: 'CustomAnnotations', themes: [THEME.material] },
{ demo: 'ServerSideDataProcessing', themes: [THEME.material] },
{ demo: 'SubvalueIndicatorTextFormatting', themes: [THEME.material] },
],
DataGrid: [
{ demo: 'SignalRService', themes: [THEME.material, THEME.fluent] },
{ demo: 'EditStateManagement', themes: [THEME.material] },
{ demo: 'MultipleRecordSelectionModes', themes: [THEME.fluent] },
{ demo: 'ToolbarCustomization', themes: [THEME.fluent, THEME.material] },
{ demo: 'MultipleRecordSelectionAPI', themes: [THEME.material] },
Expand All @@ -156,6 +162,7 @@ const SKIPPED_TESTS = {
{ demo: 'ItemDragging', themes: [THEME.fluent, THEME.material] },
],
VectorMap: [
{ demo: 'Overview', themes: [THEME.material] },
{ demo: 'PieMarkers', themes: [THEME.material] },
{ demo: 'CustomAnnotations', themes: [THEME.material] },
{ demo: 'CustomMapData', themes: [THEME.material] },
Expand All @@ -174,6 +181,8 @@ const SKIPPED_TESTS = {
{ demo: 'LayoutCustomization', themes: [THEME.material] },
],
Gauges: [
{ demo: 'SubvalueIndicatorTextFormatting', themes: [THEME.material] },
{ demo: 'VariableNumberOfSubvalueIndicators', themes: [THEME.material] },
{ demo: 'DifferentValueIndicatorTypesLinearGauge', themes: [THEME.material] },
{ demo: 'ScaleLabelFormatting', themes: [THEME.material] },
],
Expand All @@ -183,9 +192,12 @@ const SKIPPED_TESTS = {
{ demo: 'TilingAlgorithms', themes: [THEME.material] },
{ demo: 'ExportAndPrintingAPI', themes: [THEME.material] },
{ demo: 'DiscreteAxisZoomingAndScrolling', themes: [THEME.material] },
{ demo: 'Line', themes: [THEME.material] },
{ demo: 'Spline', themes: [THEME.material] },
{ demo: 'Colorization', themes: [THEME.material] },
{ demo: 'SignalRService', themes: [THEME.material] },
{ demo: 'PointsAggregation', themes: [THEME.material] },
{ demo: 'SubvalueIndicatorTextFormatting', themes: [THEME.material] },
{ demo: 'AxisLabelsOverlapping', themes: [THEME.material] },
{ demo: 'ServerSideDataProcessing', themes: [THEME.material] },
{ demo: 'PiesWithEqualSize', themes: [THEME.material] },
Expand All @@ -196,6 +208,7 @@ const SKIPPED_TESTS = {
],
DataGrid: [
{ demo: 'SignalRService', themes: [THEME.fluent, THEME.material] },
{ demo: 'EditStateManagement', themes: [THEME.material] },
{ demo: 'ToolbarCustomization', themes: [THEME.fluent, THEME.material] },
{ demo: 'MultipleRecordSelectionModes', themes: [THEME.fluent] },
{ demo: 'FilteringAPI', themes: [THEME.material] },
Expand Down Expand Up @@ -228,7 +241,9 @@ const SKIPPED_TESTS = {
],
Gauges: [
{ demo: 'Overview', themes: [THEME.material] },
{ demo: 'VariableNumberOfSubvalueIndicators', themes: [THEME.material] },
{ demo: 'ScaleLabelFormatting', themes: [THEME.material] },
{ demo: 'SubvalueIndicatorTextFormatting', themes: [THEME.material] },
{ demo: 'DifferentValueIndicatorTypes', themes: [THEME.material] },
{ demo: 'DifferentValueIndicatorTypesLinearGauge', themes: [THEME.material] },
],
Expand All @@ -242,6 +257,9 @@ const SKIPPED_TESTS = {
],
VectorMap: [
{ demo: 'CustomProjection', themes: [THEME.material] },
{ demo: 'Spline', themes: [THEME.material] },
{ demo: 'CustomAnnotations', themes: [THEME.material] },
{ demo: 'Palette', themes: [THEME.material] },
{ demo: 'Overview', themes: [THEME.material] },
{ demo: 'PieMarkers', themes: [THEME.material] },
{ demo: 'TooltipHTMLSupport', themes: [THEME.material] },
Expand All @@ -250,6 +268,7 @@ const SKIPPED_TESTS = {
{ demo: 'AreaWithLabelsAndTwoLegends', themes: [THEME.material] },
],
Gantt: [
{ demo: 'ContextMenu', themes: [THEME.material] },
{ demo: 'Validation', themes: [THEME.generic, THEME.material, THEME.fluent] },
{ demo: 'TaskTemplate', themes: [THEME.generic, THEME.material, THEME.fluent] },
],
Expand Down
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.
4 changes: 4 additions & 0 deletions apps/demos/utils/visual-tests/matrix-test-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ const SKIPPED_TESTS = {
{ demo: 'Overview', themes: [THEME.material] },
{ demo: 'ZoomingAndScrollingAPI', themes: [THEME.material] },
{ demo: 'ZoomingOnAreaSelection', themes: [THEME.material] },
{ demo: 'CustomLegendMarkers', themes: [THEME.material] },
{ demo: 'DialogsAndNotificationsOverview', themes: [THEME.material] },
],
VectorMap: [
Expand Down Expand Up @@ -307,6 +308,9 @@ const SKIPPED_TESTS = {
Charts: [
{ demo: 'Overview', themes: [THEME.material] },
{ demo: 'ZoomingAndScrollingAPI', themes: [THEME.material] },
{ demo: 'Crosshair', themes: [THEME.material] },
{ demo: 'CustomAnnotations', themes: [THEME.material] },
{ demo: 'CustomLegendMarkers', themes: [THEME.material] },
],
DataGrid: [
{ demo: 'BatchEditing', themes: [THEME.fluent] },
Expand Down
4 changes: 3 additions & 1 deletion e2e/testcafe-devextreme/helpers/themeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,7 @@ export async function testScreenshot(
.ok();
}

await changeTheme(process.env.theme ?? defaultThemeName);
if (isString(theme) || shouldTestInCompact) {
await changeTheme(process.env.theme ?? defaultThemeName);
}
}
36 changes: 18 additions & 18 deletions e2e/testcafe-devextreme/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ createTestCafe({
fs.rmSync('./screenshots', { recursive: true });
}

const browsers = args.browsers.split(' ').map(expandBrowserAlias);
const browsers = args.browsers
.split(' ')
.map((browser) => expandBrowserAlias(browser, args.componentFolder.trim()));
// eslint-disable-next-line no-console
console.log('Browsers:', browsers);

Expand Down Expand Up @@ -113,24 +115,22 @@ createTestCafe({
quarantineMode: { successThreshold: 1, attemptLimit: 5 },
};

if(args.componentFolder.trim() !== 'renovation') {
runOptions.hooks = {
test: {
before: async() => {
if(args.shadowDom) {
await addShadowRootTree();
}

if(args.theme) {
await changeTheme(args.theme);
}
},
after: async() => {
await testPageUtils.clearTestPage();
runOptions.hooks = {
test: {
before: async() => {
if(args.shadowDom) {
await addShadowRootTree();
}

if(args.theme) {
await changeTheme(args.theme);
}
},
};
}
after: async() => {
await testPageUtils.clearTestPage();
}
},
};

if(args.browsers === 'chrome:docker') {
runOptions.disableScreenshots = true;
Expand All @@ -155,7 +155,7 @@ function setShadowDom(args) {
process.env.shadowDom = args.shadowDom;
}

function expandBrowserAlias(browser) {
function expandBrowserAlias(browser, componentFolder) {
switch(browser) {
case 'chrome:devextreme-shr2':
return 'chrome:headless --disable-gpu --window-size=1200,800';
Expand Down
4 changes: 0 additions & 4 deletions e2e/testcafe-devextreme/tests/chat/alertList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ test.clientScripts([
timestamp: today,
author: userFirst,
text: 'Message text 4',
}, {
timestamp: today,
author: userFirst,
text: 'Message text 5',
}];

return createWidget('dxChat', {
Expand Down
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.
3 changes: 3 additions & 0 deletions e2e/testcafe-devextreme/tests/chat/messageGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,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
6 changes: 4 additions & 2 deletions e2e/testcafe-devextreme/tests/chat/messageList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { createWidget } from '../../helpers/createWidget';
import { testScreenshot } from '../../helpers/themeUtils';
import { insertStylesheetRulesToPage } from '../../helpers/domUtils';

const waitFont = ClientFunction(() => (window as any).DevExpress.ui.themes.waitWebFont('Item123somevalu*op ', 400));

fixture.disablePageReloads`ChatMessageList`
.page(url(__dirname, '../container.html'));

Expand Down Expand Up @@ -154,9 +156,7 @@ test('Messagelist should scrolled to the latest messages after being rendered in

test('Messagelist with loadindicator appearance on initial loading', async (t) => {
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
const chat = new Chat('#container');

await chat.repaint();
await testScreenshot(t, takeScreenshot, 'Messagelist loadindicator position on initial loading.png', { element: '#container' });

await t
Expand All @@ -165,6 +165,8 @@ test('Messagelist with loadindicator appearance on initial loading', async (t) =
}).before(async () => {
await insertStylesheetRulesToPage('.dx-loadindicator-content, .dx-loadindicator-icon, .dx-loadindicator-segment, .dx-loadindicator-segment-inner { animation-play-state: paused !important; }');

await waitFont();

await createWidget('dxChat', () => {
const data: Message[] = [];

Expand Down
11 changes: 9 additions & 2 deletions e2e/testcafe-devextreme/tests/chat/typingIndicator.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { createScreenshotsComparer } from 'devextreme-screenshot-comparer';
import Chat from 'devextreme-testcafe-models/chat';
import { ClientFunction } from 'testcafe';
import { createUser, generateMessages } from './data';
import url from '../../helpers/getPageUrl';
import { createWidget } from '../../helpers/createWidget';
import { getFullThemeName, testScreenshot } from '../../helpers/themeUtils';
import { appendElementTo, insertStylesheetRulesToPage } from '../../helpers/domUtils';

const CHAT_TYPINGINDICATOR_CIRCLE_CLASS = 'dx-chat-typingindicator-circle';
const waitFont = ClientFunction(() => (window as any).DevExpress.ui.themes.waitWebFont('Item123somevalu*op ', 400));

fixture.disablePageReloads`ChatTypingIndicator`
.page(url(__dirname, '../container.html'));
Expand All @@ -15,8 +17,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',
shouldTestInCompact: true,
Expand Down Expand Up @@ -44,6 +44,8 @@ test('Chat: typing indicator with emptyview', async (t) => {
{ name: 'Elodie Montclair' },
];

await waitFont();

return createWidget('dxChat', {
width: 400,
height: 600,
Expand All @@ -53,6 +55,9 @@ test('Chat: typing indicator with emptyview', async (t) => {

test('Chat: typing indicator with a lot of items', async (t) => {
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
const chat = new Chat('#chat');

await chat.repaint();

await testScreenshot(t, takeScreenshot, 'Typing indicator with a lot of items.png', { element: '#chat' });

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

const typingUsers = [userFirst];

await waitFont();

return createWidget('dxChat', {
user: userSecond,
width: 400,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ safeSizeTest('Geometry is good', async (t) => {
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
const dateBox = new DateBox('#container');

await dateBox.option('opened', true);

await testScreenshot(t, takeScreenshot, 'Datebox with calendar.png');

await dateBox.option('opened', false);
await dateBox.option('type', 'datetime');
await dateBox.option('opened', true);

await testScreenshot(t, takeScreenshot, 'Datebox with datetime.png');

Expand All @@ -40,7 +44,6 @@ safeSizeTest('Geometry is good', async (t) => {
await waitFont();

return createWidget('dxDateBox', {
opened: true,
pickerType: 'calendar',
width: 200,
value: new Date(1.5e12),
Expand Down
Loading

0 comments on commit 2f4cacb

Please sign in to comment.