-
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.
Merge pull request #466 from Lemoncode/dev
minor font fix dev to main
- Loading branch information
Showing
6 changed files
with
200 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { | ||
dragAndDrop, | ||
getLocatorPosition, | ||
getByShapeType, | ||
getShapePosition, | ||
moveSelected, | ||
} from '../helpers'; | ||
import { Group } from 'konva/lib/Group'; | ||
|
||
const numShifts: number = 10; | ||
|
||
test('move shape with the keyboard - left', 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 draggedPosition = await getShapePosition(inputShape); | ||
|
||
moveSelected(page, 'ArrowLeft', numShifts); | ||
|
||
const inputShapeMoved = (await getByShapeType(page, 'input')) as Group; | ||
const movedPosition = await getShapePosition(inputShapeMoved); | ||
|
||
expect(movedPosition.x === draggedPosition.x - numShifts * 2).toBeTruthy(); | ||
expect(movedPosition.y === draggedPosition.y).toBeTruthy(); | ||
}); | ||
|
||
test('move shape with the keyboard - up', 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 draggedPosition = await getShapePosition(inputShape); | ||
|
||
moveSelected(page, 'ArrowUp', numShifts); | ||
|
||
const inputShapeMoved = (await getByShapeType(page, 'input')) as Group; | ||
const movedPosition = await getShapePosition(inputShapeMoved); | ||
|
||
expect(movedPosition.x === draggedPosition.x).toBeTruthy(); | ||
expect(movedPosition.y === draggedPosition.y - numShifts * 2).toBeTruthy(); | ||
}); | ||
|
||
test('move shape with the keyboard - down', 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 draggedPosition = await getShapePosition(inputShape); | ||
|
||
moveSelected(page, 'ArrowDown', numShifts); | ||
|
||
const inputShapeMoved = (await getByShapeType(page, 'input')) as Group; | ||
const movedPosition = await getShapePosition(inputShapeMoved); | ||
|
||
expect(movedPosition.x === draggedPosition.x).toBeTruthy(); | ||
expect(movedPosition.y === draggedPosition.y + numShifts * 2).toBeTruthy(); | ||
}); | ||
|
||
test('move shape with the keyboard - right', 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 draggedPosition = await getShapePosition(inputShape); | ||
|
||
moveSelected(page, 'ArrowRight', numShifts); | ||
|
||
const inputShapeMoved = (await getByShapeType(page, 'input')) as Group; | ||
const movedPosition = await getShapePosition(inputShapeMoved); | ||
|
||
expect(movedPosition.x === draggedPosition.x + numShifts * 2).toBeTruthy(); | ||
expect(movedPosition.y === draggedPosition.y).toBeTruthy(); | ||
}); |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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