Skip to content

Commit

Permalink
Fix Failing test: X-Pack CCS Tests.x-pack/test/functional/apps/lens/r…
Browse files Browse the repository at this point in the history
…oup1/smokescreen·ts - lens app - group 1 lens smokescreen tests should allow to change index pattern (#133015) (#135398)

* Fix Failing test: X-Pack CCS Tests.x-pack/test/functional/apps/lens/group1/smokescreen·ts - lens app - group 1 lens smokescreen tests should allow to change index pattern

* fix CI

Co-authored-by: Kibana Machine <[email protected]>
(cherry picked from commit 0ac9a7c)

Co-authored-by: Alexey Antonov <[email protected]>
  • Loading branch information
flash1293 and alexwizp authored Jun 29, 2022
1 parent 98609f5 commit a4f8dc6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export function DataViewsList({
placeholder: i18n.translate('unifiedSearch.query.queryBar.indexPattern.findDataView', {
defaultMessage: 'Find a data view',
}),
'data-test-subj': 'indexPattern-switcher--input',
...(selectableProps ? selectableProps.searchProps : undefined),
}}
>
Expand Down
14 changes: 14 additions & 0 deletions test/functional/page_objects/unified_search_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { FtrService } from '../ftr_provider_context';

export class UnifiedSearchPageObject extends FtrService {
private readonly browser = this.ctx.getService('browser');
private readonly retry = this.ctx.getService('retry');
private readonly testSubjects = this.ctx.getService('testSubjects');

public async closeTour() {
Expand All @@ -23,4 +24,17 @@ export class UnifiedSearchPageObject extends FtrService {
await this.browser.setLocalStorageItem('data.newDataViewMenu', 'true');
await this.browser.refresh();
}

public async switchDataView(switchButtonSelector: string, dataViewTitle: string) {
await this.testSubjects.click(switchButtonSelector);

const indexPatternSwitcher = await this.testSubjects.find('indexPattern-switcher', 500);
await this.testSubjects.setValue('indexPattern-switcher--input', dataViewTitle);
await (await indexPatternSwitcher.findByCssSelector(`[title="${dataViewTitle}"]`)).click();

await this.retry.waitFor(
'wait for updating switcher',
async () => (await this.testSubjects.getVisibleText(switchButtonSelector)) === dataViewTitle
);
}
}
10 changes: 4 additions & 6 deletions x-pack/test/functional/page_objects/lens_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -841,18 +841,16 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont
/**
* Changes the index pattern in the data panel
*/
async switchDataPanelIndexPattern(name: string) {
await testSubjects.click('lns-dataView-switch-link');
await find.clickByCssSelector(`[title="${name}"]`);
async switchDataPanelIndexPattern(dataViewTitle: string) {
await PageObjects.unifiedSearch.switchDataView('lns-dataView-switch-link', dataViewTitle);
await PageObjects.header.waitUntilLoadingHasFinished();
},

/**
* Changes the index pattern for the first layer
*/
async switchFirstLayerIndexPattern(name: string) {
await testSubjects.click('lns_layerIndexPatternLabel');
await find.clickByCssSelector(`.lnsChangeIndexPatternPopover [title="${name}"]`);
async switchFirstLayerIndexPattern(dataViewTitle: string) {
await PageObjects.unifiedSearch.switchDataView('lns_layerIndexPatternLabel', dataViewTitle);
await PageObjects.header.waitUntilLoadingHasFinished();
},

Expand Down

0 comments on commit a4f8dc6

Please sign in to comment.