@konfuzio/document-validation-ui 0.1.16-dev.1 → 0.1.16-dev.2
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/dist/css/app.css +1 -1
- package/dist/index.html +1 -1
- package/dist/js/app.js +1 -1
- package/dist/js/app.js.map +1 -1
- package/package.json +1 -1
- package/src/assets/scss/document_top_bar.scss +1 -1
- package/src/components/DocumentAnnotations/DocumentAnnotations.cy.js +22 -10
- package/src/components/DocumentThumbnails/DocumentThumbnails.cy.js +12 -6
- package/src/components/DocumentTopBar/DocumentTopBar.cy.js +228 -0
- package/src/components/DocumentTopBar/DocumentTopBar.vue +1 -1
- package/src/components/DocumentTopBar/DocumentTopBarButtons.vue +1 -1
package/package.json
CHANGED
|
@@ -35,11 +35,12 @@ describe("Document Annotations", () => {
|
|
|
35
35
|
cy.mount(DocumentAnnotations);
|
|
36
36
|
cy.get("#labels-sidebar")
|
|
37
37
|
.find(".annotation-set-group")
|
|
38
|
-
.then((elements) => {
|
|
39
|
-
cy.
|
|
40
|
-
.
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
.then(($elements) => {
|
|
39
|
+
cy.getStore("document")
|
|
40
|
+
.then($document => {
|
|
41
|
+
expect($document.annotationSets).to.have.lengthOf($elements.length);
|
|
42
|
+
})
|
|
43
|
+
});
|
|
43
44
|
});
|
|
44
45
|
|
|
45
46
|
it("shows the empty state if there are no annotation sets", () => {
|
|
@@ -240,7 +241,7 @@ describe("Document Annotations", () => {
|
|
|
240
241
|
.find(".empty-annotation")
|
|
241
242
|
.find(".annotation-value")
|
|
242
243
|
.not(".missing-annotation")
|
|
243
|
-
.each(($annotation
|
|
244
|
+
.each(($annotation) => {
|
|
244
245
|
cy.wrap($annotation)
|
|
245
246
|
.trigger("mouseover");
|
|
246
247
|
|
|
@@ -250,15 +251,26 @@ describe("Document Annotations", () => {
|
|
|
250
251
|
.find(".action-buttons")
|
|
251
252
|
.find(".missing-button-container")
|
|
252
253
|
.find(".missing-btn")
|
|
253
|
-
.click();
|
|
254
|
-
|
|
255
|
-
cy.storeState("document", "missingAnnotations").its("length").should("not.eq", 0);
|
|
254
|
+
.click();
|
|
256
255
|
|
|
257
256
|
cy.wrap($annotation)
|
|
258
257
|
.trigger("mouseleave");
|
|
259
258
|
|
|
260
259
|
cy.wait(1000);
|
|
261
|
-
})
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
cy.get("#labels-sidebar")
|
|
263
|
+
.find(".label")
|
|
264
|
+
.find(".annotation-row")
|
|
265
|
+
.find(".empty-annotation")
|
|
266
|
+
.then($elements => {
|
|
267
|
+
|
|
268
|
+
cy.getStore("document")
|
|
269
|
+
.then($document => {
|
|
270
|
+
expect($document.missingAnnotations)
|
|
271
|
+
.to.have.lengthOf($elements.length);
|
|
272
|
+
});
|
|
273
|
+
})
|
|
262
274
|
});
|
|
263
275
|
|
|
264
276
|
it("restores empty annotation", () => {
|
|
@@ -9,11 +9,12 @@ describe("Document Thumbnails", () => {
|
|
|
9
9
|
cy.mount(DocumentThumbnails);
|
|
10
10
|
cy.get("#document-pages")
|
|
11
11
|
.find(".document-thumbnail")
|
|
12
|
-
.then((elements) => {
|
|
13
|
-
cy.
|
|
14
|
-
.
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
.then(($elements) => {
|
|
13
|
+
cy.getStore("document")
|
|
14
|
+
.then($document => {
|
|
15
|
+
expect($document.selectedDocument.pages)
|
|
16
|
+
.to.have.lengthOf($elements.length);
|
|
17
|
+
});
|
|
17
18
|
});
|
|
18
19
|
});
|
|
19
20
|
|
|
@@ -48,7 +49,12 @@ describe("Document Thumbnails", () => {
|
|
|
48
49
|
.find(".document-thumbnail")
|
|
49
50
|
.each(($row, index) => {
|
|
50
51
|
cy.wrap($row).click();
|
|
51
|
-
cy.
|
|
52
|
+
cy.getStore("display")
|
|
53
|
+
.then($display => {
|
|
54
|
+
expect($display.currentPage)
|
|
55
|
+
.to.equal(index + 1);
|
|
56
|
+
});
|
|
57
|
+
|
|
52
58
|
cy.wait(1000);
|
|
53
59
|
});
|
|
54
60
|
});
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import DocumentTopBar from "./DocumentTopBar";
|
|
2
|
+
|
|
3
|
+
describe("Document Top Bar", () => {
|
|
4
|
+
let currentDocument;
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
|
|
7
|
+
cy.fetchDocument().then(() => {
|
|
8
|
+
cy.getStore("document")
|
|
9
|
+
.then($document => {
|
|
10
|
+
currentDocument = $document.selectedDocument;
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
cy.getStore("project")
|
|
15
|
+
.then($project => {
|
|
16
|
+
cy.fetchCategories($project.projectId);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
cy.dispatchAction("document", "setPublicView", false);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("Shows category dropdown if not edit mode or reviewed", () => {
|
|
24
|
+
cy.mount(DocumentTopBar);
|
|
25
|
+
|
|
26
|
+
cy.get("#document-top-bar-component")
|
|
27
|
+
.find(".left-bar-components")
|
|
28
|
+
.find(".category-chooser")
|
|
29
|
+
.should("be.visible");
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("Shows correct file name", () => {
|
|
33
|
+
cy.mount(DocumentTopBar);
|
|
34
|
+
const fileName = currentDocument.data_file_name
|
|
35
|
+
|
|
36
|
+
cy.get("#document-top-bar-component")
|
|
37
|
+
.find(".center-bar-components")
|
|
38
|
+
.find(".document-name-component")
|
|
39
|
+
.should("be.visible");
|
|
40
|
+
|
|
41
|
+
cy.get("#document-top-bar-component")
|
|
42
|
+
.find(".center-bar-components")
|
|
43
|
+
.find(".document-name-component")
|
|
44
|
+
.find(".document-name")
|
|
45
|
+
.contains(fileName);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it("Shows arrows if available documents to navigate to", () => {
|
|
49
|
+
cy.mount(DocumentTopBar);
|
|
50
|
+
cy.fetchDocumentList();
|
|
51
|
+
const assignee = currentDocument.assignee;
|
|
52
|
+
|
|
53
|
+
cy.getStore("project")
|
|
54
|
+
.then($project => {
|
|
55
|
+
const filtered = $project.documentsInProject.filter(
|
|
56
|
+
(document) =>
|
|
57
|
+
(document.status_data === 41 || (document.status_data === 2 && document.labeling_available === 1)
|
|
58
|
+
) && document.assignee === assignee
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
if(filtered.length > 0) {
|
|
62
|
+
cy.get("#document-top-bar-component")
|
|
63
|
+
.find(".center-bar-components")
|
|
64
|
+
.find(".navigation-arrow")
|
|
65
|
+
.should("be.visible");
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it("Shows keyboard icon", () => {
|
|
71
|
+
cy.mount(DocumentTopBar);
|
|
72
|
+
|
|
73
|
+
cy.get("#document-top-bar-component")
|
|
74
|
+
.find(".right-bar-components")
|
|
75
|
+
.find(".keyboard-actions-info")
|
|
76
|
+
.should("be.visible");
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("Shows disabled finish review button", () => {
|
|
80
|
+
cy.mount(DocumentTopBar);
|
|
81
|
+
|
|
82
|
+
cy.get("#document-top-bar-component")
|
|
83
|
+
.find(".right-bar-components")
|
|
84
|
+
.find(".top-bar-buttons")
|
|
85
|
+
.find(".finish-review-button-container")
|
|
86
|
+
.should("be.visible");
|
|
87
|
+
|
|
88
|
+
cy.get("#document-top-bar-component")
|
|
89
|
+
.find(".right-bar-components")
|
|
90
|
+
.find(".top-bar-buttons")
|
|
91
|
+
.find(".finish-review-button-container")
|
|
92
|
+
.find(".finish-review-btn")
|
|
93
|
+
.should("be.disabled");
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it("Shows edit mode buttons", () => {
|
|
97
|
+
cy.mount(DocumentTopBar);
|
|
98
|
+
cy.dispatchAction("edit", "enableEditMode");
|
|
99
|
+
|
|
100
|
+
cy.get("#document-top-bar-component")
|
|
101
|
+
.find(".right-bar-components")
|
|
102
|
+
.find(".top-bar-buttons")
|
|
103
|
+
.find(".finish-review-button-container")
|
|
104
|
+
.should("not.exist");
|
|
105
|
+
|
|
106
|
+
cy.get("#document-top-bar-component")
|
|
107
|
+
.find(".right-bar-components")
|
|
108
|
+
.find(".top-bar-buttons")
|
|
109
|
+
.find(".edit-mode-buttons")
|
|
110
|
+
.should("be.visible");
|
|
111
|
+
|
|
112
|
+
cy.dispatchAction("edit", "disableEditMode");
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it("Edits file name", () => {
|
|
116
|
+
cy.mount(DocumentTopBar);
|
|
117
|
+
const fileName = currentDocument.data_file_name.split(".").slice(0, -1).join(".");
|
|
118
|
+
|
|
119
|
+
cy.get("#document-top-bar-component")
|
|
120
|
+
.find(".center-bar-components")
|
|
121
|
+
.find(".document-name-component")
|
|
122
|
+
.find(".edit-btn")
|
|
123
|
+
.click();
|
|
124
|
+
|
|
125
|
+
cy.get("#document-top-bar-component")
|
|
126
|
+
.find(".center-bar-components")
|
|
127
|
+
.find(".document-name-component")
|
|
128
|
+
.find(".document-name")
|
|
129
|
+
.should("have.class", "is-editable");
|
|
130
|
+
|
|
131
|
+
cy.get("#document-top-bar-component")
|
|
132
|
+
.find(".center-bar-components")
|
|
133
|
+
.find(".document-name-component")
|
|
134
|
+
.find(".document-name")
|
|
135
|
+
.type('{selectAll}')
|
|
136
|
+
.type('{backspace}')
|
|
137
|
+
.type("test-name");
|
|
138
|
+
|
|
139
|
+
cy.get("#document-top-bar-component")
|
|
140
|
+
.find(".center-bar-components")
|
|
141
|
+
.find(".document-name-component")
|
|
142
|
+
.find(".save-btn")
|
|
143
|
+
.should("be.visible");
|
|
144
|
+
|
|
145
|
+
cy.get("#document-top-bar-component")
|
|
146
|
+
.find(".center-bar-components")
|
|
147
|
+
.find(".document-name-component")
|
|
148
|
+
.find(".save-btn")
|
|
149
|
+
.click();
|
|
150
|
+
|
|
151
|
+
cy.wait(1000);
|
|
152
|
+
|
|
153
|
+
cy.get("#document-top-bar-component")
|
|
154
|
+
.find(".center-bar-components")
|
|
155
|
+
.find(".document-name-component")
|
|
156
|
+
.find(".cloud-icon")
|
|
157
|
+
.should("be.visible");
|
|
158
|
+
|
|
159
|
+
cy.wait(1000);
|
|
160
|
+
|
|
161
|
+
cy.get("#document-top-bar-component")
|
|
162
|
+
.find(".center-bar-components")
|
|
163
|
+
.find(".document-name-component")
|
|
164
|
+
.contains(fileName);
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
it("Shows tooltip when hovering over keyboard info", () => {
|
|
168
|
+
cy.mount(DocumentTopBar);
|
|
169
|
+
|
|
170
|
+
cy.get("#document-top-bar-component")
|
|
171
|
+
.find(".right-bar-components")
|
|
172
|
+
.find(".keyboard-actions-info")
|
|
173
|
+
.trigger("mouseenter");
|
|
174
|
+
|
|
175
|
+
cy.get("#document-top-bar-component")
|
|
176
|
+
.find(".right-bar-components")
|
|
177
|
+
.find(".keyboard-actions-info")
|
|
178
|
+
.find(".keyboard-actions-description")
|
|
179
|
+
.should("be.visible");
|
|
180
|
+
|
|
181
|
+
cy.get("#document-top-bar-component")
|
|
182
|
+
.find(".right-bar-components")
|
|
183
|
+
.find(".keyboard-actions-info")
|
|
184
|
+
.trigger("mouseleave");
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it("Closes edit mode when clicking 'back to annotaiton view' button", () => {
|
|
188
|
+
cy.mount(DocumentTopBar);
|
|
189
|
+
cy.dispatchAction("edit", "enableEditMode");
|
|
190
|
+
|
|
191
|
+
cy.get("#document-top-bar-component")
|
|
192
|
+
.find(".right-bar-components")
|
|
193
|
+
.find(".edit-mode-buttons")
|
|
194
|
+
.should("exist");
|
|
195
|
+
|
|
196
|
+
cy.get("#document-top-bar-component")
|
|
197
|
+
.find(".right-bar-components")
|
|
198
|
+
.find(".edit-mode-buttons")
|
|
199
|
+
.find(".button-cancel")
|
|
200
|
+
.click();
|
|
201
|
+
|
|
202
|
+
cy.wait(1000);
|
|
203
|
+
|
|
204
|
+
cy.get("#document-top-bar-component")
|
|
205
|
+
.find(".right-bar-components")
|
|
206
|
+
.find(".edit-mode-buttons")
|
|
207
|
+
.should("not.exist");
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
it("Shows rename and categorize section when clicking 'next' button", () => {
|
|
211
|
+
cy.mount(DocumentTopBar);
|
|
212
|
+
cy.dispatchAction("edit", "enableEditMode");
|
|
213
|
+
|
|
214
|
+
cy.get("#document-top-bar-component")
|
|
215
|
+
.find(".right-bar-components")
|
|
216
|
+
.find(".edit-mode-buttons")
|
|
217
|
+
.find(".button-next")
|
|
218
|
+
.click();
|
|
219
|
+
|
|
220
|
+
cy.wait(1000);
|
|
221
|
+
|
|
222
|
+
cy.get("#document-top-bar-component")
|
|
223
|
+
.find(".right-bar-components")
|
|
224
|
+
.find(".edit-mode-buttons")
|
|
225
|
+
.find(".submit-btn")
|
|
226
|
+
.should("be.visible")
|
|
227
|
+
});
|
|
228
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div id="document-top-bar-component" ref="documentTopBar">
|
|
3
3
|
<div
|
|
4
4
|
v-if="selectedDocument && selectedDocument.pages.length > 0 && !loading"
|
|
5
5
|
:class="['document-top-bar', editMode && 'edit-mode-top-bar']"
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
<b-button
|
|
22
22
|
:label="editMode && !renameAndCategorize ? $t('next') : $t('submit')"
|
|
23
23
|
type="is-primary"
|
|
24
|
-
class="button-next primary-button edit-mode-btn"
|
|
24
|
+
:class="['button-next primary-button edit-mode-btn', renameAndCategorize && 'submit-btn']"
|
|
25
25
|
:disabled="renameAndCategorize && !enableSubmit"
|
|
26
26
|
@click="handleButton"
|
|
27
27
|
/>
|