|
|
|
@ -45,6 +45,7 @@ export class ToolbarFilterPage extends BasePage {
|
|
|
|
|
locallySaved = false, |
|
|
|
|
dataType, |
|
|
|
|
openModal = false, |
|
|
|
|
skipWaitingResponse = false, // used for undo (single request, less stable)
|
|
|
|
|
}: { |
|
|
|
|
title: string; |
|
|
|
|
operation: string; |
|
|
|
@ -53,21 +54,32 @@ export class ToolbarFilterPage extends BasePage {
|
|
|
|
|
locallySaved?: boolean; |
|
|
|
|
dataType?: string; |
|
|
|
|
openModal?: boolean; |
|
|
|
|
skipWaitingResponse?: boolean; |
|
|
|
|
}) { |
|
|
|
|
if (!openModal) await this.get().locator(`button:has-text("Add Filter")`).first().click(); |
|
|
|
|
|
|
|
|
|
const selectedField = await getTextExcludeIconText(await this.rootPage.locator('.nc-filter-field-select .ant-select-selection-item')); |
|
|
|
|
const selectedField = await getTextExcludeIconText( |
|
|
|
|
await this.rootPage.locator('.nc-filter-field-select .ant-select-selection-item') |
|
|
|
|
); |
|
|
|
|
if (selectedField !== title) { |
|
|
|
|
await this.rootPage.locator('.nc-filter-field-select').last().click(); |
|
|
|
|
|
|
|
|
|
await this.waitForResponse({ |
|
|
|
|
uiAction: () => this.rootPage |
|
|
|
|
.locator('div.ant-select-dropdown.nc-dropdown-toolbar-field-list') |
|
|
|
|
.locator(`div[label="${title}"]:visible`) |
|
|
|
|
.click(), |
|
|
|
|
httpMethodsToMatch: ['GET'], |
|
|
|
|
requestUrlPathToMatch: locallySaved ? `/api/v1/db/public/` : `/api/v1/db/data/noco/`, |
|
|
|
|
}); |
|
|
|
|
if (skipWaitingResponse) { |
|
|
|
|
this.rootPage |
|
|
|
|
.locator('div.ant-select-dropdown.nc-dropdown-toolbar-field-list') |
|
|
|
|
.locator(`div[label="${title}"]:visible`) |
|
|
|
|
.click(); |
|
|
|
|
} else { |
|
|
|
|
await this.waitForResponse({ |
|
|
|
|
uiAction: () => |
|
|
|
|
this.rootPage |
|
|
|
|
.locator('div.ant-select-dropdown.nc-dropdown-toolbar-field-list') |
|
|
|
|
.locator(`div[label="${title}"]:visible`) |
|
|
|
|
.click(), |
|
|
|
|
httpMethodsToMatch: ['GET'], |
|
|
|
|
requestUrlPathToMatch: locallySaved ? `/api/v1/db/public/` : `/api/v1/db/data/noco/`, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const selectedOpType = await getTextExcludeIconText(await this.rootPage.locator('.nc-filter-operation-select')); |
|
|
|
@ -75,15 +87,24 @@ export class ToolbarFilterPage extends BasePage {
|
|
|
|
|
await this.rootPage.locator('.nc-filter-operation-select').click(); |
|
|
|
|
// first() : filter list has >, >=
|
|
|
|
|
|
|
|
|
|
await this.waitForResponse({ |
|
|
|
|
uiAction: () => this.rootPage |
|
|
|
|
.locator('.nc-dropdown-filter-comp-op') |
|
|
|
|
.locator(`.ant-select-item:has-text("${operation}")`) |
|
|
|
|
.first() |
|
|
|
|
.click(), |
|
|
|
|
httpMethodsToMatch: ['GET'], |
|
|
|
|
requestUrlPathToMatch: locallySaved ? `/api/v1/db/public/` : `/api/v1/db/data/noco/`, |
|
|
|
|
}); |
|
|
|
|
if (skipWaitingResponse) { |
|
|
|
|
this.rootPage |
|
|
|
|
.locator('.nc-dropdown-filter-comp-op') |
|
|
|
|
.locator(`.ant-select-item:has-text("${operation}")`) |
|
|
|
|
.first() |
|
|
|
|
.click(); |
|
|
|
|
} else { |
|
|
|
|
await this.waitForResponse({ |
|
|
|
|
uiAction: () => |
|
|
|
|
this.rootPage |
|
|
|
|
.locator('.nc-dropdown-filter-comp-op') |
|
|
|
|
.locator(`.ant-select-item:has-text("${operation}")`) |
|
|
|
|
.first() |
|
|
|
|
.click(), |
|
|
|
|
httpMethodsToMatch: ['GET'], |
|
|
|
|
requestUrlPathToMatch: locallySaved ? `/api/v1/db/public/` : `/api/v1/db/data/noco/`, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// subtype for date
|
|
|
|
@ -95,15 +116,24 @@ export class ToolbarFilterPage extends BasePage {
|
|
|
|
|
await this.rootPage.locator('.nc-filter-sub_operation-select').click(); |
|
|
|
|
// first() : filter list has >, >=
|
|
|
|
|
|
|
|
|
|
await this.waitForResponse({ |
|
|
|
|
uiAction: () => this.rootPage |
|
|
|
|
.locator('.nc-dropdown-filter-comp-sub-op') |
|
|
|
|
.locator(`.ant-select-item:has-text("${subOperation}")`) |
|
|
|
|
.first() |
|
|
|
|
.click(), |
|
|
|
|
httpMethodsToMatch: ['GET'], |
|
|
|
|
requestUrlPathToMatch: locallySaved ? `/api/v1/db/public/` : `/api/v1/db/data/noco/`, |
|
|
|
|
}); |
|
|
|
|
if (skipWaitingResponse) { |
|
|
|
|
this.rootPage |
|
|
|
|
.locator('.nc-dropdown-filter-comp-sub-op') |
|
|
|
|
.locator(`.ant-select-item:has-text("${subOperation}")`) |
|
|
|
|
.first() |
|
|
|
|
.click(); |
|
|
|
|
} else { |
|
|
|
|
await this.waitForResponse({ |
|
|
|
|
uiAction: () => |
|
|
|
|
this.rootPage |
|
|
|
|
.locator('.nc-dropdown-filter-comp-sub-op') |
|
|
|
|
.locator(`.ant-select-item:has-text("${subOperation}")`) |
|
|
|
|
.first() |
|
|
|
|
.click(), |
|
|
|
|
httpMethodsToMatch: ['GET'], |
|
|
|
|
requestUrlPathToMatch: locallySaved ? `/api/v1/db/public/` : `/api/v1/db/data/noco/`, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -135,11 +165,16 @@ export class ToolbarFilterPage extends BasePage {
|
|
|
|
|
if (subOperation === 'exact date') { |
|
|
|
|
await this.get().locator('.nc-filter-value-select').click(); |
|
|
|
|
await this.rootPage.locator(`.ant-picker-dropdown:visible`); |
|
|
|
|
await this.waitForResponse({ |
|
|
|
|
uiAction: () => this.rootPage.locator(`.ant-picker-cell-inner:has-text("${value}")`).click(), |
|
|
|
|
httpMethodsToMatch: ['GET'], |
|
|
|
|
requestUrlPathToMatch: locallySaved ? `/api/v1/db/public/` : `/api/v1/db/data/noco/`, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
if (skipWaitingResponse) { |
|
|
|
|
this.rootPage.locator(`.ant-picker-cell-inner:has-text("${value}")`).click(); |
|
|
|
|
} else { |
|
|
|
|
await this.waitForResponse({ |
|
|
|
|
uiAction: () => this.rootPage.locator(`.ant-picker-cell-inner:has-text("${value}")`).click(), |
|
|
|
|
httpMethodsToMatch: ['GET'], |
|
|
|
|
requestUrlPathToMatch: locallySaved ? `/api/v1/db/public/` : `/api/v1/db/data/noco/`, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
fillFilter = () => this.rootPage.locator('.nc-filter-value-select > input').last().fill(value); |
|
|
|
|
await this.waitForResponse({ |
|
|
|
@ -152,11 +187,15 @@ export class ToolbarFilterPage extends BasePage {
|
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case UITypes.Duration: |
|
|
|
|
await this.waitForResponse({ |
|
|
|
|
uiAction: () => this.get().locator('.nc-filter-value-select').locator('input').fill(value), |
|
|
|
|
httpMethodsToMatch: ['GET'], |
|
|
|
|
requestUrlPathToMatch: locallySaved ? `/api/v1/db/public/` : `/api/v1/db/data/noco/`, |
|
|
|
|
}); |
|
|
|
|
if (skipWaitingResponse) { |
|
|
|
|
this.get().locator('.nc-filter-value-select').locator('input').fill(value); |
|
|
|
|
} else { |
|
|
|
|
await this.waitForResponse({ |
|
|
|
|
uiAction: () => this.get().locator('.nc-filter-value-select').locator('input').fill(value), |
|
|
|
|
httpMethodsToMatch: ['GET'], |
|
|
|
|
requestUrlPathToMatch: locallySaved ? `/api/v1/db/public/` : `/api/v1/db/data/noco/`, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case UITypes.Rating: |
|
|
|
|
await this.get() |
|
|
|
|