@luomus/laji-form 15.0.0 → 15.1.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/package.json +1 -1
- package/test-export/test-utils.d.ts +4 -3
- package/test-export/test-utils.js +31 -27
package/package.json
CHANGED
|
@@ -38,14 +38,15 @@ interface DemoPageProps {
|
|
|
38
38
|
}
|
|
39
39
|
export declare class Form {
|
|
40
40
|
protected page: Page;
|
|
41
|
-
|
|
41
|
+
protected $locator: Locator;
|
|
42
|
+
constructor(page: Page, $locator?: Locator);
|
|
42
43
|
$form: Locator;
|
|
43
44
|
/** Locates a field with a dot separated identifier, e.g. "gatherings.0.units.1" */
|
|
44
45
|
$locate(path: string): Locator;
|
|
45
46
|
/** Locates a button for a field with a dot separated identifier, e.g. "gatherings.0.units.1" */
|
|
46
|
-
$locateButton(path: string, selector: string): Locator;
|
|
47
|
+
$locateButton(path: string, selector: string, locateFromBody?: boolean): Locator;
|
|
47
48
|
/** Locates some additional element for a field with a dot separated identifier, e.g. "gatherings.0.units.1" */
|
|
48
|
-
$locateAddition(path: string, selector: string): Locator;
|
|
49
|
+
$locateAddition(path: string, selector: string, locateFromBody?: boolean): Locator;
|
|
49
50
|
createValidatorPO: (type: "error" | "warning") => {
|
|
50
51
|
$all: Locator;
|
|
51
52
|
$panel: Locator;
|
|
@@ -43,21 +43,22 @@ function getEnumWidgetForContainer($container) {
|
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
45
|
class Form {
|
|
46
|
-
constructor(page) {
|
|
46
|
+
constructor(page, $locator = page.locator(".laji-form")) {
|
|
47
47
|
this.page = page;
|
|
48
|
-
this.$
|
|
48
|
+
this.$locator = $locator;
|
|
49
|
+
this.$form = this.$locator.locator(".rjsf");
|
|
49
50
|
this.createValidatorPO = (type) => ({
|
|
50
|
-
$all: this.
|
|
51
|
-
$panel: this.
|
|
51
|
+
$all: this.$locator.locator(`.laji-form-error-list:not(.laji-form-failed-jobs-list) .${type}-panel .list-group button`),
|
|
52
|
+
$panel: this.$locator.locator(`.laji-form-error-list:not(.laji-form-failed-jobs-list) .${type}-panel`)
|
|
52
53
|
});
|
|
53
54
|
this.errors = this.createValidatorPO("error");
|
|
54
55
|
this.warnings = this.createValidatorPO("warning");
|
|
55
56
|
this.failedJobs = {
|
|
56
|
-
$container: this.
|
|
57
|
-
$errors: this.
|
|
57
|
+
$container: this.$locator.locator(".laji-form-failed-jobs-list"),
|
|
58
|
+
$errors: this.$locator.locator(".laji-form-failed-jobs-list").locator(".list-group-item")
|
|
58
59
|
};
|
|
59
|
-
this.$runningJobs = this.
|
|
60
|
-
this.$acknowledgeWarnings = this.
|
|
60
|
+
this.$runningJobs = this.$locator.locator(".running-jobs");
|
|
61
|
+
this.$acknowledgeWarnings = this.$locator.locator(".laji-form-warning-list .panel-footer button");
|
|
61
62
|
this.$blocker = this.page.locator(".laji-form.blocking-loader");
|
|
62
63
|
this.$mapFieldFullscreenMap = this.page.locator(".laji-form.fullscreen .laji-form-map");
|
|
63
64
|
this.getImageArrayField = (lajiFormLocator) => {
|
|
@@ -71,7 +72,7 @@ class Form {
|
|
|
71
72
|
$imgs: $imgContainers.locator("img"),
|
|
72
73
|
$imgLoading: $imgContainers.locator(".react-spinner"),
|
|
73
74
|
$imgRemoves: $imgContainers.locator(".button-corner"),
|
|
74
|
-
$imgRemoveConfirmButton: (id) => this.$locateAddition(id, "delete-confirm-yes"),
|
|
75
|
+
$imgRemoveConfirmButton: (id) => this.$locateAddition(id, "delete-confirm-yes", true),
|
|
75
76
|
$dropzone: this.$locate(lajiFormLocator).locator(".laji-form-drop-zone"),
|
|
76
77
|
$modal,
|
|
77
78
|
$addModal,
|
|
@@ -87,7 +88,7 @@ class Form {
|
|
|
87
88
|
$getGlyph: (glyph) => this.$locate(lajiFormLocator).locator(glyph),
|
|
88
89
|
$suggestedGlyph: this.$locate(lajiFormLocator).locator(".glyphicon-ok"),
|
|
89
90
|
$nonsuggestedGlyph: this.$locate(lajiFormLocator).locator(".glyphicon-warning-sign"),
|
|
90
|
-
$powerUserButton: this.
|
|
91
|
+
$powerUserButton: this.$locator.locator(".power-user-addon")
|
|
91
92
|
};
|
|
92
93
|
};
|
|
93
94
|
this.getScopeField = (lajiFormLocator) => ({
|
|
@@ -101,18 +102,21 @@ class Form {
|
|
|
101
102
|
$listItems: this.page.locator(".scope-field-modal .list-group-item"),
|
|
102
103
|
}
|
|
103
104
|
});
|
|
104
|
-
this.getLocationChooser = (lajiFormLocator) =>
|
|
105
|
-
$
|
|
106
|
-
|
|
107
|
-
$
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
105
|
+
this.getLocationChooser = (lajiFormLocator) => {
|
|
106
|
+
const $peeker = this.$locateButton(lajiFormLocator, "location-peeker", true);
|
|
107
|
+
return {
|
|
108
|
+
$button: this.$locateButton(lajiFormLocator, "location"),
|
|
109
|
+
modal: {
|
|
110
|
+
$container: this.page.locator(".map-dialog"),
|
|
111
|
+
map: new test_utils_1.MapPageObject(this.page, this.page.locator(".map-dialog .laji-map"))
|
|
112
|
+
},
|
|
113
|
+
peeker: {
|
|
114
|
+
$popover: $peeker,
|
|
115
|
+
$map: $peeker.locator(".laji-map"),
|
|
116
|
+
$markers: $peeker.locator(".vector-marker path"),
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
};
|
|
116
120
|
this.getUnitListShorthandArrayField = (lajiFormLocator) => ({
|
|
117
121
|
$button: this.$locateButton(lajiFormLocator, "addUnitList"),
|
|
118
122
|
modal: {
|
|
@@ -141,15 +145,15 @@ class Form {
|
|
|
141
145
|
}
|
|
142
146
|
/** Locates a field with a dot separated identifier, e.g. "gatherings.0.units.1" */
|
|
143
147
|
$locate(path) {
|
|
144
|
-
return this.
|
|
148
|
+
return this.$locator.locator(exports.lajiFormLocator(path));
|
|
145
149
|
}
|
|
146
150
|
/** Locates a button for a field with a dot separated identifier, e.g. "gatherings.0.units.1" */
|
|
147
|
-
$locateButton(path, selector) {
|
|
148
|
-
return this.page.locator(`#root${typeof path === "string" && path.length > 0 ? `_${path.replace(/\./g, "_")}` : ""}-${selector}`);
|
|
151
|
+
$locateButton(path, selector, locateFromBody = false) {
|
|
152
|
+
return (locateFromBody ? this.page : this.$locator).locator(`#root${typeof path === "string" && path.length > 0 ? `_${path.replace(/\./g, "_")}` : ""}-${selector}`);
|
|
149
153
|
}
|
|
150
154
|
/** Locates some additional element for a field with a dot separated identifier, e.g. "gatherings.0.units.1" */
|
|
151
|
-
$locateAddition(path, selector) {
|
|
152
|
-
return this.$locateButton(path, selector);
|
|
155
|
+
$locateAddition(path, selector, locateFromBody = false) {
|
|
156
|
+
return this.$locateButton(path, selector, locateFromBody);
|
|
153
157
|
}
|
|
154
158
|
getBooleanWidget(str) {
|
|
155
159
|
const $container = this.$locate(str).locator(".btn-toolbar");
|