Bin
2025-12-16 9e0b2ba2c317b1a86212f24cbae3195ad1f3dbfa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const { dragKonva, serialize } = require("../helpers");
const assert = require("assert");
 
const config = `
  <View>
    <Image name="image" value="$image" zoomcontrol="true"/>
    <RectangleLabels name="label" toName="image">
        <Label value="Airplane" background="green"/>
        <Label value="Car" background="blue"/>
    </RectangleLabels>
    <RectangleLabels name="label2" toName="image">
        <Label value="F1"/>
        <Label value="Plane"/>
    </RectangleLabels>
  </View>
`;
 
const data = {
  image:
    "https://htx-pub.s3.us-east-1.amazonaws.com/examples/images/nick-owuor-astro-nic-visuals-wDifg5xc9Z4-unsplash.jpg",
};
 
Feature("Two or more same named tools referred same image").tag("@regress");
 
Scenario("Two RectangleLabels", async ({ I, LabelStudio, AtLabels, AtOutliner }) => {
  I.amOnPage("/");
  LabelStudio.init({ config, data });
 
  LabelStudio.waitForObjectsReady();
 
  AtLabels.clickLabel("Plane");
  I.executeScript(dragKonva, [300, 300, 50, 50]);
  AtLabels.clickLabel("Car");
  I.executeScript(dragKonva, [100, 600, 400, -300]);
  AtOutliner.seeRegions(2);
 
  const result = await I.executeScript(serialize);
 
  assert.deepStrictEqual(result.length, 2);
});