Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 1 addition & 3 deletions .github/workflows/testcafe_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,7 @@ jobs:
{ "componentFolder": "dataGrid", "name": "dataGrid (1/4)", "indices": "1/4", "cache": true, "concurrency": 5 },
{ "componentFolder": "dataGrid", "name": "dataGrid (2/4)", "indices": "2/4", "cache": true, "concurrency": 5 },
{ "componentFolder": "dataGrid", "name": "dataGrid (3/4)", "indices": "3/4", "cache": true, "concurrency": 5 },
{ "componentFolder": "dataGrid", "name": "dataGrid (4/4)", "indices": "4/4", "cache": true, "concurrency": 5 },

{ "componentFolder": "navigation", "name": "navigation", "concurrency": 6 }
{ "componentFolder": "dataGrid", "name": "dataGrid (4/4)", "indices": "4/4", "cache": true, "concurrency": 5 }
]
JSON
)
Expand Down
15 changes: 15 additions & 0 deletions e2e/playwright/helpers/clickUtils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { Locator, Page } from '@playwright/test';
import { pointWithin } from './dragUtils';

// TestCafe's "t.click(target, { offsetX, offsetY })" clicked the point even when it lay outside the
// target ("body" with offsetY: 400 on a shorter page), so this clicks the page point with the mouse
// instead of asking the target to receive the click.
export const clickWithOffset = async (
page: Page,
target: Locator,
{ offsetX, offsetY }: { offsetX?: number; offsetY?: number } = {},
): Promise<void> => {
const { x, y } = await pointWithin(target, offsetX, offsetY);

await page.mouse.click(x, y);
};
9 changes: 9 additions & 0 deletions e2e/playwright/helpers/domUtils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Locator, Page } from '@playwright/test';
import { expect } from '../fixtures';

const STYLESHEET_RULES_ID = 'stylesheetRules';

Expand Down Expand Up @@ -166,3 +167,11 @@ export const addFocusableElementAfter = async (
},
{ selector: targetSelector, id: elementId },
);

export const expectImagesLoaded = async (container: Locator, count: number): Promise<void> => {
const images = container.locator('img');

await expect(images).toHaveCount(count);
await expect.poll(() => images.evaluateAll((elements: HTMLImageElement[]) => elements
.every((image) => image.complete && image.naturalWidth > 0))).toBe(true);
};
2 changes: 1 addition & 1 deletion e2e/playwright/helpers/dragUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export const scrollIntoView = (
}
}, { maxMargin: MAX_SCROLL_MARGIN, offsetX, offsetY });

