Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New minor release, fixes, new components and new icons #443

Merged
merged 57 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
378c05f
show audio player component
Pableras90 Aug 29, 2024
051e3ab
work in progress
Pableras90 Sep 2, 2024
d2a79a7
Merge branch 'main' into feature/#183-create-audio-player
Pableras90 Sep 2, 2024
13836e3
work in progress
Sep 4, 2024
f33fa8d
merge with main
Sep 5, 2024
135d09c
refactor
Sep 5, 2024
fdbca93
work in progress
Sep 11, 2024
62b7cc3
fix component
Sep 11, 2024
5640809
fix all the component
Sep 13, 2024
1552ae1
merge with dev
antonio06 Sep 17, 2024
73cc573
new audio player
deletidev Sep 24, 2024
345c62d
Refactor IsdropImage
El-Mito-de-Giralda Sep 25, 2024
bb88006
Refactor isDropImageFile
El-Mito-de-Giralda Sep 25, 2024
fa70766
Refactor IsDropFile
El-Mito-de-Giralda Sep 26, 2024
2cde4e2
load test env
nasdan Sep 30, 2024
2512069
Refactor isDropImage and test
El-Mito-de-Giralda Sep 30, 2024
31a60d3
Merge pull request #418 from Lemoncode/feature/enable-konva-layer-on-…
brauliodiez Oct 1, 2024
367f226
refactor move shape folder
brauliodiez Oct 1, 2024
abfd1ba
Refactor isDropImage and test
El-Mito-de-Giralda Oct 1, 2024
ae85eaf
fix debug env variables
nasdan Oct 3, 2024
6dbd808
update vitest config
nasdan Oct 3, 2024
43b2920
#404 getTransformer and check enabledAnchors
oleojake Oct 3, 2024
9e48e09
Merge pull request #420 from Lemoncode/feature/#402-edit-inline-shape…
brauliodiez Oct 3, 2024
b8f0027
Merge pull request #419 from Lemoncode/feature/moved-shape-model-one-…
brauliodiez Oct 3, 2024
9776bfa
merge with dev
antonio06 Oct 3, 2024
e30c5f8
#404 define transform if there's any shape dropped on canvas, selecte…
oleojake Oct 6, 2024
30b7614
Merge branch 'dev' into qa/#404-drop-shape-ensure-is-selected
oleojake Oct 6, 2024
77d8750
#404 refactor
oleojake Oct 6, 2024
1a8efdd
Progress bar border radius property
El-Mito-de-Giralda Oct 8, 2024
c501455
Merge pull request #421 from Lemoncode/qa/#404-drop-shape-ensure-is-s…
brauliodiez Oct 9, 2024
3ccef86
Add a new prop to select the color of the selected item band on the l…
manugallegob Oct 9, 2024
0733816
merge with dev
antonio06 Oct 10, 2024
d3444d5
test - done
raquetelio Oct 10, 2024
12633fb
test - done
raquetelio Oct 10, 2024
9f10ad5
Merge pull request #423 from Lemoncode/feature/#195-Add-a-new-prop-to…
brauliodiez Oct 11, 2024
0330b48
refactor move shape folder
brauliodiez Oct 11, 2024
73da375
unit test fixed
brauliodiez Oct 11, 2024
cfe86be
test: add test to delete last character using Backspace in input comp…
Franlop7 Oct 11, 2024
10fd0f6
Merge branch 'dev' into feature/#183-create-audio-player
antonio06 Oct 11, 2024
a093270
Merge pull request #429 from Lemoncode/feature/#383-refactor-model
brauliodiez Oct 11, 2024
ac6dc05
work in progress
antonio06 Oct 11, 2024
5e61ce6
fix rotation component
antonio06 Oct 11, 2024
5345be4
QA add multiple selection test
Alber-Writer Oct 13, 2024
686cf43
merge with dev
antonio06 Oct 14, 2024
840d031
Merge with dev
El-Mito-de-Giralda Oct 14, 2024
01b1692
Progressbar borerradius
El-Mito-de-Giralda Oct 14, 2024
7388ce0
Merge branch 'dev' into #231-feature/Refactor-isDropImageFrom-file-to…
El-Mito-de-Giralda Oct 14, 2024
af07803
Merge pull request #430 from Lemoncode/feature/#403--QA]-Edit-inline-…
brauliodiez Oct 15, 2024
b349eff
Merge pull request #428 from Lemoncode/feature/#415-progresbar-app-bo…
brauliodiez Oct 15, 2024
9418fd3
Merge pull request #422 from Lemoncode/feature/#407-QA-Test-multiple-…
brauliodiez Oct 15, 2024
71c2bc0
Merge pull request #425 from Lemoncode/feature/#405-another-selected-…
brauliodiez Oct 15, 2024
06aeb3a
Merge pull request #424 from Lemoncode/feature/#183-create-audio-player
brauliodiez Oct 15, 2024
f5990ee
Merge pull request #400 from El-Mito-de-Giralda/#231-feature/Refactor…
brauliodiez Oct 15, 2024
aeea51d
Add new icons to set of icons
Oct 15, 2024
d437121
fix rich component gallery
Alber-Writer Oct 15, 2024
d991a4a
Merge pull request #442 from Lemoncode/fix-duplicated-video-player-wi…
brauliodiez Oct 15, 2024
0c8e0d5
Merge pull request #441 from Lemoncode/feature/#227-add-icons
brauliodiez Oct 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NODE_ENV=test
15 changes: 13 additions & 2 deletions e2e/helpers/konva-testing.helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import { Group } from 'konva/lib/Group';

