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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
| import { ImageView, Labels, LabelStudio, Sidebar } from "@humansignal/frontend-test/helpers/LSF";
|
| const config = `
| <View>
| <Image name="img" value="$image"></Image>
| <RectangleLabels name="tag" toName="img">
| <Label value="Planet"></Label>
| <Label value="Moonwalker" background="blue"></Label>
| </RectangleLabels>
| </View>
| `;
|
| const image =
| "https://htx-pub.s3.us-east-1.amazonaws.com/examples/images/nick-owuor-astro-nic-visuals-wDifg5xc9Z4-unsplash.jpg";
|
| describe("Basic Image scenario", () => {
| it("Should be able to draw a simple rectangle", () => {
| LabelStudio.init({
| config,
| task: {
| id: 1,
| annotations: [{ id: 1001, result: [] }],
| predictions: [],
| data: { image },
| },
| });
|
| ImageView.waitForImage();
| Sidebar.hasNoRegions();
|
| Labels.select("Planet");
|
| ImageView.drawRect(20, 20, 100, 100);
|
| Sidebar.hasRegions(1);
| });
|
| it("Should check that the canvas changed", () => {
| LabelStudio.init({
| config,
| task: {
| id: 1,
| annotations: [{ id: 1001, result: [] }],
| predictions: [],
| data: { image },
| },
| });
|
| ImageView.waitForImage();
| Sidebar.hasNoRegions();
|
| ImageView.capture("canvas");
|
| Labels.select("Moonwalker");
|
| ImageView.drawRect(20, 20, 100, 100);
|
| Sidebar.hasRegions(1);
| ImageView.canvasShouldChange("canvas", 0);
| });
| });
|
|