Skip to content

Commit

Permalink
✅ Add edit metadata tests in visualize list page
Browse files Browse the repository at this point in the history
  • Loading branch information
dej611 committed Aug 31, 2023
1 parent d8017a1 commit ee1fef6
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 9 deletions.
12 changes: 4 additions & 8 deletions test/functional/apps/dashboard/group4/dashboard_listing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['dashboard', 'header', 'common']);
const browser = getService('browser');
const listingTable = getService('listingTable');
const testSubjects = getService('testSubjects');
const retry = getService('retry');
const dashboardAddPanel = getService('dashboardAddPanel');

describe('dashboard listing page', function describeIndexTests() {
Expand Down Expand Up @@ -217,12 +215,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

await PageObjects.dashboard.gotoDashboardLandingPage();
await listingTable.searchForItemWithName(`${dashboardName}-editMetaData`);
await testSubjects.click('inspect-action');
await testSubjects.setValue('nameInput', 'new title');
await testSubjects.setValue('descriptionInput', 'new description');
await retry.try(async () => {
await testSubjects.click('saveButton');
await testSubjects.missingOrFail('flyoutTitle');
await listingTable.inspectVisualization();
await listingTable.editVisualizationDetails({
title: 'new title',
description: 'new description',
});

await listingTable.searchAndExpectItemsCount('dashboard', 'new title', 1);
Expand Down
17 changes: 17 additions & 0 deletions test/functional/apps/visualize/group3/_visualize_listing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,22 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await listingTable.expectItemsCount('visualize', 0);
});
});

describe('Edit', () => {
before(async () => {
await PageObjects.visualize.gotoVisualizationLandingPage();
});

it('should edit the title and description of a visualization', async () => {
await listingTable.searchForItemWithName('Hello');
await listingTable.inspectVisualization();
await listingTable.editVisualizationDetails({
title: 'new title',
description: 'new description',
});
await listingTable.searchForItemWithName('new title');
await listingTable.expectItemsCount('visualize', 1);
});
});
});
}
29 changes: 29 additions & 0 deletions test/functional/services/listing_table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,35 @@ export class ListingTableService extends FtrService {
return visualizationNames;
}

/**
* Open the inspect flyout
*/
public async inspectVisualization(index: number = 0) {
const inspectButtons = await this.testSubjects.findAll('inspect-action');
await inspectButtons[index].click();
}

/**
* Edit Visualization title and description in the flyout
*/
public async editVisualizationDetails(
{ title, description }: { title?: string; description?: string } = {},
shouldSave: boolean = true
) {
if (title) {
await this.testSubjects.setValue('nameInput', title);
}
if (description) {
await this.testSubjects.setValue('descriptionInput', description);
}
if (shouldSave) {
await this.retry.try(async () => {
await this.testSubjects.click('saveButton');
await this.testSubjects.missingOrFail('flyoutTitle');
});
}
}

/**
* Returns items count on landing page
*/
Expand Down
12 changes: 12 additions & 0 deletions x-pack/test/functional/apps/lens/group1/smokescreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -761,5 +761,17 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const hasVisualOptionsButton = await PageObjects.lens.hasVisualOptionsButton();
expect(hasVisualOptionsButton).to.be(false);
});

it('should allow edit meta-data for Lens chart on listing page', async () => {
await PageObjects.visualize.gotoVisualizationLandingPage();
await listingTable.searchForItemWithName('Afancilenstest');
await listingTable.inspectVisualization();
await listingTable.editVisualizationDetails({
title: 'Anewfancilenstest',
description: 'new description',
});
await listingTable.searchForItemWithName('Anewfancilenstest');
await listingTable.expectItemsCount('visualize', 1);
});
});
}
31 changes: 30 additions & 1 deletion x-pack/test/functional/apps/maps/group4/visualize_create_menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import expect from '@kbn/expect';

export default function ({ getService, getPageObjects }) {
const PageObjects = getPageObjects(['visualize', 'header', 'maps']);

const listingTable = getService('listingTable');
const security = getService('security');

describe('visualize create menu', () => {
Expand Down Expand Up @@ -85,5 +85,34 @@ export default function ({ getService, getPageObjects }) {
expect(hasLegecyViz).to.equal(false);
});
});
describe('edit meta-data', () => {
before(async () => {
await security.testUser.setRoles(['global_visualize_all', 'test_logstash_reader'], {
skipBrowserRefresh: true,
});

await PageObjects.visualize.navigateToNewAggBasedVisualization();
});

after(async () => {
await security.testUser.restoreDefaults();
});

it('should allow to change meta-data on a map visualization', async () => {
await PageObjects.visualize.navigateToNewVisualization();
await PageObjects.visualize.clickMapsApp();
await PageObjects.maps.waitForLayersToLoad();
await PageObjects.maps.saveMap('myTestMap');
await PageObjects.visualize.gotoVisualizationLandingPage();
await listingTable.searchForItemWithName('myTestMap');
await listingTable.inspectVisualization();
await listingTable.editVisualizationDetails({
title: 'AnotherTestMap',
description: 'new description',
});
await listingTable.searchForItemWithName('AnotherTestMap');
await listingTable.expectItemsCount('visualize', 1);
});
});
});
}

0 comments on commit ee1fef6

Please sign in to comment.