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

Unskip TSVB to Lens functional test #179858

Merged
merged 8 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
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
5 changes: 3 additions & 2 deletions x-pack/test/functional/apps/lens/group5/geo_field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import expect from '@kbn/expect';
import expect from '@kbn/expect/expect';
dej611 marked this conversation as resolved.
Show resolved Hide resolved
import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
Expand All @@ -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