-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: LEAP-219: Update LSF E2E with recent changes
- HumanSignal/label-studio-frontend#1192 for Magic Wand from @BradNeuberg - HumanSignal/label-studio-frontend#1708 with external images problem - HumanSignal/label-studio-frontend#1021 for maxUsages missed for some reason
- Loading branch information
Showing
26 changed files
with
6,868 additions
and
3,701 deletions.
There are no files selected for viewing
3,010 changes: 3,010 additions & 0 deletions
3,010
web/libs/editor/tests/e2e/examples/data/sample-sin.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 110 additions & 0 deletions
110
web/libs/editor/tests/e2e/tests/image.selected-region.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
/* global Feature, Scenario */ | ||
|
||
const { | ||
doDrawingAction, | ||
initLabelStudio, | ||
waitForImage, | ||
} = require('./helpers'); | ||
const assert = require('assert'); | ||
|
||
Feature('Test Image Region Stay Selected Between Tools'); | ||
|
||
const PLANET = { | ||
color: '#00FF00', | ||
rgbArray: [0, 255, 0], | ||
}; | ||
const MOONWALKER = { | ||
color: '#0000FF', | ||
rgbArray: [0, 0, 255], | ||
}; | ||
|
||
const config = ` | ||
<View> | ||
<Image name="image" value="$image" crossOrigin="anonymous" /> | ||
<Brush name="brush" toName="image" /> | ||
<MagicWand name="magicwand" toName="image" /> | ||
<Labels name="labels" toName="image" fillOpacity="0.5" strokeWidth="5"> | ||
<Label value="Planet" background="${PLANET.color}"></Label> | ||
<Label value="Moonwalker" background="${MOONWALKER.color}"></Label> | ||
</Labels> | ||
</View>`; | ||
|
||
const annotationEmpty = { | ||
id: '1000', | ||
result: [], | ||
}; | ||
|
||
const data = { | ||
image: | ||
'https://htx-misc.s3.amazonaws.com/opensource/label-studio/examples/images/nick-owuor-astro-nic-visuals-wDifg5xc9Z4-unsplash.jpg', | ||
}; | ||
|
||
async function testRegion(testType, toolAccelerator, I, LabelStudio, AtImageView, AtSidebar) { | ||
const params = { | ||
config, | ||
data, | ||
annotations: [annotationEmpty], | ||
}; | ||
|
||
LabelStudio.setFeatureFlags({ | ||
'fflag_feat_front_dev_4081_magic_wand_tool': true, | ||
}); | ||
|
||
I.amOnPage('/'); | ||
|
||
I.executeScript(initLabelStudio, params); | ||
|
||
AtImageView.waitForImage(); | ||
await AtImageView.lookForStage(); | ||
I.executeScript(waitForImage); | ||
|
||
I.say(`Select ${testType} & planet class`); | ||
I.pressKey(toolAccelerator); | ||
I.pressKey('1'); | ||
|
||
I.say('There should be no regions initially'); | ||
AtSidebar.seeRegions(0); | ||
|
||
I.say(`${testType} initial region`); | ||
await doDrawingAction(I, { msg: `Initial ${testType}`, fromX: 150, fromY: 110, toX: 150+50, toY: 110+50 }); | ||
|
||
I.say('There should now be a single region'); | ||
AtSidebar.seeRegions(1); | ||
|
||
I.say(`Using Eraser on ${testType} region`); | ||
I.pressKey('E'); | ||
I.usePlaywrightTo('Erasing', async ({ browser, browserContext, page }) => { | ||
await page.mouse.move(150, 150); | ||
await page.mouse.down(); | ||
await page.mouse.move(150+100, 150); | ||
await page.mouse.up(); | ||
}); | ||
|
||
I.say(`Doing another ${testType} with same class after erasing`); | ||
I.pressKey(toolAccelerator); | ||
await doDrawingAction(I, { msg: `${testType} after erasing`, fromX: 280, fromY: 480, toX: 280+50, toY: 480+50 }); | ||
|
||
I.say('There should still only be one region'); | ||
AtSidebar.seeRegions(1); | ||
|
||
I.say('Zooming and selecting pan tool'); | ||
I.click('button[aria-label="zoom-in"]'); | ||
I.click('button[aria-label="zoom-in"]'); | ||
I.pressKey('H'); | ||
|
||
I.say(`Doing another ${testType} after zooming and selecting pan tool`); | ||
I.pressKey(toolAccelerator); | ||
await doDrawingAction(I, { msg: `${testType} after zoom and pan selected`, | ||
fromX: 400, fromY: 200, toX: 400+15, toY: 400+15 }); | ||
|
||
I.say('There should still only be one region'); | ||
AtSidebar.seeRegions(1); | ||
} | ||
|
||
Scenario('Selected brush region should stay between tools', async function({ I, LabelStudio, AtImageView, AtSidebar }) { | ||
await testRegion('brush', 'B', I, LabelStudio, AtImageView, AtSidebar); | ||
}); | ||
|
||
Scenario('Selected Magic Wand region should stay between tools', async function({ I, LabelStudio, AtImageView, AtSidebar }) { | ||
await testRegion('magicwand', 'W', I, LabelStudio, AtImageView, AtSidebar); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.