From 701e0b640a620788f96e397ce7fe8d66e1f7cb4e Mon Sep 17 00:00:00 2001 From: Neha P <144308844+neha00290@users.noreply.github.com> Date: Wed, 14 Aug 2024 18:19:32 +0530 Subject: [PATCH] test: assert timestamp and all displayed in fields when uds enabled (#4208) ## Summary by CodeRabbit - **Tests** - Enhanced test coverage for schema functionalities, adding interactions for log search and schema selection. - Improved verification of `_timestamp` and `_all` fields to ensure thorough validation of the schema selection process. - Streamlined logging process by removing unnecessary console logging during test execution. - **Style** - Improved formatting and readability in the `IndexList` component, including adjustments to multiline expressions and conditional renderings. - Enhanced semantic clarity by restructuring template elements for better organization and styling. --------- Co-authored-by: omkark06 --- .../playwright-tests/schema.spec.js | 32 +++-- web/src/plugins/logs/IndexList.vue | 133 ++++++++++-------- 2 files changed, 94 insertions(+), 71 deletions(-) diff --git a/tests/ui-testing/playwright-tests/schema.spec.js b/tests/ui-testing/playwright-tests/schema.spec.js index 4e0186cc3d..0003d1d53b 100644 --- a/tests/ui-testing/playwright-tests/schema.spec.js +++ b/tests/ui-testing/playwright-tests/schema.spec.js @@ -90,15 +90,15 @@ test.describe("Schema testcases", () => { }); test('stream schema settings updated to be displayed under logs', async ({ page }) => { - page.on('console', msg => console.log(msg.text())); - page.on('response', async (resp) => { - if (resp.url().includes('api/default/')) { - console.log('url -> ', resp.url()); - console.log('code -> ', resp.status()); - console.log('payload -> ', resp.request().postData()); - console.log('response -> ', await resp.text()); - } - }); + // page.on('console', msg => console.log(msg.text())); + // page.on('response', async (resp) => { + // if (resp.url().includes('api/default/')) { + // console.log('url -> ', resp.url()); + // console.log('code -> ', resp.status()); + // console.log('payload -> ', resp.request().postData()); + // console.log('response -> ', await resp.text()); + // } + // }); await page.locator('[data-test="menu-link-\\/streams-item"]').click(); await page.getByPlaceholder('Search Stream').click(); @@ -124,7 +124,19 @@ test.describe("Schema testcases", () => { // await page.locator('[data-test="logs-search-bar-refresh-btn"]').click(); await page.locator('[data-test="log-table-column-1-\\@timestamp"] [data-test="table-row-expand-menu"]').click(); await page.waitForTimeout(1000); - await page.getByText(/^arrow_drop_down_all:.*$/).click(); + await page.getByText(/^arrow_drop_down_all:.*$/).click(); + await page.locator('[data-test="log-search-index-list-field-search-input"]').click(); + await page.locator('[data-test="log-search-index-list-field-search-input"]').fill('_timestamp'); + await page.locator('[data-test="log-search-index-list-fields-table"]').getByTitle('_timestamp').click(); + await page.locator('[data-test="log-search-index-list-field-search-input"]').click(); + await page.locator('[data-test="log-search-index-list-field-search-input"]').fill('_all'); + await page.locator('[data-test="log-search-index-list-fields-table"]').getByTitle('_all') + await page.locator('[data-test="logs-all-fields-btn"]').click(); + await page.locator('[data-test="log-search-index-list-field-search-input"]').click(); + await page.locator('[data-test="log-search-index-list-fields-table"]').getByTitle('_all') + await page.locator('[data-test="log-search-index-list-field-search-input"]').click(); + await page.locator('[data-test="log-search-index-list-field-search-input"]').fill('_timestamp'); + await page.locator('[data-test="log-search-index-list-fields-table"]').getByTitle('_timestamp').click(); await page.locator('[data-test="menu-link-\\/streams-item"]').click(); await page.getByPlaceholder('Search Stream').click(); await page.getByPlaceholder('Search Stream').fill('e2e_automate'); diff --git a/web/src/plugins/logs/IndexList.vue b/web/src/plugins/logs/IndexList.vue index 247abc40cd..71e836edd1 100644 --- a/web/src/plugins/logs/IndexList.vue +++ b/web/src/plugins/logs/IndexList.vue @@ -67,7 +67,9 @@ along with this program. If not, see . v-model="sortedStreamFields" :visible-columns="['name']" :rows="streamFieldsRows" - :row-key="(row: any) => searchObj.data.stream.selectedStream[0] + row.name" + :row-key=" + (row: any) => searchObj.data.stream.selectedStream[0] + row.name + " :filter="searchObj.data.stream.filterField" :filter-method="filterFieldFn" v-model:pagination="pagination" @@ -178,7 +180,10 @@ along with this program. If not, see .
. :data-test="`log-search-index-list-add-${props.row.name}-field-btn`" v-if=" !searchObj.data.stream.selectedFields.includes( - props.row.name + props.row.name, ) " :name="outlinedVisibility" @@ -204,7 +209,7 @@ along with this program. If not, see . :data-test="`log-search-index-list-remove-${props.row.name}-field-btn`" v-if=" searchObj.data.stream.selectedFields.includes( - props.row.name + props.row.name, ) " :name="outlinedVisibilityOff" @@ -228,7 +233,7 @@ along with this program. If not, see . @click.stop=" addToInterestingFieldList( props.row, - props.row.isInterestingField + props.row.isInterestingField, ) " /> @@ -246,7 +251,9 @@ along with this program. If not, see . expanded-icon=" expand_less " - @before-show="(event: any) => openFilterCreator(event, props.row)" + @before-show=" + (event: any) => openFilterCreator(event, props.row) + " >