Browse Source

test: undo-redo for links

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/5848/head
Raju Udava 1 year ago committed by Pranav C
parent
commit
77f5986b0f
  1. 5
      tests/playwright/pages/Dashboard/common/Cell/index.ts
  2. 39
      tests/playwright/tests/db/undo-redo.spec.ts

5
tests/playwright/pages/Dashboard/common/Cell/index.ts

@ -329,12 +329,13 @@ export class CellPageObject extends BasePage {
async unlinkVirtualCell({ index, columnHeader }: CellProps) { async unlinkVirtualCell({ index, columnHeader }: CellProps) {
const cell = this.get({ index, columnHeader }); const cell = this.get({ index, columnHeader });
await cell.click(); await cell.locator('.nc-datatype-link').click();
await this.waitForResponse({ await this.waitForResponse({
uiAction: () => cell.locator('.unlink-icon').first().click(), uiAction: () => this.rootPage.locator(`[data-testid="nc-child-list-icon-unlink"]`).first().click(),
requestUrlPathToMatch: '/api/v1/db/data/noco/', requestUrlPathToMatch: '/api/v1/db/data/noco/',
httpMethodsToMatch: ['GET'], httpMethodsToMatch: ['GET'],
}); });
await this.rootPage.keyboard.press('Escape');
} }
async verifyRoleAccess(param: { role: string }) { async verifyRoleAccess(param: { role: string }) {

39
tests/playwright/tests/db/undo-redo.spec.ts

@ -546,18 +546,35 @@ test.describe('Undo Redo - LTAR', () => {
// inserted values // inserted values
const expectedValues = [...values]; const expectedValues = [...values];
const currentRecords: Record<string, any> = await api.dbTableRow.list('noco', context.project.id, countryTable.id, { try {
fields: ['CityList'], const currentRecords: Record<string, any> = await api.dbTableRow.list(
limit: 100, 'noco',
}); context.project.id,
countryTable.id,
{
fields: ['CityList'],
limit: 100,
}
);
expect(currentRecords.list.length).toBe(4);
expect(currentRecords.list[0].CityList).toBe(expectedValues.length);
} catch (e) {
console.log(e);
}
// verify if expectedValues array includes all the values in currentRecords if (expectedValues.length > 0) {
// currentRecords [ { Id: 1, City: 'Mumbai' }, { Id: 3, City: 'Delhi' } ] // read nested records associated with first record
// expectedValues [ 'Mumbai', 'Delhi' ] const nestedRecords: Record<string, any> = await api.dbTableRow.nestedList(
currentRecords.list[0].CityList.forEach((record: any) => { 'noco',
expect(expectedValues).toContain(record.City); context.project.id,
}); countryTable.id,
expect(currentRecords.list[0].CityList.length).toBe(expectedValues.length); 1,
'hm',
'CityList'
);
const cities = nestedRecords.list.map((record: any) => record.City);
expect(cities).toEqual(expectedValues);
}
} }
async function undo({ page, values }: { page: Page; values: string[] }) { async function undo({ page, values }: { page: Page; values: string[] }) {

Loading…
Cancel
Save