@luomus/laji-form 15.0.0 → 15.1.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/CHANGELOG.md +0 -4
- package/dist/laji-form.js +1 -1
- package/dist/styles.css +81 -90
- package/jsonconfig.json +26 -0
- package/migrate.sh +0 -1
- package/package.json +8 -8
- package/test-export/array-spec.js +204 -0
- package/test-export/bird-point-count-spec.d.ts +1 -0
- package/test-export/bird-point-count-spec.js +62 -0
- package/test-export/collection-contest-form-spec.d.ts +1 -0
- package/test-export/collection-contest-form-spec.js +38 -0
- package/test-export/dataset-form-spec.d.ts +1 -0
- package/test-export/dataset-form-spec.js +50 -0
- package/test-export/date-time-widget-spec.d.ts +1 -0
- package/test-export/date-time-widget-spec.js +188 -0
- package/test-export/geocoder-spec.d.ts +1 -0
- package/test-export/geocoder-spec.js +135 -0
- package/test-export/image-array-spec.d.ts +1 -0
- package/test-export/image-array-spec.js +94 -0
- package/test-export/inject-field-spec.d.ts +1 -0
- package/test-export/inject-field-spec.js +148 -0
- package/test-export/internal-uuids-spec.d.ts +1 -0
- package/test-export/internal-uuids-spec.js +157 -0
- package/test-export/invasive-species-eradication-np-spec.d.ts +1 -0
- package/test-export/invasive-species-eradication-np-spec.js +18 -0
- package/test-export/invasive-species-eradication-spec.d.ts +1 -0
- package/test-export/invasive-species-eradication-spec.js +25 -0
- package/test-export/line-transect-spec.d.ts +1 -0
- package/test-export/line-transect-spec.js +121 -0
- package/test-export/mobile-form-spec.d.ts +1 -0
- package/test-export/mobile-form-spec.js +84 -0
- package/test-export/nafi-spec.d.ts +1 -0
- package/test-export/nafi-spec.js +85 -0
- package/test-export/select-widget-spec.d.ts +1 -0
- package/test-export/select-widget-spec.js +68 -0
- package/test-export/single-item-array-field-spec.d.ts +1 -0
- package/test-export/single-item-array-field-spec.js +92 -0
- package/test-export/syke-butterfly-spec.d.ts +1 -0
- package/test-export/syke-butterfly-spec.js +163 -0
- package/test-export/test-utils.d.ts +150 -176
- package/test-export/test-utils.js +218 -210
- package/test-export/transaction-form-spec.d.ts +1 -0
- package/test-export/transaction-form-spec.js +63 -0
- package/test-export/trip-report-autosuggest-spec.d.ts +1 -0
- package/test-export/trip-report-autosuggest-spec.js +272 -0
- package/test-export/trip-report-spec.d.ts +1 -0
- package/test-export/trip-report-spec.js +456 -0
- package/test-export/unit-list-shorthand-array-field-spec.d.ts +1 -0
- package/test-export/unit-list-shorthand-array-field-spec.js +71 -0
- package/test-export/validation-spec.d.ts +1 -0
- package/test-export/validation-spec.js +336 -0
- package/test-export/water-bird-spec.d.ts +1 -0
- package/test-export/water-bird-spec.js +30 -0
- package/test-export/wbc-spec.d.ts +1 -0
- package/test-export/wbc-spec.js +82 -0
- package/tsconfig.test.json +1 -1
- package/xsel -b +9 -0
- package/cypress/fixtures/example.json +0 -5
- package/cypress/screenshots/nafi.cy.ts/NAFI (MHL.6) -- selecting species name with keyboard navigation -- and closes suggestion list (failed).png +0 -0
- package/cypress/screenshots/nafi.cy.ts/NAFI (MHL.6) -- selecting species name with keyboard navigation -- and is marked as suggested (failed).png +0 -0
- package/lib/ApiClient.d.ts +0 -46
- package/lib/ApiClient.js +0 -93
- package/lib/Context.d.ts +0 -8
- package/lib/Context.js +0 -18
- package/lib/ReactContext.d.ts +0 -7
- package/lib/ReactContext.js +0 -5
- package/lib/components/BaseComponent.d.ts +0 -9
- package/lib/components/BaseComponent.js +0 -29
- package/lib/components/LajiForm.d.ts +0 -221
- package/lib/components/LajiForm.js +0 -615
- package/lib/components/VirtualSchemaField.d.ts +0 -42
- package/lib/components/VirtualSchemaField.js +0 -74
- package/lib/components/components.d.ts +0 -119
- package/lib/components/components.js +0 -606
- package/lib/components/fields/AnnotationField.d.ts +0 -34
- package/lib/components/fields/AnnotationField.js +0 -242
- package/lib/components/fields/AnyToBooleanField.d.ts +0 -18
- package/lib/components/fields/AnyToBooleanField.js +0 -20
- package/lib/components/fields/ArrayBulkField.d.ts +0 -23
- package/lib/components/fields/ArrayBulkField.js +0 -82
- package/lib/components/fields/ArrayCombinerField.d.ts +0 -36
- package/lib/components/fields/ArrayCombinerField.js +0 -138
- package/lib/components/fields/ArrayField.d.ts +0 -39
- package/lib/components/fields/ArrayField.js +0 -148
- package/lib/components/fields/AudioArrayField.d.ts +0 -22
- package/lib/components/fields/AudioArrayField.js +0 -100
- package/lib/components/fields/AutoArrayField.d.ts +0 -24
- package/lib/components/fields/AutoArrayField.js +0 -56
- package/lib/components/fields/AutosuggestField.d.ts +0 -69
- package/lib/components/fields/AutosuggestField.js +0 -299
- package/lib/components/fields/CombinedValueDisplayField.d.ts +0 -41
- package/lib/components/fields/CombinedValueDisplayField.js +0 -100
- package/lib/components/fields/ConditionalOnChangeField.d.ts +0 -42
- package/lib/components/fields/ConditionalOnChangeField.js +0 -107
- package/lib/components/fields/ConditionalUiSchemaField.d.ts +0 -123
- package/lib/components/fields/ConditionalUiSchemaField.js +0 -143
- package/lib/components/fields/ContextInjectionField.d.ts +0 -24
- package/lib/components/fields/ContextInjectionField.js +0 -68
- package/lib/components/fields/DataLeakerField.d.ts +0 -40
- package/lib/components/fields/DataLeakerField.js +0 -68
- package/lib/components/fields/DefaultValueArrayField.d.ts +0 -34
- package/lib/components/fields/DefaultValueArrayField.js +0 -59
- package/lib/components/fields/DependentBooleanField.d.ts +0 -38
- package/lib/components/fields/DependentBooleanField.js +0 -87
- package/lib/components/fields/DependentDisableField.d.ts +0 -35
- package/lib/components/fields/DependentDisableField.js +0 -71
- package/lib/components/fields/EnumRangeArrayField.d.ts +0 -27
- package/lib/components/fields/EnumRangeArrayField.js +0 -115
- package/lib/components/fields/ExtraLabelRowField.d.ts +0 -38
- package/lib/components/fields/ExtraLabelRowField.js +0 -100
- package/lib/components/fields/FakePropertyField.d.ts +0 -18
- package/lib/components/fields/FakePropertyField.js +0 -48
- package/lib/components/fields/FilterArrayField.d.ts +0 -73
- package/lib/components/fields/FilterArrayField.js +0 -121
- package/lib/components/fields/FlatField.d.ts +0 -29
- package/lib/components/fields/FlatField.js +0 -171
- package/lib/components/fields/GeocoderField.d.ts +0 -47
- package/lib/components/fields/GeocoderField.js +0 -372
- package/lib/components/fields/GridLayoutField.d.ts +0 -18
- package/lib/components/fields/GridLayoutField.js +0 -32
- package/lib/components/fields/HiddenField.d.ts +0 -10
- package/lib/components/fields/HiddenField.js +0 -11
- package/lib/components/fields/ImageArrayField.d.ts +0 -172
- package/lib/components/fields/ImageArrayField.js +0 -697
- package/lib/components/fields/ImageDisplayField.d.ts +0 -18
- package/lib/components/fields/ImageDisplayField.js +0 -44
- package/lib/components/fields/InitiallyHiddenField.d.ts +0 -21
- package/lib/components/fields/InitiallyHiddenField.js +0 -58
- package/lib/components/fields/InjectDefaultValueField.d.ts +0 -37
- package/lib/components/fields/InjectDefaultValueField.js +0 -68
- package/lib/components/fields/InjectField.d.ts +0 -46
- package/lib/components/fields/InjectField.js +0 -88
- package/lib/components/fields/InputWithDefaultValueButtonField.d.ts +0 -25
- package/lib/components/fields/InputWithDefaultValueButtonField.js +0 -61
- package/lib/components/fields/LocalityField.d.ts +0 -22
- package/lib/components/fields/LocalityField.js +0 -94
- package/lib/components/fields/LocationChooserField.d.ts +0 -27
- package/lib/components/fields/LocationChooserField.js +0 -440
- package/lib/components/fields/MapArrayField.d.ts +0 -78
- package/lib/components/fields/MapArrayField.js +0 -1783
- package/lib/components/fields/MapField.d.ts +0 -48
- package/lib/components/fields/MapField.js +0 -434
- package/lib/components/fields/MultiAnyToBooleanField.d.ts +0 -25
- package/lib/components/fields/MultiAnyToBooleanField.js +0 -100
- package/lib/components/fields/MultiArrayField.d.ts +0 -53
- package/lib/components/fields/MultiArrayField.js +0 -224
- package/lib/components/fields/MultiLanguageField.d.ts +0 -13
- package/lib/components/fields/MultiLanguageField.js +0 -52
- package/lib/components/fields/MultiTagArrayField.d.ts +0 -36
- package/lib/components/fields/MultiTagArrayField.js +0 -142
- package/lib/components/fields/NamedPlaceChooserField.d.ts +0 -29
- package/lib/components/fields/NamedPlaceChooserField.js +0 -380
- package/lib/components/fields/NamedPlaceSaverField.d.ts +0 -29
- package/lib/components/fields/NamedPlaceSaverField.js +0 -237
- package/lib/components/fields/NestField.d.ts +0 -148
- package/lib/components/fields/NestField.js +0 -289
- package/lib/components/fields/ObjectField.d.ts +0 -2
- package/lib/components/fields/ObjectField.js +0 -119
- package/lib/components/fields/PdfArrayField.d.ts +0 -21
- package/lib/components/fields/PdfArrayField.js +0 -40
- package/lib/components/fields/PrefillingArrayField.d.ts +0 -22
- package/lib/components/fields/PrefillingArrayField.js +0 -65
- package/lib/components/fields/SchemaField.d.ts +0 -7
- package/lib/components/fields/SchemaField.js +0 -109
- package/lib/components/fields/ScopeField.d.ts +0 -85
- package/lib/components/fields/ScopeField.js +0 -521
- package/lib/components/fields/SectionArrayField.d.ts +0 -38
- package/lib/components/fields/SectionArrayField.js +0 -618
- package/lib/components/fields/SelectTreeField.d.ts +0 -39
- package/lib/components/fields/SelectTreeField.js +0 -143
- package/lib/components/fields/SingleActiveArrayField.d.ts +0 -49
- package/lib/components/fields/SingleActiveArrayField.js +0 -974
- package/lib/components/fields/SingleItemArrayField.d.ts +0 -15
- package/lib/components/fields/SingleItemArrayField.js +0 -60
- package/lib/components/fields/SortArrayField.d.ts +0 -73
- package/lib/components/fields/SortArrayField.js +0 -351
- package/lib/components/fields/SplitField.d.ts +0 -28
- package/lib/components/fields/SplitField.js +0 -65
- package/lib/components/fields/StringToArrayField.d.ts +0 -24
- package/lib/components/fields/StringToArrayField.js +0 -48
- package/lib/components/fields/SumField.d.ts +0 -35
- package/lib/components/fields/SumField.js +0 -83
- package/lib/components/fields/TableField.d.ts +0 -18
- package/lib/components/fields/TableField.js +0 -136
- package/lib/components/fields/TagArrayField.d.ts +0 -38
- package/lib/components/fields/TagArrayField.js +0 -128
- package/lib/components/fields/ToggleAdditionalArrayFieldsField.d.ts +0 -26
- package/lib/components/fields/ToggleAdditionalArrayFieldsField.js +0 -81
- package/lib/components/fields/UiFieldApplierField.d.ts +0 -30
- package/lib/components/fields/UiFieldApplierField.js +0 -106
- package/lib/components/fields/UiFieldMapperArrayField.d.ts +0 -42
- package/lib/components/fields/UiFieldMapperArrayField.js +0 -121
- package/lib/components/fields/UnitCountShorthandField.d.ts +0 -22
- package/lib/components/fields/UnitCountShorthandField.js +0 -149
- package/lib/components/fields/UnitListShorthandArrayField.d.ts +0 -26
- package/lib/components/fields/UnitListShorthandArrayField.js +0 -108
- package/lib/components/fields/UnitShorthandField.d.ts +0 -32
- package/lib/components/fields/UnitShorthandField.js +0 -220
- package/lib/components/templates/ArrayFieldTemplate.d.ts +0 -85
- package/lib/components/templates/ArrayFieldTemplate.js +0 -417
- package/lib/components/templates/BaseInputTemplate.d.ts +0 -11
- package/lib/components/templates/BaseInputTemplate.js +0 -80
- package/lib/components/templates/DescriptionField.d.ts +0 -1
- package/lib/components/templates/DescriptionField.js +0 -37
- package/lib/components/templates/ErrorListTemplate.d.ts +0 -9
- package/lib/components/templates/ErrorListTemplate.js +0 -95
- package/lib/components/templates/FieldTemplate.d.ts +0 -6
- package/lib/components/templates/FieldTemplate.js +0 -112
- package/lib/components/templates/ObjectFieldTemplate.d.ts +0 -7
- package/lib/components/templates/ObjectFieldTemplate.js +0 -66
- package/lib/components/templates/TitleField.d.ts +0 -9
- package/lib/components/templates/TitleField.js +0 -51
- package/lib/components/widgets/AnyToBooleanWidget.d.ts +0 -20
- package/lib/components/widgets/AnyToBooleanWidget.js +0 -49
- package/lib/components/widgets/AutosuggestWidget.d.ts +0 -66
- package/lib/components/widgets/AutosuggestWidget.js +0 -1127
- package/lib/components/widgets/CheckboxWidget.d.ts +0 -37
- package/lib/components/widgets/CheckboxWidget.js +0 -139
- package/lib/components/widgets/DateTimeWidget.d.ts +0 -62
- package/lib/components/widgets/DateTimeWidget.js +0 -251
- package/lib/components/widgets/DateWidget.d.ts +0 -23
- package/lib/components/widgets/DateWidget.js +0 -41
- package/lib/components/widgets/HiddenWidget.d.ts +0 -15
- package/lib/components/widgets/HiddenWidget.js +0 -19
- package/lib/components/widgets/ImageSelectWidget.d.ts +0 -14
- package/lib/components/widgets/ImageSelectWidget.js +0 -57
- package/lib/components/widgets/InformalTaxonGroupChooserWidget.d.ts +0 -43
- package/lib/components/widgets/InformalTaxonGroupChooserWidget.js +0 -237
- package/lib/components/widgets/InputGroupWidget.d.ts +0 -21
- package/lib/components/widgets/InputGroupWidget.js +0 -36
- package/lib/components/widgets/InputWithDefaultValueButtonWidget.d.ts +0 -21
- package/lib/components/widgets/InputWithDefaultValueButtonWidget.js +0 -47
- package/lib/components/widgets/NumberWidget.d.ts +0 -13
- package/lib/components/widgets/NumberWidget.js +0 -21
- package/lib/components/widgets/PlainTextWidget.d.ts +0 -12
- package/lib/components/widgets/PlainTextWidget.js +0 -24
- package/lib/components/widgets/SelectWidget.d.ts +0 -52
- package/lib/components/widgets/SelectWidget.js +0 -158
- package/lib/components/widgets/SeparatedDateTimeWidget.d.ts +0 -19
- package/lib/components/widgets/SeparatedDateTimeWidget.js +0 -59
- package/lib/components/widgets/TaxonImageWidget.d.ts +0 -13
- package/lib/components/widgets/TaxonImageWidget.js +0 -30
- package/lib/components/widgets/TextSelectWidget.d.ts +0 -25
- package/lib/components/widgets/TextSelectWidget.js +0 -94
- package/lib/components/widgets/TextareaWidget.d.ts +0 -32
- package/lib/components/widgets/TextareaWidget.js +0 -87
- package/lib/components/widgets/TimeWidget.d.ts +0 -11
- package/lib/components/widgets/TimeWidget.js +0 -19
- package/lib/components/widgets/URLWidget.d.ts +0 -14
- package/lib/components/widgets/URLWidget.js +0 -12
- package/lib/components/widgets/UpperCaseWidget.d.ts +0 -13
- package/lib/components/widgets/UpperCaseWidget.js +0 -21
- package/lib/index.d.ts +0 -20
- package/lib/index.js +0 -50
- package/lib/services/blocker-service.d.ts +0 -11
- package/lib/services/blocker-service.js +0 -55
- package/lib/services/custom-event-service.d.ts +0 -17
- package/lib/services/custom-event-service.js +0 -35
- package/lib/services/dom-id-service.d.ts +0 -8
- package/lib/services/dom-id-service.js +0 -30
- package/lib/services/focus-service.d.ts +0 -13
- package/lib/services/focus-service.js +0 -60
- package/lib/services/id-service.d.ts +0 -22
- package/lib/services/id-service.js +0 -130
- package/lib/services/key-handler-service.d.ts +0 -56
- package/lib/services/key-handler-service.js +0 -184
- package/lib/services/root-instance-service.d.ts +0 -25
- package/lib/services/root-instance-service.js +0 -49
- package/lib/services/settings-service.d.ts +0 -34
- package/lib/services/settings-service.js +0 -154
- package/lib/services/singleton-map-service.d.ts +0 -23
- package/lib/services/singleton-map-service.js +0 -44
- package/lib/services/submit-hook-service.d.ts +0 -24
- package/lib/services/submit-hook-service.js +0 -73
- package/lib/styles.js +0 -4
- package/lib/themes/bs3.d.ts +0 -3
- package/lib/themes/bs3.js +0 -133
- package/lib/themes/bs5.d.ts +0 -3
- package/lib/themes/bs5.js +0 -111
- package/lib/themes/glyphicon-fa-mapping.d.ts +0 -3
- package/lib/themes/glyphicon-fa-mapping.js +0 -271
- package/lib/themes/stub.d.ts +0 -3
- package/lib/themes/stub.js +0 -82
- package/lib/themes/theme.d.ts +0 -233
- package/lib/themes/theme.js +0 -2
- package/lib/translations.json +0 -847
- package/lib/utils.d.ts +0 -171
- package/lib/utils.js +0 -1191
- package/lib/validation.d.ts +0 -7
- package/lib/validation.js +0 -141
- package/llol +0 -10
- package/llol.pdf +0 -10
- package/playwright-report/index.html +0 -62
- package/q +0 -196
- package/rename.sh +0 -24
- package/trip-report.spec.ts +0 -594
- /package/{lib/styles.d.ts → test-export/array-spec.d.ts} +0 -0
|
@@ -20,241 +20,128 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
return t;
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.
|
|
23
|
+
exports.maybeJSONPointerToLocator = exports.filterUUIDs = exports.mockImageMetadata = exports.updateValue = exports.removeUnit = exports.putForeignMarkerToMap = exports.waitUntilBlockingLoaderHides = exports.createForm = exports.NamedPlaceChooserPO = exports.isDisplayed = exports.Form = exports.getFocusedId = exports.getFocusedElement = exports.lajiFormLocate = exports.lajiFormLocator = exports.navigateToForm = exports.emptyForm = exports.getLocatorForContextId = exports.EC = void 0;
|
|
24
|
+
const protractor_1 = require("protractor");
|
|
24
25
|
const path = require("path");
|
|
25
|
-
const
|
|
26
|
-
|
|
26
|
+
const { HOST, PORT } = process.env;
|
|
27
|
+
exports.EC = protractor_1.protractor.ExpectedConditions;
|
|
28
|
+
const getLocatorForContextId = (contextId) => (path) => `#_laji-form_${contextId}_root${typeof path === "string" && path.length ? `_${path.replace(/\./g, "_")}` : ""}`;
|
|
29
|
+
exports.getLocatorForContextId = getLocatorForContextId;
|
|
30
|
+
const emptyForm = (params = "") => __awaiter(void 0, void 0, void 0, function* () { return protractor_1.browser.get(`http://${HOST}:${PORT}?test=true&settings=false&mockApi=true&${params}`); });
|
|
27
31
|
exports.emptyForm = emptyForm;
|
|
28
|
-
const navigateToForm = (
|
|
32
|
+
const navigateToForm = (formID, params = "") => __awaiter(void 0, void 0, void 0, function* () { return protractor_1.browser.get(`http://${HOST}:${PORT}?id=${formID}&local=true&settings=false&mockApi=true${params}`); });
|
|
29
33
|
exports.navigateToForm = navigateToForm;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
exports.lajiFormLocator = exports.getLocatorForContextId(0);
|
|
35
|
+
const lajiFormLocate = (str) => protractor_1.$(exports.lajiFormLocator(str));
|
|
36
|
+
exports.lajiFormLocate = lajiFormLocate;
|
|
37
|
+
const getFocusedElement = () => protractor_1.browser.driver.switchTo().activeElement();
|
|
33
38
|
exports.getFocusedElement = getFocusedElement;
|
|
39
|
+
const getFocusedId = () => exports.getFocusedElement().getAttribute("id");
|
|
40
|
+
exports.getFocusedId = getFocusedId;
|
|
34
41
|
function getEnumWidgetForContainer($container) {
|
|
35
42
|
return {
|
|
36
43
|
$container,
|
|
37
44
|
openEnums: () => __awaiter(this, void 0, void 0, function* () {
|
|
38
45
|
yield $container.click();
|
|
46
|
+
yield protractor_1.browser.wait(protractor_1.protractor.ExpectedConditions.visibilityOf($container.$$(".rw-list-option").first()), 300, "select list timeout");
|
|
39
47
|
}),
|
|
40
|
-
$enumContainer: $container
|
|
41
|
-
|
|
42
|
-
$input: $container
|
|
48
|
+
$enumContainer: $container.$(".rw-popup-container"),
|
|
49
|
+
$$enums: $container.$$(".rw-list-option"),
|
|
50
|
+
$input: $container.$("input")
|
|
43
51
|
};
|
|
44
52
|
}
|
|
45
53
|
class Form {
|
|
46
|
-
constructor(
|
|
47
|
-
this
|
|
48
|
-
this
|
|
54
|
+
constructor(params = {}) {
|
|
55
|
+
this.$form = protractor_1.$(".laji-form .rjsf");
|
|
56
|
+
this.getMockStr = (path, query) => `window.mockResponses[window.getMockQueryKey(${JSON.stringify(path)}, ${JSON.stringify(query)})]`;
|
|
49
57
|
this.createValidatorPO = (type) => ({
|
|
50
|
-
|
|
51
|
-
$panel:
|
|
58
|
+
$$all: protractor_1.$$(`.laji-form-error-list:not(.laji-form-failed-jobs-list) .${type}-panel .list-group button`),
|
|
59
|
+
$panel: protractor_1.$(`.laji-form-error-list:not(.laji-form-failed-jobs-list) .${type}-panel`)
|
|
52
60
|
});
|
|
53
61
|
this.errors = this.createValidatorPO("error");
|
|
54
62
|
this.warnings = this.createValidatorPO("warning");
|
|
55
63
|
this.failedJobs = {
|
|
56
|
-
$container:
|
|
57
|
-
$errors: this.page.locator(".laji-form-failed-jobs-list").locator(".list-group-item")
|
|
58
|
-
};
|
|
59
|
-
this.$runningJobs = this.page.locator(".running-jobs");
|
|
60
|
-
this.$acknowledgeWarnings = this.page.locator(".laji-form-warning-list .panel-footer button");
|
|
61
|
-
this.$blocker = this.page.locator(".laji-form.blocking-loader");
|
|
62
|
-
this.$mapFieldFullscreenMap = this.page.locator(".laji-form.fullscreen .laji-form-map");
|
|
63
|
-
this.getImageArrayField = (lajiFormLocator) => {
|
|
64
|
-
const $container = this.$locate(lajiFormLocator).locator(".laji-form-medias");
|
|
65
|
-
const $imgContainers = this.$locate(lajiFormLocator).locator(".media-container");
|
|
66
|
-
const $modal = this.page.locator(".laji-form.media-modal");
|
|
67
|
-
const $addModal = this.page.locator(".laji-form.media-add-modal");
|
|
68
|
-
return {
|
|
69
|
-
$container,
|
|
70
|
-
$imgContainers,
|
|
71
|
-
$imgs: $imgContainers.locator("img"),
|
|
72
|
-
$imgLoading: $imgContainers.locator(".react-spinner"),
|
|
73
|
-
$imgRemoves: $imgContainers.locator(".button-corner"),
|
|
74
|
-
$imgRemoveConfirmButton: (id) => this.$locateAddition(id, "delete-confirm-yes"),
|
|
75
|
-
$dropzone: this.$locate(lajiFormLocator).locator(".laji-form-drop-zone"),
|
|
76
|
-
$modal,
|
|
77
|
-
$addModal,
|
|
78
|
-
$modalClose: $modal.locator(".modal-header .close"),
|
|
79
|
-
$addModalCancel: $addModal.locator(".cancel")
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
this.getTaxonAutosuggestWidget = (lajiFormLocator) => {
|
|
83
|
-
return {
|
|
84
|
-
$input: this.$locate(lajiFormLocator).locator("input"),
|
|
85
|
-
$suggestionsContainer: this.$locate(lajiFormLocator).locator(".rw-list"),
|
|
86
|
-
$suggestions: this.$locate(lajiFormLocator).locator(".rw-list-option"),
|
|
87
|
-
$getGlyph: (glyph) => this.$locate(lajiFormLocator).locator(glyph),
|
|
88
|
-
$suggestedGlyph: this.$locate(lajiFormLocator).locator(".glyphicon-ok"),
|
|
89
|
-
$nonsuggestedGlyph: this.$locate(lajiFormLocator).locator(".glyphicon-warning-sign"),
|
|
90
|
-
$powerUserButton: this.page.locator(".power-user-addon")
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
this.getScopeField = (lajiFormLocator) => ({
|
|
94
|
-
$button: this.$locateButton(lajiFormLocator, "additionals"),
|
|
95
|
-
$listItems: this.$locate(lajiFormLocator).locator(".dropdown.open li a"),
|
|
96
|
-
modal: {
|
|
97
|
-
$container: this.page.locator(".scope-field-modal"),
|
|
98
|
-
$close: this.page.locator(".scope-field-modal .close"),
|
|
99
|
-
$loadingGroup: this.page.locator(".scope-field-modal .list-group .react-spinner"),
|
|
100
|
-
$groupTitles: this.page.locator(".scope-field-modal .list-group .list-group-item strong"),
|
|
101
|
-
$listItems: this.page.locator(".scope-field-modal .list-group-item"),
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
this.getLocationChooser = (lajiFormLocator) => ({
|
|
105
|
-
$button: this.$locateButton(lajiFormLocator, "location"),
|
|
106
|
-
modal: {
|
|
107
|
-
$container: this.page.locator(".map-dialog"),
|
|
108
|
-
map: new test_utils_1.MapPageObject(this.page, this.page.locator(".map-dialog .laji-map"))
|
|
109
|
-
},
|
|
110
|
-
peeker: {
|
|
111
|
-
$popover: this.$locateButton(lajiFormLocator, "location-peeker"),
|
|
112
|
-
$map: this.$locateButton(lajiFormLocator, "location-peeker").locator(".laji-map"),
|
|
113
|
-
$markers: this.$locateButton(lajiFormLocator, "location-peeker").locator(".vector-marker path"),
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
this.getUnitListShorthandArrayField = (lajiFormLocator) => ({
|
|
117
|
-
$button: this.$locateButton(lajiFormLocator, "addUnitList"),
|
|
118
|
-
modal: {
|
|
119
|
-
$input: this.page.locator(".unit-list-shorthand-modal input"),
|
|
120
|
-
$addButton: this.page.locator(".unit-list-shorthand-modal button")
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
this.$getShortHandWidget = (lajiFormLocator) => this.$locateAddition(lajiFormLocator, "shortHandText");
|
|
124
|
-
this.getGeocoder = (lajiFormLocator = "") => ({
|
|
125
|
-
$btn: this.$locate(lajiFormLocator).locator(".geocoder-btn"),
|
|
126
|
-
$spinner: this.$locate(lajiFormLocator).locator(".geocoder-btn .react-spinner")
|
|
127
|
-
});
|
|
128
|
-
this.getNamedPlaceChooser = () => {
|
|
129
|
-
const $namedPlaceChooserModal = this.page.locator(".named-place-chooser-modal");
|
|
130
|
-
const $mapPopupContainer = this.page.locator(".named-place-popup");
|
|
131
|
-
return {
|
|
132
|
-
select: getEnumWidgetForContainer(this.page.locator("#named-place-chooser-select")),
|
|
133
|
-
mapPopup: {
|
|
134
|
-
$container: $mapPopupContainer,
|
|
135
|
-
$useBtn: $mapPopupContainer.locator(".btn-default")
|
|
136
|
-
},
|
|
137
|
-
$alert: $namedPlaceChooserModal.locator(".alert"),
|
|
138
|
-
$close: $namedPlaceChooserModal.locator(".close")
|
|
139
|
-
};
|
|
64
|
+
$container: protractor_1.$(".laji-form-failed-jobs-list")
|
|
140
65
|
};
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
$locate(path) {
|
|
144
|
-
return this.page.locator(exports.lajiFormLocator(path));
|
|
145
|
-
}
|
|
146
|
-
/** 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}`);
|
|
149
|
-
}
|
|
150
|
-
/** 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);
|
|
153
|
-
}
|
|
154
|
-
getBooleanWidget(str) {
|
|
155
|
-
const $container = this.$locate(str).locator(".btn-toolbar");
|
|
156
|
-
return {
|
|
157
|
-
$container,
|
|
158
|
-
$true: $container.locator(".btn").nth(0),
|
|
159
|
-
$false: $container.locator(".btn").nth(1),
|
|
160
|
-
$undefined: this.$locate(str).locator(".btn").nth(2),
|
|
161
|
-
$active: $container.locator(".btn.active"),
|
|
162
|
-
$nonactive: $container.locator(".btn:not(.active)").first()
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
$getInputWidget(str) {
|
|
166
|
-
return this.$locate(str).locator("input");
|
|
167
|
-
}
|
|
168
|
-
$getTextareaWidget(str) {
|
|
169
|
-
return this.$locate(str).locator("textarea");
|
|
170
|
-
}
|
|
171
|
-
$getEnumWidget(str) {
|
|
172
|
-
const $container = this.$locate(str).locator(".rw-combobox");
|
|
173
|
-
return getEnumWidgetForContainer($container);
|
|
174
|
-
}
|
|
175
|
-
getDateWidget(str) {
|
|
176
|
-
const $widget = this.$locate(str).locator(".date-widget");
|
|
177
|
-
return {
|
|
178
|
-
$container: $widget,
|
|
179
|
-
$input: $widget.locator("input"),
|
|
180
|
-
buttons: {
|
|
181
|
-
$today: $widget.locator(".today"),
|
|
182
|
-
$yesterday: $widget.locator(".yesterday"),
|
|
183
|
-
$same: $widget.locator(".same"),
|
|
184
|
-
$date: $widget.locator(".rw-i-calendar"),
|
|
185
|
-
$time: $widget.locator(".rw-i-clock-o")
|
|
186
|
-
},
|
|
187
|
-
calendar: {
|
|
188
|
-
$today: $widget.locator(".rw-calendar-footer button"),
|
|
189
|
-
},
|
|
190
|
-
clock: {
|
|
191
|
-
"$01:00": $widget.locator(".rw-list li").nth(2),
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
$getFieldErrors(str) {
|
|
196
|
-
return this.$locate(str).locator(".laji-form-error-container li");
|
|
197
|
-
}
|
|
198
|
-
/** Draws a marker to the center of a laji-map rendered to the given locator. The locator defaults to "gatherings" */
|
|
199
|
-
putMarkerToMap(lajiFormLocator = "gatherings") {
|
|
200
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
201
|
-
const $map = this.$locate(lajiFormLocator).locator(".laji-map");
|
|
202
|
-
yield $map.scrollIntoViewIfNeeded();
|
|
203
|
-
const map = new test_utils_1.MapPageObject(this.page, $map);
|
|
204
|
-
yield map.drawMarker();
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
updateValue($input, value, blur = true) {
|
|
208
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
209
|
-
yield $input.fill(value);
|
|
210
|
-
if (blur) {
|
|
211
|
-
yield $input.press("Tab");
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
exports.Form = Form;
|
|
217
|
-
class DemoPageForm extends Form {
|
|
218
|
-
constructor(page, params = {}) {
|
|
219
|
-
super(page);
|
|
220
|
-
this.getMockStr = (path, query) => `window.mockResponses[window.getMockQueryKey(${JSON.stringify(path)}, ${JSON.stringify(query)})]`;
|
|
66
|
+
this.$acknowledgeWarnings = protractor_1.$(".laji-form-warning-list .panel-footer button");
|
|
67
|
+
this.isBlocked = () => protractor_1.$(".laji-form.blocking-loader").isDisplayed();
|
|
221
68
|
this.mockImageUpload = (lajiFormLocator) => __awaiter(this, void 0, void 0, function* () {
|
|
222
|
-
const filePath = path.resolve(__dirname, "./
|
|
69
|
+
const filePath = path.resolve(__dirname, "./pixel.png");
|
|
223
70
|
const imageResponse = [{ name: "data", filename: "pixel.png", id: "mock", expires: 1575979685 }];
|
|
224
71
|
const { resolve, remove } = yield this.setMockResponse("/images", false);
|
|
225
|
-
const mdResponse =
|
|
226
|
-
const { resolve:
|
|
227
|
-
yield this.getImageArrayField(lajiFormLocator).$dropzone
|
|
72
|
+
const mdResponse = exports.mockImageMetadata;
|
|
73
|
+
const { resolve: mdResolve, remove: mdRemove } = yield this.setMockResponse("/images/mock", false);
|
|
74
|
+
yield this.getImageArrayField(lajiFormLocator).$dropzone.$("input").sendKeys(filePath);
|
|
228
75
|
return {
|
|
229
76
|
resolve: () => __awaiter(this, void 0, void 0, function* () {
|
|
230
77
|
yield resolve(imageResponse);
|
|
231
|
-
yield
|
|
78
|
+
yield protractor_1.browser.sleep(300);
|
|
79
|
+
yield mdResolve(mdResponse);
|
|
232
80
|
}),
|
|
233
81
|
remove: () => __awaiter(this, void 0, void 0, function* () {
|
|
234
82
|
yield remove();
|
|
235
|
-
yield
|
|
83
|
+
yield mdRemove();
|
|
236
84
|
})
|
|
237
85
|
};
|
|
238
86
|
});
|
|
239
|
-
|
|
87
|
+
this._getImageArrayField = (form) => (lajiFormLocator) => new class ImageArrayFieldPO {
|
|
88
|
+
constructor() {
|
|
89
|
+
this.$container = form.$locate(lajiFormLocator).$(".laji-form-medias");
|
|
90
|
+
this.$$imgs = form.$locate(lajiFormLocator).$$(".media-container");
|
|
91
|
+
this.$$imgInteractives = this.$$imgs.$$(".media-container a");
|
|
92
|
+
this.$$imgRemoves = this.$$imgs.$$(".button-corner");
|
|
93
|
+
this.$imgRemoveConfirmButton = (id) => form.$locateAddition(id, "delete-confirm-yes");
|
|
94
|
+
this.$dropzone = form.$locate(lajiFormLocator).$(".laji-form-drop-zone");
|
|
95
|
+
this.$modal = protractor_1.$(".laji-form.media-modal");
|
|
96
|
+
this.$modalClose = this.$modal.$(".close");
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
this.getImageArrayField = this._getImageArrayField(this);
|
|
100
|
+
this._getTaxonAutosuggestWidget = (form) => (lajiFormLocator) => new class TaxonAutosuggestWidgetPO {
|
|
101
|
+
constructor() {
|
|
102
|
+
this.$input = form.$locate(lajiFormLocator).$("input");
|
|
103
|
+
this.$suggestionsContainer = form.$locate(lajiFormLocator).$(".rw-list");
|
|
104
|
+
this.$$suggestions = form.$locate(lajiFormLocator).$$(".rw-list-option");
|
|
105
|
+
this.waitForSuggestionsToLoad = () => protractor_1.browser.wait(exports.EC.visibilityOf(this.$suggestionsContainer), 5000, "Suggestion list timeout");
|
|
106
|
+
this.waitForGlyph = () => protractor_1.browser.wait(exports.EC.visibilityOf(form.$locate(lajiFormLocator).$(".glyphicon.form-control-feedback")), 5000, "Glyph didn't load");
|
|
107
|
+
this.isSuggested = () => exports.isDisplayed(form.$locate(lajiFormLocator).$(".glyphicon-ok"));
|
|
108
|
+
this.isNonsuggested = () => exports.isDisplayed(form.$locate(lajiFormLocator).$(".glyphicon-warning-sign"));
|
|
109
|
+
this.$powerUserButton = protractor_1.$(".power-user-addon");
|
|
110
|
+
this.powerUserButtonIsActive = () => __awaiter(this, void 0, void 0, function* () { return (yield this.$powerUserButton.getAttribute("class")).includes("active"); });
|
|
111
|
+
this.waitForPopoverToHide = () => protractor_1.browser.wait(exports.EC.invisibilityOf(form.$locate(lajiFormLocator).$(".popover-content")), 5000, "Popover didn't hide");
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
this.getTaxonAutosuggestWidget = this._getTaxonAutosuggestWidget(this);
|
|
115
|
+
this.getScopeField = (lajiFormLocator) => ({
|
|
116
|
+
$button: this.$locateButton(lajiFormLocator, "additionals"),
|
|
117
|
+
$$listItems: this.$locate(lajiFormLocator).$$(".dropdown.open li a")
|
|
118
|
+
});
|
|
119
|
+
this.getUnitListShorthandArrayField = (lajiFormLocator) => ({
|
|
120
|
+
$button: this.$locateButton(lajiFormLocator, "addUnitList"),
|
|
121
|
+
modal: {
|
|
122
|
+
$input: protractor_1.$(".unit-list-shorthand-modal input"),
|
|
123
|
+
$addButton: protractor_1.$(".unit-list-shorthand-modal button")
|
|
124
|
+
}
|
|
125
|
+
});
|
|
240
126
|
this.props = params;
|
|
241
127
|
}
|
|
242
|
-
initialize(beforeInit) {
|
|
128
|
+
initialize(beforeInit, contextId) {
|
|
243
129
|
return __awaiter(this, void 0, void 0, function* () {
|
|
244
130
|
const query = (params) => Object.keys(params).reduce((q, key) => `${q}&${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`, "");
|
|
245
131
|
if (this.props.id) {
|
|
246
132
|
const _a = this.props, { id } = _a, _props = __rest(_a, ["id"]);
|
|
247
|
-
yield exports.navigateToForm(
|
|
133
|
+
yield exports.navigateToForm(id, query(_props));
|
|
248
134
|
}
|
|
249
135
|
else {
|
|
250
|
-
yield exports.emptyForm(
|
|
136
|
+
yield exports.emptyForm();
|
|
251
137
|
}
|
|
252
138
|
beforeInit && (yield beforeInit(this));
|
|
253
139
|
yield this.setState(this.props);
|
|
140
|
+
this.contextId = contextId !== null && contextId !== void 0 ? contextId : yield this.e("lajiForm._id");
|
|
254
141
|
});
|
|
255
142
|
}
|
|
256
143
|
e(path) {
|
|
257
|
-
return
|
|
144
|
+
return protractor_1.browser.executeScript(`return window.lajiForm.${path}`);
|
|
258
145
|
}
|
|
259
146
|
setState(state) {
|
|
260
147
|
const onSubmit = "function(data) {window.submittedData = data.formData;}";
|
|
@@ -262,32 +149,51 @@ class DemoPageForm extends Form {
|
|
|
262
149
|
return this.e(`setState({onSubmit: ${onSubmit}, onChange: ${onChange}, ...${JSON.stringify(state)}})`);
|
|
263
150
|
}
|
|
264
151
|
getState() {
|
|
265
|
-
return this
|
|
266
|
-
const {
|
|
267
|
-
return { formData };
|
|
152
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
153
|
+
return protractor_1.browser.executeScript("const {formData} = window.lajiForm.lajiForm.state; return {formData};");
|
|
268
154
|
});
|
|
269
155
|
}
|
|
270
156
|
submit() {
|
|
157
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
158
|
+
yield this.e("submit()");
|
|
159
|
+
yield waitUntilBlockingLoaderHides();
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
startSubmit() {
|
|
271
163
|
return __awaiter(this, void 0, void 0, function* () {
|
|
272
164
|
yield this.e("submit()");
|
|
273
165
|
});
|
|
274
166
|
}
|
|
275
167
|
submitOnlySchemaValidations() {
|
|
276
|
-
return this
|
|
168
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
169
|
+
yield this.e("submitOnlySchemaValidations()");
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
waitUntilBlockingLoaderHides(timeout) {
|
|
173
|
+
return waitUntilBlockingLoaderHides(timeout);
|
|
277
174
|
}
|
|
278
175
|
getSubmittedData() {
|
|
279
|
-
return
|
|
176
|
+
return protractor_1.browser.executeScript("return window.submittedData");
|
|
280
177
|
}
|
|
281
178
|
getChangedData() {
|
|
282
|
-
return
|
|
179
|
+
return protractor_1.browser.executeScript("return window.changedData");
|
|
283
180
|
}
|
|
284
181
|
getPropsData() {
|
|
285
182
|
return this.e("lajiForm.props.formData");
|
|
286
183
|
}
|
|
184
|
+
$locate(path) {
|
|
185
|
+
return protractor_1.$(exports.getLocatorForContextId(this.contextId)(path));
|
|
186
|
+
}
|
|
187
|
+
$locateButton(path, selector) {
|
|
188
|
+
return protractor_1.$(`#root${typeof path === "string" && path.length > 0 ? `_${path.replace(/\./g, "_")}` : ""}-${selector}`);
|
|
189
|
+
}
|
|
190
|
+
$locateAddition(path, selector) {
|
|
191
|
+
return this.$locateButton(path, selector);
|
|
192
|
+
}
|
|
287
193
|
setMockResponse(path, query) {
|
|
288
194
|
return __awaiter(this, void 0, void 0, function* () {
|
|
289
|
-
yield
|
|
290
|
-
const mock = (method, response, raw) =>
|
|
195
|
+
yield protractor_1.browser.executeScript(`return window.setMockResponse(${JSON.stringify(path)}, ${JSON.stringify(query)})`);
|
|
196
|
+
const mock = (method, response, raw) => protractor_1.browser.executeScript(`return ${this.getMockStr(path, query)}.${method}(${JSON.stringify(response)}, ${JSON.stringify(raw)})`);
|
|
291
197
|
return {
|
|
292
198
|
resolve: (response, raw) => mock("resolve", response, raw),
|
|
293
199
|
reject: (response, raw) => mock("reject", response, raw),
|
|
@@ -297,15 +203,15 @@ class DemoPageForm extends Form {
|
|
|
297
203
|
}
|
|
298
204
|
createMockResponseQueue(path, query) {
|
|
299
205
|
return __awaiter(this, void 0, void 0, function* () {
|
|
300
|
-
yield
|
|
206
|
+
yield protractor_1.browser.executeScript(`return window.createMockResponseQueue(${JSON.stringify(path)}, ${JSON.stringify(query)})`);
|
|
301
207
|
const queueStr = `window.mockQueues[window.getMockQueryKey(${JSON.stringify(path)}, ${JSON.stringify(query)})]`;
|
|
302
208
|
const mock = (method, response, raw, pointer) => {
|
|
303
|
-
return
|
|
209
|
+
return protractor_1.browser.executeScript(`return ${this.getMockStr(path, query)}[${pointer}].${method}(${JSON.stringify(response)}, ${JSON.stringify(raw)})`);
|
|
304
210
|
};
|
|
305
211
|
let pointer = 0;
|
|
306
212
|
return {
|
|
307
213
|
create: () => __awaiter(this, void 0, void 0, function* () {
|
|
308
|
-
yield
|
|
214
|
+
yield protractor_1.browser.executeScript(`return ${queueStr}.create()`);
|
|
309
215
|
const _pointer = pointer;
|
|
310
216
|
pointer = pointer + 1;
|
|
311
217
|
return {
|
|
@@ -313,20 +219,127 @@ class DemoPageForm extends Form {
|
|
|
313
219
|
reject: (response, raw) => mock("reject", response, raw, _pointer),
|
|
314
220
|
};
|
|
315
221
|
}),
|
|
316
|
-
remove: () =>
|
|
222
|
+
remove: () => protractor_1.browser.executeScript(`return ${queueStr}.remove()`)
|
|
317
223
|
};
|
|
318
224
|
});
|
|
319
225
|
}
|
|
226
|
+
getBooleanWidget(str) {
|
|
227
|
+
const $container = this.$locate(str).$(".btn-toolbar");
|
|
228
|
+
return {
|
|
229
|
+
$container,
|
|
230
|
+
$true: $container.$$(".btn").get(0),
|
|
231
|
+
$false: $container.$$(".btn").get(1),
|
|
232
|
+
$undefined: this.$locate(str).$$(".btn").get(2),
|
|
233
|
+
$active: $container.$(".btn.active"),
|
|
234
|
+
$nonactive: $container.$$(".btn").filter(($btn) => __awaiter(this, void 0, void 0, function* () { return !(yield $btn.getAttribute("class")).includes("active"); })).first()
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
$getInputWidget(str) {
|
|
238
|
+
return this.$locate(str).$("input");
|
|
239
|
+
}
|
|
240
|
+
$getTextareaWidget(str) {
|
|
241
|
+
return this.$locate(str).$("textarea");
|
|
242
|
+
}
|
|
243
|
+
$getEnumWidget(str) {
|
|
244
|
+
const $container = this.$locate(str).$(".rw-combobox");
|
|
245
|
+
return getEnumWidgetForContainer($container);
|
|
246
|
+
}
|
|
247
|
+
getDateWidget(str) {
|
|
248
|
+
const $widget = this.$locate(str).$(".date-widget");
|
|
249
|
+
return {
|
|
250
|
+
$container: $widget,
|
|
251
|
+
$input: $widget.$("input"),
|
|
252
|
+
buttons: {
|
|
253
|
+
$today: $widget.$(".today"),
|
|
254
|
+
$yesterday: $widget.$(".yesterday"),
|
|
255
|
+
$same: $widget.$(".same"),
|
|
256
|
+
$date: $widget.$(".rw-i-calendar"),
|
|
257
|
+
$time: $widget.$(".rw-i-clock-o")
|
|
258
|
+
},
|
|
259
|
+
calendar: {
|
|
260
|
+
$today: $widget.$(".rw-calendar-footer button"),
|
|
261
|
+
waitAnimation: () => protractor_1.browser.wait(exports.EC.visibilityOf($widget.$(".rw-calendar-footer button")), 1000, "Calendar didn't show")
|
|
262
|
+
},
|
|
263
|
+
clock: {
|
|
264
|
+
"$01:00": $widget.$$(".rw-list li").get(2),
|
|
265
|
+
waitAnimation: () => protractor_1.browser.wait(exports.EC.visibilityOf($widget.$(".rw-list")), 1000, "Clock didn't show")
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
$$getFieldErrors(str) {
|
|
270
|
+
return this.$locate(str).$$(".laji-form-error-container li");
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
exports.Form = Form;
|
|
274
|
+
const isDisplayed = ($elem) => __awaiter(void 0, void 0, void 0, function* () { return (yield $elem.isPresent()) && (yield $elem.isDisplayed()); });
|
|
275
|
+
exports.isDisplayed = isDisplayed;
|
|
276
|
+
const $mapPopupContainer = protractor_1.$(".named-place-popup");
|
|
277
|
+
const $namedPlaceChooserModal = protractor_1.$(".named-place-chooser-modal");
|
|
278
|
+
class NamedPlaceChooserPO {
|
|
279
|
+
constructor() {
|
|
280
|
+
this.select = getEnumWidgetForContainer(protractor_1.$("#named-place-chooser-select"));
|
|
281
|
+
this.mapPopup = {
|
|
282
|
+
$container: $mapPopupContainer,
|
|
283
|
+
$useBtn: $mapPopupContainer.$(".btn-default")
|
|
284
|
+
};
|
|
285
|
+
this.$alert = $namedPlaceChooserModal.$(".alert");
|
|
286
|
+
this.$close = $namedPlaceChooserModal.$(".close");
|
|
287
|
+
}
|
|
320
288
|
}
|
|
321
|
-
exports.
|
|
322
|
-
function createForm(
|
|
289
|
+
exports.NamedPlaceChooserPO = NamedPlaceChooserPO;
|
|
290
|
+
function createForm(props, beforeInit) {
|
|
323
291
|
return __awaiter(this, void 0, void 0, function* () {
|
|
324
|
-
const form = new
|
|
292
|
+
const form = new Form(props);
|
|
325
293
|
yield form.initialize(beforeInit);
|
|
326
294
|
return form;
|
|
327
295
|
});
|
|
328
296
|
}
|
|
329
297
|
exports.createForm = createForm;
|
|
298
|
+
function waitUntilBlockingLoaderHides(timeout) {
|
|
299
|
+
return protractor_1.browser.wait(protractor_1.protractor.ExpectedConditions.invisibilityOf(protractor_1.$(".laji-form.blocking-loader")), timeout || 20000, "Blocking loader timeout");
|
|
300
|
+
}
|
|
301
|
+
exports.waitUntilBlockingLoaderHides = waitUntilBlockingLoaderHides;
|
|
302
|
+
function putForeignMarkerToMap() {
|
|
303
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
304
|
+
const $gatheringsMap = exports.lajiFormLocate("gatherings").$(".laji-map");
|
|
305
|
+
const $markerButton = protractor_1.$(".leaflet-draw-draw-marker");
|
|
306
|
+
yield $markerButton.click();
|
|
307
|
+
yield protractor_1.browser.actions().mouseMove($gatheringsMap.getWebElement(), { x: -100, y: -100 }).perform();
|
|
308
|
+
yield protractor_1.browser.actions().click().perform();
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
exports.putForeignMarkerToMap = putForeignMarkerToMap;
|
|
312
|
+
function removeUnit(gatheringIdx, unitIdx) {
|
|
313
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
314
|
+
yield protractor_1.$(`#root_gatherings_${gatheringIdx}_units_${unitIdx}-delete`).click();
|
|
315
|
+
return protractor_1.$(`#root_gatherings_${gatheringIdx}_units_${unitIdx}-delete-confirm-yes`).click();
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
exports.removeUnit = removeUnit;
|
|
319
|
+
const updateValue = ($input, value, blur = true) => __awaiter(void 0, void 0, void 0, function* () {
|
|
320
|
+
const current = (yield $input.getAttribute("value")) || "";
|
|
321
|
+
yield $input.click();
|
|
322
|
+
yield $input.sendKeys(...Array(current.length).fill(protractor_1.protractor.Key.BACK_SPACE), value);
|
|
323
|
+
if (blur) {
|
|
324
|
+
return $input.sendKeys(protractor_1.protractor.Key.TAB);
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
exports.updateValue = updateValue;
|
|
328
|
+
exports.mockImageMetadata = {
|
|
329
|
+
"id": "mock",
|
|
330
|
+
"capturerVerbatim": [
|
|
331
|
+
"mock"
|
|
332
|
+
],
|
|
333
|
+
"intellectualOwner": "mock",
|
|
334
|
+
"intellectualRights": "MZ.intellectualRightsCC-BY-SA-4.0",
|
|
335
|
+
"fullURL": "https://imagetest.laji.fi/MM.97056/pixel_full.jpg",
|
|
336
|
+
"largeURL": "https://imagetest.laji.fi/MM.97056/pixel_large.jpg",
|
|
337
|
+
"squareThumbnailURL": "https://imagetest.laji.fi/MM.97056/pixel_square.jpg",
|
|
338
|
+
"thumbnailURL": "https://imagetest.laji.fi/MM.97056/pixel_thumb.jpg",
|
|
339
|
+
"originalURL": "https://imagetest.laji.fi/MM.97056/pixel.png",
|
|
340
|
+
"uploadedBy": "MA.308",
|
|
341
|
+
"@context": "http://schema.laji.fi/context/image-en.jsonld"
|
|
342
|
+
};
|
|
330
343
|
const filterUUIDs = (any) => {
|
|
331
344
|
if (typeof any === "object" && !Array.isArray(any) && any !== null) {
|
|
332
345
|
return Object.keys(any).filter(key => key !== "_lajiFormId").reduce((_any, key) => (Object.assign(Object.assign({}, _any), { [key]: exports.filterUUIDs(any[key]) })), {});
|
|
@@ -339,8 +352,3 @@ const filterUUIDs = (any) => {
|
|
|
339
352
|
exports.filterUUIDs = filterUUIDs;
|
|
340
353
|
const maybeJSONPointerToLocator = (pointer) => pointer[0] === "/" ? pointer.slice(1).replace(/\//g, "_") : pointer;
|
|
341
354
|
exports.maybeJSONPointerToLocator = maybeJSONPointerToLocator;
|
|
342
|
-
const getRemoveUnit = (page) => (gatheringIdx, unitIdx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
343
|
-
yield page.locator(`#root_gatherings_${gatheringIdx}_units_${unitIdx}-delete`).click();
|
|
344
|
-
return page.locator(`#root_gatherings_${gatheringIdx}_units_${unitIdx}-delete-confirm-yes`).click();
|
|
345
|
-
});
|
|
346
|
-
exports.getRemoveUnit = getRemoveUnit;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const test_utils_1 = require("./test-utils");
|
|
13
|
+
const protractor_1 = require("protractor");
|
|
14
|
+
describe("transaction form (MHL.930)", () => {
|
|
15
|
+
let form;
|
|
16
|
+
let typeEnum$;
|
|
17
|
+
const uiSchemaContext = {
|
|
18
|
+
userName: "Test, User",
|
|
19
|
+
userEmail: "user.test@email.com"
|
|
20
|
+
};
|
|
21
|
+
beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
+
form = yield test_utils_1.createForm({ id: "MHL.930" });
|
|
23
|
+
yield form.setState({ uiSchemaContext });
|
|
24
|
+
typeEnum$ = form.$getEnumWidget("type");
|
|
25
|
+
yield typeEnum$.openEnums();
|
|
26
|
+
yield typeEnum$.$$enums.first().click();
|
|
27
|
+
}));
|
|
28
|
+
it("sets correct name and email when clicking a me button", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
29
|
+
yield form.$locate("localPerson").$("button").click();
|
|
30
|
+
const $input = form.$locate("localPerson").$("input");
|
|
31
|
+
expect(yield $input.getAttribute("value")).toBe("Test, User");
|
|
32
|
+
const $input2 = form.$locate("localPersonEmail").$("input");
|
|
33
|
+
expect(yield $input2.getAttribute("value")).toBe("user.test@email.com");
|
|
34
|
+
const formData = yield form.getChangedData();
|
|
35
|
+
expect(formData.localPerson).toBe("Test, User");
|
|
36
|
+
expect(formData.localPersonEmail).toBe("user.test@email.com");
|
|
37
|
+
}));
|
|
38
|
+
describe("specimen fields", () => {
|
|
39
|
+
it("adds the ids", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
+
const $input = form.$getInputWidget("awayIDs");
|
|
41
|
+
yield $input.sendKeys("abc cde efg");
|
|
42
|
+
yield $input.sendKeys(protractor_1.protractor.Key.TAB);
|
|
43
|
+
let formData = yield form.getChangedData();
|
|
44
|
+
expect(formData.awayIDs).toEqual(["abc", "cde", "efg"]);
|
|
45
|
+
}));
|
|
46
|
+
it("marks all as returned", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
|
+
const returnAllButton$ = protractor_1.$(".laji-form-multi-tag-array-field-buttons").all(protractor_1.by.tagName("button")).get(0);
|
|
48
|
+
yield returnAllButton$.click();
|
|
49
|
+
const formData = yield form.getChangedData();
|
|
50
|
+
expect(formData.awayIDs).toEqual([]);
|
|
51
|
+
expect(formData.returnedIDs).toEqual(["abc", "cde", "efg"]);
|
|
52
|
+
}));
|
|
53
|
+
it("marks selected ids as missing", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
54
|
+
const markAsMissingButton$ = protractor_1.$(".laji-form-multi-tag-array-field-buttons").all(protractor_1.by.tagName("button")).get(3);
|
|
55
|
+
yield markAsMissingButton$.click();
|
|
56
|
+
const tags$ = form.$locate("returnedIDs").$$(".rw-multiselect-tag");
|
|
57
|
+
yield tags$.get(1).click();
|
|
58
|
+
const formData = yield form.getChangedData();
|
|
59
|
+
expect(formData.returnedIDs).toEqual(["abc", "efg"]);
|
|
60
|
+
expect(formData.missingIDs).toEqual(["cde"]);
|
|
61
|
+
}));
|
|
62
|
+
});
|
|
63
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|