Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove/refactor tests related to the "new" discover table #1754

Merged
merged 1 commit into from
Mar 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ describe('date_nanos', () => {

cy.setTopNavDate(fromTime, toTime);
cy.waitForSearch();
cy.switchDiscoverTable('new');
});

after(() => {
Expand All @@ -48,8 +47,8 @@ describe('date_nanos', () => {

it('should show a timestamp with nanoseconds in the first result row', function () {
cy.verifyTimeConfig(fromTime, toTime);
cy.get(`[data-test-subj="dataGridRowCell"]`)
.eq(1)
cy.get(`[data-test-subj="osdDocTableCellDataField"]`)
.eq(0)
.contains('Sep 22, 2019 @ 16:50:13.253123345');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ describe('date_nanos_mixed', () => {
const toTime = 'Jan 1, 2019 @ 23:59:59.999';
cy.setTopNavDate(fromTime, toTime);
cy.waitForSearch();
cy.switchDiscoverTable('new');
});

after(() => {
Expand All @@ -46,20 +45,20 @@ describe('date_nanos_mixed', () => {
});

it('shows a list of records of indices with date & date_nanos fields in the right order', function () {
cy.get(`[data-test-subj="dataGridRowCell"]`)
.eq(1)
cy.get(`[data-test-subj="osdDocTableCellDataField"]`)
.eq(0)
.contains('Jan 1, 2019 @ 04:10:30.124000000');

cy.get(`[data-test-subj="dataGridRowCell"]`)
.eq(4)
cy.get(`[data-test-subj="osdDocTableCellDataField"]`)
.eq(1)
.contains('Jan 1, 2019 @ 04:10:30.123498765');

cy.get(`[data-test-subj="dataGridRowCell"]`)
.eq(7)
cy.get(`[data-test-subj="osdDocTableCellDataField"]`)
.eq(2)
.contains('Jan 1, 2019 @ 04:10:30.123456789');

cy.get(`[data-test-subj="dataGridRowCell"]`)
.eq(10)
cy.get(`[data-test-subj="osdDocTableCellDataField"]`)
.eq(3)
.contains('Jan 1, 2019 @ 04:10:30.123000000');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ describe('discover app', { scrollBehavior: false }, () => {
);
cy.waitForLoader();
cy.waitForSearch();
cy.switchDiscoverTable('new');
});

beforeEach(() => {
Expand All @@ -67,7 +66,6 @@ describe('discover app', { scrollBehavior: false }, () => {
after(() => {
cy.get('[data-test-subj~="filter-key-extension.raw"]').click();
cy.getElementByTestId(`deleteFilter`).click();
cy.switchDiscoverTable('legacy');
});
it('should persist across refresh', function () {
// Set up query and filter
Expand All @@ -79,15 +77,6 @@ describe('discover app', { scrollBehavior: false }, () => {
'be.visible'
);
});

it('should persist across switching table', function () {
cy.switchDiscoverTable('new');
cy.getElementByTestId(`queryInput`).should('have.text', 'response:200');
cy.get('[data-test-subj~="filter-key-extension.raw"]').should(
'be.visible'
);
cy.clearTopNavQuery();
});
});

describe('save search', () => {
Expand Down Expand Up @@ -124,13 +113,6 @@ describe('discover app', { scrollBehavior: false }, () => {
.should('have.text', saveSearch2);
});

it('should show the correct hit count', function () {
cy.loadSaveSearch(saveSearch2);
cy.setTopNavDate(DE_DEFAULT_START_TIME, DE_DEFAULT_END_TIME);
const expectedHitCount = '14,004';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should figure out what happened here as it was consistent before. perhaps someone modified the sample data?

cy.verifyHitCount(expectedHitCount);
});

it('should show correct time range string in chart', function () {
cy.getElementByTestId('discoverIntervalDateRange').should(
'have.text',
Expand Down Expand Up @@ -171,7 +153,6 @@ describe('discover app', { scrollBehavior: false }, () => {
before(() => {
CURRENT_TENANT.newTenant = 'global';
cy.fleshTenantSettings();
cy.switchDiscoverTable('new');
cy.setTopNavDate(fromTime, toTime);
});

Expand Down Expand Up @@ -285,10 +266,6 @@ describe('discover app', { scrollBehavior: false }, () => {
});

describe('refresh interval', function () {
beforeEach(() => {
cy.switchDiscoverTable('new');
});

it('should refetch when autofresh is enabled', () => {
cy.getElementByTestId('openInspectorButton').click();
cy.getElementByTestId('inspectorPanel')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,52 +100,6 @@ describe('discover_advanced_setting', () => {
});

describe('Default Sort Order advanced setting', () => {
it('check Default Sort Order Descending is respected in new table', function () {
cy.setAdvancedSetting({
'discover:sort:defaultOrder': 'desc',
});
cy.reload();
cy.switchDiscoverTable('new');
cy.wait(2000); // Intentional Wait to account for low performant env

cy.get('.euiDataGridRowCell--date')
.eq(0)
.invoke('text')
.then((date1) => {
cy.get('.euiDataGridRowCell--date')
.eq(99)
.invoke('text')
.then((date2) => {
expect(new Date(date1.slice(0, -18))).greaterThan(
new Date(date2.slice(0, -20))
);
});
});
});

it('check Default Sort Order Ascending is respected in new table', function () {
cy.setAdvancedSetting({
'discover:sort:defaultOrder': 'asc',
});
cy.reload();
cy.switchDiscoverTable('new');
cy.wait(2000); // Intentional Wait to account for low performant env

cy.get('.euiDataGridRowCell--date')
.eq(0)
.invoke('text')
.then((date1) => {
cy.get('.euiDataGridRowCell--date')
.eq(99)
.invoke('text')
.then((date2) => {
expect(new Date(date1.slice(0, -18))).lessThan(
new Date(date2.slice(0, -20))
);
});
});
});

it('check Default Sort Order Descending is respected in legacy table', function () {
cy.setAdvancedSetting({
'discover:sort:defaultOrder': 'desc',
Expand Down Expand Up @@ -202,19 +156,10 @@ describe('discover_advanced_setting', () => {
'discover:sampleSize': 5,
});
cy.reload();
cy.switchDiscoverTable('new');
cy.wait(2000); // Intentional Wait to account for low performant env
});

it('check new table respects Number of rows setting', function () {
cy.get('[aria-label="Inspect document details"]').should(
'have.length',
5
);
});

it('check legacy table respects Number of rows setting', function () {
cy.switchDiscoverTable('legacy');
cy.wait(2000); // Intentional Wait to account for low performant env
cy.get('[aria-label="Toggle row details"]').should('have.length', 5);
});
Expand Down Expand Up @@ -266,22 +211,6 @@ describe('discover_advanced_setting', () => {
});
});

it('check time is not added on removing last column when hideTimeColumn is true in new table', function () {
miscUtils.visitPage(
`app/data-explorer/discover#/?_g=(filters:!(),time:(from:'2015-09-19T13:31:44.000Z',to:'2015-09-24T01:31:44.000Z'))`
);
cy.waitForSearch();
cy.switchDiscoverTable('new');
cy.get('[data-test-subj="dataGridHeaderCell-@timestamp"]').should(
'not.exist'
);
cy.get('[data-test-subj="fieldToggle-agent"]').click();
cy.get('[data-test-subj="fieldToggle-agent"]').click();
cy.get('[data-test-subj="dataGridHeaderCell-@timestamp"]').should(
'not.exist'
);
});

it('check time is not added on removing last column when hideTimeColumn is true in legacy table', function () {
miscUtils.visitPage(
`app/data-explorer/discover#/?_g=(filters:!(),time:(from:'2015-09-19T13:31:44.000Z',to:'2015-09-24T01:31:44.000Z'))`
Expand Down Expand Up @@ -321,24 +250,6 @@ describe('discover_advanced_setting', () => {
});
});

it('check new table respects doc_table:highlight setting', function () {
// check if we have highlighted fields
cy.get('mark').should('exist');

cy.setAdvancedSetting({
'doc_table:highlight': false,
});
cy.reload();
cy.switchDiscoverTable('new');
cy.get('mark').should('not.exist');

// reset the setting to default value
cy.setAdvancedSetting({
'doc_table:highlight': true,
});
cy.reload();
});

it('check legacy table respects doc_table:highlight setting', function () {
// check if we have highlighted fields
cy.setAdvancedSetting({
Expand Down Expand Up @@ -384,18 +295,6 @@ describe('discover_advanced_setting', () => {
});
});

it('check defaultcolumns setting is respected in new table', function () {
cy.setAdvancedSetting({
defaultColumns: ['host', 'agent'],
});
cy.reload();
cy.switchDiscoverTable('new');
cy.get('[data-test-subj="dataGridHeaderCell-agent"]').should(
'be.visible'
);
cy.get('[data-test-subj="dataGridHeaderCell-host"]').should('be.visible');
});

it('check defaultcolumns setting is respected in legacy table', function () {
cy.setAdvancedSetting({
defaultColumns: ['host', 'agent'],
Expand Down Expand Up @@ -481,34 +380,6 @@ describe('modifyColumnsOnSwitch advanced setting', () => {
*/
});

it('check columns still available after switching data sources in new table', function () {
miscUtils.visitPage(
`app/data-explorer/discover#/?_a=(discover:(metadata:(indexPattern:'logstash-*',view:discover))&_g=(filters:!(),time:(from:'2015-09-19T13:31:44.000Z',to:'2015-09-24T01:31:44.000Z'))`
);
cy.waitForSearch();
cy.switchDiscoverTable('new');

cy.get('[data-test-subj="fieldToggle-agent"]').click();

// Now switching the data sources
cy.get('[data-test-subj="comboBoxSearchInput"]')
.type('nestedindex')
.then(() => {
cy.waitForSearch();
cy.get('[title="nestedindex*"]')
.trigger('click')
.then(() => {
cy.get('[data-test-subj="dataGridHeaderCell-agent"]').should(
'be.visible'
);
cy.wait(2000);
cy.get('[data-test-subj="dataGridRowCell"]')
.contains('-')
.should('exist');
});
});
});

after(() => {
cy.setAdvancedSetting({
'discover:modifyColumnsOnSwitch': true,
Expand Down
Loading
Loading