diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/editor_frame.test.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/editor_frame.test.tsx
index 7d41e326372e5..ad53002a1b0cb 100644
--- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/editor_frame.test.tsx
+++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/editor_frame.test.tsx
@@ -5,20 +5,12 @@
* 2.0.
*/
-import React, { useEffect } from 'react';
-import { ReactWrapper } from 'enzyme';
+import React from 'react';
import { screen, within } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { EditorFrame, EditorFrameProps } from './editor_frame';
-import {
- DatasourceMap,
- DatasourcePublicAPI,
- DatasourceSuggestion,
- Visualization,
- VisualizationMap,
-} from '../../types';
-import { act } from '@testing-library/react';
+import { DatasourceMap, DatasourcePublicAPI, Visualization, VisualizationMap } from '../../types';
import { coreMock } from '@kbn/core/public/mocks';
import {
createMockVisualization,
@@ -29,30 +21,16 @@ import {
renderWithReduxStore,
} from '../../mocks';
import { inspectorPluginMock } from '@kbn/inspector-plugin/public/mocks';
-import { Droppable, useDragDropContext } from '@kbn/dom-drag-drop';
import { uiActionsPluginMock } from '@kbn/ui-actions-plugin/public/mocks';
import { chartPluginMock } from '@kbn/charts-plugin/public/mocks';
import { expressionsPluginMock } from '@kbn/expressions-plugin/public/mocks';
-import { mockDataPlugin, mountWithProvider } from '../../mocks';
+import { mockDataPlugin } from '../../mocks';
import { LensAppState, setState } from '../../state_management';
import { getLensInspectorService } from '../../lens_inspector_service';
import { createIndexPatternServiceMock } from '../../mocks/data_views_service_mock';
import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks';
import { EventAnnotationServiceType } from '@kbn/event-annotation-plugin/public';
-function generateSuggestion(state = {}): DatasourceSuggestion {
- return {
- state,
- table: {
- columns: [],
- isMultiRow: true,
- layerId: 'first',
- changeType: 'unchanged',
- },
- keptLayerIds: ['first'],
- };
-}
-
function wrapDataViewsContract() {
const dataViewsContract = dataViewPluginMocks.createStartContract();
return {
@@ -437,180 +415,5 @@ describe('editor_frame', () => {
})
);
});
- describe('legacy tests', () => {
- let instance: ReactWrapper;
-
- afterEach(() => {
- instance.unmount();
- });
-
- it('should use the currently selected visualization if possible on field drop', async () => {
- mockDatasource.getLayers.mockReturnValue(['first', 'second', 'third']);
- const suggestionVisState = {};
- const props = {
- ...getDefaultProps(),
- visualizationMap: {
- testVis: {
- ...mockVisualization,
- getSuggestions: () => [
- {
- score: 0.2,
- state: {},
- title: 'Suggestion1',
- previewIcon: 'empty',
- },
- {
- score: 0.6,
- state: suggestionVisState,
- title: 'Suggestion2',
- previewIcon: 'empty',
- },
- ],
- },
- testVis2: {
- ...mockVisualization2,
- getSuggestions: () => [
- {
- score: 0.8,
- state: {},
- title: 'Suggestion3',
- previewIcon: 'empty',
- },
- ],
- },
- },
- datasourceMap: {
- testDatasource: {
- ...mockDatasource,
- getDatasourceSuggestionsForField: () => [generateSuggestion()],
- getDatasourceSuggestionsFromCurrentState: () => [generateSuggestion()],
- getDatasourceSuggestionsForVisualizeField: () => [generateSuggestion()],
- DataPanelComponent: jest.fn().mockImplementation(() =>
),
- },
- },
- } as EditorFrameProps;
- instance = (
- await mountWithProvider(, {
- preloadedState: {
- datasourceStates: {
- testDatasource: {
- isLoading: false,
- state: {
- internalState1: '',
- },
- },
- },
- },
- })
- ).instance;
-
- instance.update();
-
- act(() => {
- instance.find('[data-test-subj="mockVisA"]').find(Droppable).prop('onDrop')!(
- {
- indexPatternId: '1',
- field: {},
- id: '1',
- humanData: { label: 'draggedField' },
- },
- 'field_add'
- );
- });
-
- expect(mockVisualization.getConfiguration).toHaveBeenCalledWith(
- expect.objectContaining({
- state: suggestionVisState,
- })
- );
- });
-
- it('should use the highest priority suggestion available', async () => {
- mockDatasource.getLayers.mockReturnValue(['first', 'second', 'third']);
- const suggestionVisState = {};
- const mockVisualization3 = {
- ...createMockVisualization('testVis3', ['third']),
- getSuggestions: () => [
- {
- score: 0.9,
- state: suggestionVisState,
- title: 'Suggestion3',
- previewIcon: 'empty',
- },
- {
- score: 0.7,
- state: {},
- title: 'Suggestion4',
- previewIcon: 'empty',
- },
- ],
- };
-
- const props = {
- ...getDefaultProps(),
- visualizationMap: {
- testVis: {
- ...mockVisualization,
- // do not return suggestions for the currently active vis, otherwise it will be chosen
- getSuggestions: () => [],
- },
- testVis2: {
- ...mockVisualization2,
- getSuggestions: () => [],
- },
- testVis3: {
- ...mockVisualization3,
- },
- },
- datasourceMap: {
- testDatasource: {
- ...mockDatasource,
- getDatasourceSuggestionsForField: () => [generateSuggestion()],
- getDatasourceSuggestionsFromCurrentState: () => [generateSuggestion()],
- getDatasourceSuggestionsForVisualizeField: () => [generateSuggestion()],
- DataPanelComponent: jest.fn().mockImplementation(() => {
- const [, dndDispatch] = useDragDropContext();
- useEffect(() => {
- dndDispatch({
- type: 'startDragging',
- payload: {
- dragging: {
- id: 'draggedField',
- humanData: { label: '1' },
- },
- },
- });
- }, [dndDispatch]);
- return ;
- }),
- },
- },
- } as EditorFrameProps;
-
- instance = (await mountWithProvider()).instance;
-
- instance.update();
-
- act(() => {
- instance.find(Droppable).filter('[dataTestSubj="lnsWorkspace"]').prop('onDrop')!(
- {
- indexPatternId: '1',
- field: {},
- id: '1',
- humanData: {
- label: 'label',
- },
- },
- 'field_add'
- );
- });
-
- expect(mockVisualization3.getConfiguration).toHaveBeenCalledWith(
- expect.objectContaining({
- state: suggestionVisState,
- })
- );
- });
- });
});
});
diff --git a/x-pack/test/functional/apps/lens/group1/smokescreen.ts b/x-pack/test/functional/apps/lens/group1/smokescreen.ts
index dbe48cdd395da..5cb1e3583db6c 100644
--- a/x-pack/test/functional/apps/lens/group1/smokescreen.ts
+++ b/x-pack/test/functional/apps/lens/group1/smokescreen.ts
@@ -10,7 +10,7 @@ import { range } from 'lodash';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
- const { visualize, lens } = getPageObjects(['visualize', 'lens']);
+ const { visualize, lens, timePicker } = getPageObjects(['visualize', 'lens', 'timePicker']);
const find = getService('find');
const listingTable = getService('listingTable');
const testSubjects = getService('testSubjects');
@@ -20,10 +20,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const config = getService('config');
describe('lens smokescreen tests', () => {
+ before(async () => {
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
+ });
it('should allow creation of lens xy chart', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
await lens.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
@@ -60,7 +62,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visualize.gotoVisualizationLandingPage();
await listingTable.searchForItemWithName('Afancilenstest');
await lens.clickVisualizeListItemTitle('Afancilenstest');
- await lens.goToTimeRange();
+
await lens.waitForVisualization('xyVisChart');
expect(await lens.getTitle()).to.eql('Afancilenstest');
@@ -75,7 +77,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visualize.gotoVisualizationLandingPage();
await listingTable.searchForItemWithName('lnsXYvis');
await lens.clickVisualizeListItemTitle('lnsXYvis');
- await lens.goToTimeRange();
+
// Change the IP field to filters
await lens.configureDimension({
dimension: 'lnsXY_splitDimensionPanel > lns-dimensionTrigger',
@@ -94,7 +96,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visualize.gotoVisualizationLandingPage();
await listingTable.searchForItemWithName('Artistpreviouslyknownaslens');
await lens.clickVisualizeListItemTitle('Artistpreviouslyknownaslens');
- await lens.goToTimeRange();
+
await lens.assertLegacyMetric('Maximum of bytes', '19,986');
await lens.switchToVisualization('lnsDatatable');
expect(await lens.getDatatableHeaderText()).to.eql('Maximum of bytes');
@@ -106,7 +108,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should transition from a multi-layer stacked bar to a multi-layer line chart and correctly remove all layers', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
await lens.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
@@ -150,7 +151,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should transition selected layer in a multi layer bar using layer chart switch', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
await lens.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
@@ -197,7 +197,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visualize.gotoVisualizationLandingPage();
await listingTable.searchForItemWithName('lnsXYvis');
await lens.clickVisualizeListItemTitle('lnsXYvis');
- await lens.goToTimeRange();
+
await lens.removeDimension('lnsXY_splitDimensionPanel');
await lens.switchToVisualization('line');
await lens.configureDimension({
@@ -255,7 +255,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
await elasticChart.setNewChartUiDebugFlag(true);
- await lens.goToTimeRange();
+
await lens.switchToVisualization('bar');
await lens.configureDimension({
@@ -323,7 +323,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should transition from a multi-layer stacked bar to treemap chart using suggestions', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
await lens.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
@@ -367,7 +366,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visualize.gotoVisualizationLandingPage();
await listingTable.searchForItemWithName('lnsXYvis');
await lens.clickVisualizeListItemTitle('lnsXYvis');
- await lens.goToTimeRange();
+
expect(await lens.hasChartSwitchWarning('pie')).to.eql(true);
await lens.switchToVisualization('pie');
@@ -394,7 +393,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visualize.gotoVisualizationLandingPage();
await listingTable.searchForItemWithName('lnsXYvis');
await lens.clickVisualizeListItemTitle('lnsXYvis');
- await lens.goToTimeRange();
+
await lens.switchToVisualization('line');
expect(await lens.getTitle()).to.eql('lnsXYvis');
expect(await lens.getDimensionTriggerText('lnsXY_xDimensionPanel')).to.eql('@timestamp');
@@ -410,7 +409,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visualize.gotoVisualizationLandingPage();
await listingTable.searchForItemWithName('lnsPieVis');
await lens.clickVisualizeListItemTitle('lnsPieVis');
- await lens.goToTimeRange();
+
expect(await lens.hasChartSwitchWarning('treemap')).to.eql(false);
await lens.switchToVisualization('treemap');
expect(await lens.getDimensionTriggersTexts('lnsPie_groupByDimensionPanel')).to.eql([
@@ -425,7 +424,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should create a pie chart and switch to datatable', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
+
await lens.switchToVisualization('pie');
await lens.configureDimension({
dimension: 'lnsPie_sliceByDimensionPanel > lns-empty-dimension',
@@ -452,7 +451,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should create a heatmap chart and transition to barchart', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
+
await lens.switchToVisualization('heatmap', 'heat');
await lens.configureDimension({
@@ -482,7 +481,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should create a valid XY chart with references', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
await lens.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
@@ -517,7 +515,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should allow formatting on references', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
+
await lens.switchToVisualization('lnsDatatable');
await lens.configureDimension({
@@ -563,7 +561,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should handle edge cases in reference-based operations', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
await lens.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
@@ -596,7 +593,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should keep the field selection while transitioning to every reference-based operation', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
await lens.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
@@ -633,7 +629,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should not leave an incomplete column in the visualization config with field-based operation', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
await lens.configureDimension({
dimension: 'lnsXY_yDimensionPanel > lns-empty-dimension',
@@ -646,7 +641,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should revert to previous configuration and not leave an incomplete column in the visualization config with reference-based operations', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
await lens.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
@@ -682,7 +676,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should transition from unique count to last value', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
await lens.configureDimension({
dimension: 'lnsXY_yDimensionPanel > lns-empty-dimension',
@@ -715,7 +708,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should allow filtering by legend on an xy chart', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
await lens.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
@@ -745,7 +737,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should allow filtering by legend on a pie chart', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
+
await lens.switchToVisualization('pie');
await lens.configureDimension({
diff --git a/x-pack/test/functional/apps/lens/group2/field_formatters.ts b/x-pack/test/functional/apps/lens/group2/field_formatters.ts
index 33c2c02e7b372..e7007c7e24604 100644
--- a/x-pack/test/functional/apps/lens/group2/field_formatters.ts
+++ b/x-pack/test/functional/apps/lens/group2/field_formatters.ts
@@ -10,7 +10,12 @@ import { FIELD_FORMAT_IDS } from '@kbn/field-formats-plugin/common';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
- const { visualize, lens, header } = getPageObjects(['visualize', 'lens', 'header']);
+ const { visualize, lens, header, timePicker } = getPageObjects([
+ 'visualize',
+ 'lens',
+ 'header',
+ 'timePicker',
+ ]);
const retry = getService('retry');
const fieldEditor = getService('fieldEditor');
const dataViews = getService('dataViews');
@@ -20,7 +25,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
before(async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
await lens.switchToVisualization('lnsDatatable');
});
@@ -115,7 +120,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
before(async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
await lens.switchToVisualization('lnsDatatable');
});
@@ -189,7 +193,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
before(async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
await lens.switchToVisualization('lnsDatatable');
});
diff --git a/x-pack/test/functional/apps/lens/group2/layer_actions.ts b/x-pack/test/functional/apps/lens/group2/layer_actions.ts
index cc301c2dd57e5..dc3e669d18a26 100644
--- a/x-pack/test/functional/apps/lens/group2/layer_actions.ts
+++ b/x-pack/test/functional/apps/lens/group2/layer_actions.ts
@@ -9,16 +9,18 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
- const { visualize, lens } = getPageObjects(['visualize', 'lens']);
+ const { visualize, lens, timePicker } = getPageObjects(['visualize', 'lens', 'timePicker']);
const find = getService('find');
const testSubjects = getService('testSubjects');
const retry = getService('retry');
describe('lens layer actions tests', () => {
+ before(async () => {
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
+ });
it('should allow creation of lens xy chart', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
// check that no sampling info is shown in the dataView picker
expect(await testSubjects.exists('lnsChangeIndexPatternSamplingInfo')).to.be(false);
@@ -188,7 +190,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should show visualization modifiers for layer settings when embedded in a dashboard', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
// click on open layer settings
await lens.openLayerContextMenu();
await testSubjects.click('lnsLayerSettings');
diff --git a/x-pack/test/functional/apps/lens/group2/partition.ts b/x-pack/test/functional/apps/lens/group2/partition.ts
index f828c65eab284..02f1c58f70d52 100644
--- a/x-pack/test/functional/apps/lens/group2/partition.ts
+++ b/x-pack/test/functional/apps/lens/group2/partition.ts
@@ -9,14 +9,14 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
- const { visualize, lens } = getPageObjects(['visualize', 'lens']);
+ const { visualize, lens, timePicker } = getPageObjects(['visualize', 'lens', 'timePicker']);
const testSubjects = getService('testSubjects');
describe('lens partition charts', () => {
before(async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
});
it('should be able to nest up to 3 levels for Pie charts', async () => {
diff --git a/x-pack/test/functional/apps/lens/group2/persistent_context.ts b/x-pack/test/functional/apps/lens/group2/persistent_context.ts
index 0d34b0f68564d..cb3c2037f651d 100644
--- a/x-pack/test/functional/apps/lens/group2/persistent_context.ts
+++ b/x-pack/test/functional/apps/lens/group2/persistent_context.ts
@@ -31,6 +31,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
['global_discover_read', 'global_visualize_read', 'test_logstash_reader'],
{ skipBrowserRefresh: true }
);
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
});
after(async () => {
@@ -42,7 +43,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
before(async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
await navigationalSearch.focus();
await navigationalSearch.searchFor('type:lens lnsTableVis');
await navigationalSearch.clickOnOption(0);
@@ -74,7 +74,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visualize.gotoVisualizationLandingPage();
await listingTable.searchForItemWithName('lnsTableVis');
await lens.clickVisualizeListItemTitle('lnsTableVis');
- await lens.goToTimeRange();
await navigationalSearch.focus();
await navigationalSearch.searchFor('type:application lens');
await navigationalSearch.clickOnOption(0);
@@ -109,7 +108,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visualize.gotoVisualizationLandingPage();
await listingTable.searchForItemWithName('lnsTableVis');
await lens.clickVisualizeListItemTitle('lnsTableVis');
- await lens.goToTimeRange();
// go to empty vis
await lens.goToListingPageViaBreadcrumbs();
await visualize.clickNewVisualization();
diff --git a/x-pack/test/functional/apps/lens/group2/table.ts b/x-pack/test/functional/apps/lens/group2/table.ts
index 7de5645b16b03..d1531cf231461 100644
--- a/x-pack/test/functional/apps/lens/group2/table.ts
+++ b/x-pack/test/functional/apps/lens/group2/table.ts
@@ -9,18 +9,20 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
- const { visualize, lens } = getPageObjects(['visualize', 'lens']);
+ const { visualize, lens, timePicker } = getPageObjects(['visualize', 'lens', 'timePicker']);
const listingTable = getService('listingTable');
const find = getService('find');
const retry = getService('retry');
const testSubjects = getService('testSubjects');
describe('lens datatable', () => {
+ before(async () => {
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
+ });
it('should able to sort a table by a column', async () => {
await visualize.gotoVisualizationLandingPage();
await listingTable.searchForItemWithName('lnsXYvis');
await lens.clickVisualizeListItemTitle('lnsXYvis');
- await lens.goToTimeRange();
await lens.switchToVisualization('lnsDatatable');
// Sort by number
await lens.changeTableSortingBy(2, 'ascending');
diff --git a/x-pack/test/functional/apps/lens/group2/table_dashboard.ts b/x-pack/test/functional/apps/lens/group2/table_dashboard.ts
index a877211030972..77291fe347f52 100644
--- a/x-pack/test/functional/apps/lens/group2/table_dashboard.ts
+++ b/x-pack/test/functional/apps/lens/group2/table_dashboard.ts
@@ -9,7 +9,12 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
- const { lens, visualize, dashboard } = getPageObjects(['lens', 'visualize', 'dashboard']);
+ const { lens, visualize, dashboard, timePicker } = getPageObjects([
+ 'lens',
+ 'visualize',
+ 'dashboard',
+ 'timePicker',
+ ]);
const listingTable = getService('listingTable');
const retry = getService('retry');
@@ -35,11 +40,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
};
describe('lens table on dashboard', () => {
+ before(async () => {
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
+ });
it('should sort a table by column in dashboard edit mode', async () => {
await visualize.gotoVisualizationLandingPage();
await listingTable.searchForItemWithName('lnsXYvis');
await lens.clickVisualizeListItemTitle('lnsXYvis');
- await lens.goToTimeRange();
await lens.switchToVisualization('lnsDatatable');
await lens.save('New Table', true, false, false, 'new');
diff --git a/x-pack/test/functional/apps/lens/group3/add_to_dashboard.ts b/x-pack/test/functional/apps/lens/group3/add_to_dashboard.ts
index 9b5d46dd06170..11be375ba6066 100644
--- a/x-pack/test/functional/apps/lens/group3/add_to_dashboard.ts
+++ b/x-pack/test/functional/apps/lens/group3/add_to_dashboard.ts
@@ -9,14 +9,16 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
- const { dashboard, visualize, lens, timeToVisualize, common, header } = getPageObjects([
- 'dashboard',
- 'visualize',
- 'lens',
- 'timeToVisualize',
- 'common',
- 'header',
- ]);
+ const { dashboard, visualize, lens, timeToVisualize, common, header, timePicker } =
+ getPageObjects([
+ 'dashboard',
+ 'visualize',
+ 'lens',
+ 'timeToVisualize',
+ 'common',
+ 'header',
+ 'timePicker',
+ ]);
const find = getService('find');
const listingTable = getService('listingTable');
const dashboardAddPanel = getService('dashboardAddPanel');
@@ -27,8 +29,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const createNewLens = async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
-
await lens.configureDimension({
dimension: 'lnsXY_yDimensionPanel > lns-empty-dimension',
operation: 'average',
@@ -48,8 +48,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dashboardAddPanel.filterEmbeddableNames('lnsXYvis');
await find.clickByButtonText('lnsXYvis');
await dashboardAddPanel.closeAddPanel();
- await lens.goToTimeRange();
-
await dashboard.saveDashboard(dashboardName);
await dashboard.gotoDashboardLandingPage();
await listingTable.searchAndExpectItemsCount('dashboard', dashboardName, 1);
@@ -59,12 +57,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visualize.gotoVisualizationLandingPage();
await listingTable.searchForItemWithName('Artistpreviouslyknownaslens');
await lens.clickVisualizeListItemTitle('Artistpreviouslyknownaslens');
- await lens.goToTimeRange();
await lens.waitForVisualization('legacyMtrVis');
await lens.assertLegacyMetric('Maximum of bytes', '19,986');
};
describe('lens add-to-dashboards tests', () => {
+ before(async () => {
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
+ });
it('should allow new lens to be added by value to a new dashboard', async () => {
await createNewLens();
await lens.save('New Lens from Modal', false, false, false, 'new');
@@ -226,7 +226,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should add a Lens heatmap to the dashboard', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
await lens.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
@@ -281,8 +280,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should not display', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
-
await lens.configureDimension({
dimension: 'lnsXY_yDimensionPanel > lns-empty-dimension',
operation: 'average',
@@ -330,7 +327,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should not display', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
await lens.configureDimension({
dimension: 'lnsXY_yDimensionPanel > lns-empty-dimension',
diff --git a/x-pack/test/functional/apps/lens/group3/dashboard_inline_editing.ts b/x-pack/test/functional/apps/lens/group3/dashboard_inline_editing.ts
index 312bddba10eac..bee26829d1b65 100644
--- a/x-pack/test/functional/apps/lens/group3/dashboard_inline_editing.ts
+++ b/x-pack/test/functional/apps/lens/group3/dashboard_inline_editing.ts
@@ -7,11 +7,12 @@
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
- const { dashboard, visualize, lens, timeToVisualize } = getPageObjects([
+ const { dashboard, visualize, lens, timeToVisualize, timePicker } = getPageObjects([
'dashboard',
'visualize',
'lens',
'timeToVisualize',
+ 'timePicker',
]);
const find = getService('find');
const log = getService('log');
@@ -23,7 +24,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const createNewLens = async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
await lens.configureDimension({
dimension: 'lnsXY_yDimensionPanel > lns-empty-dimension',
@@ -39,11 +39,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visualize.gotoVisualizationLandingPage();
await listingTable.searchForItemWithName('lnsXYvis');
await lens.clickVisualizeListItemTitle('lnsXYvis');
- await lens.goToTimeRange();
await lens.waitForVisualization('xyVisChart');
};
describe('lens inline editing tests', () => {
+ before(async () => {
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
+ });
it('should allow inline editing of a by value visualization', async () => {
await createNewLens();
await lens.save('New Lens from Modal', false, false, false, 'new');
diff --git a/x-pack/test/functional/apps/lens/group3/epoch_millis.ts b/x-pack/test/functional/apps/lens/group3/epoch_millis.ts
index 30f3ffddfcff1..4be779b818286 100644
--- a/x-pack/test/functional/apps/lens/group3/epoch_millis.ts
+++ b/x-pack/test/functional/apps/lens/group3/epoch_millis.ts
@@ -9,7 +9,7 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
- const { visualize, lens } = getPageObjects(['visualize', 'lens']);
+ const { visualize, lens, timePicker } = getPageObjects(['visualize', 'lens', 'timePicker']);
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
@@ -19,6 +19,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/lens/epoch_millis.json'
);
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
});
after(async () => {
@@ -31,7 +32,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
await lens.switchDataPanelIndexPattern('epoch-millis*');
- await lens.goToTimeRange();
await lens.switchToVisualization('lnsDatatable');
const fieldList = await lens.findAllFields();
expect(fieldList).to.contain('@timestamp');
diff --git a/x-pack/test/functional/apps/lens/group3/runtime_fields.ts b/x-pack/test/functional/apps/lens/group3/runtime_fields.ts
index e04a00a64c81a..bc742cf8686e7 100644
--- a/x-pack/test/functional/apps/lens/group3/runtime_fields.ts
+++ b/x-pack/test/functional/apps/lens/group3/runtime_fields.ts
@@ -9,17 +9,24 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
- const { visualize, lens, header } = getPageObjects(['visualize', 'lens', 'header']);
+ const { visualize, lens, header, timePicker } = getPageObjects([
+ 'visualize',
+ 'lens',
+ 'header',
+ 'timePicker',
+ ]);
const filterBar = getService('filterBar');
const fieldEditor = getService('fieldEditor');
const retry = getService('retry');
const dataViews = getService('dataViews');
describe('lens runtime fields', () => {
+ before(async () => {
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
+ });
it('should be able to add runtime field and use it', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
await lens.switchToVisualization('lnsDatatable');
await retry.try(async () => {
await dataViews.clickAddFieldFromSearchBar();
diff --git a/x-pack/test/functional/apps/lens/group3/terms.ts b/x-pack/test/functional/apps/lens/group3/terms.ts
index 86c43a7549e0e..17db9a2d56252 100644
--- a/x-pack/test/functional/apps/lens/group3/terms.ts
+++ b/x-pack/test/functional/apps/lens/group3/terms.ts
@@ -10,7 +10,12 @@ import moment from 'moment';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
- const { visualize, lens, common } = getPageObjects(['visualize', 'lens', 'common']);
+ const { visualize, lens, common, timePicker } = getPageObjects([
+ 'visualize',
+ 'lens',
+ 'common',
+ 'timePicker',
+ ]);
const elasticChart = getService('elasticChart');
const testSubjects = getService('testSubjects');
const comboBox = getService('comboBox');
@@ -21,12 +26,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const log = getService('log');
describe('lens terms', () => {
+ before(async () => {
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
+ });
describe('lens multi terms suite', () => {
it('should allow creation of lens xy chart with multi terms categories', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
await elasticChart.setNewChartUiDebugFlag(true);
- await lens.goToTimeRange();
await lens.configureDimension({
dimension: 'lnsXY_yDimensionPanel > lns-empty-dimension',
@@ -164,7 +171,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
await elasticChart.setNewChartUiDebugFlag(true);
- await lens.goToTimeRange();
await lens.configureDimension({
dimension: 'lnsXY_yDimensionPanel > lns-empty-dimension',
@@ -282,7 +288,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
await elasticChart.setNewChartUiDebugFlag(true);
- await lens.goToTimeRange();
await lens.switchDataPanelIndexPattern(esIndexPrefix);
await lens.configureDimension({
diff --git a/x-pack/test/functional/apps/lens/group4/chart_data.ts b/x-pack/test/functional/apps/lens/group4/chart_data.ts
index 512f820e7ed75..a9f2e7e776bbd 100644
--- a/x-pack/test/functional/apps/lens/group4/chart_data.ts
+++ b/x-pack/test/functional/apps/lens/group4/chart_data.ts
@@ -11,15 +11,15 @@ import { range } from 'lodash';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
- const { visualize, lens } = getPageObjects(['visualize', 'lens']);
+ const { visualize, lens, timePicker } = getPageObjects(['visualize', 'lens', 'timePicker']);
const elasticChart = getService('elasticChart');
describe('lens chart data', () => {
before(async () => {
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
await elasticChart.setNewChartUiDebugFlag(true);
- await lens.goToTimeRange();
await lens.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
diff --git a/x-pack/test/functional/apps/lens/group4/color_mapping.ts b/x-pack/test/functional/apps/lens/group4/color_mapping.ts
index 932c628a09afa..d22f505410939 100644
--- a/x-pack/test/functional/apps/lens/group4/color_mapping.ts
+++ b/x-pack/test/functional/apps/lens/group4/color_mapping.ts
@@ -15,14 +15,14 @@ import {
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
- const { visualize, lens } = getPageObjects(['visualize', 'lens']);
+ const { visualize, lens, timePicker } = getPageObjects(['visualize', 'lens', 'timePicker']);
const elasticChart = getService('elasticChart');
describe('lens color mapping', () => {
before(async () => {
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
await elasticChart.setNewChartUiDebugFlag(true);
await lens.configureDimension({
diff --git a/x-pack/test/functional/apps/lens/group4/colors.ts b/x-pack/test/functional/apps/lens/group4/colors.ts
index 96e1866250da2..7dc06bbd6cb85 100644
--- a/x-pack/test/functional/apps/lens/group4/colors.ts
+++ b/x-pack/test/functional/apps/lens/group4/colors.ts
@@ -8,13 +8,15 @@ import { ElasticBrandPalette } from '@kbn/coloring';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getPageObjects }: FtrProviderContext) {
- const { visualize, lens } = getPageObjects(['visualize', 'lens']);
+ const { visualize, lens, timePicker } = getPageObjects(['visualize', 'lens', 'timePicker']);
describe('lens color palette tests', () => {
+ before(async () => {
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
+ });
it('should allow to pick legacy color palette in xy chart', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
await lens.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
@@ -41,7 +43,6 @@ export default function ({ getPageObjects }: FtrProviderContext) {
it('should allow to pick color mapping palette in xy chart', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
await lens.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
diff --git a/x-pack/test/functional/apps/lens/group4/dashboard.ts b/x-pack/test/functional/apps/lens/group4/dashboard.ts
index 563023a6d2ee0..d2a180179fdc7 100644
--- a/x-pack/test/functional/apps/lens/group4/dashboard.ts
+++ b/x-pack/test/functional/apps/lens/group4/dashboard.ts
@@ -50,6 +50,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
],
{ skipBrowserRefresh: true }
);
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
});
after(async () => {
await security.testUser.restoreDefaults();
@@ -61,7 +62,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dashboardAddPanel.filterEmbeddableNames('Artistpreviouslyknownaslens');
await find.clickByButtonText('Artistpreviouslyknownaslens');
await dashboardAddPanel.closeAddPanel();
- await lens.goToTimeRange();
await lens.assertLegacyMetric('Maximum of bytes', '19,986');
});
@@ -72,7 +72,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dashboardAddPanel.filterEmbeddableNames('lnsXYvis');
await find.clickByButtonText('lnsXYvis');
await dashboardAddPanel.closeAddPanel();
- await lens.goToTimeRange();
await retry.try(async () => {
await clickInChart(30, 5); // hardcoded position of bar, depends heavy on data and charts implementation
await testSubjects.existOrFail('applyFiltersPopoverButton', { timeout: 2500 });
@@ -98,7 +97,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dashboardAddPanel.filterEmbeddableNames('lnsXYvis');
await find.clickByButtonText('lnsXYvis');
await dashboardAddPanel.closeAddPanel();
- await lens.goToTimeRange();
await retry.try(async () => {
// show the tooltip actions
await rightClickInChart(30, 5); // hardcoded position of bar, depends heavy on data and charts implementation
@@ -122,7 +120,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dashboardAddPanel.filterEmbeddableNames('lnsXYvis');
await find.clickByButtonText('lnsXYvis');
await dashboardAddPanel.closeAddPanel();
- await lens.goToTimeRange();
await dashboard.saveDashboard('lnsDrilldown');
await panelActions.expectMissingPanelAction(
@@ -139,7 +136,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await find.clickByButtonText('lnsPieVis');
await dashboardAddPanel.closeAddPanel();
- await lens.goToTimeRange();
await clickInChart(5, 5); // hardcoded position of the slice, depends heavy on data and charts implementation
await lens.assertExactText(
@@ -189,7 +185,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dashboard.clickNewDashboard();
await dashboardAddPanel.clickCreateNewLink();
await header.waitUntilLoadingHasFinished();
- await lens.goToTimeRange();
await lens.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
operation: 'date_histogram',
@@ -251,7 +246,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dashboardAddPanel.clickCreateNewLink();
await header.waitUntilLoadingHasFinished();
- await lens.goToTimeRange();
await lens.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
@@ -282,7 +276,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dashboardAddPanel.filterEmbeddableNames('lnsXYvis');
await find.clickByButtonText('lnsXYvis');
await dashboardAddPanel.closeAddPanel();
- await lens.goToTimeRange();
// type an invalid search query, hit refresh
await queryBar.setQuery('this is > not valid');
await queryBar.submitQuery();
diff --git a/x-pack/test/functional/apps/lens/group4/share.ts b/x-pack/test/functional/apps/lens/group4/share.ts
index 4d01b3cf65c91..5972a77f3195d 100644
--- a/x-pack/test/functional/apps/lens/group4/share.ts
+++ b/x-pack/test/functional/apps/lens/group4/share.ts
@@ -9,7 +9,7 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
- const { visualize, lens } = getPageObjects(['visualize', 'lens']);
+ const { visualize, lens, timePicker } = getPageObjects(['visualize', 'lens', 'timePicker']);
const browser = getService('browser');
const filterBarService = getService('filterBar');
const queryBar = getService('queryBar');
@@ -17,6 +17,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
describe('lens share tests', () => {
before(async () => {
await visualize.gotoVisualizationLandingPage();
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
});
afterEach(async () => {
@@ -30,7 +31,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should disable the share button if no request is made', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
expect(await lens.isShareable()).to.eql(false);
});
diff --git a/x-pack/test/functional/apps/lens/group4/show_underlying_data.ts b/x-pack/test/functional/apps/lens/group4/show_underlying_data.ts
index 5caf47a41847d..843caca698b80 100644
--- a/x-pack/test/functional/apps/lens/group4/show_underlying_data.ts
+++ b/x-pack/test/functional/apps/lens/group4/show_underlying_data.ts
@@ -8,14 +8,16 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
- const { visualize, lens, common, header, discover, unifiedFieldList } = getPageObjects([
- 'visualize',
- 'lens',
- 'common',
- 'header',
- 'discover',
- 'unifiedFieldList',
- ]);
+ const { visualize, lens, common, header, discover, unifiedFieldList, timePicker } =
+ getPageObjects([
+ 'visualize',
+ 'lens',
+ 'common',
+ 'header',
+ 'discover',
+ 'unifiedFieldList',
+ 'timePicker',
+ ]);
const queryBar = getService('queryBar');
const filterBar = getService('filterBar');
const listingTable = getService('listingTable');
@@ -24,11 +26,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const browser = getService('browser');
describe('show underlying data', () => {
+ before(async () => {
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
+ });
it('should show the open button for a compatible saved visualization', async () => {
await visualize.gotoVisualizationLandingPage();
await listingTable.searchForItemWithName('lnsXYvis');
await lens.clickVisualizeListItemTitle('lnsXYvis');
- await lens.goToTimeRange();
await lens.waitForVisualization('xyVisChart');
diff --git a/x-pack/test/functional/apps/lens/group4/show_underlying_data_dashboard.ts b/x-pack/test/functional/apps/lens/group4/show_underlying_data_dashboard.ts
index de563366af3fb..99e7020d6ce18 100644
--- a/x-pack/test/functional/apps/lens/group4/show_underlying_data_dashboard.ts
+++ b/x-pack/test/functional/apps/lens/group4/show_underlying_data_dashboard.ts
@@ -11,13 +11,14 @@ import { FtrProviderContext } from '../../../ftr_provider_context';
const OPEN_IN_DISCOVER_DATA_TEST_SUBJ = 'embeddablePanelAction-ACTION_OPEN_IN_DISCOVER';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
- const { visualize, lens, dashboard, header, discover, common } = getPageObjects([
+ const { visualize, lens, dashboard, header, discover, common, timePicker } = getPageObjects([
'visualize',
'lens',
'dashboard',
'header',
'discover',
'common',
+ 'timePicker',
]);
const listingTable = getService('listingTable');
@@ -30,11 +31,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const retry = getService('retry');
describe('lens show underlying data from dashboard', () => {
+ before(async () => {
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
+ });
it('should show the open button for a compatible saved visualization', async () => {
await visualize.gotoVisualizationLandingPage();
await listingTable.searchForItemWithName('lnsXYvis');
await lens.clickVisualizeListItemTitle('lnsXYvis');
- await lens.goToTimeRange();
await lens.save('Embedded Visualization', true, false, false, 'new');
await dashboard.saveDashboard(`Open in Discover Testing ${uuidv4()}`, {
diff --git a/x-pack/test/functional/apps/lens/group4/time_shift.ts b/x-pack/test/functional/apps/lens/group4/time_shift.ts
index 9cbe84f033ff2..9de55809ea906 100644
--- a/x-pack/test/functional/apps/lens/group4/time_shift.ts
+++ b/x-pack/test/functional/apps/lens/group4/time_shift.ts
@@ -9,13 +9,15 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
- const { visualize, lens } = getPageObjects(['visualize', 'lens']);
+ const { visualize, lens, timePicker } = getPageObjects(['visualize', 'lens', 'timePicker']);
describe('time shift', () => {
+ before(async () => {
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
+ });
it('should able to configure a shifted metric', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
await lens.switchToVisualization('lnsDatatable');
await lens.configureDimension({
dimension: 'lnsDatatable_rows > lns-empty-dimension',
diff --git a/x-pack/test/functional/apps/lens/group5/drag_and_drop.ts b/x-pack/test/functional/apps/lens/group5/drag_and_drop.ts
index 144c9f0b8995f..0b20775870693 100644
--- a/x-pack/test/functional/apps/lens/group5/drag_and_drop.ts
+++ b/x-pack/test/functional/apps/lens/group5/drag_and_drop.ts
@@ -9,21 +9,38 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
- const { visualize, lens, header } = getPageObjects(['visualize', 'lens', 'header']);
+ const { visualize, lens, header, timePicker } = getPageObjects([
+ 'visualize',
+ 'lens',
+ 'header',
+ 'timePicker',
+ ]);
const listingTable = getService('listingTable');
const xyChartContainer = 'xyVisChart';
describe('lens drag and drop tests', () => {
+ before(async () => {
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
+ });
describe('basic drag and drop', () => {
- it('should construct the basic split xy chart', async () => {
+ it('should construct a bar chart when dropping a field to create top values chart', async () => {
+ await visualize.navigateToNewVisualization();
+ await visualize.clickVisType('lens');
+ await header.waitUntilLoadingHasFinished();
+ await lens.dragFieldToWorkspace('machine.os.raw', xyChartContainer);
+ expect(await lens.getDimensionTriggerText('lnsXY_xDimensionPanel')).to.eql(
+ 'Top 5 values of machine.os.raw'
+ );
+ expect(await lens.getChartTypeFromChartSwitcher()).to.eql('Bar');
+ });
+ it('should construct a line chart when dropping a time field to create a date histogram chart', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
await header.waitUntilLoadingHasFinished();
await lens.dragFieldToWorkspace('@timestamp', xyChartContainer);
-
expect(await lens.getDimensionTriggerText('lnsXY_xDimensionPanel')).to.eql('@timestamp');
+ expect(await lens.getChartTypeFromChartSwitcher()).to.eql('Line');
});
it('should allow dropping fields to existing and empty dimension triggers', async () => {
@@ -224,7 +241,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should drop a field to workspace', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
await header.waitUntilLoadingHasFinished();
await lens.dragFieldWithKeyboard('@timestamp');
expect(await lens.getDimensionTriggerText('lnsXY_xDimensionPanel')).to.eql('@timestamp');
@@ -300,7 +316,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should always nest time dimension in categorical dimension', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
await header.waitUntilLoadingHasFinished();
await lens.dragFieldToWorkspace('@timestamp', xyChartContainer);
await lens.waitForVisualization(xyChartContainer);
@@ -330,7 +345,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visualize.gotoVisualizationLandingPage();
await listingTable.searchForItemWithName('lnsXYvis');
await lens.clickVisualizeListItemTitle('lnsXYvis');
- await lens.goToTimeRange();
await lens.createLayer('data');
@@ -410,7 +424,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visualize.gotoVisualizationLandingPage();
await listingTable.searchForItemWithName('lnsXYvis');
await lens.clickVisualizeListItemTitle('lnsXYvis');
- await lens.goToTimeRange();
await lens.createLayer('data');
await lens.dragFieldToDimensionTrigger(
diff --git a/x-pack/test/functional/apps/lens/group5/formula.ts b/x-pack/test/functional/apps/lens/group5/formula.ts
index 95404faf5a99d..0ad2d3a6c5854 100644
--- a/x-pack/test/functional/apps/lens/group5/formula.ts
+++ b/x-pack/test/functional/apps/lens/group5/formula.ts
@@ -9,7 +9,12 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
- const { visualize, lens, common } = getPageObjects(['visualize', 'lens', 'common']);
+ const { visualize, lens, common, timePicker } = getPageObjects([
+ 'visualize',
+ 'lens',
+ 'common',
+ 'timePicker',
+ ]);
const find = getService('find');
const listingTable = getService('listingTable');
const browser = getService('browser');
@@ -19,11 +24,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const dataViews = getService('dataViews');
describe('lens formula', () => {
+ before(async () => {
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
+ });
it('should transition from count to formula', async () => {
await visualize.gotoVisualizationLandingPage();
await listingTable.searchForItemWithName('lnsXYvis');
await lens.clickVisualizeListItemTitle('lnsXYvis');
- await lens.goToTimeRange();
await lens.configureDimension({
dimension: 'lnsXY_yDimensionPanel > lns-dimensionTrigger',
@@ -43,7 +50,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should update and delete a formula', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
+
await lens.switchToVisualization('lnsDatatable');
await lens.configureDimension({
@@ -64,7 +71,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should insert single quotes and escape when needed to create valid KQL', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
+
await lens.switchToVisualization('lnsDatatable');
await lens.configureDimension({
@@ -96,7 +103,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should insert single quotes and escape when needed to create valid field name', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
+
await lens.switchToVisualization('lnsDatatable');
await dataViews.clickAddFieldFromSearchBar();
await fieldEditor.setName(`ab' "'`, true, true);
@@ -127,7 +134,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should persist a broken formula on close', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
+
await lens.switchToVisualization('lnsDatatable');
// Close immediately
@@ -145,7 +152,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should keep the formula when entering expanded mode', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
+
await lens.switchToVisualization('lnsDatatable');
await lens.configureDimension({
@@ -164,7 +171,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should allow an empty formula combined with a valid formula', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
+
await lens.switchToVisualization('lnsDatatable');
await lens.configureDimension({
@@ -184,7 +191,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should duplicate a moving average formula and be a valid table with conditional coloring', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
+
await lens.switchToVisualization('lnsDatatable');
await lens.configureDimension({
@@ -219,7 +226,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should keep the formula if the user does not fully transition to a quick function', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
+
await lens.switchToVisualization('lnsDatatable');
await lens.configureDimension({
@@ -240,7 +247,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should keep the formula if the user does not fully transition to a static value', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
await lens.configureDimension({
dimension: 'lnsXY_yDimensionPanel > lns-empty-dimension',
@@ -269,7 +275,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should allow numeric only formulas', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
+
await lens.switchToVisualization('lnsDatatable');
await lens.configureDimension({
@@ -289,7 +295,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should apply a global filter to the current formula', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
+
await lens.switchToVisualization('lnsDatatable');
await lens.configureDimension({
diff --git a/x-pack/test/functional/apps/lens/group5/heatmap.ts b/x-pack/test/functional/apps/lens/group5/heatmap.ts
index 7597b0448433d..dfd5bfe2242c5 100644
--- a/x-pack/test/functional/apps/lens/group5/heatmap.ts
+++ b/x-pack/test/functional/apps/lens/group5/heatmap.ts
@@ -9,7 +9,12 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
- const { visualize, lens, common } = getPageObjects(['visualize', 'lens', 'common']);
+ const { visualize, lens, common, timePicker } = getPageObjects([
+ 'visualize',
+ 'lens',
+ 'common',
+ 'timePicker',
+ ]);
const elasticChart = getService('elasticChart');
const testSubjects = getService('testSubjects');
const retry = getService('retry');
@@ -19,7 +24,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
await elasticChart.setNewChartUiDebugFlag(true);
- await lens.goToTimeRange();
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
await lens.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
diff --git a/x-pack/test/functional/apps/lens/group5/tagcloud.ts b/x-pack/test/functional/apps/lens/group5/tagcloud.ts
index dd718a476a489..f6b5f0531e5a9 100644
--- a/x-pack/test/functional/apps/lens/group5/tagcloud.ts
+++ b/x-pack/test/functional/apps/lens/group5/tagcloud.ts
@@ -9,21 +9,23 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
- const { visualize, lens, header, tagCloud } = getPageObjects([
+ const { visualize, lens, header, tagCloud, timePicker } = getPageObjects([
'visualize',
'lens',
'header',
'tagCloud',
+ 'timePicker',
]);
const elasticChart = getService('elasticChart');
const filterBar = getService('filterBar');
describe('lens tagcloud', () => {
before(async () => {
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
await elasticChart.setNewChartUiDebugFlag(true);
- await lens.goToTimeRange();
+
await lens.switchToVisualization('lnsTagcloud', 'Tag cloud');
await lens.configureDimension({
diff --git a/x-pack/test/functional/apps/lens/group6/annotations.ts b/x-pack/test/functional/apps/lens/group6/annotations.ts
index 7556440eeb3bb..694093fc9d39e 100644
--- a/x-pack/test/functional/apps/lens/group6/annotations.ts
+++ b/x-pack/test/functional/apps/lens/group6/annotations.ts
@@ -9,10 +9,10 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
- const { visualize, lens, common, tagManagement } = getPageObjects([
+ const { visualize, lens, timePicker, tagManagement } = getPageObjects([
'visualize',
'lens',
- 'common',
+ 'timePicker',
'tagManagement',
]);
const find = getService('find');
@@ -20,15 +20,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const toastsService = getService('toasts');
const testSubjects = getService('testSubjects');
const listingTable = getService('listingTable');
- const from = 'Sep 19, 2015 @ 06:31:44.000';
- const to = 'Sep 23, 2015 @ 18:31:44.000';
describe('lens annotations tests', () => {
before(async () => {
- await common.setTime({ from, to });
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
});
after(async () => {
- await common.unsetTime();
+ await timePicker.resetDefaultAbsoluteRangeViaUiSettings();
});
it('should show a disabled annotation layer button if there is no date histogram in data layer', async () => {
@@ -46,7 +44,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should add manual annotation layer with static date and allow edition', async () => {
await lens.removeLayer();
- await lens.goToTimeRange();
await lens.dragFieldToWorkspace('@timestamp', 'xyVisChart');
await lens.createLayer('annotations');
@@ -117,8 +114,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should save annotation group to library', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
-
- await lens.goToTimeRange();
await lens.dragFieldToWorkspace('@timestamp', 'xyVisChart');
await lens.createLayer('annotations');
@@ -166,8 +161,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should add annotation group from library', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
-
- await lens.goToTimeRange();
await lens.dragFieldToWorkspace('@timestamp', 'xyVisChart');
await lens.createLayer('annotations', ANNOTATION_GROUP_TITLE);
diff --git a/x-pack/test/functional/apps/lens/group6/disable_auto_apply.ts b/x-pack/test/functional/apps/lens/group6/disable_auto_apply.ts
index 8cccfd759450d..376340f204a25 100644
--- a/x-pack/test/functional/apps/lens/group6/disable_auto_apply.ts
+++ b/x-pack/test/functional/apps/lens/group6/disable_auto_apply.ts
@@ -9,12 +9,15 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
- const { lens, visualize } = getPageObjects(['lens', 'visualize']);
+ const { lens, visualize, timePicker } = getPageObjects(['lens', 'visualize', 'timePicker']);
const browser = getService('browser');
const testSubjects = getService('testSubjects');
const retry = getService('retry');
describe('lens disable auto-apply tests', () => {
+ before(async () => {
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
+ });
it('should persist auto-apply setting across page refresh', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
@@ -47,8 +50,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
it('should preserve apply-changes button with full-screen datasource', async () => {
- await lens.goToTimeRange();
-
await lens.disableAutoApply();
await lens.closeSettingsMenu();
diff --git a/x-pack/test/functional/apps/lens/group6/inspector.ts b/x-pack/test/functional/apps/lens/group6/inspector.ts
index 56d8fd3cdd7b1..3f2715f4f4d05 100644
--- a/x-pack/test/functional/apps/lens/group6/inspector.ts
+++ b/x-pack/test/functional/apps/lens/group6/inspector.ts
@@ -8,17 +8,17 @@ import expect from '@kbn/expect';
import type { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
- const { visualize, lens } = getPageObjects(['visualize', 'lens']);
+ const { visualize, lens, timePicker } = getPageObjects(['visualize', 'lens', 'timePicker']);
const elasticChart = getService('elasticChart');
const inspector = getService('inspector');
const testSubjects = getService('testSubjects');
describe('lens inspector', () => {
before(async () => {
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
await elasticChart.setNewChartUiDebugFlag(true);
- await lens.goToTimeRange();
await lens.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
diff --git a/x-pack/test/functional/apps/lens/group6/legacy_metric.ts b/x-pack/test/functional/apps/lens/group6/legacy_metric.ts
index 9b404e7f8e531..1a6f7b61b19e1 100644
--- a/x-pack/test/functional/apps/lens/group6/legacy_metric.ts
+++ b/x-pack/test/functional/apps/lens/group6/legacy_metric.ts
@@ -9,18 +9,25 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
- const { visualize, lens, header } = getPageObjects(['visualize', 'lens', 'header']);
+ const { visualize, lens, header, timePicker } = getPageObjects([
+ 'visualize',
+ 'lens',
+ 'header',
+ 'timePicker',
+ ]);
const listingTable = getService('listingTable');
const retry = getService('retry');
const filterBar = getService('filterBar');
const testSubjects = getService('testSubjects');
describe('lens legacy metric', () => {
+ before(async () => {
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
+ });
it('should render a numeric metric', async () => {
await visualize.gotoVisualizationLandingPage();
await listingTable.searchForItemWithName('Artistpreviouslyknownaslens');
await lens.clickVisualizeListItemTitle('Artistpreviouslyknownaslens');
- await lens.goToTimeRange();
await lens.assertLegacyMetric('Maximum of bytes', '19,986');
});
diff --git a/x-pack/test/functional/apps/lens/group6/lens_reporting.ts b/x-pack/test/functional/apps/lens/group6/lens_reporting.ts
index 4b2a182df741a..7ed7569644e7c 100644
--- a/x-pack/test/functional/apps/lens/group6/lens_reporting.ts
+++ b/x-pack/test/functional/apps/lens/group6/lens_reporting.ts
@@ -78,7 +78,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visualize.gotoVisualizationLandingPage();
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
await lens.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
diff --git a/x-pack/test/functional/apps/lens/group6/lens_tagging.ts b/x-pack/test/functional/apps/lens/group6/lens_tagging.ts
index 56f97c8751d77..37657b38e6f1b 100644
--- a/x-pack/test/functional/apps/lens/group6/lens_tagging.ts
+++ b/x-pack/test/functional/apps/lens/group6/lens_tagging.ts
@@ -44,7 +44,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('adds a new tag to a Lens visualization', async () => {
// create lens
await dashboardAddPanel.clickCreateNewLink();
- await lens.goToTimeRange();
await lens.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
operation: 'date_histogram',
diff --git a/x-pack/test/functional/apps/lens/group6/metric.ts b/x-pack/test/functional/apps/lens/group6/metric.ts
index fcf8cd6f7e557..6e914649d4f0b 100644
--- a/x-pack/test/functional/apps/lens/group6/metric.ts
+++ b/x-pack/test/functional/apps/lens/group6/metric.ts
@@ -9,7 +9,12 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
- const { visualize, lens, common } = getPageObjects(['visualize', 'lens', 'common']);
+ const { visualize, lens, common, timePicker } = getPageObjects([
+ 'visualize',
+ 'lens',
+ 'common',
+ 'timePicker',
+ ]);
const testSubjects = getService('testSubjects');
const filterBar = getService('filterBar');
const retry = getService('retry');
@@ -73,10 +78,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
};
describe('lens metric', () => {
+ before(async () => {
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
+ });
it('should render a metric', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
await lens.switchToVisualization('lnsMetric', 'Metric');
@@ -349,7 +356,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('does carry custom formatting when transitioning from other visualization', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
await lens.switchToVisualization('lnsLegacyMetric');
// await lens.clickLegacyMetric();
diff --git a/x-pack/test/functional/apps/lens/group6/reference_lines.ts b/x-pack/test/functional/apps/lens/group6/reference_lines.ts
index 245162b5e4742..309d4d005aeec 100644
--- a/x-pack/test/functional/apps/lens/group6/reference_lines.ts
+++ b/x-pack/test/functional/apps/lens/group6/reference_lines.ts
@@ -9,12 +9,15 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
- const { visualize, lens } = getPageObjects(['visualize', 'lens']);
+ const { visualize, lens, timePicker } = getPageObjects(['visualize', 'lens', 'timePicker']);
const find = getService('find');
const retry = getService('retry');
const testSubjects = getService('testSubjects');
describe('lens reference lines tests', () => {
+ before(async () => {
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
+ });
it('should show a disabled reference layer button if no data dimension is defined', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
@@ -29,8 +32,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
it('should add a reference layer with a static value in it', async () => {
- await lens.goToTimeRange();
-
await lens.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
operation: 'date_histogram',
diff --git a/x-pack/test/functional/apps/lens/group6/rollup.ts b/x-pack/test/functional/apps/lens/group6/rollup.ts
index c1d3c343350d7..923edcfb54eaa 100644
--- a/x-pack/test/functional/apps/lens/group6/rollup.ts
+++ b/x-pack/test/functional/apps/lens/group6/rollup.ts
@@ -34,8 +34,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should allow creation of lens xy chart', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
-
await lens.configureDimension({
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
operation: 'date_histogram',
@@ -62,7 +60,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visualize.gotoVisualizationLandingPage();
await listingTable.searchForItemWithName('Afancilenstest');
await lens.clickVisualizeListItemTitle('Afancilenstest');
- await lens.goToTimeRange();
expect(await lens.getTitle()).to.eql('Afancilenstest');
@@ -82,7 +79,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should allow to switch from regular index to rollup index retaining config', async () => {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
await lens.switchDataPanelIndexPattern('lens_regular_data');
await lens.switchToVisualization('lnsLegacyMetric');
await lens.configureDimension({
diff --git a/x-pack/test/functional/apps/lens/group6/workspace_size.ts b/x-pack/test/functional/apps/lens/group6/workspace_size.ts
index 0ba44a5249c6e..d9b054ffbe5df 100644
--- a/x-pack/test/functional/apps/lens/group6/workspace_size.ts
+++ b/x-pack/test/functional/apps/lens/group6/workspace_size.ts
@@ -9,7 +9,7 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
- const { visualize, lens } = getPageObjects(['visualize', 'lens']);
+ const { visualize, lens, timePicker } = getPageObjects(['visualize', 'lens', 'timePicker']);
const browser = getService('browser');
const testSubjects = getService('testSubjects');
const retry = getService('retry');
@@ -44,7 +44,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visualize.navigateToNewVisualization();
await visualize.clickVisType('lens');
- await lens.goToTimeRange();
+ await timePicker.setDefaultAbsoluteRangeViaUiSettings();
// Detect here if the Chrome bug is present, and adjust the aspect ratio accordingly if not
if (!within(width, DEFAULT_WINDOW_SIZE[0]) || !within(height, DEFAULT_WINDOW_SIZE[1])) {
const { width: containerWidth, height: containerHeight } =
diff --git a/x-pack/test/functional/page_objects/lens_page.ts b/x-pack/test/functional/page_objects/lens_page.ts
index 310f52f7e651b..f4db890b26952 100644
--- a/x-pack/test/functional/page_objects/lens_page.ts
+++ b/x-pack/test/functional/page_objects/lens_page.ts
@@ -915,6 +915,10 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont
}
});
},
+ async getChartTypeFromChartSwitcher() {
+ const chartSwitcher = await testSubjects.find('lnsChartSwitchPopover');
+ return await chartSwitcher.getVisibleText();
+ },
async openChartSwitchPopover(layerIndex = 0) {
if (await testSubjects.exists('lnsChartSwitchList', { timeout: 50 })) {