1- Feature ( 'Image list via `valueList` ' ) ;
1+ Feature ( 'MIG ' ) ;
22
3- const config = `
3+ const assert = require ( 'assert' ) ;
4+
5+ const rectConfig = `
46 <View>
57 <Image name="img" valueList="$images"/>
68 <RectangleLabels name="tag" toName="img">
@@ -10,6 +12,16 @@ const config = `
1012 </View>
1113` ;
1214
15+ const brushConfig = `
16+ <View>
17+ <Image name="img" valueList="$images"/>
18+ <BrushLabels name="tag" toName="img">
19+ <Label value="Planet"></Label>
20+ <Label value="Moonwalker" background="blue"></Label>
21+ </BrushLabels>
22+ </View>
23+ ` ;
24+
1325const data = {
1426 images : [
1527 'https://data.heartex.net/open-images/train_0/mini/0030019819f25b28.jpg' ,
@@ -93,7 +105,7 @@ Before(async ({ LabelStudio }) => {
93105
94106Scenario ( 'Image list rendering' , async ( { I, LabelStudio, AtImageView } ) => {
95107 const params = {
96- config,
108+ config : rectConfig ,
97109 data,
98110 annotations : [ { id : 1 , result : [ ] } ] ,
99111 } ;
@@ -109,7 +121,7 @@ Scenario('Image list rendering', async ({ I, LabelStudio, AtImageView }) => {
109121
110122Scenario ( 'Image list with page navigation' , async ( { I, AtImageView, LabelStudio } ) => {
111123 const params = {
112- config,
124+ config : rectConfig ,
113125 data,
114126 annotations : [ { id : 1 , result : [ ] } ] ,
115127 } ;
@@ -147,7 +159,7 @@ Scenario('Image list with page navigation', async ({ I, AtImageView, LabelStudio
147159
148160Scenario ( 'Image list with hotkey navigation' , async ( { I, AtImageView, LabelStudio } ) => {
149161 const params = {
150- config,
162+ config : rectConfig ,
151163 data,
152164 annotations : [ { id : 1 , result : [ ] } ] ,
153165 } ;
@@ -167,15 +179,13 @@ Scenario('Image list with hotkey navigation', async ({ I, AtImageView, LabelStud
167179 I . say ( 'The number of pages is correct' ) ;
168180 I . see ( '1 of 4' ) ;
169181
170- I . say ( 'Clicking on the next page' ) ;
171- I . pressKey ( 'Ctrl+d' ) ;
182+ await AtImageView . multiImageGoForwartWithHotkey ( ) ;
172183
173184 I . say ( 'Loading second image' ) ;
174185 I . seeElement ( `img[src="${ data . images [ 1 ] } "]` ) ;
175186 I . see ( '2 of 4' ) ;
176187
177- I . say ( 'Clicking on the previous page' ) ;
178- I . pressKey ( 'Ctrl+a' ) ;
188+ await AtImageView . multiImageGoBackwardWithHotkey ( ) ;
179189 I . seeElement ( `img[src="${ data . images [ 0 ] } "]` ) ;
180190 I . see ( '1 of 4' ) ;
181191} ) ;
@@ -186,7 +196,7 @@ Scenario('Ensure that results are the same when exporting existing regions', asy
186196 } ) ;
187197
188198 const params = {
189- config,
199+ config : rectConfig ,
190200 data,
191201 annotations : [ { id : 1 , result } ] ,
192202 } ;
@@ -207,7 +217,7 @@ Scenario('Image list exports correct data', async ({ I, LabelStudio, AtImageView
207217 } ) ;
208218
209219 const params = {
210- config,
220+ config : rectConfig ,
211221 data,
212222 annotations : [ { id : 1 , result } ] ,
213223 } ;
@@ -218,8 +228,7 @@ Scenario('Image list exports correct data', async ({ I, LabelStudio, AtImageView
218228 await AtImageView . waitForImage ( ) ;
219229 await AtImageView . lookForStage ( ) ;
220230
221- I . say ( 'Attempting to go to the next image' ) ;
222- I . pressKey ( 'Ctrl+d' ) ;
231+ AtImageView . multiImageGoForwartWithHotkey ( ) ;
223232
224233 await AtImageView . waitForImage ( ) ;
225234 await AtImageView . lookForStage ( ) ;
@@ -231,7 +240,7 @@ Scenario('Image list exports correct data', async ({ I, LabelStudio, AtImageView
231240// TODO: temporarily disable, will be fixed in another ticket
232241Scenario ( 'Regions are not changes when duplicating an annotation' , async ( { I, LabelStudio, AtImageView } ) => {
233242 const params = {
234- config,
243+ config : rectConfig ,
235244 data,
236245 annotations : [ { id : 1 , result } ] ,
237246 } ;
@@ -251,3 +260,41 @@ Scenario('Regions are not changes when duplicating an annotation', async ({ I, L
251260 I . say ( 'Confirm that result is not changed' ) ;
252261 await LabelStudio . resultsNotChanged ( result ) ;
253262} ) ;
263+
264+ Scenario ( 'No errors during brush export in MIG' , async ( { I, LabelStudio, AtImageView, AtLabels } ) => {
265+ const params = {
266+ config : brushConfig ,
267+ data,
268+ annotations : [ { id : 1 , result : [ ] } ] ,
269+ } ;
270+
271+ const brushRegionPoints = [
272+ [ 20 , 20 ] ,
273+ [ 20 , 40 ] ,
274+ [ 40 , 40 ] ,
275+ [ 40 , 20 ] ,
276+ [ 20 , 20 ] ,
277+ ] ;
278+
279+ I . amOnPage ( '/' ) ;
280+ LabelStudio . init ( params ) ;
281+
282+ await AtImageView . waitForImage ( ) ;
283+ await AtImageView . lookForStage ( ) ;
284+
285+ I . say ( 'Create brush regions on the first image' ) ;
286+ AtLabels . clickLabel ( 'Moonwalker' ) ;
287+ AtImageView . drawThroughPoints ( brushRegionPoints ) ;
288+
289+ await AtImageView . multiImageGoForwartWithHotkey ( ) ;
290+
291+ I . pressKey ( 'u' ) ;
292+ I . say ( 'Create brush regions on the second image' ) ;
293+ AtLabels . clickLabel ( 'Planet' ) ;
294+ AtImageView . drawThroughPoints ( brushRegionPoints ) ;
295+
296+ const result = await LabelStudio . serialize ( ) ;
297+
298+ assert . equal ( result . length , 2 ) ;
299+ } ) ;
300+
0 commit comments