Skip to content

Commit fd7884a

Browse files
chore: FIT-1068: setting flakey tests to retry 3 times (#8920)
1 parent a34298b commit fd7884a

File tree

3 files changed

+91
-74
lines changed

3 files changed

+91
-74
lines changed

web/libs/editor/tests/e2e/tests/image.transformer.test.js

Lines changed: 72 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -127,89 +127,91 @@ for (const shapeName of Object.keys(shapes)) {
127127
shapesTable.add([shapeName]);
128128
}
129129

130-
Data(shapesTable).Scenario(
131-
"Check transformer existing for different shapes, their amount and modes.",
132-
async ({ I, LabelStudio, AtImageView, AtOutliner, AtPanels, current }) => {
133-
const { shapeName } = current;
134-
const Shape = shapes[shapeName];
135-
136-
I.amOnPage("/");
137-
const bbox1 = {
138-
x: 100,
139-
y: 100,
140-
width: 200,
141-
height: 200,
142-
};
143-
const bbox2 = {
144-
x: 400,
145-
y: 100,
146-
width: 200,
147-
height: 200,
148-
};
149-
const getCenter = (bbox) => [bbox.x + bbox.width / 2, bbox.y + bbox.height / 2];
150-
let isTransformerExist;
151-
const AtDetailsPanel = AtPanels.usePanel(AtPanels.PANEL.DETAILS);
130+
Data(shapesTable)
131+
.Scenario(
132+
"Check transformer existing for different shapes, their amount and modes.",
133+
async ({ I, LabelStudio, AtImageView, AtOutliner, AtPanels, current }) => {
134+
const { shapeName } = current;
135+
const Shape = shapes[shapeName];
136+
137+
I.amOnPage("/");
138+
const bbox1 = {
139+
x: 100,
140+
y: 100,
141+
width: 200,
142+
height: 200,
143+
};
144+
const bbox2 = {
145+
x: 400,
146+
y: 100,
147+
width: 200,
148+
height: 200,
149+
};
150+
const getCenter = (bbox) => [bbox.x + bbox.width / 2, bbox.y + bbox.height / 2];
151+
let isTransformerExist;
152+
const AtDetailsPanel = AtPanels.usePanel(AtPanels.PANEL.DETAILS);
152153

153-
LabelStudio.init(getParamsWithLabels(shapeName));
154-
AtDetailsPanel.collapsePanel();
154+
LabelStudio.init(getParamsWithLabels(shapeName));
155+
AtDetailsPanel.collapsePanel();
155156

156-
LabelStudio.waitForObjectsReady();
157-
AtOutliner.seeRegions(0);
158-
await AtImageView.lookForStage();
157+
LabelStudio.waitForObjectsReady();
158+
AtOutliner.seeRegions(0);
159+
await AtImageView.lookForStage();
159160

160-
// Draw two regions
161-
I.pressKey("1");
162-
drawShapeByBbox(Shape, bbox1.x, bbox1.y, bbox1.width, bbox1.height, AtImageView);
163-
AtOutliner.seeRegions(1);
164-
I.pressKey("1");
165-
drawShapeByBbox(Shape, bbox2.x, bbox2.y, bbox2.width, bbox2.height, AtImageView);
166-
AtOutliner.seeRegions(2);
161+
// Draw two regions
162+
I.pressKey("1");
163+
drawShapeByBbox(Shape, bbox1.x, bbox1.y, bbox1.width, bbox1.height, AtImageView);
164+
AtOutliner.seeRegions(1);
165+
I.pressKey("1");
166+
drawShapeByBbox(Shape, bbox2.x, bbox2.y, bbox2.width, bbox2.height, AtImageView);
167+
AtOutliner.seeRegions(2);
167168

168-
// Check that it wasn't a cause to show a transformer
169-
isTransformerExist = await AtImageView.isTransformerExist();
170-
assert.strictEqual(isTransformerExist, false);
169+
// Check that it wasn't a cause to show a transformer
170+
isTransformerExist = await AtImageView.isTransformerExist();
171+
assert.strictEqual(isTransformerExist, false);
171172

172-
// Select the first region
173-
AtImageView.clickAt(...getCenter(bbox1));
174-
AtOutliner.seeSelectedRegion();
173+
// Select the first region
174+
AtImageView.clickAt(...getCenter(bbox1));
175+
AtOutliner.seeSelectedRegion();
175176

176-
// Match if transformer exist with expectations in single selected mode
177-
isTransformerExist = await AtImageView.isTransformerExist();
178-
assert.strictEqual(isTransformerExist, Shape.hasTransformer);
177+
// Match if transformer exist with expectations in single selected mode
178+
isTransformerExist = await AtImageView.isTransformerExist();
179+
assert.strictEqual(isTransformerExist, Shape.hasTransformer);
179180

180-
// Match if rotator at transformer exist with expectations in single selected mode
181-
isTransformerExist = await AtImageView.isRotaterExist();
182-
assert.strictEqual(isTransformerExist, Shape.hasRotator);
181+
// Match if rotator at transformer exist with expectations in single selected mode
182+
isTransformerExist = await AtImageView.isRotaterExist();
183+
assert.strictEqual(isTransformerExist, Shape.hasRotator);
183184

184-
// Switch to move tool
185-
I.pressKey("v");
185+
// Switch to move tool
186+
I.pressKey("v");
186187

187-
// Match if rotator at transformer exist with expectations in single selected mode with move tool chosen
188-
isTransformerExist = await AtImageView.isTransformerExist();
189-
assert.strictEqual(isTransformerExist, Shape.hasMoveToolTransformer);
188+
// Match if rotator at transformer exist with expectations in single selected mode with move tool chosen
189+
isTransformerExist = await AtImageView.isTransformerExist();
190+
assert.strictEqual(isTransformerExist, Shape.hasMoveToolTransformer);
190191

191-
// Deselect the previous selected region
192-
I.pressKey(["u"]);
192+
// Deselect the previous selected region
193+
I.pressKey(["u"]);
193194

194-
// Select 2 regions
195-
AtImageView.drawThroughPoints(
196-
[
197-
[bbox1.x - 5, bbox1.y - 5],
198-
[bbox2.x + bbox2.width + 5, bbox2.y + bbox2.height + 5],
199-
],
200-
"steps",
201-
10,
202-
);
195+
// Select 2 regions
196+
AtImageView.drawThroughPoints(
197+
[
198+
[bbox1.x - 5, bbox1.y - 5],
199+
[bbox2.x + bbox2.width + 5, bbox2.y + bbox2.height + 5],
200+
],
201+
"steps",
202+
10,
203+
);
203204

204-
// Match if transformer exist with expectations in multiple selected mode
205-
isTransformerExist = await AtImageView.isTransformerExist();
206-
assert.strictEqual(isTransformerExist, Shape.hasMultiSelectionTransformer);
205+
// Match if transformer exist with expectations in multiple selected mode
206+
isTransformerExist = await AtImageView.isTransformerExist();
207+
assert.strictEqual(isTransformerExist, Shape.hasMultiSelectionTransformer);
207208

208-
// Match if rotator exist with expectations in multiple selected mode
209-
isTransformerExist = await AtImageView.isRotaterExist();
210-
assert.strictEqual(isTransformerExist, Shape.hasMultiSelectionRotator);
211-
},
212-
);
209+
// Match if rotator exist with expectations in multiple selected mode
210+
isTransformerExist = await AtImageView.isRotaterExist();
211+
assert.strictEqual(isTransformerExist, Shape.hasMultiSelectionRotator);
212+
},
213+
)
214+
.retry(3);
213215

214216
Data(shapesTable.filter(({ shapeName }) => shapes[shapeName].hasMoveToolTransformer)).Scenario(
215217
"Resizing a single region",

web/libs/editor/tests/e2e/tests/outliner.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ Scenario("Basic details", async ({ I, LabelStudio, AtOutliner, AtDetails }) => {
219219
const resultWithoutMeta = await LabelStudio.serialize();
220220

221221
assert.deepStrictEqual(resultWithoutMeta[2].meta, undefined);
222-
});
222+
}).retry(3);
223223

