@konfuzio/document-validation-ui 0.1.17-dev.0 → 0.1.17-dev.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konfuzio/document-validation-ui",
3
- "version": "0.1.17-dev.0",
3
+ "version": "0.1.17-dev.1",
4
4
  "repository": "git://github.com:konfuzio-ai/document-validation-ui.git",
5
5
  "main": "dist/app.js",
6
6
  "scripts": {
@@ -46,6 +46,7 @@
46
46
  "vuex": "^3.6.2"
47
47
  },
48
48
  "devDependencies": {
49
+ "@4tw/cypress-drag-drop": "^2.2.5",
49
50
  "@intlify/vue-i18n-loader": "^1.x",
50
51
  "@vue/cli-plugin-eslint": "^5.0.8",
51
52
  "@vue/cli-plugin-unit-jest": "^5.0.8",
@@ -10,30 +10,26 @@ describe("Document Edit", () => {
10
10
  });
11
11
 
12
12
  it("Shows edit mode - split, rotate & reorder view", () => {
13
- cy.get("#document-edit")
14
- .find(".pages-section")
15
- .should("be.visible");
13
+ cy.get("#document-edit").find(".pages-section").should("be.visible");
16
14
  });
17
15
 
18
16
  it("Shows as many thumbnails as the document has", () => {
19
17
  cy.getStore("document").then(($document) => {
20
- const pages = $document.selectedDocument.pages
18
+ const pages = $document.selectedDocument.pages;
21
19
  const pagesLength = pages.length;
22
20
 
23
21
  cy.get("#document-edit")
24
- .find(".pages-section")
25
- .find(".edit-pages")
26
- .find(".document-grid")
27
- .find(".image-section")
28
- .its("length")
29
- .should("equal", pagesLength);
22
+ .find(".pages-section")
23
+ .find(".edit-pages")
24
+ .find(".document-grid")
25
+ .find(".image-section")
26
+ .its("length")
27
+ .should("equal", pagesLength);
30
28
  });
31
29
  });
32
30
 
33
31
  it("Shows the sidebar & buttons", () => {
34
- cy.get("#document-edit")
35
- .find(".sidebar")
36
- .should("be.visible");
32
+ cy.get("#document-edit").find(".sidebar").should("be.visible");
37
33
 
38
34
  cy.get("#document-edit")
39
35
  .find(".sidebar")
@@ -49,8 +45,8 @@ describe("Document Edit", () => {
49
45
  .find(".smart-split")
50
46
  .should("be.visible");
51
47
 
52
- cy.getStore("document").then($document => {
53
- if($document.selectedDocument.proposed_split) {
48
+ cy.getStore("document").then(($document) => {
49
+ if ($document.selectedDocument.proposed_split) {
54
50
  cy.get("#document-edit")
55
51
  .find(".sidebar")
56
52
  .find(".smart-split")
@@ -86,14 +82,13 @@ describe("Document Edit", () => {
86
82
  .find(".smart-split")
87
83
  .find(".split-tooltip")
88
84
  .should("be.visible");
89
-
90
85
  }
91
86
  });
92
87
  });
93
88
 
94
89
  it("Can toggle automatic splitting switch if there are splitting suggestions", () => {
95
- cy.getStore("document").then($document => {
96
- if($document.selectedDocument.proposed_split) {
90
+ cy.getStore("document").then(($document) => {
91
+ if ($document.selectedDocument.proposed_split) {
97
92
  cy.get("#document-edit")
98
93
  .find(".sidebar")
99
94
  .find(".smart-split")
@@ -113,7 +108,7 @@ describe("Document Edit", () => {
113
108
  .find(".lines")
114
109
  .should("have.class", "not-active-split");
115
110
 
116
- cy.getStore("edit").then($edit => {
111
+ cy.getStore("edit").then(($edit) => {
117
112
  expect($edit.updatedDocument).to.have.lengthOf(1);
118
113
  });
119
114
  }
@@ -121,8 +116,8 @@ describe("Document Edit", () => {
121
116
  });
122
117
 
123
118
  it("Shows the splitting points if there are splitting suggestions", () => {
124
- cy.getStore("document").then($document => {
125
- if($document.selectedDocument.proposed_split) {
119
+ cy.getStore("document").then(($document) => {
120
+ if ($document.selectedDocument.proposed_split) {
126
121
  const split = $document.selectedDocument.proposed_split;
127
122
  const splitLength = split.length;
128
123
 
@@ -133,24 +128,23 @@ describe("Document Edit", () => {
133
128
  .find(".active-split")
134
129
  .its("length")
135
130
  .should("equal", splitLength);
136
-
137
131
  }
138
132
  });
139
133
  });
140
134
 
141
135
  it("Shows the splitting lines by default when no suggestions, and the visible lines should be number of pages, and last one not visible", () => {
142
- cy.getStore("document").then($document => {
143
- const pages = $document.selectedDocument.pages
136
+ cy.getStore("document").then(($document) => {
137
+ const pages = $document.selectedDocument.pages;
144
138
  const pagesLength = pages.length;
145
139
 
146
- if(!$document.selectedDocument.proposed_split) {
140
+ if (!$document.selectedDocument.proposed_split) {
147
141
  cy.get("#document-edit")
148
142
  .find(".pages-section")
149
143
  .find(".image-section")
150
144
  .find(".splitting-lines")
151
145
  .find(".lines")
152
146
  .should("have.class", "not-active-split")
153
- .and($lines => {
147
+ .and(($lines) => {
154
148
  expect($lines).to.have.lengthOf(pagesLength);
155
149
  expect($lines[pagesLength - 1]).not.to.be.visible;
156
150
  });
@@ -159,14 +153,14 @@ describe("Document Edit", () => {
159
153
  });
160
154
 
161
155
  it("Clicking splitting lines creates new documents", () => {
162
- cy.getStore("document").then($document => {
163
- if($document.selectedDocument.proposed_split) {
156
+ cy.getStore("document").then(($document) => {
157
+ if ($document.selectedDocument.proposed_split) {
164
158
  cy.get("#document-edit")
165
159
  .find(".sidebar")
166
160
  .find(".smart-split")
167
161
  .find(".split-switch")
168
162
  .click();
169
-
163
+
170
164
  cy.wait(1000);
171
165
  }
172
166
 
@@ -177,8 +171,8 @@ describe("Document Edit", () => {
177
171
  .find(".lines")
178
172
  .first()
179
173
  .click();
180
-
181
- cy.getStore("edit").then($edit => {
174
+
175
+ cy.getStore("edit").then(($edit) => {
182
176
  expect($edit.updatedDocument).to.have.lengthOf(2);
183
177
  });
184
178
  });
@@ -249,7 +243,7 @@ describe("Document Edit", () => {
249
243
  .find(".edit-mode-btn")
250
244
  .first()
251
245
  .should("not.be.disabled");
252
-
246
+
253
247
  cy.get("#document-edit")
254
248
  .find(".pages-section")
255
249
  .find(".edit-pages")
@@ -289,10 +283,10 @@ describe("Document Edit", () => {
289
283
  .find(".edit-mode-btn")
290
284
  .first()
291
285
  .click();
292
-
293
- cy.getStore("edit").then($edit => {
286
+
287
+ cy.getStore("edit").then(($edit) => {
294
288
  expect($edit.pagesForPostprocess[0].angle).to.equal(-90);
295
- })
289
+ });
296
290
  });
297
291
 
298
292
  it("Rotates all thumbnails", () => {
@@ -304,10 +298,29 @@ describe("Document Edit", () => {
304
298
  .last()
305
299
  .click();
306
300
 
307
- cy.getStore("edit").then($edit => {
308
- $edit.pagesForPostprocess.map(page => {
301
+ cy.getStore("edit").then(($edit) => {
302
+ $edit.pagesForPostprocess.map((page) => {
309
303
  expect(page.angle).to.equal(90);
310
- })
304
+ });
305
+ });
306
+ });
307
+
308
+ it("Can drag and drop to reorder pages", () => {
309
+ cy.getStore("edit").then(($edit) => {
310
+ if ($edit.pagesForPostprocess.length > 1) {
311
+ const firstPageId = $edit.pagesForPostprocess[0].id;
312
+ cy.get(
313
+ "#document-edit .pages-section .edit-pages .document-grid .image-section:last-child"
314
+ ).drag(
315
+ "#document-edit .pages-section .edit-pages .document-grid .image-section:first-child"
316
+ );
317
+ cy.getStore("edit").then(($newEdit) => {
318
+ const newFirstPageId = $newEdit.pagesForPostprocess[0].id;
319
+ expect(newFirstPageId).to.not.equal(firstPageId);
320
+ });
321
+ } else {
322
+ cy.log("Can't test drag and drop, this document has only one page");
323
+ }
311
324
  });
312
325
  });
313
326
  });