Skip to content

Commit

Permalink
Unskip TSVB to Lens functional test (#179858)
Browse files Browse the repository at this point in the history
## Summary

Fixes #179307 and speeds up a bit the `resetPage` method when possible
via click on the `Visualize list` navigation breadcrumb on the top left:

<img width="289" alt="Screenshot 2024-04-04 at 09 56 37"
src="https://github.com/elastic/kibana/assets/924948/74011b51-34b1-4cfa-a78e-4224a3494a25">


The work on `navigateToNewVisualization` (function called by
`resetPage`) had some side effects for some tests where a uiSettings
changes were used as shortcut for the time picker: in such case a
`forceRefresh` option has been provided now to cover it, but I may
suggest to reduce the usage as much as possible.
The new change lead to an average of ~5 minutes saving only within the
`open_in_lens/tsvb` test suite, but it is a rough number as the average
between the savings on the CI on the flaky runner.
Probably there's an extra saving on other test suites as well.

Flaky runner for the `Open in Lens/TSVB` test suite (50x runs):
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5604
Flaky runner for the `Lens - Group5` test suite (50x runs):
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5606#_


### 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
  • Loading branch information
dej611 authored Apr 4, 2024
1 parent 94a4b47 commit d680d2d
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 11 deletions.
40 changes: 34 additions & 6 deletions test/functional/page_objects/visualize_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,30 @@ export class VisualizePageObject extends FtrService {
});
}

public async gotoVisualizationLandingPage() {
await this.common.navigateToApp('visualize');
/**
* Try to speed resets a bit if the Visualize Library breadcrumb is available
*/
private async clickOnVisualizeLibraryBreadcrumb() {
// Try to navigate to the Visualize Listing page from breadcrumb if available
const selector = '[data-test-subj="breadcrumb first"][title="Visualize Library"]';
const visualizeLibraryBreadcrumb = await this.find.existsByCssSelector(selector);
if (visualizeLibraryBreadcrumb) {
await this.find.clickByCssSelector(selector);
// Lens offers a last modal before leaving the page for unsaved charts
// so close it as quick as possible
if (await this.testSubjects.exists('confirmModalConfirmButton')) {
await this.testSubjects.click('confirmModalConfirmButton');
return true;
}
}
}

public async gotoVisualizationLandingPage(
{ forceRefresh }: { forceRefresh: boolean } = { forceRefresh: false }
) {
if (forceRefresh || !(await this.clickOnVisualizeLibraryBreadcrumb())) {
await this.common.navigateToApp('visualize');
}
}

public async selectVisualizationsTab() {
Expand Down Expand Up @@ -142,8 +164,15 @@ export class VisualizePageObject extends FtrService {
});
}

public async navigateToNewVisualization() {
await this.gotoVisualizationLandingPage();
/**
* Navigation now happens without URL refresh by default
* so a new "forceRefresh" option has been passed in order to
* address those scenarios where a full refresh is required (i.e. changing default settings)
*/
public async navigateToNewVisualization(
options: { forceRefresh: boolean } = { forceRefresh: false }
) {
await this.gotoVisualizationLandingPage(options);
await this.header.waitUntilLoadingHasFinished();
await this.clickNewVisualization();
await this.waitForGroupsSelectPage();
Expand All @@ -158,8 +187,7 @@ export class VisualizePageObject extends FtrService {
}

public async navigateToLensFromAnotherVisualization() {
const button = await this.testSubjects.find('visualizeEditInLensButton');
await button.click();
await this.testSubjects.click('visualizeEditInLensButton');
}

public async hasNavigateToLensButton() {
Expand Down
3 changes: 2 additions & 1 deletion x-pack/test/functional/apps/lens/group5/geo_field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

it('should visualize geo fields in maps', async () => {
await PageObjects.visualize.navigateToNewVisualization();
// as navigation does not happen via URL refresh by default, force a reset via URL navigation
await PageObjects.visualize.navigateToNewVisualization({ forceRefresh: true });
await PageObjects.visualize.clickVisType('lens');
await PageObjects.lens.switchDataPanelIndexPattern('logstash-*');
await PageObjects.header.waitUntilLoadingHasFinished();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
const dashboardAddPanel = getService('dashboardAddPanel');
const filterBar = getService('filterBar');

// FLAKY: https://github.com/elastic/kibana/issues/179307
describe.skip('Dashboard to TSVB to Lens', function describeIndexTests() {
describe('Dashboard to TSVB to Lens', function describeIndexTests() {
before(async () => {
await visualize.initTests();
});
Expand Down
5 changes: 3 additions & 2 deletions x-pack/test/functional/apps/lens/open_in_lens/tsvb/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@ export default function ({ loadTestFile, getService, getPageObjects }: FtrProvid
}

await esNode.load(esArchive);
// changing the timepicker default here saves us from having to set it in Discover (~8s)
await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings();
await kibanaServer.uiSettings.update({
defaultIndex: indexPatternString,
'dateFormat:tz': 'UTC',
// changing the timepicker default here saves us from having to set it in Discover (~8s)
// The TSVB tests are using a slightly difference end date, so it needs to be set manually here
'timepicker:timeDefaults': `{ "from": "${PageObjects.timePicker.defaultStartTime}", "to": "Sep 22, 2015 @ 18:31:44.000" }`,
});
await kibanaServer.importExport.load(fixtureDirs.lensBasic);
await kibanaServer.importExport.load(fixtureDirs.lensDefault);
Expand Down

0 comments on commit d680d2d

Please sign in to comment.