TagSpaces is an offline, open source, document manager with tagging support
e2e add TST4912
Stanimir26339563dd8d
diff --git a/tests/e2e/perspective-kanban.helpers.js b/tests/e2e/perspective-kanban.helpers.jsindex a89413f93..4aa888459 100644--- a/tests/e2e/perspective-kanban.helpers.js+++ b/tests/e2e/perspective-kanban.helpers.js@@ -1,5 +1,5 @@/* Copyright (c) 2016-present - TagSpaces GmbH. All rights reserved. */-+import { expect } from './fixtures';import { clickOn, expectElementExist, typeInputValue } from './general.helpers';export async function createColumn(columnName) {@@ -18,6 +18,35 @@ export async function createMdCard(cardName, column = 'empty_folder') {await clickOn('[data-tid=createCard_' + column + ']');await typeInputValue('[data-tid=newEntryDialogInputTID] input', cardName, 0);await clickOn('[data-tid=createMarkdownButton]');+ const cardSelector = '[data-tid=fsEntryName_' + cardName + '_md]';+ await expectElementExist(cardSelector, true);+ const card = await global.client.locator(cardSelector);+ const parent = await card.locator('..');+ return await parent.getAttribute('data-entry-id');+}++export async function getColumnEntries(column) {+ // grab a Locator for the container+ const container = global.client.locator('[data-tid="' + column + 'CTID"]');- await expectElementExist('[data-tid=fsEntryName_' + cardName + '_md]', true);+ // then find all descendants with a data-entry-id attribute+ const entries = container.locator('[data-entry-id]');++ const count = await entries.count();+ const ids = [];+ for (let i = 0; i < count; i++) {+ const entry = entries.nth(i);+ const id = await entry.getAttribute('data-entry-id');+ ids.push(id);+ //console.log(`Entry ${i}: ${id}`);+ }+ return ids;+}+export async function expectFirstColumnElement(elId, column = 'empty_folder') {+ const el = await getColumnEntries(column);+ expect(elId).toBe(el[0]);+}+export async function expectLastColumnElement(elId, column = 'empty_folder') {+ const el = await getColumnEntries(column);+ expect(elId).toBe(el[el.length - 1]);}diff --git a/tests/e2e/perspective-kanban.pw.e2e.js b/tests/e2e/perspective-kanban.pw.e2e.jsindex c48672c25..cf2f8c903 100644--- a/tests/e2e/perspective-kanban.pw.e2e.js+++ b/tests/e2e/perspective-kanban.pw.e2e.js@@ -29,7 +29,12 @@ import {import { clearDataStorage, closeWelcomePlaywright } from './welcome.helpers';import { openContextEntryMenu } from './test-utils';import { dataTidFormat } from '../../src/renderer/services/test';-import { createColumn, createMdCard } from './perspective-kanban.helpers';+import {+ createColumn,+ createMdCard,+ expectFirstColumnElement,+ expectLastColumnElement,+} from './perspective-kanban.helpers';import { AddRemovePropertiesTags } from './file.properties.helpers';test.beforeAll(async ({ isWeb, isS3, webServerPort }, testInfo) => {@@ -328,14 +333,31 @@ test.describe('TST49 - Perspective KanBan', () => {await clickOn('[data-tid=backgroundClearTID]');await clickOn('[data-tid=confirmConfirmResetColorDialog]');- await waitUntilChanged(- targetSelector,- bgStyle, //'height: 100%; background: transparent;',- 'style',- 10000,- );+ await waitUntilChanged(targetSelector, bgStyle, 'style', 10000);++ //const bgRemovedStyle = await getAttribute(targetSelector, 'style');+ //expect(initStyle).toBe(bgRemovedStyle);//const bgnRemovedScreenshot = await getElementScreenshot(targetSelector);- //expect(initScreenshot).toBe(bgnRemovedScreenshot);+ //expect(initScreenshot).toBe(withBgnColorScreenshot);+ });+ test('TST4912 - Move card to top / bottom [web,minio,electron,_pro]', async () => {+ const cardName1 = 'testCard1';+ const cardName2 = 'testCard2';+ const card1Id = await createMdCard(cardName1);+ const card2Id = await createMdCard(cardName2);+ await expectFirstColumnElement(card2Id, 'empty_folder');++ await rightClickOn('[data-tid=fsEntryName_' + cardName2 + '_md]');+ await clickOn('[data-tid=reorderBottomTID]');+ await expectLastColumnElement(card2Id, 'empty_folder');++ await rightClickOn('[data-tid=fsEntryName_' + cardName1 + '_md]');+ await clickOn('[data-tid=reorderBottomTID]');+ await expectLastColumnElement(card1Id, 'empty_folder');++ await rightClickOn('[data-tid=fsEntryName_' + cardName1 + '_md]');+ await clickOn('[data-tid=reorderTopTID]');+ await expectFirstColumnElement(card1Id, 'empty_folder');});});