Browse Source

test: code realign (WIP)

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/5896/head
Raju Udava 1 year ago
parent
commit
98cca2d377
  1. 126
      tests/playwright/tests/db/verticalFillHandle.spec.ts

126
tests/playwright/tests/db/verticalFillHandle.spec.ts

@ -6,6 +6,9 @@ import { createDemoTable } from '../../setup/demoTable';
import { BulkUpdatePage } from '../../pages/Dashboard/BulkUpdate'; import { BulkUpdatePage } from '../../pages/Dashboard/BulkUpdate';
let dashboard: DashboardPage; let dashboard: DashboardPage;
let context: any;
let api: Api<any>;
let table;
async function dragDrop({ firstColumn, lastColumn }: { firstColumn: string; lastColumn: string }) { async function dragDrop({ firstColumn, lastColumn }: { firstColumn: string; lastColumn: string }) {
await dashboard.grid.cell.get({ index: 0, columnHeader: firstColumn }).click(); await dashboard.grid.cell.get({ index: 0, columnHeader: firstColumn }).click();
await dashboard.rootPage.keyboard.press( await dashboard.rootPage.keyboard.press(
@ -19,27 +22,26 @@ async function dragDrop({ firstColumn, lastColumn }: { firstColumn: string; last
// drag and drop // drag and drop
await src.dragTo(dst); await src.dragTo(dst);
} }
async function beforeEachInit({ page, tableType }: { page: any; tableType: string }) {
context = await setup({ page, isEmptyProject: true });
dashboard = new DashboardPage(page, context.project);
api = new Api({
baseURL: `http://localhost:8080/`,
headers: {
'xc-auth': context.token,
},
});
test.describe.skip('Bulk update', () => { table = await createDemoTable({ context, type: tableType, recordCnt: 10 });
let context: any; await page.reload();
let api: Api<any>;
let table;
test.beforeEach(async ({ page }) => {
context = await setup({ page, isEmptyProject: true });
dashboard = new DashboardPage(page, context.project);
api = new Api({
baseURL: `http://localhost:8080/`,
headers: {
'xc-auth': context.token,
},
});
table = await createDemoTable({ context, type: 'textBased', recordCnt: 10 }); await dashboard.treeView.openTable({ title: tableType });
await page.reload(); }
await dashboard.treeView.openTable({ title: 'textBased' }); test.describe('Fill Handle', () => {
test.beforeEach(async ({ page }) => {
await beforeEachInit({ page, tableType: 'textBased' });
}); });
test('Text based', async () => { test('Text based', async () => {
@ -70,26 +72,9 @@ test.describe.skip('Bulk update', () => {
}); });
}); });
test.describe.skip('Bulk update', () => { test.describe('Fill Handle', () => {
let context: any;
let api: Api<any>;
let table;
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
context = await setup({ page, isEmptyProject: true }); await beforeEachInit({ page, tableType: 'numberBased' });
dashboard = new DashboardPage(page, context.project);
api = new Api({
baseURL: `http://localhost:8080/`,
headers: {
'xc-auth': context.token,
},
});
table = await createDemoTable({ context, type: 'numberBased', recordCnt: 10 });
await page.reload();
await dashboard.treeView.openTable({ title: 'numberBased' });
}); });
test('Number based', async () => { test('Number based', async () => {
@ -144,26 +129,9 @@ test.describe.skip('Bulk update', () => {
}); });
}); });
test.describe.skip('Bulk update', () => { test.describe('Fill Handle', () => {
let context: any;
let api: Api<any>;
let table;
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
context = await setup({ page, isEmptyProject: true }); await beforeEachInit({ page, tableType: 'selectBased' });
dashboard = new DashboardPage(page, context.project);
api = new Api({
baseURL: `http://localhost:8080/`,
headers: {
'xc-auth': context.token,
},
});
table = await createDemoTable({ context, type: 'selectBased', recordCnt: 10 });
await page.reload();
await dashboard.treeView.openTable({ title: 'selectBased' });
}); });
test('Select based', async () => { test('Select based', async () => {
@ -204,26 +172,9 @@ test.describe.skip('Bulk update', () => {
}); });
}); });
test.describe.skip('Bulk update', () => { test.describe.only('Fill Handle', () => {
let context: any;
let api: Api<any>;
let table;
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
context = await setup({ page, isEmptyProject: true }); await beforeEachInit({ page, tableType: 'miscellaneous' });
dashboard = new DashboardPage(page, context.project);
api = new Api({
baseURL: `http://localhost:8080/`,
headers: {
'xc-auth': context.token,
},
});
table = await createDemoTable({ context, type: 'miscellaneous', recordCnt: 50 });
await page.reload();
await dashboard.treeView.openTable({ title: 'miscellaneous' });
}); });
test('Miscellaneous (Checkbox, attachment)', async () => { test('Miscellaneous (Checkbox, attachment)', async () => {
@ -232,6 +183,8 @@ test.describe.skip('Bulk update', () => {
{ title: 'Attachment', value: `${process.cwd()}/fixtures/sampleFiles/1.json`, type: 'attachment' }, { title: 'Attachment', value: `${process.cwd()}/fixtures/sampleFiles/1.json`, type: 'attachment' },
]; ];
await dragDrop({ firstColumn: 'Checkbox', lastColumn: 'Attachment' });
// verify data on grid // verify data on grid
for (let i = 0; i < fields.length; i++) { for (let i = 0; i < fields.length; i++) {
if (fields[i].type === 'checkbox') { if (fields[i].type === 'checkbox') {
@ -260,31 +213,16 @@ test.describe.skip('Bulk update', () => {
}); });
}); });
test.describe.skip('Bulk update', () => { test.describe('Fill Handle', () => {
let context: any;
let api: Api<any>;
let table;
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
context = await setup({ page, isEmptyProject: true }); await beforeEachInit({ page, tableType: 'dateTimeBased' });
dashboard = new DashboardPage(page, context.project);
api = new Api({
baseURL: `http://localhost:8080/`,
headers: {
'xc-auth': context.token,
},
});
table = await createDemoTable({ context, type: 'dateTimeBased', recordCnt: 50 });
await page.reload();
await dashboard.treeView.openTable({ title: 'dateTimeBased' });
}); });
test('Date Time Based', async () => { test('Date Time Based', async () => {
const fields = [{ title: 'Date', value: '2024-08-04', type: 'date' }]; const fields = [{ title: 'Date', value: '2024-08-04', type: 'date' }];
await dragDrop({ firstColumn: 'Date', lastColumn: 'Date' });
// verify data on grid // verify data on grid
for (let i = 0; i < fields.length; i++) { for (let i = 0; i < fields.length; i++) {
await dashboard.grid.cell.date.verify({ await dashboard.grid.cell.date.verify({

Loading…
Cancel
Save