Skip to content

Commit

Permalink
[Discover] Unskip default app state tests (elastic#190506)
Browse files Browse the repository at this point in the history
  • Loading branch information
jughosta authored Aug 15, 2024
1 parent bc88e54 commit 8cf87c0
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,29 @@ import kbnRison from '@kbn/rison';
import type { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['common', 'discover', 'unifiedFieldList']);
const PageObjects = getPageObjects(['common', 'discover', 'unifiedFieldList', 'header']);
const dataViews = getService('dataViews');
const dataGrid = getService('dataGrid');
const queryBar = getService('queryBar');
const monacoEditor = getService('monacoEditor');
const testSubjects = getService('testSubjects');
const kibanaServer = getService('kibanaServer');
const retry = getService('retry');

describe('extension getDefaultAppState', () => {
afterEach(async () => {
await kibanaServer.uiSettings.unset('defaultColumns');
});

async function expectColumns(columns: string[]) {
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.discover.waitUntilSearchingHasFinished();
await retry.try(async () => {
const actualColumns = await PageObjects.discover.getColumnHeaders();
expect(actualColumns).to.eql(columns);
});
}

describe('ES|QL mode', () => {
it('should render default columns and row height', async () => {
const state = kbnRison.encode({
Expand All @@ -35,9 +45,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.common.navigateToActualUrl('discover', `?_a=${state}`, {
ensureCurrentUrl: false,
});
await PageObjects.discover.waitUntilSearchingHasFinished();
const columns = await PageObjects.discover.getColumnHeaders();
expect(columns).to.eql(['@timestamp', 'log.level', 'message']);
await expectColumns(['@timestamp', 'log.level', 'message']);
await dataGrid.clickGridSettings();
const rowHeightValue = await dataGrid.getCurrentRowHeightValue();
expect(rowHeightValue).to.be('Custom');
Expand All @@ -55,19 +63,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.common.navigateToActualUrl('discover', `?_a=${state}`, {
ensureCurrentUrl: false,
});
await PageObjects.discover.waitUntilSearchingHasFinished();
let columns = await PageObjects.discover.getColumnHeaders();
expect(columns).to.eql(['@timestamp', 'Document']);
await expectColumns(['@timestamp', 'Document']);
await dataGrid.clickGridSettings();
let rowHeightValue = await dataGrid.getCurrentRowHeightValue();
expect(rowHeightValue).to.be('Custom');
let rowHeightNumber = await dataGrid.getCustomRowHeightNumber();
expect(rowHeightNumber).to.be(3);
await monacoEditor.setCodeEditorValue('from my-example-logs');
await queryBar.clickQuerySubmitButton();
await PageObjects.discover.waitUntilSearchingHasFinished();
columns = await PageObjects.discover.getColumnHeaders();
expect(columns).to.eql(['@timestamp', 'log.level', 'message']);
await expectColumns(['@timestamp', 'log.level', 'message']);
await dataGrid.clickGridSettings();
rowHeightValue = await dataGrid.getCurrentRowHeightValue();
expect(rowHeightValue).to.be('Custom');
Expand All @@ -88,16 +92,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.discover.waitUntilSearchingHasFinished();
await PageObjects.unifiedFieldList.clickFieldListItemRemove('log.level');
await PageObjects.unifiedFieldList.clickFieldListItemRemove('message');
let columns = await PageObjects.discover.getColumnHeaders();
expect(columns).to.eql(['@timestamp', 'Document']);
await expectColumns(['@timestamp', 'Document']);
await dataGrid.clickGridSettings();
await dataGrid.changeRowHeightValue('Single');
let rowHeightValue = await dataGrid.getCurrentRowHeightValue();
expect(rowHeightValue).to.be('Single');
await testSubjects.click('discoverNewButton');
await PageObjects.discover.waitUntilSearchingHasFinished();
columns = await PageObjects.discover.getColumnHeaders();
expect(columns).to.eql(['@timestamp', 'log.level', 'message']);
await expectColumns(['@timestamp', 'log.level', 'message']);
await dataGrid.clickGridSettings();
rowHeightValue = await dataGrid.getCurrentRowHeightValue();
expect(rowHeightValue).to.be('Custom');
Expand All @@ -118,9 +119,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.common.navigateToActualUrl('discover', `?_a=${state}`, {
ensureCurrentUrl: false,
});
await PageObjects.discover.waitUntilSearchingHasFinished();
const columns = await PageObjects.discover.getColumnHeaders();
expect(columns).to.eql(['@timestamp', 'log.level', 'message', 'data_stream.type']);
await expectColumns(['@timestamp', 'log.level', 'message', 'data_stream.type']);
});
});

Expand All @@ -130,9 +129,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
ensureCurrentUrl: false,
});
await dataViews.switchTo('my-example-logs');
await PageObjects.discover.waitUntilSearchingHasFinished();
const columns = await PageObjects.discover.getColumnHeaders();
expect(columns).to.eql(['@timestamp', 'log.level', 'message']);
await expectColumns(['@timestamp', 'log.level', 'message']);
await dataGrid.clickGridSettings();
const rowHeightValue = await dataGrid.getCurrentRowHeightValue();
expect(rowHeightValue).to.be('Custom');
Expand All @@ -145,18 +142,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
ensureCurrentUrl: false,
});
await dataViews.switchTo('my-example-*');
await PageObjects.discover.waitUntilSearchingHasFinished();
let columns = await PageObjects.discover.getColumnHeaders();
expect(columns).to.eql(['@timestamp', 'Document']);
await expectColumns(['@timestamp', 'Document']);
await dataGrid.clickGridSettings();
let rowHeightValue = await dataGrid.getCurrentRowHeightValue();
expect(rowHeightValue).to.be('Custom');
let rowHeightNumber = await dataGrid.getCustomRowHeightNumber();
expect(rowHeightNumber).to.be(3);
await dataViews.switchTo('my-example-logs');
await PageObjects.discover.waitUntilSearchingHasFinished();
columns = await PageObjects.discover.getColumnHeaders();
expect(columns).to.eql(['@timestamp', 'log.level', 'message']);
await expectColumns(['@timestamp', 'log.level', 'message']);
await dataGrid.clickGridSettings();
rowHeightValue = await dataGrid.getCurrentRowHeightValue();
expect(rowHeightValue).to.be('Custom');
Expand All @@ -172,16 +165,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.discover.waitUntilSearchingHasFinished();
await PageObjects.unifiedFieldList.clickFieldListItemRemove('log.level');
await PageObjects.unifiedFieldList.clickFieldListItemRemove('message');
let columns = await PageObjects.discover.getColumnHeaders();
expect(columns).to.eql(['@timestamp', 'Document']);
await expectColumns(['@timestamp', 'Document']);
await dataGrid.clickGridSettings();
await dataGrid.changeRowHeightValue('Single');
let rowHeightValue = await dataGrid.getCurrentRowHeightValue();
expect(rowHeightValue).to.be('Single');
await testSubjects.click('discoverNewButton');
await PageObjects.discover.waitUntilSearchingHasFinished();
columns = await PageObjects.discover.getColumnHeaders();
expect(columns).to.eql(['@timestamp', 'log.level', 'message']);
await expectColumns(['@timestamp', 'log.level', 'message']);
await dataGrid.clickGridSettings();
rowHeightValue = await dataGrid.getCurrentRowHeightValue();
expect(rowHeightValue).to.be('Custom');
Expand All @@ -197,9 +187,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
ensureCurrentUrl: false,
});
await dataViews.switchTo('my-example-logs');
await PageObjects.discover.waitUntilSearchingHasFinished();
const columns = await PageObjects.discover.getColumnHeaders();
expect(columns).to.eql(['@timestamp', 'log.level', 'message', 'data_stream.type']);
await expectColumns(['@timestamp', 'log.level', 'message', 'data_stream.type']);
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,20 @@ import kbnRison from '@kbn/rison';
import type { FtrProviderContext } from '../../../../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['common', 'discover', 'svlCommonPage', 'unifiedFieldList']);
const PageObjects = getPageObjects([
'common',
'discover',
'svlCommonPage',
'unifiedFieldList',
'header',
]);
const dataViews = getService('dataViews');
const dataGrid = getService('dataGrid');
const queryBar = getService('queryBar');
const monacoEditor = getService('monacoEditor');
const testSubjects = getService('testSubjects');
const kibanaServer = getService('kibanaServer');
const retry = getService('retry');