const getLayer = async (page: Page): Promise<Layer> =>
await page.evaluate(() => {
const layer = (window as any).KONVA_LAYER;
return layer;
return window.__TESTING_KONVA_LAYER__;
});

const getChildren = async (page: Page): Promise<(Group | Shape)[]> => {
Expand Down Expand Up @@ -48,3 +47,15 @@ export const getByShapeType = async (
return undefined;
}
};

export const getTransformer = async (page: Page): Promise<any> => {
const layer = await getLayer(page);
const transformer = layer?.children.find((child: any) => {
// Ensure that canvas has an element dropped, selected or not
return (
child._nodes?.length > 0 ||
(child._nodes?.length === 0 && child.index > 0)
);
});
return transformer;
};
26 changes: 26 additions & 0 deletions e2e/helpers/position.helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,29 @@ export const dragAndDrop = async (
await page.mouse.move(bPosition.x, bPosition.y);
await page.mouse.up();
};

export const addComponentsToCanvas = async (
page: Page,
components: string[]
) => {
const canvasPosition = await page.locator('canvas').boundingBox();
if (!canvasPosition) throw new Error('No canvas found');

for await (const [index, c] of components.entries()) {
const component = page.getByAltText(c, { exact: true });
const position = await getLocatorPosition(component);

const targetPosition = (
displacementQty: number,
multiplyFactor: number
) => {
const positionDisplacement = displacementQty * (multiplyFactor + 1);
return {
x: canvasPosition.x + displacementQty + positionDisplacement,
y: canvasPosition.y + positionDisplacement,
};
};

await dragAndDrop(page, position, targetPosition(120, index));
}
};
63 changes: 63 additions & 0 deletions e2e/inline-edit/simple-inline-edit.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { test, expect } from '@playwright/test';
import { Group } from 'konva/lib/Group';
import { dragAndDrop, getByShapeType, getLocatorPosition } from '../helpers';

test('can add input component to canvas and edit', async ({ page }) => {
await page.goto('');
const component = page.getByAltText('Input', { exact: true });

const position = await getLocatorPosition(component);
const targetPosition = {
x: position.x + 500,
y: position.y - 240,
};
await dragAndDrop(page, position, targetPosition);
await page.mouse.dblclick(targetPosition.x, targetPosition.y);
const input = page.getByRole('textbox').first();
const inputValue = await input.getAttribute('value');
expect(inputValue).toEqual('Placeholder');

const textContent = 'User';
await input.fill(textContent);
await page.keyboard.press('Enter');
const inputShape = (await getByShapeType(page, 'input')) as Group;
expect(inputShape).toBeDefined();
const textShape = inputShape.children.find(
child => child.attrs.text === textContent
);
expect(textShape).toBeDefined();
});

