Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
rshen91 committed Apr 1, 2024
1 parent 1ef237b commit cd34f52
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 72 deletions.
1 change: 1 addition & 0 deletions packages/shared-ux/modal/tabbed/src/tabbed_modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ const TabbedModalInner: FC<ITabbedModalInner> = ({ onClose, modalTitle, modalWid
disabled={tab.disabled}
prepend={tab.prepend}
append={tab.append}
data-test-subj={tab.name}
>
{tab.name}
</EuiTab>
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/dashboard/group3/dashboard_state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
};
}
);

await PageObjects.share.closeShareModal();
// We need to add a timestamp to the URL because URL changes now only work with a hard refresh.
await browser.get(newUrl.toString());
await PageObjects.header.waitUntilLoadingHasFinished();
Expand Down
44 changes: 5 additions & 39 deletions test/functional/apps/dashboard/group5/share.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const filterBar = getService('filterBar');
const kibanaServer = getService('kibanaServer');
const testSubjects = getService('testSubjects');
const dashboardPanelActions = getService('dashboardPanelActions');
const dashboardCustomizePanel = getService('dashboardCustomizePanel');

const PageObjects = getPageObjects(['dashboard', 'common', 'share', 'timePicker']);

Expand Down Expand Up @@ -109,45 +107,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.common.unsetTime();
});