describe('extension getDefaultAppState', () => {
before(async () => {
Expand All @@ -27,6 +34,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await kibanaServer.uiSettings.unset('defaultColumns');
});

async function expectColumns(columns: string[]) {
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.discover.waitUntilSearchingHasFinished();
await retry.try(async () => {
const actualColumns = await PageObjects.discover.getColumnHeaders();
expect(actualColumns).to.eql(columns);
});
}

describe('ES|QL mode', () => {
it('should render default columns and row height', async () => {
const state = kbnRison.encode({
Expand All @@ -38,9 +54,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.common.navigateToActualUrl('discover', `?_a=${state}`, {
ensureCurrentUrl: false,
});
await PageObjects.discover.waitUntilSearchingHasFinished();
const columns = await PageObjects.discover.getColumnHeaders();
expect(columns).to.eql(['@timestamp', 'log.level', 'message']);
await expectColumns(['@timestamp', 'log.level', 'message']);
await dataGrid.clickGridSettings();
const rowHeightValue = await dataGrid.getCurrentRowHeightValue();
expect(rowHeightValue).to.be('Custom');
Expand All @@ -58,19 +72,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.common.navigateToActualUrl('discover', `?_a=${state}`, {
ensureCurrentUrl: false,
});
await PageObjects.discover.waitUntilSearchingHasFinished();
let columns = await PageObjects.discover.getColumnHeaders();
expect(columns).to.eql(['@timestamp', 'Document']);
await expectColumns(['@timestamp', 'Document']);
await dataGrid.clickGridSettings();
let rowHeightValue = await dataGrid.getCurrentRowHeightValue();
expect(rowHeightValue).to.be('Custom');
let rowHeightNumber = await dataGrid.getCustomRowHeightNumber();
expect(rowHeightNumber).to.be(3);
await monacoEditor.setCodeEditorValue('from my-example-logs');
await queryBar.clickQuerySubmitButton();
await PageObjects.discover.waitUntilSearchingHasFinished();
columns = await PageObjects.discover.getColumnHeaders();
expect(columns).to.eql(['@timestamp', 'log.level', 'message']);
await expectColumns(['@timestamp', 'log.level', 'message']);
await dataGrid.clickGridSettings();
rowHeightValue = await dataGrid.getCurrentRowHeightValue();
expect(rowHeightValue).to.be('Custom');
Expand All @@ -91,16 +101,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.discover.waitUntilSearchingHasFinished();
await PageObjects.unifiedFieldList.clickFieldListItemRemove('log.level');
await PageObjects.unifiedFieldList.clickFieldListItemRemove('message');
let columns = await PageObjects.discover.getColumnHeaders();
expect(columns).to.eql(['@timestamp', 'Document']);
await expectColumns(['@timestamp', 'Document']);
await dataGrid.clickGridSettings();
await dataGrid.changeRowHeightValue('Single');
let rowHeightValue = await dataGrid.getCurrentRowHeightValue();
expect(rowHeightValue).to.be('Single');
await testSubjects.click('discoverNewButton');
await PageObjects.discover.waitUntilSearchingHasFinished();
columns = await PageObjects.discover.getColumnHeaders();
expect(columns).to.eql(['@timestamp', 'log.level', 'message']);
await expectColumns(['@timestamp', 'log.level', 'message']);
await dataGrid.clickGridSettings();
rowHeightValue = await dataGrid.getCurrentRowHeightValue();
expect(rowHeightValue).to.be('Custom');
Expand All @@ -121,22 +128,17 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.common.navigateToActualUrl('discover', `?_a=${state}`, {
ensureCurrentUrl: false,
});
await PageObjects.discover.waitUntilSearchingHasFinished();
const columns = await PageObjects.discover.getColumnHeaders();
expect(columns).to.eql(['@timestamp', 'log.level', 'message', 'data_stream.type']);
await expectColumns(['@timestamp', 'log.level', 'message', 'data_stream.type']);
});
});

// FLAKY: https://github.com/elastic/kibana/issues/189994
describe.skip('data view mode', () => {
describe('data view mode', () => {
it('should render default columns and row height', async () => {
await PageObjects.common.navigateToActualUrl('discover', undefined, {
ensureCurrentUrl: false,
});
await dataViews.switchTo('my-example-logs');
await PageObjects.discover.waitUntilSearchingHasFinished();
const columns = await PageObjects.discover.getColumnHeaders();
expect(columns).to.eql(['@timestamp', 'log.level', 'message']);
await expectColumns(['@timestamp', 'log.level', 'message']);
await dataGrid.clickGridSettings();
const rowHeightValue = await dataGrid.getCurrentRowHeightValue();
expect(rowHeightValue).to.be('Custom');
Expand All @@ -149,18 +151,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
ensureCurrentUrl: false,
});
await dataViews.switchTo('my-example-*');
await PageObjects.discover.waitUntilSearchingHasFinished();
let columns = await PageObjects.discover.getColumnHeaders();
expect(columns).to.eql(['@timestamp', 'Document']);
await expectColumns(['@timestamp', 'Document']);
await dataGrid.clickGridSettings();
let rowHeightValue = await dataGrid.getCurrentRowHeightValue();
expect(rowHeightValue).to.be('Custom');
let rowHeightNumber = await dataGrid.getCustomRowHeightNumber();
expect(rowHeightNumber).to.be(3);
await dataViews.switchTo('my-example-logs');
await PageObjects.discover.waitUntilSearchingHasFinished();
columns = await PageObjects.discover.getColumnHeaders();
expect(columns).to.eql(['@timestamp', 'log.level', 'message']);
await expectColumns(['@timestamp', 'log.level', 'message']);
await dataGrid.clickGridSettings();
rowHeightValue = await dataGrid.getCurrentRowHeightValue();
expect(rowHeightValue).to.be('Custom');
Expand All @@ -176,16 +174,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.discover.waitUntilSearchingHasFinished();
await PageObjects.unifiedFieldList.clickFieldListItemRemove('log.level');
await PageObjects.unifiedFieldList.clickFieldListItemRemove('message');
let columns = await PageObjects.discover.getColumnHeaders();
expect(columns).to.eql(['@timestamp', 'Document']);
await expectColumns(['@timestamp', 'Document']);
await dataGrid.clickGridSettings();
await dataGrid.changeRowHeightValue('Single');
let rowHeightValue = await dataGrid.getCurrentRowHeightValue();
expect(rowHeightValue).to.be('Single');
await testSubjects.click('discoverNewButton');
await PageObjects.discover.waitUntilSearchingHasFinished();
columns = await PageObjects.discover.getColumnHeaders();
expect(columns).to.eql(['@timestamp', 'log.level', 'message']);
await expectColumns(['@timestamp', 'log.level', 'message']);
await dataGrid.clickGridSettings();
rowHeightValue = await dataGrid.getCurrentRowHeightValue();
expect(rowHeightValue).to.be('Custom');
Expand All @@ -201,9 +196,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
ensureCurrentUrl: false,
});
await dataViews.switchTo('my-example-logs');
await PageObjects.discover.waitUntilSearchingHasFinished();
const columns = await PageObjects.discover.getColumnHeaders();
expect(columns).to.eql(['@timestamp', 'log.level', 'message', 'data_stream.type']);
await expectColumns(['@timestamp', 'log.level', 'message', 'data_stream.type']);
});
});
});
Expand Down

0 comments on commit 8cf87c0

Please sign in to comment.