test('can add and edit input, and delete last letter', async ({ page }) => {
await page.goto('');
const component = page.getByAltText('Input', { exact: true });

const position = await getLocatorPosition(component);
const targetPosition = {
x: position.x + 500,
y: position.y - 240,
};
await dragAndDrop(page, position, targetPosition);
await page.mouse.dblclick(targetPosition.x, targetPosition.y);

const input = page.getByRole('textbox').first();
const inputValue = await input.getAttribute('value');
expect(inputValue).toEqual('Placeholder');

const textContent = 'user';
await input.fill(textContent);

await page.keyboard.press('Backspace');

const updatedInputValue = await input.inputValue();
expect(updatedInputValue).toEqual('use');

await page.keyboard.press('Enter');

const inputShape = (await getByShapeType(page, 'input')) as Group;
expect(inputShape).toBeDefined();
const textShape = inputShape.children.find(
child => child.attrs.text === 'use'
);
expect(textShape).toBeDefined();
});
98 changes: 98 additions & 0 deletions e2e/selection/dropped-shape-is-selected.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import { test, expect } from '@playwright/test';
import {
dragAndDrop,
getByShapeType,
getLocatorPosition,
getTransformer,
getAllByShapeType,
} from '../helpers';
import { Group } from 'konva/lib/Group';

test('drop new shape in canvas, ensure new is selected, former is unselected - different shapes', 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);

const component2 = page.getByAltText('Label', { exact: true });
expect(component2).toBeDefined();

const offset = 200;

const position2 = await getLocatorPosition(component2);
await dragAndDrop(page, position2, {
x: position2.x + 500 + offset,
y: position2.y - 240 + offset,
});

const inputShape2 = (await getByShapeType(page, 'label')) as Group;
expect(inputShape2).toBeDefined();

const transformer2 = await getTransformer(page);
expect(transformer2).toBeDefined();
expect(transformer2.index).toEqual(2);
expect(transformer2._nodes.length).toEqual(1);
});

test('drop new shape in canvas, ensure new is selected, former is unselected - same shapes', 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 inputShapes: Group[] = (await getAllByShapeType(
page,
'input'
)) as Group[];
expect(inputShapes[0]).toBeDefined();

const transformer = await getTransformer(page);
expect(transformer).toBeDefined();
expect(transformer.index).toEqual(1);
expect(transformer._nodes.length).toEqual(1);

const component2 = page.getByAltText('Input', { exact: true });
expect(component2).toBeDefined();

const offset = 200;

const position2 = await getLocatorPosition(component2);
await dragAndDrop(page, position2, {
x: position2.x + 500 + offset,
y: position2.y - 240 + offset,
});

const inputShapes2: Group[] = (await getAllByShapeType(
page,
'input'
)) as Group[];
expect(inputShapes2[1]).toBeDefined();
expect(inputShapes2.length).toEqual(2);

const transformer2 = await getTransformer(page);
expect(transformer2).toBeDefined();
expect(transformer2.index).toEqual(2);
expect(transformer2._nodes.length).toEqual(1);
});
22 changes: 22 additions & 0 deletions e2e/selection/multiple-selection.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { test, expect } from '@playwright/test';
import { dragAndDrop, addComponentsToCanvas, getTransformer } from '../helpers';

test('Should perform multiple selection when dragging and dropping over multiple components in the canvas', async ({
page,
}) => {
await page.goto('');

//Drag and drop component to canvas
const componentsAtCanvas = ['Input', 'Input', 'Icon', 'Label'];
await addComponentsToCanvas(page, componentsAtCanvas);

//Click Away
await page.mouse.click(800, 130);

//Perform items selection by drag and drop
await dragAndDrop(page, { x: 260, y: 130 }, { x: 1000, y: 550 });

//Assert
const selectedItems = await getTransformer(page);
expect(selectedItems._nodes.length).toEqual(3);
});
55 changes: 55 additions & 0 deletions e2e/selection/shape-selection.spec.ts
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);
});
7 changes: 7 additions & 0 deletions global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Konva from 'konva';

declare global {
interface Window {
__TESTING_KONVA_LAYER__: Konva.Layer;
}
}
Loading