const pointWithin = async (
export const pointWithin = async (
element: Locator,
offsetX?: number,
offsetY?: number,
Expand Down
4 changes: 4 additions & 0 deletions e2e/playwright/models/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@ export default class Button extends Widget {
public expectSelected(present = true): Promise<void> {
return this.expectClass(CLASS.selected, present);
}

public expectItemSelected(present = true): Promise<void> {
return this.expectClass(CLASS.itemSelected, present);
}
}
24 changes: 24 additions & 0 deletions e2e/playwright/models/buttonGroup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { Locator, Page } from '@playwright/test';
import type { WidgetName } from './types';
import Widget from './internal/widget';
import Button from './button';

const CLASS = {
item: 'dx-button',
};

export default class ButtonGroup extends Widget {
name: WidgetName = 'dxButtonGroup';

public readonly items: Locator;

constructor(page: Page, selector: Locator | string) {
super(page, selector);

this.items = this.element.locator(`.${CLASS.item}`);
}

public getItem(index = 0): Button {
return new Button(this.page, this.items.nth(index));
}
}
15 changes: 15 additions & 0 deletions e2e/playwright/models/gallery/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { WidgetName } from '../types';
import Widget from '../internal/widget';
import GalleryIndicatorItem from './indicatorItem';

const CLASS = {
indicatorItem: 'dx-gallery-indicator-item',
};

export default class Gallery extends Widget {
name: WidgetName = 'dxGallery';

public getIndicatorItem(index = 0): GalleryIndicatorItem {
return new GalleryIndicatorItem(this.element.locator(`.${CLASS.indicatorItem}`).nth(index));
}
}
18 changes: 18 additions & 0 deletions e2e/playwright/models/gallery/indicatorItem.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { Locator } from '@playwright/test';
import { expectClass } from '../internal/classMatcher';

const CLASS = {
selected: 'dx-gallery-indicator-item-selected',
};

export default class GalleryIndicatorItem {
public readonly element: Locator;

constructor(element: Locator) {
this.element = element;
}

public expectSelected(present = true): Promise<void> {
return expectClass(this.element, CLASS.selected, present);
}
}
15 changes: 15 additions & 0 deletions e2e/playwright/models/multiView.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { WidgetName } from './types';
import Widget from './internal/widget';
import FocusableElement from './internal/focusable';

const CLASS = {
item: 'dx-multiview-item',
};

export default class MultiView extends Widget {
name: WidgetName = 'dxMultiView';

public getItem(index = 0): FocusableElement {
return new FocusableElement(this.element.locator(`.${CLASS.item}`).nth(index));
}
}
15 changes: 15 additions & 0 deletions e2e/playwright/models/stepper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { Locator } from '@playwright/test';
import type { WidgetName } from './types';
import Widget from './internal/widget';

const CLASS = {
item: 'dx-step',
};

export default class Stepper extends Widget {
name: WidgetName = 'dxStepper';

public getItem(index = 0): Locator {
return this.element.locator(`.${CLASS.item}`).nth(index);
}
}
18 changes: 17 additions & 1 deletion e2e/playwright/models/tabPanel.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
import type { Locator } from '@playwright/test';
import type { Locator, Page } from '@playwright/test';
import type { WidgetName } from './types';
import Widget from './internal/widget';
import MultiView from './multiView';
import Tabs from './tabs';

const CLASS = {
tab: 'dx-tab',
tabsContainer: 'dx-tabpanel-tabs',
tabs: 'dx-tabs',
};

export default class TabPanel extends Widget {
name: WidgetName = 'dxTabPanel';

public readonly tabs: Tabs;

public readonly multiView: MultiView;

constructor(page: Page, selector: Locator | string) {
super(page, selector);

this.tabs = new Tabs(page, this.element.locator(`:scope > .${CLASS.tabsContainer} > .${CLASS.tabs}`));
// TabPanel extends MultiView: its own element is the MultiView.
this.multiView = new MultiView(page, this.element);
}

public getTab(index = 0): Locator {
return this.element.locator(`.${CLASS.tab}`).nth(index);
}
Expand Down
15 changes: 15 additions & 0 deletions e2e/playwright/models/tabs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { WidgetName } from './types';
import Widget from './internal/widget';
import FocusableElement from './internal/focusable';

const CLASS = {
item: 'dx-tab',
};

export default class Tabs extends Widget {
name: WidgetName = 'dxTabs';

public getItem(index = 0): FocusableElement {
return new FocusableElement(this.element.locator(`.${CLASS.item}`).nth(index));
}
}
3 changes: 1 addition & 2 deletions e2e/playwright/tests/editors/chat/avatar.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { test } from '../../../fixtures';
import { createWidget } from '../../../helpers/createWidget';
import { appendElementTo } from '../../../helpers/domUtils';
import { appendElementTo, expectImagesLoaded } from '../../../helpers/domUtils';
import { testScreenshot } from '../../../helpers/screenshots';
import Chat from '../../../models/chat';
import { avatarUrl, createUser, generateMessages } from './data';
import { expectImagesLoaded } from './utils';

test.describe('ChatAvatar', () => {
test('Chat: avatar', async ({ page }) => {
Expand Down
3 changes: 1 addition & 2 deletions e2e/playwright/tests/editors/chat/messageBubble.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { test } from '../../../fixtures';
import { createWidget } from '../../../helpers/createWidget';
import { appendElementTo } from '../../../helpers/domUtils';
import { appendElementTo, expectImagesLoaded } from '../../../helpers/domUtils';
import { testScreenshot } from '../../../helpers/screenshots';
import Chat from '../../../models/chat';
import {
Expand All @@ -10,7 +10,6 @@ import {
generateImageMessage,
generateMessages,
} from './data';
import { expectImagesLoaded } from './utils';

test.describe('ChatMessageBubble', () => {
test('Chat: messagebubble', async ({ page }) => {
Expand Down
10 changes: 0 additions & 10 deletions e2e/playwright/tests/editors/chat/utils.ts

This file was deleted.

36 changes: 36 additions & 0 deletions e2e/playwright/tests/navigation/accordion/common.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import type { Item } from 'devextreme/ui/accordion';
import { test } from '../../../fixtures';
import { createWidget } from '../../../helpers/createWidget';
import { appendElementTo, setAttribute } from '../../../helpers/domUtils';
import { testScreenshot } from '../../../helpers/screenshots';

test.describe('Accordion_common', () => {
test('Accordion items render (T865742)', async ({ page }) => {
await appendElementTo(page, '#container', 'div', 'accordion');
await appendElementTo(page, '#container', 'div', 'accordion2');

await setAttribute(page, '#container', 'style', 'display: flex; gap: 50px;');

const items: Item[] = [
{ title: 'Some text 1', icon: 'coffee' },
{ title: 'Some text 2' },
{ title: 'Some text 3' },
];

await createWidget(page, 'dxAccordion', { items, width: 500 }, '#accordion');
await createWidget(page, 'dxAccordion', { items, rtlEnabled: true, width: 500 }, '#accordion2');

await testScreenshot(page, 'Accordion items render.png', { element: '#container' });
});

test('Icon-only button should be rendered correctly (T851081)', async ({ page }) => {
await appendElementTo(page, '#container', 'div', 'accordion');

await createWidget(page, 'dxAccordion', () => ({
dataSource: [{}],
itemTitleTemplate: () => ($('<div>') as any).dxButton({ icon: 'coffee' }),
}), '#accordion');

await testScreenshot(page, 'Accordion with icon-only button.png', { element: '#container' });
});
});
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