|
|
@ -38,53 +38,53 @@ export class ToolbarFilterPage extends BasePage { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async add({ |
|
|
|
async add({ |
|
|
|
columnTitle, |
|
|
|
title, |
|
|
|
opType, |
|
|
|
operation, |
|
|
|
opSubType, |
|
|
|
subOperation, |
|
|
|
value, |
|
|
|
value, |
|
|
|
isLocallySaved, |
|
|
|
locallySaved = false, |
|
|
|
dataType, |
|
|
|
dataType, |
|
|
|
openModal = false, |
|
|
|
openModal = false, |
|
|
|
}: { |
|
|
|
}: { |
|
|
|
columnTitle: string; |
|
|
|
title: string; |
|
|
|
opType: string; |
|
|
|
operation: string; |
|
|
|
opSubType?: string; // for date datatype
|
|
|
|
subOperation?: string; // for date datatype
|
|
|
|
value?: string; |
|
|
|
value?: string; |
|
|
|
isLocallySaved: boolean; |
|
|
|
locallySaved?: boolean; |
|
|
|
dataType?: string; |
|
|
|
dataType?: string; |
|
|
|
openModal?: boolean; |
|
|
|
openModal?: boolean; |
|
|
|
}) { |
|
|
|
}) { |
|
|
|
if (!openModal) await this.get().locator(`button:has-text("Add Filter")`).first().click(); |
|
|
|
if (!openModal) await this.get().locator(`button:has-text("Add Filter")`).first().click(); |
|
|
|
|
|
|
|
|
|
|
|
const selectedField = await this.rootPage.locator('.nc-filter-field-select').textContent(); |
|
|
|
const selectedField = await this.rootPage.locator('.nc-filter-field-select').textContent(); |
|
|
|
if (selectedField !== columnTitle) { |
|
|
|
if (selectedField !== title) { |
|
|
|
await this.rootPage.locator('.nc-filter-field-select').last().click(); |
|
|
|
await this.rootPage.locator('.nc-filter-field-select').last().click(); |
|
|
|
await this.rootPage |
|
|
|
await this.rootPage |
|
|
|
.locator('div.ant-select-dropdown.nc-dropdown-toolbar-field-list') |
|
|
|
.locator('div.ant-select-dropdown.nc-dropdown-toolbar-field-list') |
|
|
|
.locator(`div[label="${columnTitle}"]:visible`) |
|
|
|
.locator(`div[label="${title}"]:visible`) |
|
|
|
.click(); |
|
|
|
.click(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const selectedOpType = await this.rootPage.locator('.nc-filter-operation-select').textContent(); |
|
|
|
const selectedOpType = await this.rootPage.locator('.nc-filter-operation-select').textContent(); |
|
|
|
if (selectedOpType !== opType) { |
|
|
|
if (selectedOpType !== operation) { |
|
|
|
await this.rootPage.locator('.nc-filter-operation-select').click(); |
|
|
|
await this.rootPage.locator('.nc-filter-operation-select').click(); |
|
|
|
// first() : filter list has >, >=
|
|
|
|
// first() : filter list has >, >=
|
|
|
|
await this.rootPage |
|
|
|
await this.rootPage |
|
|
|
.locator('.nc-dropdown-filter-comp-op') |
|
|
|
.locator('.nc-dropdown-filter-comp-op') |
|
|
|
.locator(`.ant-select-item:has-text("${opType}")`) |
|
|
|
.locator(`.ant-select-item:has-text("${operation}")`) |
|
|
|
.first() |
|
|
|
.first() |
|
|
|
.click(); |
|
|
|
.click(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// subtype for date
|
|
|
|
// subtype for date
|
|
|
|
if (dataType === UITypes.Date && opSubType) { |
|
|
|
if (dataType === UITypes.Date && subOperation) { |
|
|
|
const selectedSubType = await this.rootPage.locator('.nc-filter-sub_operation-select').textContent(); |
|
|
|
const selectedSubType = await this.rootPage.locator('.nc-filter-sub_operation-select').textContent(); |
|
|
|
if (selectedSubType !== opSubType) { |
|
|
|
if (selectedSubType !== subOperation) { |
|
|
|
await this.rootPage.locator('.nc-filter-sub_operation-select').click(); |
|
|
|
await this.rootPage.locator('.nc-filter-sub_operation-select').click(); |
|
|
|
// first() : filter list has >, >=
|
|
|
|
// first() : filter list has >, >=
|
|
|
|
await this.rootPage |
|
|
|
await this.rootPage |
|
|
|
.locator('.nc-dropdown-filter-comp-sub-op') |
|
|
|
.locator('.nc-dropdown-filter-comp-sub-op') |
|
|
|
.locator(`.ant-select-item:has-text("${opSubType}")`) |
|
|
|
.locator(`.ant-select-item:has-text("${subOperation}")`) |
|
|
|
.first() |
|
|
|
.first() |
|
|
|
.click(); |
|
|
|
.click(); |
|
|
|
} |
|
|
|
} |
|
|
@ -115,7 +115,7 @@ export class ToolbarFilterPage extends BasePage { |
|
|
|
await this.rootPage.locator(`.ant-btn-primary:has-text("Ok")`).click(); |
|
|
|
await this.rootPage.locator(`.ant-btn-primary:has-text("Ok")`).click(); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case UITypes.Date: |
|
|
|
case UITypes.Date: |
|
|
|
if (opSubType === 'exact date') { |
|
|
|
if (subOperation === 'exact date') { |
|
|
|
await this.get().locator('.nc-filter-value-select').click(); |
|
|
|
await this.get().locator('.nc-filter-value-select').click(); |
|
|
|
await this.rootPage.locator(`.ant-picker-dropdown:visible`); |
|
|
|
await this.rootPage.locator(`.ant-picker-dropdown:visible`); |
|
|
|
await this.rootPage.locator(`.ant-picker-cell-inner:has-text("${value}")`).click(); |
|
|
|
await this.rootPage.locator(`.ant-picker-cell-inner:has-text("${value}")`).click(); |
|
|
@ -124,7 +124,7 @@ export class ToolbarFilterPage extends BasePage { |
|
|
|
await this.waitForResponse({ |
|
|
|
await this.waitForResponse({ |
|
|
|
uiAction: fillFilter, |
|
|
|
uiAction: fillFilter, |
|
|
|
httpMethodsToMatch: ['GET'], |
|
|
|
httpMethodsToMatch: ['GET'], |
|
|
|
requestUrlPathToMatch: isLocallySaved ? `/api/v1/db/public/` : `/api/v1/db/data/noco/`, |
|
|
|
requestUrlPathToMatch: locallySaved ? `/api/v1/db/public/` : `/api/v1/db/data/noco/`, |
|
|
|
}); |
|
|
|
}); |
|
|
|
await this.toolbar.parent.dashboard.waitForLoaderToDisappear(); |
|
|
|
await this.toolbar.parent.dashboard.waitForLoaderToDisappear(); |
|
|
|
await this.toolbar.parent.waitLoading(); |
|
|
|
await this.toolbar.parent.waitLoading(); |
|
|
@ -174,7 +174,7 @@ export class ToolbarFilterPage extends BasePage { |
|
|
|
await this.waitForResponse({ |
|
|
|
await this.waitForResponse({ |
|
|
|
uiAction: fillFilter, |
|
|
|
uiAction: fillFilter, |
|
|
|
httpMethodsToMatch: ['GET'], |
|
|
|
httpMethodsToMatch: ['GET'], |
|
|
|
requestUrlPathToMatch: isLocallySaved ? `/api/v1/db/public/` : `/api/v1/db/data/noco/`, |
|
|
|
requestUrlPathToMatch: locallySaved ? `/api/v1/db/public/` : `/api/v1/db/data/noco/`, |
|
|
|
}); |
|
|
|
}); |
|
|
|
await this.toolbar.parent.dashboard.waitForLoaderToDisappear(); |
|
|
|
await this.toolbar.parent.dashboard.waitForLoaderToDisappear(); |
|
|
|
await this.toolbar.parent.waitLoading(); |
|
|
|
await this.toolbar.parent.waitLoading(); |
|
|
|