opensearch-project / OpenSearch-Dashboards

📊 Open source visualization dashboards for OpenSearch.
https://opensearch.org/docs/latest/dashboards/index/
Apache License 2.0
1.65k stars 857 forks source link

[BUG][Discover] Unable to sort boolean scripted fields #5126

Open ananzh opened 11 months ago

ananzh commented 11 months ago

This is a legacy issue and not caused by Discover 2.0. This functional test is skipped due to this bug:

//add a test to sort boolean
      //existing bug: https://github.com/elastic/kibana/issues/75519 hence the issue is skipped.
      // TODO: replace updateExpectedResultHere with actual data value once bug is fixed
      it.skip('should sort scripted field value in Discover', async function () {
        await sleep(50000);
        await testSubjects.click(`dataGridHeaderCell-${scriptedPainlessFieldName2}`);
        await PageObjects.discover.clickTableHeaderListItem(
          scriptedPainlessFieldName2,
          'Sort True-False'
        );
        await PageObjects.header.waitUntilLoadingHasFinished();
        await testSubjects.click('dataGridHeaderCell-@timestamp');
        await PageObjects.discover.clickTableHeaderListItem('@timestamp', 'Sort A-Z');
        await PageObjects.header.waitUntilLoadingHasFinished();
        const sortedDataByTimeField = await PageObjects.discover.getDataGridTableValues();
        expect(sortedDataByTimeField[0][0]).contain('updateExpectedResultHere');
        expect(sortedDataByTimeField[0][1]).contain('true');

        await testSubjects.click('dataGridColumnSortingButton');
        await PageObjects.discover.removeSort(`${scriptedPainlessFieldName2}`);
        await PageObjects.header.waitUntilLoadingHasFinished();
        const sortedDataByPainlessField = await PageObjects.discover.getDataGridTableValues();
        expect(sortedDataByPainlessField[0][0]).contain('updateExpectedResultHere');
        expect(sortedDataByPainlessField[0][1]).contain('false');
      });
vvavdiya commented 11 months ago

I'd like to take a look at this. @ananzh can you please help with more context/details of the issue.

shawnkchan commented 11 months ago

Hi, I would like to be assigned this issue! Thank you

ananzh commented 10 months ago

https://github.com/opensearch-project/OpenSearch-Dashboards/assets/79961084/99cfe3a2-7224-4637-8d9d-35e4d6c9ed55