describe('snapshot share', async () => {
describe('test local state', async () => {
it('should not have "panels" state when not in unsaved changes state', async () => {
await testSubjects.missingOrFail('dashboardUnsavedChangesBadge');
expect(await getSharedUrl()).to.not.contain('panels');
});

it('should have "panels" in app state when a panel has been modified', async () => {
await dashboardPanelActions.customizePanel();
await dashboardCustomizePanel.setCustomPanelTitle('Test New Title');
await dashboardCustomizePanel.clickSaveButton();
await PageObjects.dashboard.waitForRenderComplete();
await testSubjects.existOrFail('dashboardUnsavedChangesBadge');

const sharedUrl = await getSharedUrl();
const { appState } = getStateFromUrl(sharedUrl);
expect(appState).to.contain('panels');
});

it('should once again not have "panels" state when save is clicked', async () => {
await PageObjects.dashboard.clickQuickSave();
await PageObjects.dashboard.waitForRenderComplete();
await testSubjects.missingOrFail('dashboardUnsavedChangesBadge');
expect(await getSharedUrl()).to.not.contain('panels');
describe('saved object share', async () => {
afterEach(async () => {
retry.waitFor('close share modal', async () => {
await PageObjects.share.closeShareModal(); // close modal
return await testSubjects.exists('shareTopNavButton');
});
});

describe('test filter state', async () => {
await testFilterState();
});

after(async () => {
await filterBar.removeAllFilters();
await PageObjects.dashboard.clickQuickSave();
await PageObjects.dashboard.waitForRenderComplete();
});
});

describe('saved object share', async () => {
describe('test filter state', async () => {
await testFilterState();
});
Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/functional/apps/canvas/reports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.canvas.goToListingPage();
await PageObjects.canvas.loadFirstWorkpad('The Very Cool Workpad for PDF Tests');

this.log.debug(`openShareMenuItem title: PDF Reports`);
log.debug(`openShareMenuItem title: PDF Reports`);
const isShareMenuOpen = await this.isShareMenuOpen();
if (!isShareMenuOpen) {
await this.clickShareTopNavButton();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await panelActions.expectMissingPanelAction('embeddablePanelAction-copyToDashboard');
});

it(`Permalinks doesn't show create short-url button`, async () => {
await PageObjects.share.openShareMenuItem('Permalinks');
await PageObjects.share.createShortUrlMissingOrFail();
// close the menu
await PageObjects.share.clickShareTopNavButton();
});

it('allows loading a saved query via the saved query management component', async () => {
await savedQueryManagementComponent.loadSavedQuery('OKJpgs');
const queryString = await queryBar.getQueryString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,6 @@ export default function (ctx: FtrProviderContext) {
await PageObjects.unifiedFieldList.expectMissingFieldListItemVisualize('bytes');
});

it(`Permalinks doesn't show create short-url button`, async () => {
await PageObjects.share.clickShareTopNavButton();
await PageObjects.share.createShortUrlMissingOrFail();
await PageObjects.share.clickShareTopNavButton();
});

savedQuerySecurityUtils.shouldDisallowSavingButAllowLoadingSavedQueries();
});

Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/functional/apps/lens/group6/lens_reporting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
// open the share menu and check that reporting is disabled
await PageObjects.lens.clickShareMenu();

expect(await PageObjects.lens.isShareActionEnabled(`${type}Reports`));
expect(await PageObjects.lens.isShareActionEnabled(`Export`));
});

it(`should be able to download report of the current visualization`, async () => {
Expand Down
3 changes: 3 additions & 0 deletions x-pack/test/functional/apps/maps/group3/reports/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const REPORTS_FOLDER = __dirname;

export default function ({ getPageObjects, getService }: FtrProviderContext) {
const PageObjects = getPageObjects(['reporting', 'common', 'dashboard']);
const testSubjects = getService('testSubjects');
const browser = getService('browser');
const config = getService('config');
const log = getService('log');
Expand Down Expand Up @@ -64,6 +65,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await PageObjects.dashboard.navigateToApp();
await PageObjects.dashboard.loadSavedDashboard('Ecommerce Map');
await PageObjects.reporting.openExportTab();
await testSubjects.click('pngReportOption');
await PageObjects.reporting.clickGenerateReportButton();

const percentDiff = await measurePngDifference('geo_map_report');
Expand All @@ -76,6 +78,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await PageObjects.dashboard.navigateToApp();
await PageObjects.dashboard.loadSavedDashboard('map embeddable example');
await PageObjects.reporting.openExportTab();
await testSubjects.click('pngReportOption');
await PageObjects.reporting.clickGenerateReportButton();

const percentDiff = await measurePngDifference('example_map_report');
Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/functional/apps/security/secure_roles_perm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.discover.loadSavedSearch('A Saved Search');
log.debug('click Top Nav Share button');
await PageObjects.share.clickShareTopNavButton();
await testSubjects.existOrFail('sharePanel-CSVReports');
await testSubjects.existOrFail('Exports');
});

after(async function () {
Expand Down
14 changes: 13 additions & 1 deletion x-pack/test/functional/apps/visualize/reporting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const config = getService('config');
const kibanaServer = getService('kibanaServer');
const png = getService('png');
const testSubjects = getService('testSubjects');
const retry = getService('retry');

const PageObjects = getPageObjects([
'reporting',
Expand Down Expand Up @@ -70,6 +72,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await kibanaServer.uiSettings.unset('timepicker:timeDefaults');
});

afterEach(async () => {
retry.waitFor('close share modal', async () => {
await PageObjects.share.closeShareModal(); // close modal
return await testSubjects.exists('shareTopNavButton');
});
});

it('is available if new', async () => {
await PageObjects.visualize.gotoVisualizationLandingPage();
await PageObjects.visualize.clickNewVisualization();
Expand Down Expand Up @@ -117,7 +126,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

afterEach(async () => {
await PageObjects.share.closeShareModal();
retry.waitFor('close share modal', async () => {
await PageObjects.share.closeShareModal(); // close modal
return await testSubjects.exists('shareTopNavButton');
});
});
it('TSVB Gauge: PNG file matches the baseline image', async function () {
log.debug('load saved visualization');
Expand Down
26 changes: 11 additions & 15 deletions x-pack/test/functional/page_objects/lens_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1819,20 +1819,16 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont
return await testSubjects.isEnabled('lnsApp_shareButton');
},

async isShareActionEnabled(action: 'csvDownload' | 'permalinks' | 'PNGReports' | 'PDFReports') {
async isShareActionEnabled(action: 'Export' | 'Links') {
switch (action) {
case 'csvDownload':
return await testSubjects.isEnabled('sharePanel-CSVDownload');
case 'permalinks':
return await testSubjects.isEnabled('sharePanel-Permalinks');
case 'Links':
return await testSubjects.isEnabled('Links');
default:
return await testSubjects.isEnabled(`sharePanel-${action}`);
return await testSubjects.isEnabled(action);
}
},

async ensureShareMenuIsOpen(
action: 'csvDownload' | 'permalinks' | 'PNGReports' | 'PDFReports'
) {
async ensureShareMenuIsOpen(action: 'Export' | 'Links') {
await this.clickShareMenu();

if (!(await testSubjects.exists('shareContextMenu'))) {
Expand All @@ -1844,8 +1840,8 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont
},

async openPermalinkShare() {
await this.ensureShareMenuIsOpen('permalinks');
await testSubjects.click('sharePanel-Permalinks');
await this.ensureShareMenuIsOpen('Links');
await testSubjects.click('Links');
},

async getAvailableUrlSharingOptions() {
Expand Down Expand Up @@ -1875,8 +1871,8 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont
},

async openCSVDownloadShare() {
await this.ensureShareMenuIsOpen('csvDownload');
await testSubjects.click('sharePanel-CSVDownload');
await this.ensureShareMenuIsOpen('Export');
await testSubjects.click('Export');
},

async setCSVDownloadDebugFlag(value: boolean = true) {
Expand All @@ -1886,8 +1882,8 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont
},

async openReportingShare(type: 'PNG' | 'PDF') {
await this.ensureShareMenuIsOpen(`${type}Reports`);
await testSubjects.click(`sharePanel-${type}Reports`);
await this.ensureShareMenuIsOpen(`Export`);
await testSubjects.click(`Export`);
},

async getCSVContent() {
Expand Down
1 change: 1 addition & 0 deletions x-pack/test/reporting_functional/services/scenarios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export function createScenarios(
};
const tryGeneratePngSuccess = async () => {
await PageObjects.reporting.openExportTab();
await testSubjects.click('PngReportOption');
expect(await PageObjects.reporting.canReportBeCreated()).to.be(true);
};
const tryReportsNotAvailable = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
};

describe('Discover CSV Export', () => {
afterEach(async () => {
retry.waitFor('close share modal', async () => {
await PageObjects.share.closeShareModal(); // close modal
return await testSubjects.exists('shareTopNavButton');
});
});
describe('Check Available', () => {
before(async () => {
await PageObjects.svlCommonPage.loginAsAdmin();
Expand Down Expand Up @@ -112,6 +118,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.discover.selectIndexPattern('ecommerce');
});

afterEach(async () => {
retry.waitFor('close share modal', async () => {
await PageObjects.share.closeShareModal(); // close modal
return await testSubjects.exists('shareTopNavButton');
});
});

it('generates a report with single timefilter', async () => {
await PageObjects.discover.clickNewSearchButton();
await PageObjects.timePicker.setCommonlyUsedTime('Last_24 hours');
Expand Down Expand Up @@ -291,6 +304,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
});

afterEach(async () => {
retry.waitFor('close share modal', async () => {
await PageObjects.share.closeShareModal(); // close modal
return await testSubjects.exists('shareTopNavButton');
});
});

it(`handles field formatting for a field that doesn't exist initially`, async () => {
const res = await getReport();
expect(res.status).to.equal(200);
Expand Down

0 comments on commit cd34f52

Please sign in to comment.