-
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 branch 'dev' into feature/#227-add-icons
- Loading branch information
Showing
103 changed files
with
3,267 additions
and
797 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
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,17 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('create-and-verify-new-thumb-page', async ({ page }) => { | ||
await page.goto(''); | ||
|
||
await page.getByText('Pages').click(); | ||
|
||
await expect(page.getByText('Page 2', { exact: true })).toHaveCount(0); | ||
|
||
const addButton = page.getByRole('button', { name: 'add new page' }); | ||
await expect(addButton).toBeVisible(); | ||
await addButton.click(); | ||
|
||
const siblingElement = page.getByText('Page 2', { exact: true }); | ||
const thumb = siblingElement.locator('..'); | ||
await expect(thumb).toBeVisible(); | ||
}); |
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,34 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('rename-thumb-page-through-direct-edit-and-context-menu', async ({ | ||
page, | ||
}) => { | ||
await page.goto(''); | ||
|
||
await page.getByText('Pages').click(); | ||
const thumb = page.getByText('Page 1', { exact: true }); | ||
await expect(thumb).toBeVisible(); | ||
await expect(thumb).toHaveText('Page 1'); | ||
|
||
await thumb.dblclick(); | ||
const input = page.getByRole('textbox'); | ||
const newTextContent = 'Change the name'; | ||
await input.fill(newTextContent); | ||
await page.keyboard.press('Enter'); | ||
const renamedPage = page.getByText(newTextContent, { exact: true }); | ||
await expect(renamedPage).toBeVisible(); | ||
|
||
const siblingElement = page.getByText('Change the name', { exact: true }); | ||
const divThumb = siblingElement.locator('..'); | ||
await divThumb.click({ button: 'right' }); | ||
await page.getByText('Rename').click(); | ||
|
||
const secondNewTextContent = 'Other name'; | ||
await expect(input).toBeVisible(); | ||
await input.fill(secondNewTextContent); | ||
await page.keyboard.press('Enter'); | ||
const secondRenamedPage = page.getByText(secondNewTextContent, { | ||
exact: true, | ||
}); | ||
await expect(secondRenamedPage).toBeVisible(); | ||
}); |
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,19 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('verifies visibility of thumb page, chevron and add new page button', async ({ | ||
page, | ||
}) => { | ||
await page.goto(''); | ||
|
||
await page.getByText('Pages').click(); | ||
|
||
const siblingElement = page.getByText('Page 1', { exact: true }); | ||
const thumb = siblingElement.locator('..'); | ||
await expect(thumb).toBeVisible(); | ||
|
||
const svgElement = thumb.locator('span > svg'); | ||
await expect(svgElement).toBeVisible(); | ||
|
||
const addButton = page.getByRole('button', { name: 'add new page' }); | ||
await expect(addButton).toBeVisible(); | ||
}); |
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,92 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { | ||
addComponentsToCanvas, | ||
getAllByShapeType, | ||
getIndexFromCanvasShape, | ||
getShapePosition, | ||
} from '../helpers'; | ||
import { Group } from 'konva/lib/Group'; | ||
|
||
test('drop three shapes in canvas, select one, try all z-index levels', async ({ | ||
page, | ||
}) => { | ||
await page.goto(''); | ||
|
||
//Drag and drop component to canvas | ||
const componentsAtCanvas = ['Input', 'Input', 'Input']; | ||
await addComponentsToCanvas(page, componentsAtCanvas, 30); | ||
|
||
const inputShapes: Group[] = (await getAllByShapeType( | ||
page, | ||
'input' | ||
)) as Group[]; | ||
expect(inputShapes.length).toBe(3); | ||
|
||
// Get Canvas position | ||
const stageCanvas = await page.locator('#konva-stage canvas').first(); | ||
expect(stageCanvas).toBeDefined(); | ||
const canvasPosition = await stageCanvas.boundingBox(); | ||
if (!canvasPosition) throw new Error('No canvas found'); | ||
|
||
// Click on empty canvas space to clear selection | ||
await page.mouse.click(500, 500); | ||
|
||
// Click on second input shape (will be the test subject) | ||
const inputShapePosition = await getShapePosition(inputShapes[1]); | ||
await page.mouse.click( | ||
canvasPosition.x + inputShapePosition.x + 30, | ||
canvasPosition.y + inputShapePosition.y + 10 | ||
); | ||
|
||
// Get initial Z-index of all shapes | ||
const InitialzIndexes: number[] = await Promise.all( | ||
inputShapes.map(async shape => { | ||
return await getIndexFromCanvasShape(page, shape._id); | ||
}) | ||
); | ||
expect(InitialzIndexes).toEqual([0, 1, 2]); | ||
|
||
// FIRST BUTTON: Move to the top (highest z-index) | ||
await page.locator('button[aria-label="Bring to front"]').click(); | ||
|
||
// Verify Z-index after moving to the top | ||
const zIndexesAfterMoveToTop: number[] = await Promise.all( | ||
inputShapes.map(async shape => { | ||
return await getIndexFromCanvasShape(page, shape._id); | ||
}) | ||
); | ||
expect(zIndexesAfterMoveToTop).toEqual([0, 2, 1]); // Second shape is now on top | ||
|
||
// SECOND BUTTON: Move to the bottom (lowest z-index) | ||
await page.locator('button[aria-label="Send to back"]').click(); | ||
|
||
// Verify Z-index after moving to the bottom | ||
const zIndexesAfterMoveToBottom: number[] = await Promise.all( | ||
inputShapes.map(async shape => { | ||
return await getIndexFromCanvasShape(page, shape._id); | ||
}) | ||
); | ||
expect(zIndexesAfterMoveToBottom).toEqual([1, 0, 2]); // Second shape is now at the bottom | ||
|
||
// THIRD BUTTON: Move up one level | ||
await page.locator('button[aria-label="Bring forward"]').click(); | ||
|
||
// Verify Z-index after moving up one level | ||
const zIndexesAfterMoveUp: number[] = await Promise.all( | ||
inputShapes.map(async shape => { | ||
return await getIndexFromCanvasShape(page, shape._id); | ||
}) | ||
); | ||
expect(zIndexesAfterMoveUp).toEqual([0, 1, 2]); // Second shape moved up one level | ||
|
||
// FOURTH BUTTON: Move down one level | ||
await page.locator('button[aria-label="Send backward"]').click(); | ||
|
||
// Verify Z-index after moving down one level | ||
const zIndexesAfterMoveDown: number[] = await Promise.all( | ||
inputShapes.map(async shape => { | ||
return await getIndexFromCanvasShape(page, shape._id); | ||
}) | ||
); | ||
expect(zIndexesAfterMoveDown).toEqual([1, 0, 2]); // Second shape moved down one level again | ||
}); |
Oops, something went wrong.