Skip to content

Commit

Permalink
[Discover] Unskip ES|QL switch modal tests and fix other flaky tests …
Browse files Browse the repository at this point in the history
…in the same suite (elastic#200923)

- Closes elastic#189636
- Closes elastic#200805
- Closes elastic#195479

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
  • Loading branch information
jughosta authored and paulinashakirova committed Nov 26, 2024
1 parent 3703bac commit f5a05f2
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 14 deletions.
17 changes: 14 additions & 3 deletions test/functional/apps/discover/esql/_esql_view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

it('should perform test query correctly', async function () {
await timePicker.setDefaultAbsoluteRange();
await header.waitUntilLoadingHasFinished();
await discover.waitUntilSearchingHasFinished();
await discover.selectTextBaseLang();
const testQuery = `from logstash-* | limit 10 | stats countB = count(bytes) by geo.dest | sort countB`;
await header.waitUntilLoadingHasFinished();
await discover.waitUntilSearchingHasFinished();

const testQuery = `from logstash-* | sort @timestamp | limit 10 | stats countB = count(bytes) by geo.dest | sort countB`;
await monacoEditor.setCodeEditorValue(testQuery);
await testSubjects.click('querySubmitButton');
await header.waitUntilLoadingHasFinished();
Expand All @@ -158,7 +162,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

it('should render when switching to a time range with no data, then back to a time range with data', async () => {
await discover.selectTextBaseLang();
const testQuery = `from logstash-* | limit 10 | stats countB = count(bytes) by geo.dest | sort countB`;
await header.waitUntilLoadingHasFinished();
await discover.waitUntilSearchingHasFinished();

const testQuery = `from logstash-* | sort @timestamp | limit 10 | stats countB = count(bytes) by geo.dest | sort countB`;
await monacoEditor.setCodeEditorValue(testQuery);
await testSubjects.click('querySubmitButton');
await header.waitUntilLoadingHasFinished();
Expand All @@ -181,8 +188,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

it('should query an index pattern that doesnt translate to a dataview correctly', async function () {
await discover.selectTextBaseLang();
const testQuery = `from logstash* | limit 10 | stats countB = count(bytes) by geo.dest | sort countB`;
await header.waitUntilLoadingHasFinished();
await discover.waitUntilSearchingHasFinished();

const testQuery = `from logstash* | sort @timestamp | limit 10 | stats countB = count(bytes) by geo.dest | sort countB`;
await monacoEditor.setCodeEditorValue(testQuery);
await testSubjects.click('querySubmitButton');
await header.waitUntilLoadingHasFinished();
Expand Down Expand Up @@ -296,6 +305,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await header.waitUntilLoadingHasFinished();
await discover.waitUntilSearchingHasFinished();
await discover.saveSearch('esql_test2');
await header.waitUntilLoadingHasFinished();
await discover.waitUntilSearchingHasFinished();
const testQuery = 'from logstash-* | limit 100 | drop @timestamp';
await monacoEditor.setCodeEditorValue(testQuery);
await testSubjects.click('querySubmitButton');
Expand Down
3 changes: 1 addition & 2 deletions test/functional/page_objects/unified_field_list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,9 @@ export class UnifiedFieldListPageObject extends FtrService {

if (!isActive) {
// expand the field to show the "Visualize" button
await field.click();
await this.clickFieldListItem(fieldName);
}

await this.waitUntilFieldPopoverIsOpen();
const visualizeButtonTestSubject = `fieldVisualize-${fieldName}`;
// wrap visualize button click in retry to ensure button is clicked and retry if button click is not registered
await this.retry.try(async () => {
Expand Down
11 changes: 8 additions & 3 deletions x-pack/test/functional/apps/discover/visualize_field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,19 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
describe('discover field visualize button', () => {
before(async () => {
await kibanaServer.uiSettings.replace(defaultSettings);
});
beforeEach(async () => {
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional');
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json'
);
});

beforeEach(async () => {
await common.navigateToApp('discover');
await header.waitUntilLoadingHasFinished();
await discover.waitUntilSearchingHasFinished();
await setDiscoverTimeRange();
await header.waitUntilLoadingHasFinished();
await discover.waitUntilSearchingHasFinished();
});

after(async () => {
Expand All @@ -73,7 +78,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await unifiedFieldList.expectFieldListItemVisualize('bytes');
});

it('visualizes field to Lens and loads fields to the dimesion editor', async () => {
it('visualizes field to Lens and loads fields to the dimension editor', async () => {
await unifiedFieldList.findFieldByName('bytes');
await unifiedFieldList.clickFieldListItemVisualize('bytes');
await header.waitUntilLoadingHasFinished();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

it('should perform test query correctly', async function () {
await PageObjects.timePicker.setDefaultAbsoluteRange();
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.discover.waitUntilSearchingHasFinished();
await PageObjects.discover.selectTextBaseLang();
const testQuery = `from logstash-* | limit 10 | stats countB = count(bytes) by geo.dest | sort countB`;
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.discover.waitUntilSearchingHasFinished();
const testQuery = `from logstash-* | sort @timestamp | limit 10 | stats countB = count(bytes) by geo.dest | sort countB`;

await monacoEditor.setCodeEditorValue(testQuery);
await testSubjects.click('querySubmitButton');
Expand All @@ -157,7 +161,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

it('should render when switching to a time range with no data, then back to a time range with data', async () => {
await PageObjects.discover.selectTextBaseLang();
const testQuery = `from logstash-* | limit 10 | stats countB = count(bytes) by geo.dest | sort countB`;
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.discover.waitUntilSearchingHasFinished();

const testQuery = `from logstash-* | sort @timestamp | limit 10 | stats countB = count(bytes) by geo.dest | sort countB`;
await monacoEditor.setCodeEditorValue(testQuery);
await testSubjects.click('querySubmitButton');
await PageObjects.header.waitUntilLoadingHasFinished();
Expand All @@ -183,7 +190,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.discover.waitUntilSearchingHasFinished();

const testQuery = `from logstash* | limit 10 | stats countB = count(bytes) by geo.dest | sort countB`;
const testQuery = `from logstash* | sort @timestamp | limit 10 | stats countB = count(bytes) by geo.dest | sort countB`;
await monacoEditor.setCodeEditorValue(testQuery);
await testSubjects.click('querySubmitButton');
await PageObjects.header.waitUntilLoadingHasFinished();
Expand Down Expand Up @@ -256,8 +263,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
});

// FLAKY: https://github.com/elastic/kibana/issues/189636
describe.skip('switch modal', () => {
describe('switch modal', () => {
beforeEach(async () => {
await PageObjects.common.navigateToApp('discover');
await PageObjects.timePicker.setDefaultAbsoluteRange();
Expand Down Expand Up @@ -302,6 +308,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.discover.waitUntilSearchingHasFinished();
await PageObjects.discover.saveSearch('esql_test2');
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.discover.waitUntilSearchingHasFinished();
const testQuery = 'from logstash-* | limit 100 | drop @timestamp';
await monacoEditor.setCodeEditorValue(testQuery);
await testSubjects.click('querySubmitButton');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {

beforeEach(async () => {
await PageObjects.common.navigateToApp('discover');
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.discover.waitUntilSearchingHasFinished();
await setDiscoverTimeRange();
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.discover.waitUntilSearchingHasFinished();
});

after(async () => {
Expand All @@ -64,7 +68,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await PageObjects.unifiedFieldList.expectFieldListItemVisualize('bytes');
});

it('visualizes field to Lens and loads fields to the dimesion editor', async () => {
it('visualizes field to Lens and loads fields to the dimension editor', async () => {
await PageObjects.unifiedFieldList.findFieldByName('bytes');
await PageObjects.unifiedFieldList.clickFieldListItemVisualize('bytes');
await PageObjects.header.waitUntilLoadingHasFinished();
Expand Down

0 comments on commit f5a05f2

Please sign in to comment.