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

[Test] Test legacy cypress against discover 2.0 #1580

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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,7 @@ describe('date_nanos', () => {

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

after(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('date_nanos_mixed', () => {
const toTime = 'Jan 1, 2019 @ 23:59:59.999';
cy.setTopNavDate(fromTime, toTime);
cy.waitForSearch();
cy.switchDiscoverTable('new');
//cy.switchDiscoverTable('new');
});

after(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('discover app', { scrollBehavior: false }, () => {
);
cy.waitForLoader();
cy.waitForSearch();
cy.switchDiscoverTable('new');
//cy.switchDiscoverTable('new');
});

beforeEach(() => {
Expand Down Expand Up @@ -144,7 +144,7 @@ describe('discover app', { scrollBehavior: false }, () => {
before(() => {
CURRENT_TENANT.newTenant = 'global';
cy.fleshTenantSettings();
cy.switchDiscoverTable('new');
//cy.switchDiscoverTable('new');
cy.setTopNavDate(fromTime, toTime);
});

Expand Down Expand Up @@ -259,7 +259,7 @@ describe('discover app', { scrollBehavior: false }, () => {

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

it('should refetch when autofresh is enabled', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ describe('discover_advanced_setting', () => {
});

describe('Default Sort Order advanced setting', () => {
it('check Default Sort Order Descending is respected in new table', function () {
it.skip('check Default Sort Order Descending is respected in new table', function () {
cy.setAdvancedSetting({
'discover:sort:defaultOrder': 'desc',
});
Expand All @@ -123,7 +123,7 @@ describe('discover_advanced_setting', () => {
});
});

it('check Default Sort Order Ascending is respected in new table', function () {
it.skip('check Default Sort Order Ascending is respected in new table', function () {
cy.setAdvancedSetting({
'discover:sort:defaultOrder': 'asc',
});
Expand Down Expand Up @@ -194,7 +194,7 @@ describe('discover_advanced_setting', () => {
});
});

describe('Number of rows advanced setting', () => {
describe.skip('Number of rows advanced setting', () => {
before(() => {
CURRENT_TENANT.newTenant = 'global';
cy.fleshTenantSettings();
Expand Down Expand Up @@ -266,7 +266,7 @@ describe('discover_advanced_setting', () => {
});
});

it('check time is not added on removing last column when hideTimeColumn is true in new table', function () {
it.skip('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'))`
);
Expand Down Expand Up @@ -321,7 +321,7 @@ describe('discover_advanced_setting', () => {
});
});

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

Expand Down Expand Up @@ -384,7 +384,7 @@ describe('discover_advanced_setting', () => {
});
});

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

it('check columns still available after switching data sources in new table', function () {
it.skip('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'))`
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe('discover_table', () => {
});
});

describe('dynamic height of row in new table', () => {
describe.skip('dynamic height of row in new table', () => {
before(() => {
cy.switchDiscoverTable('new');
cy.waitForLoader();
Expand Down Expand Up @@ -121,7 +121,7 @@ describe('discover_table', () => {
});
});

describe('data source selector', () => {
describe.skip('data source selector', () => {
before(() => {
// Creating additional index patterns
// logstash index pattern
Expand Down Expand Up @@ -305,7 +305,7 @@ describe('discover_table', () => {
});
});

describe('Saved Search in new table', () => {
describe.skip('Saved Search in new table', () => {
before(() => {
cy.switchDiscoverTable('new');
});
Expand Down Expand Up @@ -453,7 +453,7 @@ describe('discover_table', () => {
cy.waitForSearch();
});
});
describe('New Table', () => {
describe.skip('New Table', () => {
before(() => {
cy.switchDiscoverTable('new');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('discover doc table', () => {
`app/data-explorer/discover#/?_g=(filters:!(),time:(from:'2015-09-19T13:31:44.000Z',to:'2015-09-24T01:31:44.000Z'))`
);
cy.waitForLoader();
cy.switchDiscoverTable('new');
//cy.switchDiscoverTable('new');
cy.waitForSearch();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('discover tab', () => {
);
cy.waitForLoader();
cy.waitForSearch();
cy.switchDiscoverTable('new');
//cy.switchDiscoverTable('new');
});

after(() => {});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('index pattern with encoded id', () => {
// Go to the Discover page
miscUtils.visitPage('app/data-explorer/discover#/');
cy.setTopNavDate(DE_DEFAULT_START_TIME, DE_DEFAULT_END_TIME);
cy.switchDiscoverTable('new');
//cy.switchDiscoverTable('new');
cy.waitForLoader();
});

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
import {
MiscUtils,
TestFixtureHandler,
} from '@opensearch-dashboards-test/opensearch-dashboards-test-library';
import { CURRENT_TENANT } from '../../../../../utils/commands';

const miscUtils = new MiscUtils(cy);
const testFixtureHandler = new TestFixtureHandler(
cy,
Cypress.env('openSearchUrl')
);

const indexSet = [
'logstash-2015.09.22',
'logstash-2015.09.21',
'logstash-2015.09.20',
];

describe('dataset navigator', { scrollBehavior: false }, () => {
before(() => {
CURRENT_TENANT.newTenant = 'global';
cy.fleshTenantSettings();
cy.deleteAllIndices();
cy.deleteSavedObjectByType('index-pattern');
});

describe('empty state', () => {
it('no index pattern', function () {
// Go to the Discover page
miscUtils.visitPage(
`app/data-explorer/discover#/?_g=(filters:!(),time:(from:'2015-09-19T13:31:44.000Z',to:'2015-09-24T01:31:44.000Z'))`
);

cy.waitForLoaderNewHeader();
cy.getElementByTestId('discoverNoIndexPatterns');
});
});

describe('select indices', () => {
before(() => {
// import logstash functional
testFixtureHandler.importJSONDocIfNeeded(
indexSet,
'cypress/fixtures/dashboard/opensearch_dashboards/data_explorer/logstash/logstash.mappings.json.txt',
'cypress/fixtures/dashboard/opensearch_dashboards/data_explorer/logstash/logstash.json.txt'
);

// Go to the Discover page
miscUtils.visitPage(
`app/data-explorer/discover#/?_g=(filters:!(),time:(from:'2015-09-19T13:31:44.000Z',to:'2015-09-24T01:31:44.000Z'))`
);
});

it('with SQL as default language', function () {
cy.get(`[class~="datasetSelector__button"]`).click();
cy.get(`[class~="datasetSelector__advancedButton"]`).click();
cy.get(`[title="Indexes"]`).click();
cy.get(`[title="Default Cluster"]`).click();
cy.get(`[title="logstash-2015.09.20"]`).click();
cy.getElementByTestId('datasetSelectorNext').click();

cy.get(`[class="euiModalHeader__title"]`).should(
'contain',
'Step 2: Configure data'
);
// should have two options: SQL and PPL
cy.get('option').should('have.length', 2);
cy.getElementByTestId('advancedSelectorConfirmButton').click();

cy.waitForLoaderNewHeader();

// Selected language should be SQL
cy.getElementByTestId('queryEditorLanguageSelector').should(
'contain',
'SQL'
);

// The following steps are needed because when selecting SQL, discover loaded with data but the
// multi-line query editor are not loaded properly(it renders a single line query bar) unless we select SQL again
// This bug only exist in cypress test; can not reproduce manually
cy.get(`[data-test-subj="queryEditorLanguageSelector"]`).click();
cy.get(`[class~="languageSelector__menuItem"]`)
.should('have.length', 2)
.eq(1)
.click({
force: true,
});
cy.waitForLoaderNewHeader();
cy.get(`[data-test-subj="queryResultCompleteMsg"]`).should('be.visible');

// Switch language to PPL
cy.get(`[data-test-subj="queryEditorLanguageSelector"]`).click();
cy.get(`[class~="languageSelector__menuItem"]`).eq(0).click({
force: true,
});
cy.waitForLoaderNewHeader();
cy.get(`[data-test-subj="queryResultCompleteMsg"]`).should('be.visible');
});

it('with PPL as default language', function () {
cy.get(`[class~="datasetSelector__button"]`).click();
cy.get(`[class~="datasetSelector__advancedButton"]`).click();
cy.get(`[title="Indexes"]`).click();
cy.get(`[title="Default Cluster"]`).click();
cy.get(`[title="logstash-2015.09.21"]`).click();
cy.getElementByTestId('datasetSelectorNext').click();

cy.get(`[class="euiModalHeader__title"]`).should(
'contain',
'Step 2: Configure data'
);
// should have two options: SQL and PPL; PPL should be selected
cy.getElementByTestId('advancedSelectorTimeFieldSelect').select(
'@timestamp'
);
cy.getElementByTestId('advancedSelectorConfirmButton').click();

cy.waitForLoaderNewHeader();

// Selected language should be PPL
cy.getElementByTestId('queryEditorLanguageSelector').should(
'contain',
'PPL'
);

cy.waitForLoaderNewHeader();
cy.getElementByTestId('queryResultCompleteMsg').should('be.visible');
cy.getElementByTestId('queryEditorFooterTimestamp').should(
'contain',
'@timestamp'
);

// Switch language to SQL
cy.getElementByTestId('queryEditorLanguageSelector').click();
cy.get(`[class~="languageSelector__menuItem"]`).eq(1).click({
force: true,
});
cy.waitForLoaderNewHeader();
cy.getElementByTestId('queryResultCompleteMsg').should('be.visible');
cy.getElementByTestId('queryEditorFooterTimestamp').should(
'contain',
'@timestamp'
);
});
});

describe('index pattern', () => {
it('create index pattern and select it', function () {
testFixtureHandler.importJSONMapping(
'cypress/fixtures/dashboard/opensearch_dashboards/data_explorer/discover/discover.mappings.json.txt'
);

testFixtureHandler.importJSONDoc(
'cypress/fixtures/dashboard/opensearch_dashboards/data_explorer/discover/discover.json.txt'
);

// Go to the Discover page
miscUtils.visitPage(
`app/data-explorer/discover#/?_g=(filters:!(),time:(from:'2015-09-19T13:31:44.000Z',to:'2015-09-24T01:31:44.000Z'))`
);

cy.get(`[class~="datasetSelector__button"]`).click();
cy.getElementByTestId(`datasetOption-logstash-*`).click();

cy.waitForLoaderNewHeader();
cy.waitForSearch();
cy.verifyHitCount('14,004');
});
});
});
Loading
Loading