Skip to content

Commit

Permalink
[Lens] Add serverless functional tests (elastic#164798)
Browse files Browse the repository at this point in the history
## Summary

This PR copies, with limited modifications, functional test suites from
`test/functional` and `x-pack/test/functional`

## Lens Smoke tests
- [x] Smokescreen tests
(x-pack/test/functional/apps/lens/group1/smokescreen.ts)
- [x] Basic vega tests
(test/functional/apps/visualize/group6/_vega_chart.ts)
- [x] Sanity checks for TSDB functionality in Lens
x-pack/test/functional/apps/lens/group4/tsdb.ts

## Convert to Lens

These tests outside of serverless, assume the following vis types are
accessible via the **Visualize editor**, however all the following types
are designated **readonly** in serverless and thus the fn tests fail.

In place of these tests I created the identical visualizations, added
them to a dashboard and exported the SOs. These dashboard and dependent
visualizations are loaded in each respective test, and the assertions
are run on the `Convert to Lens` option from the dashboard. All
assertions are mostly unchanged or achieve the same effect.

- ✅ Agg based -
`x-pack/test/functional/apps/lens/open_in_lens/agg_based`
- ✅ TSVB - `x-pack/test/functional/apps/lens/open_in_lens/tsvb`
- ❌ Dashboard -
`x-pack/test/functional/apps/lens/open_in_lens/dashboard/config.ts`
  - Not applicable to serverless env and/or duplicate of other tests.

Closes elastic#162346

---------

Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Stratoula Kalafateli <[email protected]>
  • Loading branch information
3 people authored Oct 4, 2023
1 parent ffb60a1 commit 0f1a6e3
Show file tree
Hide file tree
Showing 61 changed files with 9,253 additions and 87 deletions.
3 changes: 3 additions & 0 deletions .buildkite/ftr_configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -412,13 +412,16 @@ enabled:
- x-pack/test_serverless/functional/test_suites/observability/config.ts
- x-pack/test_serverless/functional/test_suites/observability/config.examples.ts
- x-pack/test_serverless/functional/test_suites/observability/common_configs/config.group1.ts
- x-pack/test_serverless/functional/test_suites/observability/common_configs/config.group2.ts
- x-pack/test_serverless/functional/test_suites/search/config.ts
- x-pack/test_serverless/functional/test_suites/search/config.examples.ts
- x-pack/test_serverless/functional/test_suites/search/config.screenshots.ts
- x-pack/test_serverless/functional/test_suites/search/common_configs/config.group1.ts
- x-pack/test_serverless/functional/test_suites/search/common_configs/config.group2.ts
- x-pack/test_serverless/functional/test_suites/security/config.ts
- x-pack/test_serverless/functional/test_suites/security/config.examples.ts
- x-pack/test_serverless/functional/test_suites/security/common_configs/config.group1.ts
- x-pack/test_serverless/functional/test_suites/security/common_configs/config.group2.ts
- x-pack/performance/journeys/ecommerce_dashboard.ts
- x-pack/performance/journeys/ecommerce_dashboard_map_only.ts
- x-pack/performance/journeys/flight_dashboard.ts
Expand Down
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,8 @@ packages/kbn-yarn-lock-validator @elastic/kibana-operations
/test/functional/apps/visualize/ @elastic/kibana-visualizations
/x-pack/test/functional/apps/graph @elastic/kibana-visualizations
/test/api_integration/apis/event_annotations @elastic/kibana-visualizations
/x-pack/test_serverless/functional/test_suites/common/visualizations/ @elastic/kibana-visualizations
/x-pack/test_serverless/functional/fixtures/kbn_archiver/lens/ @elastic/kibana-visualizations

# Global Experience

Expand Down
2 changes: 1 addition & 1 deletion test/functional/page_objects/dashboard_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ export class DashboardPageObject extends FtrService {

await this.gotoDashboardLandingPage();

await this.listingTable.searchForItemWithName(dashboardName);
await this.listingTable.searchForItemWithName(dashboardName, { escape: false });
await this.retry.try(async () => {
await this.listingTable.clickItemLink('dashboard', dashboardName);
await this.header.waitUntilLoadingHasFinished();
Expand Down
2 changes: 1 addition & 1 deletion test/functional/page_objects/visualize_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export class VisualizePageObject extends FtrService {
await this.waitForVisualizationSelectPage();
}

public async navigateToLensFromAnotherVisulization() {
public async navigateToLensFromAnotherVisualization() {
const button = await this.testSubjects.find('visualizeEditInLensButton');
await button.click();
}
Expand Down
2 changes: 1 addition & 1 deletion test/functional/services/common/test_subjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class TestSubjects extends FtrService {
* `retry.waitFor()` loops.
*
* When `options.timeout` is not passed the `timeouts.waitForExists` config is used as
* the timeout. The default value for that config is currently 2.5 seconds.
* the timeout. The default value for that config is currently 2.5 seconds (in ms).
*
* If the element is hidden it is not treated as "existing", unless `options.allowHidden`
* is set to `true`.
Expand Down
18 changes: 15 additions & 3 deletions test/functional/services/dashboard/panel_actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,13 +382,25 @@ export class DashboardPanelActionsService extends FtrService {
throw new Error(`No action matching text "${text}"`);
}

async convertToLens(parent?: WebElementWrapper) {
this.log.debug('convertToLens');
async canConvertToLens(parent?: WebElementWrapper) {
this.log.debug('canConvertToLens');
await this.openContextMenu(parent);
const isActionVisible = await this.testSubjects.exists(CONVERT_TO_LENS_TEST_SUBJ);
if (!isActionVisible) await this.clickContextMenuMoreItem();
const isPanelActionVisible = await this.testSubjects.exists(CONVERT_TO_LENS_TEST_SUBJ);
if (!isPanelActionVisible) await this.clickContextMenuMoreItem();
await this.testSubjects.click(CONVERT_TO_LENS_TEST_SUBJ);
return await this.testSubjects.exists(CONVERT_TO_LENS_TEST_SUBJ, { timeout: 500 });
}

async convertToLens(parent?: WebElementWrapper) {
this.log.debug('convertToLens');

await this.retry.try(async () => {
if (!(await this.canConvertToLens(parent))) {
throw new Error('Convert to Lens option not found');
}

await this.testSubjects.click(CONVERT_TO_LENS_TEST_SUBJ);
});
}
}
2 changes: 0 additions & 2 deletions test/functional/services/listing_table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export class ListingTableService extends FtrService {
private readonly log = this.ctx.getService('log');
private readonly retry = this.ctx.getService('retry');
private readonly common = this.ctx.getPageObject('common');
private readonly header = this.ctx.getPageObject('header');

private readonly tagPopoverToggle = this.ctx.getService('menuToggle').create({
name: 'Tag Popover',
Expand Down Expand Up @@ -89,7 +88,6 @@ export class ListingTableService extends FtrService {
} else {
throw new Error('Waiting');
}
await this.header.waitUntilLoadingHasFinished();
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
});

it('should convert to Lens', async () => {
await visualize.navigateToLensFromAnotherVisulization();
await visualize.navigateToLensFromAnotherVisualization();
await lens.waitForVisualization('gaugeChart');
});

Expand All @@ -49,7 +49,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await visEditor.selectField('machine.ram', 'metrics');
await visEditor.clickGo();

await visualize.navigateToLensFromAnotherVisulization();
await visualize.navigateToLensFromAnotherVisualization();
await lens.waitForVisualization('gaugeChart');

expect(await lens.getLayerCount()).to.be(1);
Expand Down Expand Up @@ -101,7 +101,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {

await visEditor.clickGo();

await visualize.navigateToLensFromAnotherVisulization();
await visualize.navigateToLensFromAnotherVisualization();
await lens.waitForVisualization('gaugeChart');

expect(await lens.getLayerCount()).to.be(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
});

it('should convert to Lens', async () => {
await visualize.navigateToLensFromAnotherVisulization();
await visualize.navigateToLensFromAnotherVisualization();
await lens.waitForVisualization('mtrVis');
const data = await lens.getMetricVisualizationData();
expect(data.length).to.be.equal(1);
Expand All @@ -61,7 +61,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await visEditor.selectField('machine.ram', 'metrics');
await visEditor.clickGo();

await visualize.navigateToLensFromAnotherVisulization();
await visualize.navigateToLensFromAnotherVisualization();
await lens.waitForVisualization('mtrVis');

expect(await lens.getLayerCount()).to.be(1);
Expand Down Expand Up @@ -91,7 +91,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await visEditor.selectAggregation('Max Bucket', 'metrics');
await visEditor.clickGo();

await visualize.navigateToLensFromAnotherVisulization();
await visualize.navigateToLensFromAnotherVisualization();
await lens.waitForVisualization('mtrVis');

expect(await lens.getLayerCount()).to.be(1);
Expand Down Expand Up @@ -134,7 +134,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {

await visEditor.clickGo();

await visualize.navigateToLensFromAnotherVisulization();
await visualize.navigateToLensFromAnotherVisualization();
await lens.waitForVisualization('mtrVis');

expect(await lens.getLayerCount()).to.be(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await visEditor.selectField('machine.os.raw');
await visEditor.clickGo();

await visualize.navigateToLensFromAnotherVisulization();
await visualize.navigateToLensFromAnotherVisualization();
await lens.waitForVisualization('heatmapChart');
const debugState = await lens.getCurrentChartDebugState('heatmapChart');

Expand Down Expand Up @@ -90,7 +90,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await visEditor.selectField('machine.os.raw');
await visEditor.clickGo();

await visualize.navigateToLensFromAnotherVisulization();
await visualize.navigateToLensFromAnotherVisualization();
await lens.waitForVisualization('heatmapChart');
const debugState = await lens.getCurrentChartDebugState('heatmapChart');

Expand All @@ -114,7 +114,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await visEditor.clickGo();
await visChart.waitForVisualizationRenderingStabilized();

await visualize.navigateToLensFromAnotherVisulization();
await visualize.navigateToLensFromAnotherVisualization();
await lens.waitForVisualization('heatmapChart');
const debugState = await lens.getCurrentChartDebugState('heatmapChart');

Expand Down Expand Up @@ -174,7 +174,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await visEditor.clickGo();
await visChart.waitForVisualizationRenderingStabilized();

await visualize.navigateToLensFromAnotherVisulization();
await visualize.navigateToLensFromAnotherVisualization();
await lens.waitForVisualization('heatmapChart');
const debugState = await lens.getCurrentChartDebugState('heatmapChart');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
});

it('should convert to Lens', async () => {
await visualize.navigateToLensFromAnotherVisulization();
await visualize.navigateToLensFromAnotherVisualization();
await lens.waitForVisualization('mtrVis');
const data = await lens.getMetricVisualizationData();
expect(data.length).to.be.equal(1);
Expand All @@ -62,7 +62,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await visEditor.selectField('machine.ram', 'metrics');
await visEditor.clickGo();

await visualize.navigateToLensFromAnotherVisulization();
await visualize.navigateToLensFromAnotherVisualization();
await lens.waitForVisualization('mtrVis');

expect(await lens.getLayerCount()).to.be(1);
Expand Down Expand Up @@ -91,7 +91,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await visEditor.selectAggregation('Max Bucket', 'metrics');
await visEditor.clickGo();

await visualize.navigateToLensFromAnotherVisulization();
await visualize.navigateToLensFromAnotherVisualization();
await lens.waitForVisualization('mtrVis');

expect(await lens.getLayerCount()).to.be(1);
Expand Down Expand Up @@ -146,7 +146,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await backgroundButton.click();
await visEditor.clickGo();

await visualize.navigateToLensFromAnotherVisulization();
await visualize.navigateToLensFromAnotherVisualization();
await lens.waitForVisualization('mtrVis');

expect(await lens.getLayerCount()).to.be(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
});

it('should let the user return back to Visualize if no changes were made', async () => {
await visualize.navigateToLensFromAnotherVisulization();
await visualize.navigateToLensFromAnotherVisualization();
await lens.waitForVisualization('xyVisChart');

await retry.try(async () => {
Expand All @@ -43,7 +43,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
});

it('should let the user return back to Visualize but show a warning modal if changes happened in Lens', async () => {
await visualize.navigateToLensFromAnotherVisulization();
await visualize.navigateToLensFromAnotherVisualization();
await lens.waitForVisualization('xyVisChart');

await retry.try(async () => {
Expand Down Expand Up @@ -72,7 +72,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
});

it('should let the user return back to Visualize with no modal if changes have been saved in Lens', async () => {
await visualize.navigateToLensFromAnotherVisulization();
await visualize.navigateToLensFromAnotherVisualization();
await lens.waitForVisualization('xyVisChart');

await retry.try(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await visEditor.clickGo();
await header.waitUntilLoadingHasFinished();

await visualize.navigateToLensFromAnotherVisulization();
await visualize.navigateToLensFromAnotherVisualization();
await lens.waitForVisualization('partitionVisChart');

expect(await lens.getLayerCount()).to.be(1);
Expand All @@ -97,7 +97,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await visEditor.clickGo(isNewChartsLibraryEnabled);
await header.waitUntilLoadingHasFinished();

await visualize.navigateToLensFromAnotherVisulization();
await visualize.navigateToLensFromAnotherVisualization();
await lens.waitForVisualization('partitionVisChart');

const sliceByText = await lens.getDimensionTriggerText('lnsPie_sliceByDimensionPanel', 0);
Expand All @@ -119,7 +119,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await visEditor.clickGo(isNewChartsLibraryEnabled);
await header.waitUntilLoadingHasFinished();

await visualize.navigateToLensFromAnotherVisulization();
await visualize.navigateToLensFromAnotherVisualization();
await lens.waitForVisualization('partitionVisChart');

let chartSwitcher = await testSubjects.find('lnsChartSwitchPopover');
Expand All @@ -135,7 +135,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await visEditor.clickGo(isNewChartsLibraryEnabled);
await header.waitUntilLoadingHasFinished();

await visualize.navigateToLensFromAnotherVisulization();
await visualize.navigateToLensFromAnotherVisualization();
await lens.waitForVisualization('partitionVisChart');

chartSwitcher = await testSubjects.find('lnsChartSwitchPopover');
Expand Down
12 changes: 6 additions & 6 deletions x-pack/test/functional/apps/lens/open_in_lens/agg_based/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await visEditor.clickGo();
await header.waitUntilLoadingHasFinished();

await visualize.navigateToLensFromAnotherVisulization();
await visualize.navigateToLensFromAnotherVisualization();
await lens.waitForVisualization('lnsDataTable');

expect(await lens.getLayerCount()).to.be(1);
Expand All @@ -75,7 +75,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await visEditor.clickGo();
await header.waitUntilLoadingHasFinished();

await visualize.navigateToLensFromAnotherVisulization();
await visualize.navigateToLensFromAnotherVisualization();
await lens.waitForVisualization('lnsDataTable');

expect(await lens.getLayerCount()).to.be(1);
Expand All @@ -95,7 +95,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await visEditor.clickGo();
await header.waitUntilLoadingHasFinished();

await visualize.navigateToLensFromAnotherVisulization();
await visualize.navigateToLensFromAnotherVisualization();
await lens.waitForVisualization('lnsDataTable');

expect(await lens.getLayerCount()).to.be(1);
Expand All @@ -117,7 +117,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await visEditor.clickGo();
await header.waitUntilLoadingHasFinished();

await visualize.navigateToLensFromAnotherVisulization();
await visualize.navigateToLensFromAnotherVisualization();
await lens.waitForVisualization('lnsDataTable');

expect(await lens.getLayerCount()).to.be(1);
Expand All @@ -140,7 +140,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await visEditor.clickGo();
await header.waitUntilLoadingHasFinished();

await visualize.navigateToLensFromAnotherVisulization();
await visualize.navigateToLensFromAnotherVisualization();
await lens.waitForVisualization('lnsDataTable');

expect(await lens.getLayerCount()).to.be(1);
Expand All @@ -162,7 +162,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await visEditor.clickGo();
await header.waitUntilLoadingHasFinished();

await visualize.navigateToLensFromAnotherVisulization();
await visualize.navigateToLensFromAnotherVisualization();
await lens.waitForVisualization('lnsDataTable');

expect(await lens.getLayerCount()).to.be(1);
Expand Down
Loading

0 comments on commit 0f1a6e3

Please sign in to comment.