224224
Scenario("Panels manipulations", async ({ I, LabelStudio, AtPanels }) => {
225225
I.amOnPage("/");

web/libs/editor/tests/e2e/tests/taxonomy.test.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,23 @@ Before(({ LabelStudio }) => {
1212

1313
Scenario("Lines overlap", async ({ I, LabelStudio, AtTaxonomy }) => {
1414
async function checkOverlapAndGap(text1, text2) {
15-
const bbox1 = await I.grabElementBoundingRect(AtTaxonomy.locate(AtTaxonomy.item).find("label").withText(text1));
16-
const bbox2 = await I.grabElementBoundingRect(AtTaxonomy.locate(AtTaxonomy.item).find("label").withText(text2));
15+
// Wait for elements to be present in the DOM before grabbing their bounding rects
16+
const locator1 = AtTaxonomy.locate(AtTaxonomy.item).find("label").withText(text1);
17+
const locator2 = AtTaxonomy.locate(AtTaxonomy.item).find("label").withText(text2);
18+
19+
await I.waitForElement(locator1, 5);
20+
await I.waitForElement(locator2, 5);
21+
22+
const bbox1 = await I.grabElementBoundingRect(locator1);
23+
const bbox2 = await I.grabElementBoundingRect(locator2);
24+
25+
// Add null checks with better error messages
26+
if (!bbox1) {
27+
assert.fail(`Element with text "${text1}" not found or has no bounding rect`);
28+
}
29+
if (!bbox2) {
30+
assert.fail(`Element with text "${text2}" not found or has no bounding rect`);
31+
}
1732

1833
bbox1.y2 = bbox1.y + bbox1.height;
1934
bbox2.y2 = bbox2.y + bbox2.height;
@@ -98,7 +113,7 @@ Scenario("Lines overlap", async ({ I, LabelStudio, AtTaxonomy }) => {
98113
AtTaxonomy.fillSearch("long");
99114
await checkOverlapAndGap("super long line", "enough long line");
100115
await checkOverlapAndGap("enough long line", "not long line");
101-
});
116+
}).retry(3);
102117

103118
Scenario("Add custom items", async ({ I, LabelStudio, AtTaxonomy }) => {
104119
const params = {

0 commit comments

Comments
 (0)