@uxf/e2e-playwright 15.2.0 → 15.2.1
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/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022–2026 UX Fans s.r.o.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @uxf/e2e-playwright
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@uxf/e2e-playwright)
|
|
4
|
+
|
|
3
5
|
Playwright helper classes a factory funkce pro testování UXF komponent.
|
|
4
6
|
|
|
5
7
|
```sh
|
|
@@ -190,7 +192,7 @@ ui.datePickerInput({ $name: "birthDate" }).change(new Date("1990-05-15"));
|
|
|
190
192
|
|
|
191
193
|
### `datetimePickerInput`
|
|
192
194
|
|
|
193
|
-
Vyplní vstup pro výběr data a času. Hodnota se formátuje jako `DD.MM.YYYY HH:mm
|
|
195
|
+
Vyplní vstup pro výběr data a času. Hodnota se formátuje jako `DD.MM.YYYY HH:mm`, bez sekund, které vstup nepřijímá.
|
|
194
196
|
|
|
195
197
|
```typescript
|
|
196
198
|
ui.datetimePickerInput({ $name: "scheduledAt" }).change(new Date("2025-01-15T14:30:00"));
|
|
@@ -200,9 +202,9 @@ ui.datetimePickerInput({ $name: "scheduledAt" }).change(new Date("2025-01-15T14:
|
|
|
200
202
|
| ------- | -------- | ---------------------------- |
|
|
201
203
|
| `$name` | `string` | Hodnota atributu `data-name` |
|
|
202
204
|
|
|
203
|
-
| Metoda | Parametr | Popis
|
|
204
|
-
| --------------- | -------- |
|
|
205
|
-
| `change(value)` | `Date` | Vyplní vstup datem a časem ve formátu `DD.MM.YYYY HH:mm
|
|
205
|
+
| Metoda | Parametr | Popis |
|
|
206
|
+
| --------------- | -------- | -------------------------------------------------------- |
|
|
207
|
+
| `change(value)` | `Date` | Vyplní vstup datem a časem ve formátu `DD.MM.YYYY HH:mm` |
|
|
206
208
|
|
|
207
209
|
---
|
|
208
210
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxf/e2e-playwright",
|
|
3
|
-
"version": "15.2.
|
|
3
|
+
"version": "15.2.1",
|
|
4
4
|
"description": "UXF Playwright helpers",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -13,18 +13,19 @@
|
|
|
13
13
|
"e2e:ci": "../../node_modules/.bin/playwright test",
|
|
14
14
|
"typecheck": "tsc --noEmit"
|
|
15
15
|
},
|
|
16
|
-
"author": "UX Fans s.r.o",
|
|
16
|
+
"author": "UX Fans s.r.o. <dev@uxf.cz>",
|
|
17
|
+
"homepage": "https://fe.uxf.dev/docs/e2e-playwright",
|
|
17
18
|
"license": "MIT",
|
|
18
19
|
"devDependencies": {
|
|
19
20
|
"@playwright/test": "1.64.1",
|
|
20
|
-
"@uxf/core": "15.
|
|
21
|
-
"@uxf/ui": "15.2.
|
|
21
|
+
"@uxf/core": "15.2.1",
|
|
22
|
+
"@uxf/ui": "15.2.1",
|
|
22
23
|
"dayjs": "^1.11.23"
|
|
23
24
|
},
|
|
24
25
|
"peerDependencies": {
|
|
25
26
|
"@playwright/test": "1.64.1",
|
|
26
|
-
"@uxf/core": "15.
|
|
27
|
-
"@uxf/ui": "15.2.
|
|
27
|
+
"@uxf/core": "15.2.1",
|
|
28
|
+
"@uxf/ui": "15.2.1",
|
|
28
29
|
"dayjs": "^1.11.23"
|
|
29
30
|
}
|
|
30
31
|
}
|
|
@@ -4,10 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const test_1 = require("@playwright/test");
|
|
7
|
+
const constants_1 = require("@uxf/ui/date-picker-input/constants");
|
|
7
8
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
8
9
|
const components_1 = require("../components");
|
|
9
10
|
(0, test_1.test)("DatePickerInput", async ({ page }) => {
|
|
10
11
|
const ui = (0, components_1.createUi)(page);
|
|
11
12
|
await page.goto("/examples/ui/date-picker-input/Default");
|
|
12
|
-
|
|
13
|
+
const input = ui.datePickerInput({ $name: "default" });
|
|
14
|
+
await input.change((0, dayjs_1.default)("2025-10-05").toDate());
|
|
15
|
+
// the display format replaces the typed text only once it parses, text that does not parse stays as typed
|
|
16
|
+
await (0, test_1.expect)(input.locator.locator(".uxf-input__element")).toHaveValue((0, dayjs_1.default)("2025-10-05").format(constants_1.DISPLAY_DATE_FORMAT));
|
|
13
17
|
});
|
package/ui/date-picker-input.js
CHANGED
|
@@ -7,14 +7,19 @@ exports.datePickerInput = exports.DatePickerInputModel = void 0;
|
|
|
7
7
|
const constants_1 = require("@uxf/ui/date-picker-input/constants");
|
|
8
8
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
9
9
|
const form_component_model_1 = require("../utils/form-component-model");
|
|
10
|
+
// not the display format, so that a test can tell the typed text parsed: the input replaces it with the display format
|
|
11
|
+
const TYPED_FORMAT = "DD.MM.YYYY";
|
|
12
|
+
if (!constants_1.ALLOWED_DATE_FORMAT.includes(TYPED_FORMAT)) {
|
|
13
|
+
// text the input does not accept stays in it and onChange reports null
|
|
14
|
+
throw new Error(`DatePickerInputModel types "${TYPED_FORMAT}", which @uxf/ui/date-picker-input no longer accepts`);
|
|
15
|
+
}
|
|
10
16
|
class DatePickerInputModel extends form_component_model_1.FormComponentModel {
|
|
11
17
|
constructor(page, finder) {
|
|
12
18
|
super(constants_1.DATE_PICKER_INPUT_COMPONENT_NAME, page, finder);
|
|
13
19
|
this.inputLocator = this.locator.locator(".uxf-input__element");
|
|
14
20
|
}
|
|
15
21
|
async change(value) {
|
|
16
|
-
|
|
17
|
-
await this.inputLocator.fill(datetimeValue);
|
|
22
|
+
await this.inputLocator.fill((0, dayjs_1.default)(value).format(TYPED_FORMAT));
|
|
18
23
|
}
|
|
19
24
|
}
|
|
20
25
|
exports.DatePickerInputModel = DatePickerInputModel;
|
|
@@ -4,10 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const test_1 = require("@playwright/test");
|
|
7
|
+
const constants_1 = require("@uxf/ui/datetime-picker-input/constants");
|
|
7
8
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
8
9
|
const components_1 = require("../components");
|
|
9
10
|
(0, test_1.test)("DatetimePickerInput", async ({ page }) => {
|
|
10
11
|
const ui = (0, components_1.createUi)(page);
|
|
11
12
|
await page.goto("/examples/ui/datetime-picker-input/Default");
|
|
12
|
-
|
|
13
|
+
const input = ui.datetimePickerInput({ $name: "default" });
|
|
14
|
+
await input.change((0, dayjs_1.default)("2025-10-05T14:30").toDate());
|
|
15
|
+
// the display format replaces the typed text only once it parses, text that does not parse stays as typed
|
|
16
|
+
await (0, test_1.expect)(input.locator.locator(".uxf-input__element")).toHaveValue((0, dayjs_1.default)("2025-10-05T14:30").format(constants_1.DISPLAY_DATETIME_FORMAT));
|
|
13
17
|
});
|
|
@@ -7,14 +7,19 @@ exports.datetimePickerInput = exports.DatetimePickerInputModel = void 0;
|
|
|
7
7
|
const constants_1 = require("@uxf/ui/datetime-picker-input/constants");
|
|
8
8
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
9
9
|
const form_component_model_1 = require("../utils/form-component-model");
|
|
10
|
+
// not the display format, so that a test can tell the typed text parsed: the input replaces it with the display format
|
|
11
|
+
const TYPED_FORMAT = "DD.MM.YYYY HH:mm";
|
|
12
|
+
if (!constants_1.ALLOWED_DATETIME_FORMAT.includes(TYPED_FORMAT)) {
|
|
13
|
+
// text the input does not accept stays in it and onChange reports null
|
|
14
|
+
throw new Error(`DatetimePickerInputModel types "${TYPED_FORMAT}", which @uxf/ui/datetime-picker-input no longer accepts`);
|
|
15
|
+
}
|
|
10
16
|
class DatetimePickerInputModel extends form_component_model_1.FormComponentModel {
|
|
11
17
|
constructor(page, finder) {
|
|
12
18
|
super(constants_1.DATETIME_PICKER_INPUT_COMPONENT_NAME, page, finder);
|
|
13
19
|
this.inputLocator = this.locator.locator(".uxf-input__element");
|
|
14
20
|
}
|
|
15
21
|
async change(value) {
|
|
16
|
-
|
|
17
|
-
await this.inputLocator.fill(datetimeValue);
|
|
22
|
+
await this.inputLocator.fill((0, dayjs_1.default)(value).format(TYPED_FORMAT));
|
|
18
23
|
}
|
|
19
24
|
}
|
|
20
25
|
exports.DatetimePickerInputModel = DatetimePickerInputModel;
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
const test_1 = require("@playwright/test");
|
|
7
|
+
const constants_1 = require("@uxf/ui/time-picker-input/constants");
|
|
8
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
4
9
|
const components_1 = require("../components");
|
|
5
10
|
(0, test_1.test)("Time picker input", async ({ page }) => {
|
|
6
11
|
const ui = (0, components_1.createUi)(page);
|
|
7
12
|
await page.goto("/examples/ui/time-picker-input/Default");
|
|
8
|
-
|
|
13
|
+
const input = ui.timePickerInput({ $name: "default" });
|
|
14
|
+
await input.change("08:05");
|
|
15
|
+
// the display format replaces the typed text only once it parses, text that does not parse stays as typed
|
|
16
|
+
await (0, test_1.expect)(input.locator.locator("input")).toHaveValue((0, dayjs_1.default)("2025-10-05T08:05").format(constants_1.DISPLAY_TIME_FORMAT));
|
|
9
17
|
await ui.timePickerInput({ $name: "invalid" }).shouldBeInvalid();
|
|
10
18
|
});
|