Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions test/functional/services/listing_table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ export class ListingTableService extends FtrService {
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',
menuTestSubject: 'tagSelectableList',
toggleButtonTestSubject: 'tagFilterPopoverButton',
});

private async getSearchFilter() {
return await this.testSubjects.find('tableListSearchBox');
}
Expand Down Expand Up @@ -72,6 +78,7 @@ export class ListingTableService extends FtrService {
} else {
throw new Error('Waiting');
}
await this.header.waitUntilLoadingHasFinished();
});
}

Expand All @@ -92,12 +99,35 @@ export class ListingTableService extends FtrService {
);
if (morePages) {
await this.testSubjects.click('pagerNextButton');
await this.header.waitUntilLoadingHasFinished();
await this.waitUntilTableIsLoaded();
}
}
return visualizationNames;
}

/**
* Select tags in the searchbar's tag filter.
*/
public async selectFilterTags(...tagNames: string[]): Promise<void> {
await this.openTagPopover();
// select the tags
for (const tagName of tagNames) {
await this.testSubjects.click(`tag-searchbar-option-${tagName.replace(' ', '_')}`);
}
await this.closeTagPopover();
await this.waitUntilTableIsLoaded();
}

public async openTagPopover(): Promise<void> {
this.log.debug('ListingTable.openTagPopover');
await this.tagPopoverToggle.open();
}

public async closeTagPopover(): Promise<void> {
this.log.debug('ListingTable.closeTagPopover');
await this.tagPopoverToggle.close();
}

/**
* Navigates through all pages on Landing page and returns array of items names
*/
Expand All @@ -112,7 +142,7 @@ export class ListingTableService extends FtrService {
);
if (morePages) {
await this.testSubjects.click('pagerNextButton');
await this.header.waitUntilLoadingHasFinished();
await this.waitUntilTableIsLoaded();
}
}
return visualizationNames;
Expand Down Expand Up @@ -154,7 +184,7 @@ export class ListingTableService extends FtrService {
await this.common.pressEnterKey();
});

await this.header.waitUntilLoadingHasFinished();
await this.waitUntilTableIsLoaded();
}

/**
Expand Down
102 changes: 0 additions & 102 deletions x-pack/test/functional/apps/dashboard/group2/dashboard_tagging.ts

This file was deleted.

1 change: 0 additions & 1 deletion x-pack/test/functional/apps/dashboard/group2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export default function ({ loadTestFile }: FtrProviderContext) {
describe('dashboard', function () {
loadTestFile(require.resolve('./sync_colors'));
loadTestFile(require.resolve('./_async_dashboard'));
loadTestFile(require.resolve('./dashboard_tagging'));
loadTestFile(require.resolve('./dashboard_lens_by_value'));
loadTestFile(require.resolve('./dashboard_maps_by_value'));
loadTestFile(require.resolve('./panel_titles'));
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,14 @@

import expect from '@kbn/expect';
import { FtrProviderContext } from '../ftr_provider_context';
import { TAGFILTER_DROPDOWN_SELECTOR } from './constants';

// eslint-disable-next-line import/no-default-export
export default function ({ getPageObjects, getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const listingTable = getService('listingTable');
const testSubjects = getService('testSubjects');
const find = getService('find');
const PageObjects = getPageObjects(['dashboard', 'tagManagement', 'common', 'header']);

/**
* Select tags in the searchbar's tag filter.
*/
const selectFilterTags = async (...tagNames: string[]) => {
// open the filter dropdown
const filterButton = await find.byCssSelector(TAGFILTER_DROPDOWN_SELECTOR);
await filterButton.click();
// select the tags
for (const tagName of tagNames) {
await testSubjects.click(
`tag-searchbar-option-${PageObjects.tagManagement.testSubjFriendly(tagName)}`
);
}
// click elsewhere to close the filter dropdown
const searchFilter = await find.byCssSelector('.euiPageTemplate .euiFieldSearch');
await searchFilter.click();
// wait until the table refreshes
await listingTable.waitUntilTableIsLoaded();
};
const PageObjects = getPageObjects(['dashboard', 'tagManagement', 'common']);

describe('dashboard integration', () => {
before(async () => {
Expand Down Expand Up @@ -76,15 +54,15 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
});

it('allows to filter by selecting a tag in the filter menu', async () => {
await selectFilterTags('tag-3');
await listingTable.selectFilterTags('tag-3');

await listingTable.expectItemsCount('dashboard', 2);
const itemNames = await listingTable.getAllItemsNames();
expect(itemNames.sort()).to.eql(['dashboard 2 (tag-3)', 'dashboard 3 (tag-1 and tag-3)']);
});

it('allows to filter by multiple tags', async () => {
await selectFilterTags('tag-2', 'tag-3');
await listingTable.selectFilterTags('tag-2', 'tag-3');

await listingTable.expectItemsCount('dashboard', 3);
const itemNames = await listingTable.getAllItemsNames();
Expand Down Expand Up @@ -113,7 +91,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await PageObjects.dashboard.gotoDashboardLandingPage();
await listingTable.waitUntilTableIsLoaded();

await selectFilterTags('tag-1');
await listingTable.selectFilterTags('tag-1');
const itemNames = await listingTable.getAllItemsNames();
expect(itemNames).to.contain('my-new-dashboard');
});
Expand Down Expand Up @@ -150,14 +128,13 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await PageObjects.dashboard.gotoDashboardLandingPage();
await listingTable.waitUntilTableIsLoaded();

await selectFilterTags('my-new-tag');
await listingTable.selectFilterTags('my-new-tag');
const itemNames = await listingTable.getAllItemsNames();
expect(itemNames).to.contain('dashboard-with-new-tag');
});
});

// FLAKY: https://github.com/elastic/kibana/issues/106547
describe.skip('editing', () => {
describe('editing', () => {
beforeEach(async () => {
await PageObjects.common.navigateToApp('dashboard');
await PageObjects.dashboard.gotoDashboardLandingPage();
Expand All @@ -176,7 +153,21 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await PageObjects.dashboard.gotoDashboardLandingPage();
await listingTable.waitUntilTableIsLoaded();

await selectFilterTags('tag-3');
await listingTable.selectFilterTags('tag-3');
const itemNames = await listingTable.getAllItemsNames();
expect(itemNames).to.contain('dashboard 4 with real data (tag-1)');
});

it('retains dashboard saved object tags after quicksave', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 Thanks for combining these!

// edit and save dashboard
await PageObjects.dashboard.gotoDashboardEditMode('dashboard 4 with real data (tag-1)');
await PageObjects.dashboard.useMargins(false); // turn margins off to cause quicksave to be enabled
await PageObjects.dashboard.clickQuickSave();

// verify dashboard still has original tags
await PageObjects.dashboard.gotoDashboardLandingPage();
await listingTable.waitUntilTableIsLoaded();
await listingTable.selectFilterTags('tag-3');
const itemNames = await listingTable.getAllItemsNames();
expect(itemNames).to.contain('dashboard 4 with real data (tag-1)');
});
Expand Down
Loading