-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…elected Qa/#404 drop shape ensure is selected
- Loading branch information
Showing
2 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { | ||
dragAndDrop, | ||
getByShapeType, | ||
getLocatorPosition, | ||
getTransformer, | ||
} from '../helpers'; | ||
import { Group } from 'konva/lib/Group'; | ||
|
||
test('no shapes on canvas, transformer not defined', async ({ page }) => { | ||
await page.goto(''); | ||
const transformer = await getTransformer(page); | ||
expect(transformer).not.toBeDefined(); | ||
}); | ||
|
||
test('drop shape in canvas, ensure is selected', async ({ page }) => { | ||
await page.goto(''); | ||
const component = page.getByAltText('Input', { exact: true }); | ||
|
||
const position = await getLocatorPosition(component); | ||
await dragAndDrop(page, position, { | ||
x: position.x + 500, | ||
y: position.y - 240, | ||
}); | ||
|
||
const inputShape = (await getByShapeType(page, 'input')) as Group; | ||
expect(inputShape).toBeDefined(); | ||
|
||
const transformer = await getTransformer(page); | ||
expect(transformer).toBeDefined(); | ||
expect(transformer.index).toEqual(1); | ||
expect(transformer._nodes.length).toEqual(1); | ||
}); | ||
|
||
test('drop shape in canvas, click on canvas, drop diselected', async ({ | ||
page, | ||
}) => { | ||
await page.goto(''); | ||
const component = page.getByAltText('Input', { exact: true }); | ||
|
||
const position = await getLocatorPosition(component); | ||
await dragAndDrop(page, position, { | ||
x: position.x + 500, | ||
y: position.y - 240, | ||
}); | ||
const inputShape = (await getByShapeType(page, 'input')) as Group; | ||
expect(inputShape).toBeDefined(); | ||
|
||
await page.click('canvas'); | ||
|
||
const transformer = await getTransformer(page); | ||
expect(transformer).toBeDefined(); | ||
expect(transformer.index).toEqual(1); | ||
expect(transformer._nodes.length).toEqual(0); | ||
}); |