Browse Source

test: bulk update- date

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
test/pw-duplicate-check
Raju Udava 1 year ago
parent
commit
b2918a11f1
  1. 20
      tests/playwright/pages/Dashboard/BulkUpdate/index.ts
  2. 51
      tests/playwright/tests/db/bulkUpdate.spec.ts

20
tests/playwright/pages/Dashboard/BulkUpdate/index.ts

@ -142,6 +142,26 @@ export class BulkUpdatePage extends BasePage {
const attachFileAction = field.locator('[data-testid="attachment-cell-file-picker-button"]').click();
await this.attachFile({ filePickUIAction: attachFileAction, filePath: value });
break;
case 'date':
{
const values = value.split('-');
const { year, month, day } = { year: values[0], month: values[1], day: values[2] };
picker = this.rootPage.locator('.ant-picker-dropdown.active');
const monthBtn = picker.locator('.ant-picker-month-btn');
const yearBtn = picker.locator('.ant-picker-year-btn');
await yearBtn.click();
await picker.waitFor();
await picker.locator(`td[title="${year}"]`).click();
await monthBtn.click();
await picker.waitFor();
await picker.locator(`td[title="${year}-${month}"]`).click();
await picker.waitFor();
await picker.locator(`td[title="${year}-${month}-${day}"]`).click();
}
break;
}
}

51
tests/playwright/tests/db/bulkUpdate.spec.ts

@ -312,3 +312,54 @@ test.describe('Bulk update - Miscellaneous', () => {
}
});
});
test.describe('Bulk update - DateTimeBased', () => {
let dashboard: DashboardPage;
let context: any;
let api: Api<any>;
let table;
test.beforeEach(async ({ page }) => {
context = await setup({ page, isEmptyProject: true });
dashboard = new DashboardPage(page, context.project);
bulkUpdateForm = dashboard.bulkUpdateForm;
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' });
// Open bulk update form
await dashboard.grid.updateAll();
});
test('dateTimeBased', async () => {
const fields = [{ title: 'Date', value: '2024-08-04', type: 'date' }];
await updateBulkFields(fields);
// verify data on grid
for (let i = 0; i < fields.length; i++) {
await dashboard.grid.cell.date.verify({
index: 5,
columnHeader: fields[i].title,
date: fields[i].value,
});
}
// verify api response
const updatedRecords = (await api.dbTableRow.list('noco', context.project.id, table.id, { limit: 50 })).list;
for (let i = 0; i < updatedRecords.length; i++) {
for (let j = 0; j < fields.length; j++) {
expect(updatedRecords[i]['Date']).toBe(fields[j].value);
}
}
});
});

Loading…
Cancel
Save