@uxf/e2e-playwright 11.114.0 → 11.115.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components.d.ts +1 -0
- package/components.js +2 -0
- package/data-grid/table.d.ts +20 -0
- package/data-grid/table.e2e.d.ts +1 -0
- package/data-grid/table.e2e.js +11 -0
- package/data-grid/table.js +40 -0
- package/package.json +3 -3
- package/playwright.config.js +7 -6
- package/ui/checkbox-input.js +1 -1
- package/ui/text-input.d.ts +1 -0
- package/ui/text-input.e2e.js +2 -0
- package/ui/text-input.js +3 -2
package/components.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export declare function createUi(page: Page): {
|
|
|
3
3
|
button: (finder: import("./ui/button").ButtonFinder) => import("./ui/button").ButtonModel;
|
|
4
4
|
checkboxInput: (finder: import("./ui/checkbox-input").CheckboxInputFinder) => import("./ui/checkbox-input").CheckboxInputModel;
|
|
5
5
|
combobox: (finder: import("./ui/combobox").ComboboxFinder) => import("./ui/combobox").ComboboxModel;
|
|
6
|
+
dataGridTable: (finder: import("./data-grid/table").DataGridTableFinder) => import("./data-grid/table").DataGridTableModel;
|
|
6
7
|
datePickerInput: (finder: import("./ui/date-picker-input").DatePickerInputFinder) => import("./ui/date-picker-input").DatePickerInputModel;
|
|
7
8
|
datetimePickerInput: (finder: import("./ui/datetime-picker-input").DatetimePickerInputFinder) => import("./ui/datetime-picker-input").DatetimePickerInputModel;
|
|
8
9
|
dropzone: (finder: import("./ui/dropzone").DropzoneFinder) => import("./ui/dropzone").DropzoneModel;
|
package/components.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createUi = createUi;
|
|
4
|
+
const table_1 = require("./data-grid/table");
|
|
4
5
|
const button_1 = require("./ui/button");
|
|
5
6
|
const checkbox_input_1 = require("./ui/checkbox-input");
|
|
6
7
|
const combobox_1 = require("./ui/combobox");
|
|
@@ -22,6 +23,7 @@ function createUi(page) {
|
|
|
22
23
|
button: (0, button_1.button)(page),
|
|
23
24
|
checkboxInput: (0, checkbox_input_1.checkboxInput)(page),
|
|
24
25
|
combobox: (0, combobox_1.combobox)(page),
|
|
26
|
+
dataGridTable: (0, table_1.dataGridTable)(page),
|
|
25
27
|
datePickerInput: (0, date_picker_input_1.datePickerInput)(page),
|
|
26
28
|
datetimePickerInput: (0, datetime_picker_input_1.datetimePickerInput)(page),
|
|
27
29
|
dropzone: (0, dropzone_1.dropzone)(page),
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Page } from "@playwright/test";
|
|
2
|
+
import { BaseFinder } from "../utils/base-finder";
|
|
3
|
+
import { BaseModel } from "../utils/base-model";
|
|
4
|
+
export interface DataGridTableFinder extends BaseFinder {
|
|
5
|
+
nth?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare class DataGridTableModel extends BaseModel {
|
|
8
|
+
private readonly bodyLocator;
|
|
9
|
+
private readonly headerLocator;
|
|
10
|
+
constructor(page: Page, finder: DataGridTableFinder);
|
|
11
|
+
private getColumnIndex;
|
|
12
|
+
getRowCount(): Promise<number>;
|
|
13
|
+
/** When using a numeric column index, checkbox and action cells are counted */
|
|
14
|
+
shouldHaveCellValue(data: {
|
|
15
|
+
content: string;
|
|
16
|
+
row?: number;
|
|
17
|
+
column: number | string;
|
|
18
|
+
}): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export declare const dataGridTable: (page: Page) => (finder: DataGridTableFinder) => DataGridTableModel;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const test_1 = require("@playwright/test");
|
|
4
|
+
const components_1 = require("../components");
|
|
5
|
+
(0, test_1.test)("DataGridTable", async ({ page }) => {
|
|
6
|
+
const ui = (0, components_1.createUi)(page);
|
|
7
|
+
await page.goto("/examples/data-grid/table-v2/Default");
|
|
8
|
+
(0, test_1.expect)(await ui.dataGridTable({ nth: 0 }).getRowCount()).toBe(12);
|
|
9
|
+
await ui.dataGridTable({}).shouldHaveCellValue({ column: "Text", content: "Red" });
|
|
10
|
+
await ui.dataGridTable({}).shouldHaveCellValue({ row: 2, column: 1, content: "Green" });
|
|
11
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dataGridTable = exports.DataGridTableModel = void 0;
|
|
4
|
+
const test_1 = require("@playwright/test");
|
|
5
|
+
const base_model_1 = require("../utils/base-model");
|
|
6
|
+
class DataGridTableModel extends base_model_1.BaseModel {
|
|
7
|
+
constructor(page, finder) {
|
|
8
|
+
var _a, _b;
|
|
9
|
+
const container = (_a = finder.parent) !== null && _a !== void 0 ? _a : page;
|
|
10
|
+
super(page, container.locator(".uxf-dg-table").nth((_b = finder.nth) !== null && _b !== void 0 ? _b : 0));
|
|
11
|
+
this.bodyLocator = this.locator.locator(".uxf-dg-table__body");
|
|
12
|
+
this.headerLocator = this.locator.locator(".uxf-dg-table__header");
|
|
13
|
+
}
|
|
14
|
+
async getColumnIndex(title) {
|
|
15
|
+
const index = await this.headerLocator
|
|
16
|
+
.locator(".uxf-dg-table__cell--header")
|
|
17
|
+
.evaluateAll((els, t) => els.findIndex((el) => el.textContent.trim() === t), title);
|
|
18
|
+
if (index === -1) {
|
|
19
|
+
throw new Error(`Column "${title}" not found in data grid table header`);
|
|
20
|
+
}
|
|
21
|
+
return index;
|
|
22
|
+
}
|
|
23
|
+
async getRowCount() {
|
|
24
|
+
return this.bodyLocator.locator(".uxf-dg-table__row").count();
|
|
25
|
+
}
|
|
26
|
+
/** When using a numeric column index, checkbox and action cells are counted */
|
|
27
|
+
async shouldHaveCellValue(data) {
|
|
28
|
+
var _a;
|
|
29
|
+
const columnIndex = typeof data.column === "string" ? await this.getColumnIndex(data.column) : data.column;
|
|
30
|
+
const cell = this.bodyLocator
|
|
31
|
+
.locator(".uxf-dg-table__row")
|
|
32
|
+
.nth((_a = data.row) !== null && _a !== void 0 ? _a : 0)
|
|
33
|
+
.locator(".uxf-dg-table__cell")
|
|
34
|
+
.nth(columnIndex);
|
|
35
|
+
await (0, test_1.expect)(cell).toHaveText(data.content);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.DataGridTableModel = DataGridTableModel;
|
|
39
|
+
const dataGridTable = (page) => (finder) => new DataGridTableModel(page, finder);
|
|
40
|
+
exports.dataGridTable = dataGridTable;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxf/e2e-playwright",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.115.0",
|
|
4
4
|
"description": "UXF Playwright helpers",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@playwright/test": "1.57.0",
|
|
20
20
|
"@uxf/core": "11.114.0",
|
|
21
|
-
"@uxf/ui": "11.
|
|
21
|
+
"@uxf/ui": "11.115.0",
|
|
22
22
|
"dayjs": "^1.11.19"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@playwright/test": "1.57.0",
|
|
26
26
|
"@uxf/core": "11.114.0",
|
|
27
|
-
"@uxf/ui": "11.
|
|
27
|
+
"@uxf/ui": "11.115.0",
|
|
28
28
|
"dayjs": "^1.11.19"
|
|
29
29
|
}
|
|
30
30
|
}
|
package/playwright.config.js
CHANGED
|
@@ -12,8 +12,8 @@ const test_1 = require("@playwright/test");
|
|
|
12
12
|
* See https://playwright.dev/docs/test-configuration.
|
|
13
13
|
*/
|
|
14
14
|
exports.default = (0, test_1.defineConfig)({
|
|
15
|
-
testDir: "
|
|
16
|
-
testMatch: "
|
|
15
|
+
testDir: ".",
|
|
16
|
+
testMatch: ["ui/**/*.e2e.ts", "data-grid/**/*.e2e.ts"],
|
|
17
17
|
/* Run tests in files in parallel */
|
|
18
18
|
fullyParallel: true,
|
|
19
19
|
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
|
@@ -39,14 +39,15 @@ exports.default = (0, test_1.defineConfig)({
|
|
|
39
39
|
name: "chromium",
|
|
40
40
|
use: { ...test_1.devices["Desktop Chrome"] },
|
|
41
41
|
},
|
|
42
|
-
{
|
|
42
|
+
/*{
|
|
43
43
|
name: "firefox",
|
|
44
|
-
use: { ...
|
|
44
|
+
use: { ...devices["Desktop Firefox"] },
|
|
45
45
|
},
|
|
46
|
+
|
|
46
47
|
{
|
|
47
48
|
name: "webkit",
|
|
48
|
-
use: { ...
|
|
49
|
-
}
|
|
49
|
+
use: { ...devices["Desktop Safari"] },
|
|
50
|
+
},*/
|
|
50
51
|
/* Test against mobile viewports. */
|
|
51
52
|
// {
|
|
52
53
|
// name: 'Mobile Chrome',
|
package/ui/checkbox-input.js
CHANGED
|
@@ -10,7 +10,7 @@ class CheckboxInputModel extends form_component_model_1.FormComponentModel {
|
|
|
10
10
|
}
|
|
11
11
|
async change(value) {
|
|
12
12
|
if (value !== (await this.fakeCheckboxLocator.evaluate((el) => el.classList.contains("is-selected")))) {
|
|
13
|
-
await this.
|
|
13
|
+
await this.fakeCheckboxLocator.click();
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
}
|
package/ui/text-input.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { FormComponentFinder } from "../utils/base-finder";
|
|
|
3
3
|
import { FormComponentModel } from "../utils/form-component-model";
|
|
4
4
|
export type TextInputFinder = FormComponentFinder;
|
|
5
5
|
export declare class TextInputModel extends FormComponentModel<string> {
|
|
6
|
+
private readonly fakeTextInputLocator;
|
|
6
7
|
constructor(page: Page, finder: FormComponentFinder);
|
|
7
8
|
change(value: string): Promise<void>;
|
|
8
9
|
getValue(): Promise<string>;
|
package/ui/text-input.e2e.js
CHANGED
|
@@ -8,4 +8,6 @@ const components_1 = require("../components");
|
|
|
8
8
|
await ui.textInput({ $name: "default" }).change("Value");
|
|
9
9
|
await ui.textInput({ $name: "error" }).shouldBeInvalid();
|
|
10
10
|
await ui.textInput({ $name: "withValue" }).getValue();
|
|
11
|
+
await page.goto("/examples/ui/text-input/OnlyForE2ETests");
|
|
12
|
+
await ui.textInput({ $name: "phoneNumber" }).change("123456789");
|
|
11
13
|
});
|
package/ui/text-input.js
CHANGED
|
@@ -6,12 +6,13 @@ const form_component_model_1 = require("../utils/form-component-model");
|
|
|
6
6
|
class TextInputModel extends form_component_model_1.FormComponentModel {
|
|
7
7
|
constructor(page, finder) {
|
|
8
8
|
super(text_input_1.TEXT_INPUT_COMPONENT_NAME, page, finder);
|
|
9
|
+
this.fakeTextInputLocator = this.locator.locator(":scope > .uxf-form-component__input > .uxf-input > .uxf-input__wrapper input");
|
|
9
10
|
}
|
|
10
11
|
async change(value) {
|
|
11
|
-
await this.
|
|
12
|
+
await this.fakeTextInputLocator.fill(value);
|
|
12
13
|
}
|
|
13
14
|
async getValue() {
|
|
14
|
-
return await this.
|
|
15
|
+
return await this.fakeTextInputLocator.inputValue();
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
18
|
exports.TextInputModel = TextInputModel;
|