TagSpaces is an offline, open source, document manager with tagging support
add e2e TST4916 - Move columns with dnd
Stanimirbcc6ce9d12b8
diff --git a/tests/e2e/perspective-kanban.helpers.js b/tests/e2e/perspective-kanban.helpers.jsindex 4d963e21f..fe66268dd 100644--- a/tests/e2e/perspective-kanban.helpers.js+++ b/tests/e2e/perspective-kanban.helpers.js@@ -43,6 +43,51 @@ export async function getColumnEntries(column) {}return ids;}++export async function dragKanBanColumn(sourceColumn, targetColumn) {+ const src = global.client.locator(+ '[data-tid="' + sourceColumn + 'KanBanColumnTID"]',+ ); //`[data-rbd-draggable-id="${sourceColumn}"]`);+ const tgt = global.client.locator(+ '[data-tid="' + targetColumn + 'KanBanColumnTID"]',+ );+ const from = await src.boundingBox();+ const to = await tgt.boundingBox();+ if (!from || !to) throw new Error('Could not resolve bounding boxes');++ await global.client.mouse.move(+ from.x + from.width / 2,+ from.y + from.height / 2,+ );+ await global.client.mouse.down();+ await global.client.mouse.move(to.x + to.width / 2, to.y + to.height / 2, {+ steps: 8,+ });+ await global.client.mouse.up();++ /* await src.hover();+ await global.client.mouse.down();+ await tgt.hover();+ await global.client.mouse.up();*/+}++export async function getColumnsIds() {+ const draggables = global.client.locator(+ '[data-tid="perspectiveGridFileTable"] [data-rbd-draggable-id]',+ );++ // 2. Count how many there are+ const count = await draggables.count();++ // 3. Loop and collect their IDs+ const ids = [];+ for (let i = 0; i < count; i++) {+ const id = await draggables.nth(i).getAttribute('data-rbd-draggable-id');+ if (id) ids.push(id);+ }++ return ids;+}export async function expectFirstColumnElement(elId, column = 'empty_folder') {const el = await getColumnEntries(column);expect(elId).toBe(el[0]);diff --git a/tests/e2e/perspective-kanban.pw.e2e.js b/tests/e2e/perspective-kanban.pw.e2e.jsindex 81cdc1f20..33bd3e2ca 100644--- a/tests/e2e/perspective-kanban.pw.e2e.js+++ b/tests/e2e/perspective-kanban.pw.e2e.js@@ -32,8 +32,10 @@ import { dataTidFormat } from '../../src/renderer/services/test';import {createColumn,createMdCard,+ dragKanBanColumn,expectFirstColumnElement,expectLastColumnElement,+ getColumnsIds,} from './perspective-kanban.helpers';import { AddRemovePropertiesTags } from './file.properties.helpers';@@ -476,4 +478,32 @@ test.describe('TST49 - Perspective KanBan', () => {const changeThumbScreenshot = await getElementScreenshot(cardSelector);expect(initScreenshot).not.toBe(changeThumbScreenshot);});++ test('TST4916 - Move columns with dnd [web,minio,electron,_pro]', async () => {+ const srcColumnName = 'column1';+ const midColumnName = 'column2';+ const destColumnName = 'column3';++ await createColumn(srcColumnName);+ await createColumn(midColumnName);+ await createColumn(destColumnName);++ const initColumns = await getColumnsIds();+ console.log(initColumns);+ expect(initColumns.slice(-3)).toEqual([+ srcColumnName,+ midColumnName,+ destColumnName,+ ]);++ await dragKanBanColumn(srcColumnName, destColumnName);+ const movedColumns = await getColumnsIds();+ console.log(movedColumns);++ expect(movedColumns.slice(-3)).toEqual([+ midColumnName,+ destColumnName,+ srcColumnName,+ ]);+ });});