Browse Source

test: kanban, undo - disabled

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/5332/head
Raju Udava 2 years ago committed by mertmit
parent
commit
dd6b55ae5d
  1. 29
      tests/playwright/pages/Dashboard/Kanban/index.ts
  2. 131
      tests/playwright/tests/undo-redo.spec.ts

29
tests/playwright/pages/Dashboard/Kanban/index.ts

@ -29,20 +29,21 @@ export class KanbanPage extends BasePage {
// todo: Implement
async addOption() {}
// todo: Implement
async dragDropCard(param: { from: string; to: string }) {
// const { from, to } = param;
// const srcStack = await this.get().locator(`.nc-kanban-stack`).nth(1);
// const dstStack = await this.get().locator(`.nc-kanban-stack`).nth(2);
// const fromCard = await srcStack.locator(`.nc-kanban-item`).nth(1);
// const toCard = await dstStack.locator(`.nc-kanban-item`).nth(1);
// const [fromCard, toCard] = await Promise.all([
// srcStack.locator(`.nc-kanban-item[data-draggable="true"]`).nth(0),
// dstStack.locator(`.nc-kanban-item[data-draggable="true"]`).nth(0),
// ]);
// const fromCard = await this.get().locator(`.nc-kanban-item`).nth(0);
// const toCard = await this.get().locator(`.nc-kanban-item`).nth(25);
// await fromCard.dragTo(toCard);
async dragDropCard(param: { from: { stack: number; card: number }; to: { stack: number; card: number } }) {
const { from, to } = param;
const srcStack = await this.get().locator(`.nc-kanban-stack`).nth(from.stack);
const dstStack = await this.get().locator(`.nc-kanban-stack`).nth(to.stack);
const fromCard = await srcStack.locator(`.nc-kanban-item`).nth(from.card);
const toCard = await dstStack.locator(`.nc-kanban-item`).nth(to.card);
console.log(await fromCard.allTextContents());
console.log(await toCard.allTextContents());
await fromCard.dragTo(toCard, {
force: true,
sourcePosition: { x: 10, y: 10 },
targetPosition: { x: 10, y: 10 },
});
}
async dragDropStack(param: { from: number; to: number }) {

131
tests/playwright/tests/undo-redo.spec.ts

@ -34,6 +34,21 @@ const validateResponse = false;
Table Rename
**/
async function undo({ page }: { page: Page }) {
const isMac = await grid.isMacOs();
if (validateResponse) {
await dashboard.grid.waitForResponse({
uiAction: () => page.keyboard.press(isMac ? 'Meta+z' : 'Control+z'),
httpMethodsToMatch: ['GET'],
requestUrlPathToMatch: `/api/v1/db/data/noco/`,
responseJsonMatcher: json => json.pageInfo,
});
} else {
await page.keyboard.press(isMac ? 'Meta+z' : 'Control+z');
await page.waitForTimeout(100);
}
}
test.describe('Undo Redo', () => {
test.beforeEach(async ({ page }) => {
@ -116,22 +131,6 @@ test.describe('Undo Redo', () => {
await dashboard.grid.verifyTotalRowCount({ count: expectedValues.length });
}
async function undo({ page }: { page: Page }) {
const isMac = await grid.isMacOs();
if (validateResponse) {
await dashboard.grid.waitForResponse({
uiAction: () => page.keyboard.press(isMac ? 'Meta+z' : 'Control+z'),
httpMethodsToMatch: ['GET'],
requestUrlPathToMatch: `/api/v1/db/data/noco/`,
responseJsonMatcher: json => json.pageInfo,
});
} else {
await page.keyboard.press(isMac ? 'Meta+z' : 'Control+z');
await page.waitForTimeout(100);
}
}
test('Row: Create, Update, Delete', async ({ page }) => {
await dashboard.closeTab({ title: 'Team & Auth' });
await dashboard.treeView.openTable({ title: 'numberBased' });
@ -504,3 +503,103 @@ test.describe('Undo Redo - 2', () => {
await undo({ page, values: [] });
});
});
test.describe('Undo Redo - 3', () => {
test.beforeEach(async ({ page }) => {
context = await setup({ page, isEmptyProject: true });
dashboard = new DashboardPage(page, context.project);
grid = dashboard.grid;
api = new Api({
baseURL: `http://localhost:8080/`,
headers: {
'xc-auth': context.token,
},
});
const columns = [
{
column_name: 'Id',
title: 'Id',
uidt: UITypes.ID,
},
{
column_name: 'Title',
title: 'Title',
uidt: UITypes.SingleLineText,
pv: true,
},
{
column_name: 'select',
title: 'select',
uidt: UITypes.SingleSelect,
dtxp: "'jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec'",
},
];
try {
const project = await api.project.read(context.project.id);
table = await api.base.tableCreate(context.project.id, project.bases?.[0].id, {
table_name: 'selectSample',
title: 'selectSample',
columns,
});
const RowAttributes = [
{ Title: 'Mumbai', select: 'jan' },
{ Title: 'Pune', select: 'feb' },
{ Title: 'Delhi', select: 'mar' },
{ Title: 'Bangalore', select: 'jan' },
];
await api.dbTableRow.bulkCreate('noco', context.project.id, table.id, RowAttributes);
} catch (e) {
console.log(e);
}
// reload page after api calls
await page.reload();
});
test.skip('Kanban', async ({ page }) => {
await dashboard.closeTab({ title: 'Team & Auth' });
await dashboard.treeView.openTable({ title: 'selectSample' });
await dashboard.viewSidebar.createKanbanView({
title: 'Kanban',
});
const kanban = dashboard.kanban;
// Drag drop stack
await kanban.verifyStackOrder({
order: ['Uncategorized', 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'],
});
// verify drag drop stack
await kanban.dragDropStack({
from: 1, // jan
to: 2, // feb
});
await kanban.verifyStackOrder({
order: ['Uncategorized', 'feb', 'jan', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'],
});
// undo drag drop stack
await undo({ page });
await kanban.verifyStackOrder({
order: ['Uncategorized', 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'],
});
// drag drop card
await kanban.verifyCardCount({
count: [0, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
});
await kanban.dragDropCard({ from: { stack: 1, card: 0 }, to: { stack: 2, card: 0 } });
await kanban.verifyCardCount({
count: [0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
});
// undo drag drop card
await undo({ page });
await kanban.verifyCardCount({
count: [0, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
});
});
});

Loading…
Cancel
Save