[BUG][Discover] Unable to sort Date scripted fields #5127
Open
Description
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 date scripted field
//https://github.com/elastic/kibana/issues/75711
// TODO: replace updateExpectedResultHere with actual data value once bug is fixed
it.skip('should sort scripted field value in Discover', async function () {
await testSubjects.click(`dataGridHeaderCell-${scriptedPainlessFieldName2}`);
await PageObjects.discover.clickTableHeaderListItem(scriptedPainlessFieldName2, 'Sort A-Z');
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('2015-09-18 07:00');
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('2015-09-18 07:00');
});