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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
/packages/devextreme/js/ui/shared/** @DevExpress/devextreme-grids
/packages/devextreme/js/__internal/ui/shared/** @DevExpress/devextreme-grids
/packages/testcafe-models/gridCore/** @DevExpress/devextreme-grids
/e2e/playwright/models/gridCore/** @DevExpress/devextreme-grids

/packages/devextreme-scss/scss/widgets/*/gridBase/** @DevExpress/devextreme-grids

Expand All @@ -66,6 +67,8 @@
/packages/testcafe-models/dataGrid/** @DevExpress/devextreme-grids
/e2e/testcafe-devextreme/tests/dataGrid/** @DevExpress/devextreme-grids
/e2e/playwright/tests/accessibility/dataGrid/** @DevExpress/devextreme-grids
/e2e/playwright/tests/dataGrid/** @DevExpress/devextreme-grids
/e2e/playwright/models/dataGrid/** @DevExpress/devextreme-grids

/apps/demos/Demos/DataGrid/** @DevExpress/devextreme-grids
/apps/demos/testing/widgets/datagrid/** @DevExpress/devextreme-grids
Expand All @@ -84,9 +87,11 @@
/packages/devextreme/testing/tests/*/treeList.* @DevExpress/devextreme-grids
/packages/testcafe-models/treeList/** @DevExpress/devextreme-grids
/e2e/testcafe-devextreme/tests/common/treeList/** @DevExpress/devextreme-grids
/e2e/playwright/tests/accessibility/treeList/** @DevExpress/devextreme-grids
/e2e/playwright/tests/accessibility/treeList/** @DevExpress/devextreme-grids
/e2e/playwright/tests/common/treeList/** @DevExpress/devextreme-grids
/e2e/playwright/models/treeList/** @DevExpress/devextreme-grids

/apps/demos/Demos/TreeList/** @DevExpress/devextreme-grids
/apps/demos/Demos/TreeList/** @DevExpress/devextreme-grids

## filter_builder
/packages/devextreme/js/ui/filter_builder_types.d.ts @DevExpress/devextreme-grids
Expand All @@ -99,11 +104,13 @@

/packages/devextreme/testing/tests/*/filterBuilder.* @DevExpress/devextreme-grids
/packages/devextreme/testing/tests/DevExpress.ui.widgets/filterBuilderParts/** @DevExpress/devextreme-grids
/e2e/testcafe-devextreme/tests/common/filterBuilder/** @DevExpress/devextreme-grids
/e2e/playwright/tests/accessibility/filterBuilder.spec.ts @DevExpress/devextreme-grids
/packages/testcafe-models/filterBuilder/** @DevExpress/devextreme-grids
/e2e/testcafe-devextreme/tests/common/filterBuilder/** @DevExpress/devextreme-grids
/e2e/playwright/tests/accessibility/filterBuilder.spec.ts @DevExpress/devextreme-grids
/packages/testcafe-models/filterBuilder/** @DevExpress/devextreme-grids
/e2e/playwright/tests/common/filterBuilder/** @DevExpress/devextreme-grids
/e2e/playwright/models/filterBuilder/** @DevExpress/devextreme-grids

/apps/demos/Demos/FilterBuilder/** @DevExpress/devextreme-grids
/apps/demos/Demos/FilterBuilder/** @DevExpress/devextreme-grids

## sortable
/packages/devextreme/js/ui/sortable_types.d.ts @DevExpress/devextreme-grids
Expand Down Expand Up @@ -144,7 +151,9 @@
/apps/demos/Demos/CardView/** @DevExpress/devextreme-grids
/packages/testcafe-models/cardView/** @DevExpress/devextreme-grids
/e2e/testcafe-devextreme/tests/cardView/** @DevExpress/devextreme-grids
/e2e/playwright/tests/accessibility/cardView/** @DevExpress/devextreme-grids
/e2e/playwright/tests/accessibility/cardView/** @DevExpress/devextreme-grids
/e2e/playwright/tests/cardView/** @DevExpress/devextreme-grids
/e2e/playwright/models/cardView/** @DevExpress/devextreme-grids

# Scheduler

Expand Down
8 changes: 7 additions & 1 deletion e2e/playwright/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ viewport is 1200×800 and the widgets of the previous test are disposed.
| `RequestMock` | `mockApi` on top of `page.route` |
| `mockdate` | `mockDate` on top of `page.clock` |
| machine timezone on the agent | `TIMEZONE` → the browser context |
| `t.typeText` | `locator.pressSequentially` |
| `t.typeText` | a click, then `pressSequentially` (Typing) |
| `t.pressKey('ctrl+a')` | `page.keyboard.press('Control+a')` |
| `t.expect(selector.value)` | `expect(locator).toHaveValue` |
| `t.expect(widget.option('x'))` | `expect.poll(() => widget.option('x'))` |
Expand All @@ -269,6 +269,12 @@ test would run once more in the tagged job.
editors do not react to it. Type with `pressSequentially`, and press keys under their Playwright
names: `Enter`, `Escape`, `ArrowLeft`, `Control+a`.

`t.typeText` did more than type. It clicked the element unless the element already had the focus,
put the caret at the end of the value (`replace: true` selected the whole value instead), and only
then sent the keys. `pressSequentially` alone focuses the element without a click, so a widget that
reacts to the pointer (a grid moving its focused cell) never sees it, and the caret stays where the
browser puts it, which can be the start of the value. Port it as all three steps.

**Checks.** TestCafe retried `t.expect(selector.value)`; here only `expect(locator)` and
`expect.poll` retry. `expect(await locator.inputValue()).toBe(x)` reads the value once and fails
whenever the page is a moment late.
Expand Down
12 changes: 4 additions & 8 deletions e2e/playwright/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,10 @@ export default [
},
},
{
files: [
'helpers/**/*.ts',
'models/**/*.ts',
'tests/editors/**/*.ts',
'tests/navigation/**/*.ts',
'tests/common/*.ts',
'tests/common/gantt/**/*.ts',
'tests/common/pagination/**/*.ts',
files: ['**/*.ts'],
ignores: [
'playwright.config.ts',
'tests/scheduler/**/*.ts',
],
rules: {
'no-restricted-syntax': ['error', {
Expand Down
4 changes: 2 additions & 2 deletions e2e/playwright/models/cardView/headerItem.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { Locator } from '@playwright/test';
import FocusableElement from '../internal/focusable';
import GridElement from '../gridCore/element';

const CLASS = {
filterIcon: 'dx-header-filter-icon',
};

export default class HeaderItem extends FocusableElement {
export default class HeaderItem extends GridElement {
public getFilterIcon(): Locator {
return this.element.locator(`.${CLASS.filterIcon}`);
}
Expand Down
16 changes: 0 additions & 16 deletions e2e/playwright/models/cardView/headers/headers.ts

This file was deleted.

3 changes: 0 additions & 3 deletions e2e/playwright/models/cardView/headers/item.ts

This file was deleted.

8 changes: 0 additions & 8 deletions e2e/playwright/models/cardView/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type { Locator } from '@playwright/test';
import type { WidgetName } from '../types';
import GridCore, { CLASS as CLASS_BASE } from '../gridCore';
import Card from './card';
import HeadersElement from './headers/headers';
import HeaderPanel from './headerPanel';
import Toolbar from './toolbar';

Expand All @@ -27,13 +26,6 @@ export default class CardView extends GridCore {
return new Card(this.getCards().nth(nth), this.getName());
}

public getHeaders(): HeadersElement {
return new HeadersElement(
this.element.locator(`.${this.addWidgetPrefix(CLASS.headers)}`),
this.getName(),
);
}

public getHeaderPanel(): HeaderPanel {
return new HeaderPanel(
this.element.locator(`.${this.addWidgetPrefix(CLASS.headers)}`),
Expand Down
10 changes: 2 additions & 8 deletions e2e/playwright/models/cardView/toolbar.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import type { Locator } from '@playwright/test';
import Button from '../button';
import GridElement from '../gridCore/element';

export default class Toolbar {
public readonly element: Locator;

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

export default class Toolbar extends GridElement {
public getAddButton(): Button {
return new Button(this.element.page(), this.element.locator('[aria-label=\'add\']'));
}
Expand Down
4 changes: 2 additions & 2 deletions e2e/playwright/models/dataGrid/adaptiveDetailRow.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import FocusableElement from '../internal/focusable';
import GridElement from '../gridCore/element';

export default class AdaptiveDetailRow extends FocusableElement {}
export default class AdaptiveDetailRow extends GridElement {}
33 changes: 33 additions & 0 deletions e2e/playwright/models/dataGrid/commandCell.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import type { Locator } from '@playwright/test';
import GridFocusableElement from '../gridCore/focusable';

const CLASS = {
commandEdit: 'dx-command-edit',
commandExpand: 'dx-command-expand',
commandSelect: 'dx-command-select',
commandAdaptive: 'dx-command-adaptive',
commandAI: 'dx-command-ai',
editButton: 'dx-link-edit',
};

const commandSelector = [
`.${CLASS.commandEdit}`,
`.${CLASS.commandExpand}`,
`.${CLASS.commandSelect}`,
`.${CLASS.commandAdaptive}`,
`.${CLASS.commandAI}`,
].join(', ');

export default class CommandCell extends GridFocusableElement {
constructor(dataRow: Locator, index: number) {
super(dataRow.locator(`:scope > td[aria-colindex='${index + 1}']:is(${commandSelector})`));
}

public getButton(index: number): Locator {
return this.element.locator(':scope > *').nth(index);
}

public getEditButton(): Locator {
return this.element.locator(`.${CLASS.editButton}`);
}
}
30 changes: 14 additions & 16 deletions e2e/playwright/models/dataGrid/data/cell.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
import type { Locator } from '@playwright/test';
import { expect } from '@playwright/test';
import FocusableElement from '../../internal/focusable';
import { classMatcher } from '../../internal/classMatcher';
import GridFocusableElement from '../../gridCore/focusable';
import { expectClass } from '../../internal/classMatcher';
import { CellEditor } from './cellEditor';

const CLASS = {
editCell: 'dx-editor-cell',
focused: 'dx-focused',
editorInput: 'dx-texteditor-input',
cellModified: 'dx-cell-modified',
checkbox: 'dx-checkbox',
};

export default class DataCell extends FocusableElement {
export default class DataCell extends GridFocusableElement {
constructor(dataRow: Locator, index: number) {
super(dataRow.locator(`td[aria-colindex='${index + 1}']`));
}

private async expectClass(className: string, present: boolean): Promise<void> {
// TestCafe reads the state of the first match; legacy fixed columns render every row twice.
const assertion = expect(this.element.first());

await (present ? assertion : assertion.not).toHaveClass(classMatcher(className));
public expectEditCell(present = true): Promise<void> {
return expectClass(this.element, CLASS.editCell, present);
}

public expectEditCell(present = true): Promise<void> {
return this.expectClass(CLASS.editCell, present);
public expectModified(present = true): Promise<void> {
return expectClass(this.element, CLASS.cellModified, present);
}

public expectFocused(present = true): Promise<void> {
return this.expectClass(CLASS.focused, present);
public getEditor(): CellEditor {
return new CellEditor(this.element.locator(`.${CLASS.editorInput}, .${CLASS.checkbox}`));
}

public expectModified(present = true): Promise<void> {
return this.expectClass(CLASS.cellModified, present);
public getCheckbox(): Locator {
return this.element.locator(`.${CLASS.checkbox}`);
}
}
26 changes: 26 additions & 0 deletions e2e/playwright/models/dataGrid/data/cellEditor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type { Locator } from '@playwright/test';
import GridElement from '../../gridCore/element';
import { expectClass } from '../../internal/classMatcher';

const CLASS = {
checkboxChecked: 'dx-checkbox-checked',
dropDownEditorButton: 'dx-dropdowneditor-button',
editFormItem: 'dx-datagrid-edit-form-item',
fieldItemLabel: 'dx-field-item-label',
};

export class CellEditor extends GridElement {
public getItemLabel(): Locator {
return this.element
.locator(`xpath=ancestor::*[contains(concat(' ', normalize-space(@class), ' '), ' ${CLASS.editFormItem} ')]`)
.locator(`.${CLASS.fieldItemLabel}`);
}

public getDropDownButton(): Locator {
return this.element.locator('xpath=../..').locator(`.${CLASS.dropDownEditorButton}`);
}

public expectChecked(present = true): Promise<void> {
return expectClass(this.element, CLASS.checkboxChecked, present);
}
}
32 changes: 17 additions & 15 deletions e2e/playwright/models/dataGrid/data/row.ts
Original file line number Diff line number Diff line change
@@ -1,40 +1,42 @@
import { expect } from '@playwright/test';
import GridModule from '../../gridCore/module';
import { classMatcher } from '../../internal/classMatcher';
import GridFocusableElement from '../../gridCore/focusable';
import { expectClass } from '../../internal/classMatcher';
import CommandCell from '../commandCell';
import DataCell from './cell';

const CLASS = {
focusedRow: 'dx-row-focused',
rowRemoved: 'dx-row-removed',
selection: 'dx-selection',
insertedRow: 'dx-row-inserted',
editedRow: 'dx-edit-row',
};

export default class DataRow extends GridModule {
private async expectClass(className: string, present: boolean): Promise<void> {
// TestCafe reads the state of the first match; legacy fixed columns render every row twice.
const assertion = expect(this.element.first());

await (present ? assertion : assertion.not).toHaveClass(classMatcher(className));
}

export default class DataRow extends GridFocusableElement {
public expectRemoved(present = true): Promise<void> {
return this.expectClass(CLASS.rowRemoved, present);
return expectClass(this.element, CLASS.rowRemoved, present);
}

public expectFocusedRow(present = true): Promise<void> {
return this.expectClass(CLASS.focusedRow, present);
return expectClass(this.element, CLASS.focusedRow, present);
}

public expectSelected(present = true): Promise<void> {
return this.expectClass(CLASS.selection, present);
return expectClass(this.element, CLASS.selection, present);
}

public expectInserted(present = true): Promise<void> {
return expectClass(this.element, CLASS.insertedRow, present);
}

public expectEdited(present = true): Promise<void> {
return this.expectClass(CLASS.editedRow, present);
return expectClass(this.element, CLASS.editedRow, present);
}

public getDataCell(index: number): DataCell {
return new DataCell(this.element, index);
}

public getCommandCell(index: number): CommandCell {
return new CommandCell(this.element, index);
}
}
10 changes: 8 additions & 2 deletions e2e/playwright/models/dataGrid/editForm.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import type { Locator } from '@playwright/test';
import FocusableElement from '../internal/focusable';
import GridElement from '../gridCore/element';

const CLASS = {
form: 'dx-form',
textEditorInput: 'dx-texteditor-input',
checkbox: 'dx-checkbox',
};

export default class EditForm extends FocusableElement {
export default class EditForm extends GridElement {
public readonly form: Locator;

public readonly saveButton: Locator;
Expand All @@ -18,4 +20,8 @@ export default class EditForm extends FocusableElement {
this.saveButton = buttons.nth(0);
this.cancelButton = buttons.nth(1);
}

public getItem(id: string): Locator {
return this.form.locator(`.${CLASS.textEditorInput}[id*=_${id}], .${CLASS.checkbox}[id*=_${id}]`);
}
}
4 changes: 2 additions & 2 deletions e2e/playwright/models/dataGrid/filter/cell.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { Locator, Page } from '@playwright/test';
import FocusableElement from '../../internal/focusable';
import GridElement from '../../gridCore/element';

const CLASS = {
filterEditor: 'dx-widget',
filterEditorContainer: 'dx-editor-container',
menuButton: 'dx-menu-item',
};

export default class FilterCell extends FocusableElement {
export default class FilterCell extends GridElement {
public readonly menuButton: Locator;

constructor(element: Locator) {
Expand Down
Loading