@luomus/laji-form 15.1.6 → 15.1.7
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 +3 -2
- package/test-export/test-utils.js +14 -13
package/package.json
CHANGED
|
@@ -57,8 +57,8 @@ interface DemoPageProps {
|
|
|
57
57
|
}
|
|
58
58
|
export declare class Form {
|
|
59
59
|
protected page: Page;
|
|
60
|
-
protected locator: Locator;
|
|
61
|
-
constructor(page: Page, locator?: Locator);
|
|
60
|
+
protected $locator: Locator;
|
|
61
|
+
constructor(page: Page, $locator?: Locator);
|
|
62
62
|
$form: Locator;
|
|
63
63
|
$locate(path: string): Locator;
|
|
64
64
|
$locateButton(path: string, selector: string, locateFromBody?: boolean): Locator;
|
|
@@ -252,6 +252,7 @@ export declare const mockImageMetadata: {
|
|
|
252
252
|
};
|
|
253
253
|
export declare const filterUUIDs: (any: any) => any;
|
|
254
254
|
export declare const maybeJSONPointerToLocator: (pointer: string) => string;
|
|
255
|
+
/** Fills value into given input and presses tab to unfocus it. Useful for inputs with debounce */
|
|
255
256
|
export declare const updateValue: ($input: Locator, value: string) => Promise<void>;
|
|
256
257
|
export declare const getRemoveUnit: (page: Page) => (gatheringIdx: number, unitIdx: number) => Promise<void>;
|
|
257
258
|
export {};
|
|
@@ -45,25 +45,25 @@ function getEnumWidgetForContainer($container) {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
class Form {
|
|
48
|
-
constructor(page, locator = page.locator(".laji-form")) {
|
|
48
|
+
constructor(page, $locator = page.locator(".laji-form")) {
|
|
49
49
|
this.page = page;
|
|
50
|
-
this
|
|
51
|
-
this.$form = this.
|
|
50
|
+
this.$locator = $locator;
|
|
51
|
+
this.$form = this.$locator.locator(".rjsf");
|
|
52
52
|
this.getMockStr = (path, query) => `window.mockResponses[window.getMockQueryKey(${JSON.stringify(path)}, ${JSON.stringify(query)})]`;
|
|
53
53
|
this.createValidatorPO = (type) => ({
|
|
54
|
-
$$all: this.
|
|
55
|
-
$panel: this.
|
|
54
|
+
$$all: this.$locator.locator(`.laji-form-error-list:not(.laji-form-failed-jobs-list) .${type}-panel .list-group button`),
|
|
55
|
+
$panel: this.$locator.locator(`.laji-form-error-list:not(.laji-form-failed-jobs-list) .${type}-panel`)
|
|
56
56
|
});
|
|
57
57
|
this.errors = this.createValidatorPO("error");
|
|
58
58
|
this.warnings = this.createValidatorPO("warning");
|
|
59
59
|
this.failedJobs = {
|
|
60
|
-
$container: this.
|
|
61
|
-
$$errors: this.
|
|
60
|
+
$container: this.$locator.locator(".laji-form-failed-jobs-list"),
|
|
61
|
+
$$errors: this.$locator.locator(".laji-form-failed-jobs-list .list-group-item")
|
|
62
62
|
};
|
|
63
|
-
this.$runningJobs = this.
|
|
64
|
-
this.$acknowledgeWarnings = this.
|
|
63
|
+
this.$runningJobs = this.$locator.locator(".running-jobs");
|
|
64
|
+
this.$acknowledgeWarnings = this.$locator.locator(".laji-form-warning-list .panel-footer button");
|
|
65
65
|
this.$blocker = this.page.locator(".laji-form.blocking-loader");
|
|
66
|
-
this.$mapFieldFullscreenMap = this.
|
|
66
|
+
this.$mapFieldFullscreenMap = this.$locator.locator(".laji-form.fullscreen .laji-form-map");
|
|
67
67
|
this.getImageArrayField = (lajiFormLocator) => {
|
|
68
68
|
const $container = this.$locate(lajiFormLocator).locator(".laji-form-medias");
|
|
69
69
|
const $imgContainers = this.$locate(lajiFormLocator).locator(".media-container");
|
|
@@ -92,7 +92,7 @@ class Form {
|
|
|
92
92
|
};
|
|
93
93
|
this.getTaxonAutosuggestWidget = (lajiFormLocator) => {
|
|
94
94
|
const autosuggest = this.getAutosuggestWidget(lajiFormLocator);
|
|
95
|
-
return Object.assign(Object.assign({}, autosuggest), { $powerUserButton: this.
|
|
95
|
+
return Object.assign(Object.assign({}, autosuggest), { $powerUserButton: this.$locator.locator(".power-user-addon"), $suggestedGlyph: this.$locate(lajiFormLocator).locator(".glyphicon-ok"), $nonsuggestedGlyph: this.$locate(lajiFormLocator).locator(".glyphicon-warning-sign") });
|
|
96
96
|
};
|
|
97
97
|
this.getPersonAutosuggestWidget = (lajiFormLocator) => {
|
|
98
98
|
const autosuggest = this.getAutosuggestWidget(lajiFormLocator);
|
|
@@ -151,10 +151,10 @@ class Form {
|
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
153
|
$locate(path) {
|
|
154
|
-
return this.
|
|
154
|
+
return this.$locator.locator(exports.lajiFormLocator(path));
|
|
155
155
|
}
|
|
156
156
|
$locateButton(path, selector, locateFromBody = false) {
|
|
157
|
-
return (locateFromBody ? this.page : this
|
|
157
|
+
return (locateFromBody ? this.page : this.$locator).locator(`#root${typeof path === "string" && path.length > 0 ? `_${path.replace(/\./g, "_")}` : ""}-${selector}`);
|
|
158
158
|
}
|
|
159
159
|
$locateAddition(path, selector, locateFromBody = false) {
|
|
160
160
|
return this.$locateButton(path, selector, locateFromBody);
|
|
@@ -356,6 +356,7 @@ const filterUUIDs = (any) => {
|
|
|
356
356
|
exports.filterUUIDs = filterUUIDs;
|
|
357
357
|
const maybeJSONPointerToLocator = (pointer) => pointer[0] === "/" ? pointer.slice(1).replace(/\//g, "_") : pointer;
|
|
358
358
|
exports.maybeJSONPointerToLocator = maybeJSONPointerToLocator;
|
|
359
|
+
/** Fills value into given input and presses tab to unfocus it. Useful for inputs with debounce */
|
|
359
360
|
const updateValue = ($input, value) => __awaiter(void 0, void 0, void 0, function* () {
|
|
360
361
|
yield $input.fill(value);
|
|
361
362
|
yield $input.press("Tab");
|