@luomus/laji-form 14.3.8 → 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/CHANGELOG.md +4 -0
- package/cypress/fixtures/example.json +5 -0
- closes suggestion list (failed).png +0 -0
- is marked as suggested (failed).png +0 -0
- package/dist/laji-form.js +1 -1
- package/lib/components/LajiForm.js +0 -1
- package/lib/components/fields/ImageArrayField.js +2 -4
- package/lib/components/fields/NamedPlaceSaverField.js +1 -1
- package/lib/components/fields/SectionArrayField.js +5 -1
- package/lib/components/fields/SingleActiveArrayField.js +1 -1
- package/lib/components/fields/UnitShorthandField.js +2 -2
- package/lib/components/templates/ArrayFieldTemplate.js +3 -2
- package/lib/components/templates/FieldTemplate.js +2 -2
- package/lib/utils.d.ts +6 -2
- package/lib/utils.js +13 -13
- package/llol +10 -0
- package/llol.pdf +10 -0
- package/migrate.sh +33 -0
- package/package.json +14 -21
- package/playwright-report/index.html +62 -0
- package/playwright.config.ts +77 -0
- package/q +196 -0
- package/rename.sh +24 -0
- package/test-export/test-utils.d.ts +177 -150
- package/test-export/test-utils.js +214 -218
- package/trip-report.spec.ts +594 -0
- package/tsconfig.test.json +1 -1
- package/lib/components/fields/AsArrayField.d.ts +0 -292
- package/lib/components/fields/AsArrayField.js +0 -39
- package/test-export/array-spec.d.ts +0 -1
- package/test-export/array-spec.js +0 -204
- package/test-export/bird-point-count-spec.d.ts +0 -1
- package/test-export/bird-point-count-spec.js +0 -62
- package/test-export/collection-contest-form-spec.d.ts +0 -1
- package/test-export/collection-contest-form-spec.js +0 -38
- package/test-export/dataset-form-spec.d.ts +0 -1
- package/test-export/dataset-form-spec.js +0 -50
- package/test-export/date-time-widget-spec.d.ts +0 -1
- package/test-export/date-time-widget-spec.js +0 -188
- package/test-export/geocoder-spec.d.ts +0 -1
- package/test-export/geocoder-spec.js +0 -135
- package/test-export/image-array-spec.d.ts +0 -1
- package/test-export/image-array-spec.js +0 -94
- package/test-export/inject-field-spec.d.ts +0 -1
- package/test-export/inject-field-spec.js +0 -148
- package/test-export/internal-uuids-spec.d.ts +0 -1
- package/test-export/internal-uuids-spec.js +0 -157
- package/test-export/invasive-species-eradication-np-spec.d.ts +0 -1
- package/test-export/invasive-species-eradication-np-spec.js +0 -18
- package/test-export/invasive-species-eradication-spec.d.ts +0 -1
- package/test-export/invasive-species-eradication-spec.js +0 -25
- package/test-export/line-transect-spec.d.ts +0 -1
- package/test-export/line-transect-spec.js +0 -121
- package/test-export/mobile-form-spec.d.ts +0 -1
- package/test-export/mobile-form-spec.js +0 -84
- package/test-export/nafi-spec.d.ts +0 -1
- package/test-export/nafi-spec.js +0 -85
- package/test-export/select-widget-spec.d.ts +0 -1
- package/test-export/select-widget-spec.js +0 -68
- package/test-export/single-item-array-field-spec.d.ts +0 -1
- package/test-export/single-item-array-field-spec.js +0 -92
- package/test-export/syke-butterfly-spec.d.ts +0 -1
- package/test-export/syke-butterfly-spec.js +0 -163
- package/test-export/transaction-form-spec.d.ts +0 -1
- package/test-export/transaction-form-spec.js +0 -63
- package/test-export/trip-report-autosuggest-spec.d.ts +0 -1
- package/test-export/trip-report-autosuggest-spec.js +0 -272
- package/test-export/trip-report-spec.d.ts +0 -1
- package/test-export/trip-report-spec.js +0 -456
- package/test-export/unit-list-shorthand-array-field-spec.d.ts +0 -1
- package/test-export/unit-list-shorthand-array-field-spec.js +0 -71
- package/test-export/validation-spec.d.ts +0 -1
- package/test-export/validation-spec.js +0 -336
- package/test-export/water-bird-spec.d.ts +0 -1
- package/test-export/water-bird-spec.js +0 -30
- package/test-export/wbc-spec.d.ts +0 -1
- package/test-export/wbc-spec.js +0 -82
|
@@ -1,92 +0,0 @@
|
|
|
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("SingleItemArrayField", () => {
|
|
15
|
-
const uiSchema = {
|
|
16
|
-
"ui:field": "SingleItemArrayField",
|
|
17
|
-
};
|
|
18
|
-
let form;
|
|
19
|
-
beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
-
form = yield test_utils_1.createForm();
|
|
21
|
-
}));
|
|
22
|
-
describe("object", () => {
|
|
23
|
-
const schema = {
|
|
24
|
-
type: "array",
|
|
25
|
-
items: {
|
|
26
|
-
type: "object",
|
|
27
|
-
properties: {
|
|
28
|
-
a: { type: "string" }
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
const formData = [{ a: "foo" }, { a: "bar" }];
|
|
33
|
-
beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
34
|
-
yield form.setState({ schema, uiSchema, formData });
|
|
35
|
-
}));
|
|
36
|
-
it("uses first item by default and keeps idSchema intact", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
|
-
expect(yield form.$getInputWidget("0.a").isDisplayed()).toBe(true);
|
|
38
|
-
}));
|
|
39
|
-
describe("respects activeIdx and", () => {
|
|
40
|
-
beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
-
yield form.setState({ uiSchema: Object.assign(Object.assign({}, uiSchema), { "ui:options": { activeIdx: 1 } }) });
|
|
42
|
-
}));
|
|
43
|
-
it("renders only single item", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
44
|
-
expect(yield form.$locate("1.a").isDisplayed()).toBe(true);
|
|
45
|
-
expect(yield form.$locate("0.a").isPresent()).toBe(false);
|
|
46
|
-
}));
|
|
47
|
-
it("renders form data", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
|
-
expect(yield form.$getInputWidget("1.a").getAttribute("value")).toBe(formData[1].a);
|
|
49
|
-
}));
|
|
50
|
-
it("onChange", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
-
yield test_utils_1.updateValue(form.$getInputWidget("1.a"), "test");
|
|
52
|
-
expect(yield form.$getInputWidget("1.a").getAttribute("value")).toBe("test");
|
|
53
|
-
}));
|
|
54
|
-
it("renders item errors", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
|
-
yield form.setState({
|
|
56
|
-
formData: [{ a: "a" }, { a: 1 }]
|
|
57
|
-
});
|
|
58
|
-
yield form.submit();
|
|
59
|
-
expect(yield form.$$getFieldErrors("1.a").count()).toBe(1);
|
|
60
|
-
}));
|
|
61
|
-
it("renders array errors", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
62
|
-
yield form.setState({
|
|
63
|
-
schema: Object.assign(Object.assign({}, schema), { minItems: 1 }),
|
|
64
|
-
formData: []
|
|
65
|
-
});
|
|
66
|
-
yield form.submit();
|
|
67
|
-
expect(yield form.$$getFieldErrors("").count()).toBe(1);
|
|
68
|
-
}));
|
|
69
|
-
});
|
|
70
|
-
it("formats title", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
71
|
-
yield form.setState({ uiSchema: Object.assign(Object.assign({}, uiSchema), { "ui:title": "test %{idx} test" }) });
|
|
72
|
-
expect(yield protractor_1.element(protractor_1.by.cssContainingText("span", "test 1 test")).isDisplayed()).toBe(true);
|
|
73
|
-
}));
|
|
74
|
-
it("respects titleClassName option", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
75
|
-
yield form.setState({ uiSchema: Object.assign(Object.assign({}, uiSchema), { "ui:title": "test", "ui:options": { titleClassName: "title-format-test" } }) });
|
|
76
|
-
expect(yield protractor_1.$(".title-format-test").isDisplayed()).toBe(true);
|
|
77
|
-
}));
|
|
78
|
-
});
|
|
79
|
-
describe("string array with unique items", () => {
|
|
80
|
-
const schema = { type: "array", uniqueItems: true, title: "test", items: { type: "string", enum: ["a"], enumNames: ["a"] } };
|
|
81
|
-
beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
82
|
-
yield form.setState({ schema, uiSchema });
|
|
83
|
-
}));
|
|
84
|
-
it("is rendered as select", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
85
|
-
expect(yield form.$getEnumWidget("").$container.isDisplayed()).toBe(true);
|
|
86
|
-
}));
|
|
87
|
-
it("renders title as label", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
88
|
-
expect(yield protractor_1.$("label").isDisplayed()).toBe(true);
|
|
89
|
-
expect(yield protractor_1.$("legend").isPresent()).toBe(false);
|
|
90
|
-
}));
|
|
91
|
-
});
|
|
92
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,163 +0,0 @@
|
|
|
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("SYKE butterfly form (MHL.59)", () => {
|
|
15
|
-
let form;
|
|
16
|
-
let $firstUnitsAdd;
|
|
17
|
-
let $secondUnitsAdd;
|
|
18
|
-
let $gatheringsAdd;
|
|
19
|
-
it("navigate to form", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
-
const formData = {
|
|
21
|
-
"gatherings": [
|
|
22
|
-
{
|
|
23
|
-
"section": 1,
|
|
24
|
-
"units": []
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"units": []
|
|
28
|
-
}
|
|
29
|
-
]
|
|
30
|
-
};
|
|
31
|
-
form = yield test_utils_1.createForm({ id: "MHL.59", formData });
|
|
32
|
-
const $$addButtons = yield form.$locate("gatherings.0.units").$$("button");
|
|
33
|
-
$firstUnitsAdd = $$addButtons[0];
|
|
34
|
-
$secondUnitsAdd = $$addButtons[1];
|
|
35
|
-
$gatheringsAdd = form.$locateButton("gatherings", "add");
|
|
36
|
-
//$lastGatheringsUnitsAdd = form.$locateButton("gatherings.1.units", "add");
|
|
37
|
-
}));
|
|
38
|
-
it("has gatherings", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
39
|
-
expect(yield form.$locate("gatherings").isDisplayed()).toBe(true);
|
|
40
|
-
}));
|
|
41
|
-
it("has one gathering by default", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
42
|
-
expect(yield form.$locate("gatherings.0").isDisplayed()).toBe(true);
|
|
43
|
-
}));
|
|
44
|
-
it("has gatherings add", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
45
|
-
expect(yield $gatheringsAdd.isDisplayed()).toBe(true);
|
|
46
|
-
}));
|
|
47
|
-
it("has first unit add", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
|
-
expect(yield $firstUnitsAdd.isDisplayed()).toBe(true);
|
|
49
|
-
}));
|
|
50
|
-
it("has second unit add", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
-
expect(yield $secondUnitsAdd.isDisplayed()).toBe(true);
|
|
52
|
-
}));
|
|
53
|
-
describe("adding unit to first group", () => {
|
|
54
|
-
it("works", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
|
-
yield $firstUnitsAdd.click();
|
|
56
|
-
expect(yield form.$locate("gatherings.0.units.0.identifications.0.taxonVerbatim").isDisplayed()).toBe(true);
|
|
57
|
-
expect(yield form.$locate("gatherings.0.units.0.individualCount").isDisplayed()).toBe(true);
|
|
58
|
-
}));
|
|
59
|
-
it("autofocuses", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
60
|
-
expect(yield test_utils_1.getFocusedId()).toBe(yield form.$getInputWidget("gatherings.0.units.0.identifications.0.taxonVerbatim").getAttribute("id"));
|
|
61
|
-
}));
|
|
62
|
-
});
|
|
63
|
-
describe("adding unit to second group", () => {
|
|
64
|
-
it("works", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
65
|
-
yield $secondUnitsAdd.click();
|
|
66
|
-
expect(yield form.$locate("gatherings.0.units.0.identifications.0.taxonVerbatim").isDisplayed()).toBe(true);
|
|
67
|
-
expect(yield form.$locate("gatherings.0.units.1.identifications.0.taxonVerbatim").isDisplayed()).toBe(true);
|
|
68
|
-
expect(yield form.$locate("gatherings.0.units.0.individualCount").isDisplayed()).toBe(true);
|
|
69
|
-
expect(yield form.$locate("gatherings.0.units.1.individualCount").isDisplayed()).toBe(true);
|
|
70
|
-
}));
|
|
71
|
-
it("autofocuses", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
72
|
-
expect(yield test_utils_1.getFocusedId()).toBe(yield form.$getInputWidget("gatherings.0.units.1.identifications.0.taxonVerbatim").getAttribute("id"));
|
|
73
|
-
}));
|
|
74
|
-
});
|
|
75
|
-
describe("adding new section", () => {
|
|
76
|
-
it("works", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
77
|
-
yield $gatheringsAdd.click();
|
|
78
|
-
yield form.$locateAddition("gatherings", "section-input").sendKeys("2");
|
|
79
|
-
yield form.$locateAddition("gatherings", "section-input").sendKeys(protractor_1.protractor.Key.ENTER);
|
|
80
|
-
expect(yield form.$locate("gatherings.0.units.1.identifications.0.taxonVerbatim").isDisplayed()).toBe(true);
|
|
81
|
-
expect(yield form.$locate("gatherings.0.units.0.individualCount").isDisplayed()).toBe(true);
|
|
82
|
-
expect(yield form.$locate("gatherings.0.units.1.individualCount").isDisplayed()).toBe(true);
|
|
83
|
-
expect(yield form.$locate("gatherings.1.units.0.individualCount").isDisplayed()).toBe(true);
|
|
84
|
-
expect(yield form.$locate("gatherings.1.units.1.individualCount").isDisplayed()).toBe(true);
|
|
85
|
-
}));
|
|
86
|
-
// Works really but test suite fails
|
|
87
|
-
//it("autofocuses", async () => {
|
|
88
|
-
// expect(await getFocusedId() === await form.$getInputWidget("gatherings.1.gatheringFact.sykeButterFlyCensusWind").getAttribute("id")).toBe(true);
|
|
89
|
-
//});
|
|
90
|
-
});
|
|
91
|
-
describe("adding unit to first group again", () => {
|
|
92
|
-
it("works", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
93
|
-
yield $firstUnitsAdd.click();
|
|
94
|
-
expect(yield form.$locate("gatherings.0.units.0.identifications.0.taxonVerbatim").isDisplayed()).toBe(true);
|
|
95
|
-
expect(yield form.$locate("gatherings.0.units.1.identifications.0.taxonVerbatim").isDisplayed()).toBe(true);
|
|
96
|
-
expect(yield form.$locate("gatherings.0.units.2.identifications.0.taxonVerbatim").isDisplayed()).toBe(true);
|
|
97
|
-
expect(yield form.$locate("gatherings.0.units.0.individualCount").isDisplayed()).toBe(true);
|
|
98
|
-
expect(yield form.$locate("gatherings.0.units.1.individualCount").isDisplayed()).toBe(true);
|
|
99
|
-
expect(yield form.$locate("gatherings.0.units.2.individualCount").isDisplayed()).toBe(true);
|
|
100
|
-
expect(yield form.$locate("gatherings.1.units.0.individualCount").isDisplayed()).toBe(true);
|
|
101
|
-
expect(yield form.$locate("gatherings.1.units.1.individualCount").isDisplayed()).toBe(true);
|
|
102
|
-
expect(yield form.$locate("gatherings.1.units.2.individualCount").isDisplayed()).toBe(true);
|
|
103
|
-
}));
|
|
104
|
-
it("autofocuses", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
105
|
-
expect(yield test_utils_1.getFocusedId()).toBe(yield form.$getInputWidget("gatherings.0.units.1.identifications.0.taxonVerbatim").getAttribute("id"));
|
|
106
|
-
}));
|
|
107
|
-
});
|
|
108
|
-
describe("adding unit to second group again", () => {
|
|
109
|
-
it("works", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
110
|
-
yield $secondUnitsAdd.click();
|
|
111
|
-
expect(yield form.$locate("gatherings.0.units.0.identifications.0.taxonVerbatim").isDisplayed()).toBe(true);
|
|
112
|
-
expect(yield form.$locate("gatherings.0.units.1.identifications.0.taxonVerbatim").isDisplayed()).toBe(true);
|
|
113
|
-
expect(yield form.$locate("gatherings.0.units.2.identifications.0.taxonVerbatim").isDisplayed()).toBe(true);
|
|
114
|
-
expect(yield form.$locate("gatherings.0.units.3.identifications.0.taxonVerbatim").isDisplayed()).toBe(true);
|
|
115
|
-
expect(yield form.$locate("gatherings.0.units.0.individualCount").isDisplayed()).toBe(true);
|
|
116
|
-
expect(yield form.$locate("gatherings.0.units.1.individualCount").isDisplayed()).toBe(true);
|
|
117
|
-
expect(yield form.$locate("gatherings.0.units.2.individualCount").isDisplayed()).toBe(true);
|
|
118
|
-
expect(yield form.$locate("gatherings.0.units.3.individualCount").isDisplayed()).toBe(true);
|
|
119
|
-
expect(yield form.$locate("gatherings.1.units.0.individualCount").isDisplayed()).toBe(true);
|
|
120
|
-
expect(yield form.$locate("gatherings.1.units.1.individualCount").isDisplayed()).toBe(true);
|
|
121
|
-
expect(yield form.$locate("gatherings.1.units.2.individualCount").isDisplayed()).toBe(true);
|
|
122
|
-
expect(yield form.$locate("gatherings.1.units.3.individualCount").isDisplayed()).toBe(true);
|
|
123
|
-
}));
|
|
124
|
-
it("autofocuses", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
125
|
-
expect(yield test_utils_1.getFocusedId()).toBe(yield form.$getInputWidget("gatherings.0.units.3.identifications.0.taxonVerbatim").getAttribute("id"));
|
|
126
|
-
}));
|
|
127
|
-
});
|
|
128
|
-
describe("adding new section again", () => {
|
|
129
|
-
it("works", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
130
|
-
yield $gatheringsAdd.click();
|
|
131
|
-
yield form.$locateAddition("gatherings", "section-input").sendKeys("3");
|
|
132
|
-
yield form.$locateAddition("gatherings", "section-input").sendKeys(protractor_1.protractor.Key.ENTER);
|
|
133
|
-
expect(yield form.$locate("gatherings.0.units.0.identifications.0.taxonVerbatim").isDisplayed()).toBe(true);
|
|
134
|
-
expect(yield form.$locate("gatherings.0.units.1.identifications.0.taxonVerbatim").isDisplayed()).toBe(true);
|
|
135
|
-
expect(yield form.$locate("gatherings.0.units.2.identifications.0.taxonVerbatim").isDisplayed()).toBe(true);
|
|
136
|
-
expect(yield form.$locate("gatherings.0.units.3.identifications.0.taxonVerbatim").isDisplayed()).toBe(true);
|
|
137
|
-
expect(yield form.$locate("gatherings.0.units.0.individualCount").isDisplayed()).toBe(true);
|
|
138
|
-
expect(yield form.$locate("gatherings.0.units.1.individualCount").isDisplayed()).toBe(true);
|
|
139
|
-
expect(yield form.$locate("gatherings.0.units.2.individualCount").isDisplayed()).toBe(true);
|
|
140
|
-
expect(yield form.$locate("gatherings.0.units.3.individualCount").isDisplayed()).toBe(true);
|
|
141
|
-
expect(yield form.$locate("gatherings.1.units.0.individualCount").isDisplayed()).toBe(true);
|
|
142
|
-
expect(yield form.$locate("gatherings.1.units.1.individualCount").isDisplayed()).toBe(true);
|
|
143
|
-
expect(yield form.$locate("gatherings.1.units.2.individualCount").isDisplayed()).toBe(true);
|
|
144
|
-
expect(yield form.$locate("gatherings.1.units.3.individualCount").isDisplayed()).toBe(true);
|
|
145
|
-
expect(yield form.$locate("gatherings.2.units.0.individualCount").isDisplayed()).toBe(true);
|
|
146
|
-
expect(yield form.$locate("gatherings.2.units.1.individualCount").isDisplayed()).toBe(true);
|
|
147
|
-
expect(yield form.$locate("gatherings.2.units.2.individualCount").isDisplayed()).toBe(true);
|
|
148
|
-
expect(yield form.$locate("gatherings.2.units.3.individualCount").isDisplayed()).toBe(true);
|
|
149
|
-
}));
|
|
150
|
-
// Works really but test suite fails
|
|
151
|
-
//it("autofocuses", async () => {
|
|
152
|
-
// expect(await getFocusedId() === await form.$getInputWidget("gatherings.2.gatheringFact.sykeButterFlyCensusWind").getAttribute("id")).toBe(true);
|
|
153
|
-
//});
|
|
154
|
-
});
|
|
155
|
-
it("removing new section works", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
156
|
-
const gatheringsLength = (yield form.getChangedData()).gatherings.length;
|
|
157
|
-
yield form.$locateButton("gatherings.0", "delete").click();
|
|
158
|
-
const formData = yield form.getChangedData();
|
|
159
|
-
expect(formData.gatherings.length).not.toBe(gatheringsLength);
|
|
160
|
-
expect(formData.gatherings[0].section).toBe(2);
|
|
161
|
-
expect(formData.gatherings[formData.gatherings.length - 1].section).toBe(undefined);
|
|
162
|
-
}));
|
|
163
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,63 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,272 +0,0 @@
|
|
|
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("Trip report (JX.519) autosuggestions", () => {
|
|
15
|
-
let form;
|
|
16
|
-
beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
-
form = yield test_utils_1.createForm({ id: "JX.519" });
|
|
18
|
-
yield test_utils_1.putForeignMarkerToMap();
|
|
19
|
-
}));
|
|
20
|
-
describe("observers", () => {
|
|
21
|
-
it("when two unknown and 1st is removed, the autosuggest input value updated to the value of the 1st", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
-
// TableField has problems, so ids here are erratic but correct
|
|
23
|
-
const $deleteObserver = form.$locateButton("gatheringEvent.0", "delete");
|
|
24
|
-
const $addObserver = form.$locateButton("gatheringEvent", "add");
|
|
25
|
-
const observer1$ = form.$getInputWidget("gatheringEvent.0.leg");
|
|
26
|
-
const observer2$ = form.$getInputWidget("gatheringEvent.1.leg");
|
|
27
|
-
yield $deleteObserver.click();
|
|
28
|
-
yield $addObserver.click();
|
|
29
|
-
yield $addObserver.click();
|
|
30
|
-
yield observer1$.sendKeys("matti");
|
|
31
|
-
yield observer2$.sendKeys("teppo");
|
|
32
|
-
yield $deleteObserver.click();
|
|
33
|
-
expect(yield observer1$.getAttribute("value")).toBe("teppo");
|
|
34
|
-
}));
|
|
35
|
-
});
|
|
36
|
-
describe("taxon census", () => {
|
|
37
|
-
let censusAutosuggest;
|
|
38
|
-
beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
39
|
-
const scopeField = form.getScopeField("gatherings.0");
|
|
40
|
-
yield protractor_1.browser.wait(protractor_1.protractor.ExpectedConditions.visibilityOf(scopeField.$button), 1000, "gatherings additionals button didn't show up");
|
|
41
|
-
yield scopeField.$button.click();
|
|
42
|
-
yield scopeField.$$listItems.last().click();
|
|
43
|
-
censusAutosuggest = form.getTaxonAutosuggestWidget("gatherings.0.taxonCensus.0.censusTaxonID");
|
|
44
|
-
}));
|
|
45
|
-
it("selects on click", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
46
|
-
yield protractor_1.browser.wait(protractor_1.protractor.ExpectedConditions.visibilityOf(form.$locateButton("gatherings.0.taxonCensus", "add")), 1000, "taxon census didn't show up");
|
|
47
|
-
yield form.$locateButton("gatherings.0.taxonCensus", "add").click();
|
|
48
|
-
yield censusAutosuggest.$input.sendKeys("aves");
|
|
49
|
-
yield censusAutosuggest.waitForSuggestionsToLoad();
|
|
50
|
-
yield censusAutosuggest.$$suggestions.first().click();
|
|
51
|
-
yield censusAutosuggest.waitForGlyph();
|
|
52
|
-
expect(yield censusAutosuggest.isSuggested()).toBe(true, "wasn't displayed as suggested");
|
|
53
|
-
expect(yield censusAutosuggest.$input.getAttribute("value")).toBe("Aves", "Input value wasn't the clicked value");
|
|
54
|
-
}));
|
|
55
|
-
});
|
|
56
|
-
describe("unit taxon", () => {
|
|
57
|
-
let taxonAutosuggest;
|
|
58
|
-
let $addUnit;
|
|
59
|
-
const moveMouseAway = (locator) => protractor_1.browser.actions()
|
|
60
|
-
.mouseMove(form.$locate(locator).getWebElement(), { x: -100, y: -100 })
|
|
61
|
-
.perform();
|
|
62
|
-
beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
63
|
-
taxonAutosuggest = form.getTaxonAutosuggestWidget("gatherings.0.units.0.identifications.0.taxon");
|
|
64
|
-
$addUnit = form.$locateButton("gatherings.0.units", "add");
|
|
65
|
-
}));
|
|
66
|
-
beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
67
|
-
if (yield form.$locate("gatherings.0.units.0.identifications.0.taxon").isPresent()) {
|
|
68
|
-
yield moveMouseAway("gatherings.0.units.0.identifications.0.taxon");
|
|
69
|
-
}
|
|
70
|
-
}));
|
|
71
|
-
it("clicking any match selects it", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
72
|
-
yield taxonAutosuggest.$input.sendKeys("kett");
|
|
73
|
-
yield taxonAutosuggest.waitForSuggestionsToLoad();
|
|
74
|
-
yield taxonAutosuggest.$$suggestions.first().click();
|
|
75
|
-
yield taxonAutosuggest.waitForGlyph();
|
|
76
|
-
expect(yield taxonAutosuggest.isSuggested()).toBe(true);
|
|
77
|
-
expect(yield taxonAutosuggest.$input.getAttribute("value")).toBe("kettu");
|
|
78
|
-
yield test_utils_1.removeUnit(0, 0);
|
|
79
|
-
yield $addUnit.click();
|
|
80
|
-
}));
|
|
81
|
-
it("typing exact match and pressing enter after waiting for suggestion list selects exact match", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
82
|
-
yield taxonAutosuggest.$input.sendKeys("kettu");
|
|
83
|
-
yield taxonAutosuggest.waitForSuggestionsToLoad();
|
|
84
|
-
yield taxonAutosuggest.$input.sendKeys(protractor_1.protractor.Key.ENTER);
|
|
85
|
-
yield taxonAutosuggest.waitForGlyph();
|
|
86
|
-
expect(yield taxonAutosuggest.isSuggested()).toBe(true);
|
|
87
|
-
expect(yield taxonAutosuggest.$input.getAttribute("value")).toBe("kettu");
|
|
88
|
-
yield test_utils_1.removeUnit(0, 0);
|
|
89
|
-
yield $addUnit.click();
|
|
90
|
-
}));
|
|
91
|
-
it("typing exact match and pressing enter without waiting for suggestion list selects exact match", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
92
|
-
yield taxonAutosuggest.$input.sendKeys("kettu");
|
|
93
|
-
yield taxonAutosuggest.$input.sendKeys(protractor_1.protractor.Key.ENTER);
|
|
94
|
-
yield taxonAutosuggest.waitForGlyph();
|
|
95
|
-
expect(yield taxonAutosuggest.isSuggested()).toBe(true);
|
|
96
|
-
expect(yield taxonAutosuggest.$input.getAttribute("value")).toBe("kettu");
|
|
97
|
-
yield test_utils_1.removeUnit(0, 0);
|
|
98
|
-
yield $addUnit.click();
|
|
99
|
-
}));
|
|
100
|
-
it("typing exact match and pressing tab after waiting for suggestion list selects exact match", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
101
|
-
yield taxonAutosuggest.$input.sendKeys("kettu");
|
|
102
|
-
yield taxonAutosuggest.waitForSuggestionsToLoad();
|
|
103
|
-
yield taxonAutosuggest.$input.sendKeys(protractor_1.protractor.Key.TAB);
|
|
104
|
-
yield taxonAutosuggest.waitForGlyph();
|
|
105
|
-
expect(yield taxonAutosuggest.isSuggested()).toBe(true);
|
|
106
|
-
expect(yield taxonAutosuggest.$input.getAttribute("value")).toBe("kettu");
|
|
107
|
-
expect(yield test_utils_1.getFocusedElement().getAttribute("id")).not.toBe(yield taxonAutosuggest.$input.getAttribute("id"), "next elem wasn't focused");
|
|
108
|
-
yield test_utils_1.getFocusedElement().sendKeys(protractor_1.protractor.Key.TAB); // Tab to get rid of toggler tooltip obscuring elements
|
|
109
|
-
yield protractor_1.browser.sleep(100);
|
|
110
|
-
yield test_utils_1.removeUnit(0, 0);
|
|
111
|
-
yield $addUnit.click();
|
|
112
|
-
}));
|
|
113
|
-
it("typing exact match and pressing tab without waiting for suggestion list selects exact match", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
114
|
-
yield taxonAutosuggest.$input.sendKeys("kettu");
|
|
115
|
-
yield taxonAutosuggest.$input.sendKeys(protractor_1.protractor.Key.TAB);
|
|
116
|
-
yield taxonAutosuggest.waitForGlyph();
|
|
117
|
-
expect(yield taxonAutosuggest.isSuggested()).toBe(true);
|
|
118
|
-
expect(yield taxonAutosuggest.$input.getAttribute("value")).toBe("kettu");
|
|
119
|
-
expect(yield test_utils_1.getFocusedElement().getAttribute("id")).not.toBe(yield taxonAutosuggest.$input.getAttribute("id"), "next elem wasn't focused");
|
|
120
|
-
yield test_utils_1.getFocusedElement().sendKeys(protractor_1.protractor.Key.TAB); // Tab to get rid of toggler tooltip obscuring elements
|
|
121
|
-
yield protractor_1.browser.sleep(100);
|
|
122
|
-
yield test_utils_1.removeUnit(0, 0);
|
|
123
|
-
yield $addUnit.click();
|
|
124
|
-
}));
|
|
125
|
-
it("typing non exact match and blurring after waiting for suggestion list shows warning sign", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
126
|
-
yield taxonAutosuggest.$input.sendKeys("kett");
|
|
127
|
-
yield taxonAutosuggest.waitForSuggestionsToLoad();
|
|
128
|
-
yield taxonAutosuggest.$input.sendKeys(protractor_1.protractor.Key.TAB);
|
|
129
|
-
yield taxonAutosuggest.waitForGlyph();
|
|
130
|
-
expect(yield taxonAutosuggest.isNonsuggested()).toBe(true);
|
|
131
|
-
expect(yield taxonAutosuggest.$input.getAttribute("value")).toBe("kett");
|
|
132
|
-
expect(yield test_utils_1.getFocusedElement().getAttribute("id")).not.toBe(yield taxonAutosuggest.$input.getAttribute("id"), "next elem wasn't focused");
|
|
133
|
-
yield test_utils_1.getFocusedElement().sendKeys(protractor_1.protractor.Key.TAB); // Tab to get rid of toggler tooltip obscuring elements
|
|
134
|
-
yield protractor_1.browser.sleep(100);
|
|
135
|
-
yield test_utils_1.removeUnit(0, 0);
|
|
136
|
-
yield $addUnit.click();
|
|
137
|
-
}));
|
|
138
|
-
it("typing non exact match and blurring without waiting for suggestion list shows warning sign", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
139
|
-
yield taxonAutosuggest.$input.sendKeys("kett");
|
|
140
|
-
yield taxonAutosuggest.$input.sendKeys(protractor_1.protractor.Key.TAB);
|
|
141
|
-
yield taxonAutosuggest.waitForGlyph();
|
|
142
|
-
expect(yield taxonAutosuggest.isNonsuggested()).toBe(true);
|
|
143
|
-
expect(yield taxonAutosuggest.$input.getAttribute("value")).toBe("kett");
|
|
144
|
-
expect(yield test_utils_1.getFocusedElement().getAttribute("id")).not.toBe(yield taxonAutosuggest.$input.getAttribute("id"), "next elem wasn't focused");
|
|
145
|
-
yield test_utils_1.getFocusedElement().sendKeys(protractor_1.protractor.Key.TAB); // Tab to get rid of toggler tooltip obscuring elements
|
|
146
|
-
yield protractor_1.browser.sleep(100);
|
|
147
|
-
yield test_utils_1.removeUnit(0, 0);
|
|
148
|
-
yield $addUnit.click();
|
|
149
|
-
}));
|
|
150
|
-
it("typing exact match and blurring after waiting for suggestion list selects exact match", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
151
|
-
yield taxonAutosuggest.$input.sendKeys("kettu");
|
|
152
|
-
yield taxonAutosuggest.waitForSuggestionsToLoad();
|
|
153
|
-
yield taxonAutosuggest.$input.sendKeys(protractor_1.protractor.Key.TAB);
|
|
154
|
-
expect(yield taxonAutosuggest.isSuggested()).toBe(true);
|
|
155
|
-
expect(yield taxonAutosuggest.$input.getAttribute("value")).toBe("kettu");
|
|
156
|
-
expect(yield test_utils_1.getFocusedElement().getAttribute("id")).not.toBe(yield taxonAutosuggest.$input.getAttribute("id"), "next elem wasn't focused");
|
|
157
|
-
yield test_utils_1.getFocusedElement().sendKeys(protractor_1.protractor.Key.TAB); // Tab to get rid of toggler tooltip obscuring elements
|
|
158
|
-
yield protractor_1.browser.sleep(100);
|
|
159
|
-
yield test_utils_1.removeUnit(0, 0);
|
|
160
|
-
yield $addUnit.click();
|
|
161
|
-
}));
|
|
162
|
-
it("typing exact match and blurring before waiting for suggestion list selects exact match", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
163
|
-
yield taxonAutosuggest.$input.sendKeys("kettu");
|
|
164
|
-
yield taxonAutosuggest.$input.sendKeys(protractor_1.protractor.Key.TAB);
|
|
165
|
-
yield taxonAutosuggest.waitForGlyph();
|
|
166
|
-
expect(yield taxonAutosuggest.isSuggested()).toBe(true);
|
|
167
|
-
expect(yield taxonAutosuggest.$input.getAttribute("value")).toBe("kettu");
|
|
168
|
-
expect(yield test_utils_1.getFocusedElement().getAttribute("id")).not.toBe(yield taxonAutosuggest.$input.getAttribute("id"), "next elem wasn't focused");
|
|
169
|
-
yield test_utils_1.getFocusedElement().sendKeys(protractor_1.protractor.Key.TAB); // Tab to get rid of toggler tooltip obscuring elements
|
|
170
|
-
yield protractor_1.browser.sleep(100);
|
|
171
|
-
yield test_utils_1.removeUnit(0, 0);
|
|
172
|
-
yield $addUnit.click();
|
|
173
|
-
}));
|
|
174
|
-
it("typing exact match with sp suffix keeps sp suffix in value but select the exact match", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
175
|
-
for (const suffix of ["sp", "spp", "sp.", "spp."]) {
|
|
176
|
-
yield taxonAutosuggest.$input.sendKeys(`parus ${suffix}`);
|
|
177
|
-
yield taxonAutosuggest.$input.sendKeys(protractor_1.protractor.Key.TAB);
|
|
178
|
-
yield taxonAutosuggest.waitForGlyph();
|
|
179
|
-
expect(yield taxonAutosuggest.isSuggested()).toBe(true);
|
|
180
|
-
expect(yield taxonAutosuggest.$input.getAttribute("value")).toBe(`parus ${suffix}`);
|
|
181
|
-
expect(yield test_utils_1.getFocusedElement().getAttribute("id")).not.toBe(yield taxonAutosuggest.$input.getAttribute("id"), "next elem wasn't focused");
|
|
182
|
-
yield test_utils_1.getFocusedElement().sendKeys(protractor_1.protractor.Key.TAB); // Tab to get rid of toggler tooltip obscuring elements
|
|
183
|
-
yield protractor_1.browser.sleep(100);
|
|
184
|
-
yield test_utils_1.removeUnit(0, 0);
|
|
185
|
-
yield $addUnit.click();
|
|
186
|
-
}
|
|
187
|
-
}));
|
|
188
|
-
describe("power user", () => {
|
|
189
|
-
it("is shown power taxon field", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
190
|
-
expect(yield taxonAutosuggest.$powerUserButton.isDisplayed()).toBe(true);
|
|
191
|
-
}));
|
|
192
|
-
it("click toggles power user mode on/off", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
193
|
-
yield taxonAutosuggest.$powerUserButton.click();
|
|
194
|
-
expect(yield taxonAutosuggest.powerUserButtonIsActive()).toBe(true);
|
|
195
|
-
yield taxonAutosuggest.$powerUserButton.click();
|
|
196
|
-
expect(yield taxonAutosuggest.powerUserButtonIsActive()).toBe(false);
|
|
197
|
-
}));
|
|
198
|
-
it("clicking any match after waiting for suggestion list works", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
199
|
-
yield taxonAutosuggest.$powerUserButton.click();
|
|
200
|
-
yield taxonAutosuggest.$input.sendKeys("kettu");
|
|
201
|
-
yield taxonAutosuggest.waitForSuggestionsToLoad();
|
|
202
|
-
yield taxonAutosuggest.$$suggestions.last().click();
|
|
203
|
-
yield protractor_1.browser.wait(protractor_1.protractor.ExpectedConditions.visibilityOf(form.$locate("gatherings.0.units.1")), 5000, "auto added unit didn't appear");
|
|
204
|
-
expect(yield form.$locate("gatherings.0.units.0").getTagName()).toBe("tr", "entered unit wasn't deactivated");
|
|
205
|
-
const enteredUnitTaxon = yield form.$locate("gatherings.0.units.0").$$("td").first().getText();
|
|
206
|
-
expect(enteredUnitTaxon).toBe("ravunsyöjäkettu");
|
|
207
|
-
}));
|
|
208
|
-
it("entering second unit auto adds", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
209
|
-
const _taxonAutosuggest = form.getTaxonAutosuggestWidget("gatherings.0.units.1.identifications.0.taxon");
|
|
210
|
-
yield _taxonAutosuggest.$input.sendKeys("kettu");
|
|
211
|
-
yield _taxonAutosuggest.waitForSuggestionsToLoad();
|
|
212
|
-
yield _taxonAutosuggest.$$suggestions.last().click();
|
|
213
|
-
yield protractor_1.browser.wait(protractor_1.protractor.ExpectedConditions.visibilityOf(form.$locate("gatherings.0.units.2")), 5000, "auto added unit didn't appear");
|
|
214
|
-
expect(yield form.$locate("gatherings.0.units.1").getTagName()).toBe("tr", "entered unit wasn't deactivated");
|
|
215
|
-
const enteredUnitTaxon = yield form.$locate("gatherings.0.units.1").$$("td").first().getText();
|
|
216
|
-
expect(enteredUnitTaxon).toBe("ravunsyöjäkettu");
|
|
217
|
-
yield test_utils_1.removeUnit(0, 0);
|
|
218
|
-
yield test_utils_1.removeUnit(0, 0);
|
|
219
|
-
yield test_utils_1.removeUnit(0, 0);
|
|
220
|
-
yield $addUnit.click();
|
|
221
|
-
yield taxonAutosuggest.$powerUserButton.click();
|
|
222
|
-
}));
|
|
223
|
-
it("entering exact match adds new unit automatically", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
224
|
-
yield taxonAutosuggest.$powerUserButton.click();
|
|
225
|
-
yield taxonAutosuggest.$input.sendKeys("susi");
|
|
226
|
-
yield taxonAutosuggest.$input.sendKeys(protractor_1.protractor.Key.ENTER);
|
|
227
|
-
yield protractor_1.browser.wait(protractor_1.protractor.ExpectedConditions.visibilityOf(form.$locate("gatherings.0.units.1")), 5000, "New unit didn't show up");
|
|
228
|
-
expect(yield form.$locate("gatherings.0.units.0").getTagName()).toBe("tr");
|
|
229
|
-
expect(yield form.$locate("gatherings.0.units.1").getTagName()).toBe("div");
|
|
230
|
-
yield test_utils_1.removeUnit(0, 1);
|
|
231
|
-
yield taxonAutosuggest.$powerUserButton.click();
|
|
232
|
-
expect(yield taxonAutosuggest.powerUserButtonIsActive()).toBe(false);
|
|
233
|
-
yield test_utils_1.removeUnit(0, 0);
|
|
234
|
-
yield $addUnit.click();
|
|
235
|
-
}));
|
|
236
|
-
});
|
|
237
|
-
it("works when autocomplete response has autocompleteSelectedName", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
238
|
-
const mock = yield form.setMockResponse("/autocomplete/taxon");
|
|
239
|
-
yield taxonAutosuggest.$input.sendKeys("kuusi");
|
|
240
|
-
const autocompleteSelectedName = "foobar";
|
|
241
|
-
yield mock.resolve([{
|
|
242
|
-
"key": "MX.37812",
|
|
243
|
-
"value": "kuusi",
|
|
244
|
-
autocompleteSelectedName,
|
|
245
|
-
"payload": {
|
|
246
|
-
"matchingName": "kuusi",
|
|
247
|
-
"informalTaxonGroups": [
|
|
248
|
-
{
|
|
249
|
-
"id": "MVL.343",
|
|
250
|
-
"name": "Putkilokasvit"
|
|
251
|
-
}
|
|
252
|
-
],
|
|
253
|
-
"scientificName": "Picea abies",
|
|
254
|
-
"scientificNameAuthorship": "(L.) H. Karst.",
|
|
255
|
-
"taxonRankId": "MX.species",
|
|
256
|
-
"matchType": "exactMatches",
|
|
257
|
-
"cursiveName": true,
|
|
258
|
-
"finnish": true,
|
|
259
|
-
"species": true,
|
|
260
|
-
"nameType": "MX.obsoleteVernacularName",
|
|
261
|
-
"vernacularName": "metsäkuusi"
|
|
262
|
-
}
|
|
263
|
-
}]);
|
|
264
|
-
// idk why needed...
|
|
265
|
-
yield protractor_1.browser.sleep(100);
|
|
266
|
-
yield taxonAutosuggest.$input.sendKeys(protractor_1.protractor.Key.ENTER);
|
|
267
|
-
yield mock.remove();
|
|
268
|
-
expect(yield taxonAutosuggest.$input.getAttribute("value")).toBe(autocompleteSelectedName);
|
|
269
|
-
expect((yield form.getChangedData()).gatherings[0].units[0].identifications[0].taxon).toBe(autocompleteSelectedName);
|
|
270
|
-
}));
|
|
271
|
-
});
|
|
272
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|