Browse Source

test: replace addRecord call using API

pull/8380/head
Raju Udava 5 months ago
parent
commit
0234b950c7
  1. 4
      tests/playwright/pages/Dashboard/TreeView.ts
  2. 37
      tests/playwright/tests/db/columns/columnMultiSelect.spec.ts

4
tests/playwright/pages/Dashboard/TreeView.ts

@ -162,10 +162,6 @@ export class TreeViewPage extends BasePage {
// Tab render is slow for playwright
await this.dashboard.waitForTabRender({ title, mode });
// Some of the tests are flaky due to immediate operations on the table
// Tab render above is no more valid
await this.rootPage.waitForTimeout(1000);
}
async verifyTable({ title, index, exists = true }: { title: string; index?: number; exists?: boolean }) {

37
tests/playwright/tests/db/columns/columnMultiSelect.spec.ts

@ -5,10 +5,18 @@ import setup, { unsetup } from '../../../setup';
import { ToolbarPage } from '../../../pages/Dashboard/common/Toolbar';
import { Api } from 'nocodb-sdk';
let api: Api<any>;
const addRecordUsingAPI = async (context: any, tableId: string, rowAttributes: any) => {
try {
await api.dbTableRow.bulkCreate('noco', context.base.id, tableId, rowAttributes);
} catch (e) {
console.error(e);
}
};
test.describe('Multi select', () => {
let dashboard: DashboardPage, grid: GridPage;
let context: any;
let tableId: string;
test.beforeEach(async ({ page }) => {
context = await setup({ page, isEmptyProject: true });
@ -22,7 +30,25 @@ test.describe('Multi select', () => {
columnTitle: 'MultiSelect',
options: ['Option 1', 'Option 2'],
});
await grid.addNewRow({ index: 0, value: 'Row 0' });
api = new Api({
baseURL: `http://localhost:8080/`,
headers: {
'xc-auth': context.token,
},
});
const tables = await api.dbTable.list(context.base.id);
tableId = tables.list.find((table: any) => table.title === 'sheet1').id;
await addRecordUsingAPI(context, tableId, [
{
Id: 1,
Title: `Row 0`,
},
]);
// page reload
await page.reload();
});
test.afterEach(async () => {
@ -56,7 +82,14 @@ test.describe('Multi select', () => {
multiSelect: true,
});
await grid.addNewRow({ index: 1, value: 'Row 1' });
await addRecordUsingAPI(context, tableId, [
{
Id: 2,
Title: `Row 1`,
},
]);
await grid.rootPage.reload();
await grid.cell.selectOption.select({
index: 1,
columnHeader: 'MultiSelect',

Loading…
Cancel
Save