Skip to content

Commit

Permalink
reduce changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tsullivan committed Aug 11, 2020
1 parent a39f8af commit 44df9ce
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const dashboardPanelActions = getService('dashboardPanelActions');
const log = getService('log');
const testSubjects = getService('testSubjects');
const pageObjects = getPageObjects(['reporting', 'common', 'dashboard']);
const PageObjects = getPageObjects(['reporting', 'common', 'dashboard']);

describe('Reporting Download CSV', () => {
before('initialize tests', async () => {
Expand All @@ -41,8 +41,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

it('Downloads a CSV export of a saved search panel', async function () {
await pageObjects.common.navigateToApp('dashboard');
await pageObjects.dashboard.loadSavedDashboard('Ecom Dashboard');
await PageObjects.common.navigateToApp('dashboard');
await PageObjects.dashboard.loadSavedDashboard('Ecom Dashboard');
const savedSearchPanel = await testSubjects.find('embeddablePanelHeading-EcommerceData');
await dashboardPanelActions.toggleContextMenu(savedSearchPanel);

Expand Down
60 changes: 30 additions & 30 deletions x-pack/test/functional/apps/dashboard/reporting/screenshots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const mkdirAsync = promisify(fs.mkdir);
const REPORTS_FOLDER = path.resolve(__dirname, 'reports');

export default function ({ getPageObjects, getService }: FtrProviderContext) {
const pageObjects = getPageObjects(['reporting', 'common', 'dashboard']);
const PageObjects = getPageObjects(['reporting', 'common', 'dashboard']);
const esArchiver = getService('esArchiver');
const browser = getService('browser');
const log = getService('log');
Expand All @@ -43,16 +43,16 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {

describe('Print PDF button', () => {
it('is not available if new', async () => {
await pageObjects.common.navigateToApp('dashboard');
await pageObjects.dashboard.clickNewDashboard();
await pageObjects.reporting.openPdfReportingPanel();
expect(await pageObjects.reporting.isGenerateReportButtonDisabled()).to.be('true');
await PageObjects.common.navigateToApp('dashboard');
await PageObjects.dashboard.clickNewDashboard();
await PageObjects.reporting.openPdfReportingPanel();
expect(await PageObjects.reporting.isGenerateReportButtonDisabled()).to.be('true');
});

it('becomes available when saved', async () => {
await pageObjects.dashboard.saveDashboard('My PDF Dashboard');
await pageObjects.reporting.openPdfReportingPanel();
expect(await pageObjects.reporting.isGenerateReportButtonDisabled()).to.be(null);
await PageObjects.dashboard.saveDashboard('My PDF Dashboard');
await PageObjects.reporting.openPdfReportingPanel();
expect(await PageObjects.reporting.isGenerateReportButtonDisabled()).to.be(null);
});
});

Expand All @@ -61,14 +61,14 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
// Generating and then comparing reports can take longer than the default 60s timeout because the comparePngs
// function is taking about 15 seconds per comparison in jenkins.
this.timeout(300000);
await pageObjects.common.navigateToApp('dashboard');
await pageObjects.dashboard.loadSavedDashboard('Ecom Dashboard');
await pageObjects.reporting.openPdfReportingPanel();
await pageObjects.reporting.checkUsePrintLayout();
await pageObjects.reporting.clickGenerateReportButton();
await PageObjects.common.navigateToApp('dashboard');
await PageObjects.dashboard.loadSavedDashboard('Ecom Dashboard');
await PageObjects.reporting.openPdfReportingPanel();
await PageObjects.reporting.checkUsePrintLayout();
await PageObjects.reporting.clickGenerateReportButton();

const url = await pageObjects.reporting.getReportURL(60000);
const res = await pageObjects.reporting.getResponse(url);
const url = await PageObjects.reporting.getReportURL(60000);
const res = await PageObjects.reporting.getResponse(url);

expect(res.statusCode).to.equal(200);
expect(res.headers['content-type']).to.equal('application/pdf');
Expand All @@ -77,16 +77,16 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {

describe('Print PNG button', () => {
it('is not available if new', async () => {
await pageObjects.common.navigateToApp('dashboard');
await pageObjects.dashboard.clickNewDashboard();
await pageObjects.reporting.openPngReportingPanel();
expect(await pageObjects.reporting.isGenerateReportButtonDisabled()).to.be('true');
await PageObjects.common.navigateToApp('dashboard');
await PageObjects.dashboard.clickNewDashboard();
await PageObjects.reporting.openPngReportingPanel();
expect(await PageObjects.reporting.isGenerateReportButtonDisabled()).to.be('true');
});

it('becomes available when saved', async () => {
await pageObjects.dashboard.saveDashboard('My PNG Dash');
await pageObjects.reporting.openPngReportingPanel();
expect(await pageObjects.reporting.isGenerateReportButtonDisabled()).to.be(null);
await PageObjects.dashboard.saveDashboard('My PNG Dash');
await PageObjects.reporting.openPngReportingPanel();
expect(await PageObjects.reporting.isGenerateReportButtonDisabled()).to.be(null);
});
});

Expand All @@ -108,15 +108,15 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {

this.timeout(300000);

await pageObjects.common.navigateToApp('dashboard');
await pageObjects.dashboard.loadSavedDashboard('Ecom Dashboard');
await pageObjects.reporting.openPngReportingPanel();
await pageObjects.reporting.forceSharedItemsContainerSize({ width: 1405 });
await pageObjects.reporting.clickGenerateReportButton();
await pageObjects.reporting.removeForceSharedItemsContainerSize();
await PageObjects.common.navigateToApp('dashboard');
await PageObjects.dashboard.loadSavedDashboard('Ecom Dashboard');
await PageObjects.reporting.openPngReportingPanel();
await PageObjects.reporting.forceSharedItemsContainerSize({ width: 1405 });
await PageObjects.reporting.clickGenerateReportButton();
await PageObjects.reporting.removeForceSharedItemsContainerSize();

const url = await pageObjects.reporting.getReportURL(60000);
const reportData = await pageObjects.reporting.getRawPdfReportData(url);
const url = await PageObjects.reporting.getReportURL(60000);
const reportData = await PageObjects.reporting.getRawPdfReportData(url);
const reportFileName = 'dashboard_preserve_layout';
const sessionReportPath = await writeSessionReport(reportFileName, reportData, 'png');
const percentSimilar = await checkIfPngsMatch(
Expand Down
54 changes: 27 additions & 27 deletions x-pack/test/functional/apps/discover/reporting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const log = getService('log');
const esArchiver = getService('esArchiver');
const browser = getService('browser');
const pageObjects = getPageObjects(['reporting', 'common', 'discover']);
const PageObjects = getPageObjects(['reporting', 'common', 'discover']);
const filterBar = getService('filterBar');

describe('Discover', () => {
Expand All @@ -25,51 +25,51 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

describe('Generate CSV button', () => {
beforeEach(() => pageObjects.common.navigateToApp('discover'));
beforeEach(() => PageObjects.common.navigateToApp('discover'));

it('is not available if new', async () => {
await pageObjects.reporting.openCsvReportingPanel();
expect(await pageObjects.reporting.isGenerateReportButtonDisabled()).to.be('true');
await PageObjects.reporting.openCsvReportingPanel();
expect(await PageObjects.reporting.isGenerateReportButtonDisabled()).to.be('true');
});

it('becomes available when saved', async () => {
await pageObjects.discover.saveSearch('my search - expectEnabledGenerateReportButton');
await pageObjects.reporting.openCsvReportingPanel();
expect(await pageObjects.reporting.isGenerateReportButtonDisabled()).to.be(null);
await PageObjects.discover.saveSearch('my search - expectEnabledGenerateReportButton');
await PageObjects.reporting.openCsvReportingPanel();
expect(await PageObjects.reporting.isGenerateReportButtonDisabled()).to.be(null);
});

it('becomes available/not available when a saved search is created, changed and saved again', async () => {
// create new search, csv export is not available
await pageObjects.discover.clickNewSearchButton();
await pageObjects.reporting.openCsvReportingPanel();
expect(await pageObjects.reporting.isGenerateReportButtonDisabled()).to.be('true');
await PageObjects.discover.clickNewSearchButton();
await PageObjects.reporting.openCsvReportingPanel();
expect(await PageObjects.reporting.isGenerateReportButtonDisabled()).to.be('true');
// save search, csv export is available
await pageObjects.discover.saveSearch('my search - expectEnabledGenerateReportButton 2');
await pageObjects.reporting.openCsvReportingPanel();
expect(await pageObjects.reporting.isGenerateReportButtonDisabled()).to.be(null);
await PageObjects.discover.saveSearch('my search - expectEnabledGenerateReportButton 2');
await PageObjects.reporting.openCsvReportingPanel();
expect(await PageObjects.reporting.isGenerateReportButtonDisabled()).to.be(null);
// add filter, csv export is not available
await filterBar.addFilter('currency', 'is', 'EUR');
await pageObjects.reporting.openCsvReportingPanel();
expect(await pageObjects.reporting.isGenerateReportButtonDisabled()).to.be('true');
await PageObjects.reporting.openCsvReportingPanel();
expect(await PageObjects.reporting.isGenerateReportButtonDisabled()).to.be('true');
// save search again, csv export is available
await pageObjects.discover.saveSearch('my search - expectEnabledGenerateReportButton 2');
await pageObjects.reporting.openCsvReportingPanel();
expect(await pageObjects.reporting.isGenerateReportButtonDisabled()).to.be(null);
await PageObjects.discover.saveSearch('my search - expectEnabledGenerateReportButton 2');
await PageObjects.reporting.openCsvReportingPanel();
expect(await PageObjects.reporting.isGenerateReportButtonDisabled()).to.be(null);
});

it('generates a report with data', async () => {
await pageObjects.discover.clickNewSearchButton();
await pageObjects.reporting.setTimepickerInDataRange();
await pageObjects.discover.saveSearch('my search - with data - expectReportCanBeCreated');
await pageObjects.reporting.openCsvReportingPanel();
expect(await pageObjects.reporting.canReportBeCreated()).to.be(true);
await PageObjects.discover.clickNewSearchButton();
await PageObjects.reporting.setTimepickerInDataRange();
await PageObjects.discover.saveSearch('my search - with data - expectReportCanBeCreated');
await PageObjects.reporting.openCsvReportingPanel();
expect(await PageObjects.reporting.canReportBeCreated()).to.be(true);
});

it('generates a report with no data', async () => {
await pageObjects.reporting.setTimepickerInNoDataRange();
await pageObjects.discover.saveSearch('my search - no data - expectReportCanBeCreated');
await pageObjects.reporting.openCsvReportingPanel();
expect(await pageObjects.reporting.canReportBeCreated()).to.be(true);
await PageObjects.reporting.setTimepickerInNoDataRange();
await PageObjects.discover.saveSearch('my search - no data - expectReportCanBeCreated');
await PageObjects.reporting.openCsvReportingPanel();
expect(await PageObjects.reporting.canReportBeCreated()).to.be(true);
});
});
});
Expand Down
10 changes: 5 additions & 5 deletions x-pack/test/functional/apps/lens/lens_reporting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const pageObjects = getPageObjects(['common', 'dashboard', 'reporting']);
const PageObjects = getPageObjects(['common', 'dashboard', 'reporting']);
const es = getService('es');
const esArchiver = getService('esArchiver');
const listingTable = getService('listingTable');
Expand All @@ -28,11 +28,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

it('should not cause PDF reports to fail', async () => {
await pageObjects.common.navigateToApp('dashboard');
await PageObjects.common.navigateToApp('dashboard');
await listingTable.clickItemLink('dashboard', 'Lens reportz');
await pageObjects.reporting.openPdfReportingPanel();
await pageObjects.reporting.clickGenerateReportButton();
const url = await pageObjects.reporting.getReportURL(60000);
await PageObjects.reporting.openPdfReportingPanel();
await PageObjects.reporting.clickGenerateReportButton();
const url = await PageObjects.reporting.getReportURL(60000);

expect(url).to.be.ok();
});
Expand Down
38 changes: 19 additions & 19 deletions x-pack/test/functional/apps/visualize/reporting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const browser = getService('browser');
const log = getService('log');
const pageObjects = getPageObjects([
const PageObjects = getPageObjects([
'reporting',
'common',
'dashboard',
Expand All @@ -39,34 +39,34 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

describe('Print PDF button', () => {
it('is not available if new', async () => {
await pageObjects.common.navigateToUrl('visualize', 'new', { useActualUrl: true });
await pageObjects.visualize.clickAreaChart();
await pageObjects.visualize.clickNewSearch('ecommerce');
await pageObjects.reporting.openPdfReportingPanel();
expect(await pageObjects.reporting.isGenerateReportButtonDisabled()).to.be('true');
await PageObjects.common.navigateToUrl('visualize', 'new', { useActualUrl: true });
await PageObjects.visualize.clickAreaChart();
await PageObjects.visualize.clickNewSearch('ecommerce');
await PageObjects.reporting.openPdfReportingPanel();
expect(await PageObjects.reporting.isGenerateReportButtonDisabled()).to.be('true');
});

it('becomes available when saved', async () => {
await pageObjects.reporting.setTimepickerInDataRange();
await pageObjects.visEditor.clickBucket('X-axis');
await pageObjects.visEditor.selectAggregation('Date Histogram');
await pageObjects.visEditor.clickGo();
await pageObjects.visualize.saveVisualization('my viz');
await pageObjects.reporting.openPdfReportingPanel();
expect(await pageObjects.reporting.isGenerateReportButtonDisabled()).to.be(null);
await PageObjects.reporting.setTimepickerInDataRange();
await PageObjects.visEditor.clickBucket('X-axis');
await PageObjects.visEditor.selectAggregation('Date Histogram');
await PageObjects.visEditor.clickGo();
await PageObjects.visualize.saveVisualization('my viz');
await PageObjects.reporting.openPdfReportingPanel();
expect(await PageObjects.reporting.isGenerateReportButtonDisabled()).to.be(null);
});

it('downloaded PDF has OK status', async function () {
// Generating and then comparing reports can take longer than the default 60s timeout
this.timeout(180000);

await pageObjects.common.navigateToApp('dashboard');
await pageObjects.dashboard.loadSavedDashboard('Ecom Dashboard');
await pageObjects.reporting.openPdfReportingPanel();
await pageObjects.reporting.clickGenerateReportButton();
await PageObjects.common.navigateToApp('dashboard');
await PageObjects.dashboard.loadSavedDashboard('Ecom Dashboard');
await PageObjects.reporting.openPdfReportingPanel();
await PageObjects.reporting.clickGenerateReportButton();

const url = await pageObjects.reporting.getReportURL(60000);
const res = await pageObjects.reporting.getResponse(url);
const url = await PageObjects.reporting.getReportURL(60000);
const res = await PageObjects.reporting.getResponse(url);

expect(res.statusCode).to.equal(200);
expect(res.headers['content-type']).to.equal('application/pdf');
Expand Down
12 changes: 6 additions & 6 deletions x-pack/test/functional/page_objects/reporting_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function ReportingPageProvider({ getService, getPageObjects }: FtrProvide
const retry = getService('retry');
const testSubjects = getService('testSubjects');

const pageObjects = getPageObjects(['common', 'security' as any, 'share', 'timePicker']); // FIXME: Security PageObject is not Typescript
const PageObjects = getPageObjects(['common', 'security' as any, 'share', 'timePicker']); // FIXME: Security PageObject is not Typescript

class ReportingPage {
async forceSharedItemsContainerSize({ width }: { width: number }) {
Expand Down Expand Up @@ -86,17 +86,17 @@ export function ReportingPageProvider({ getService, getPageObjects }: FtrProvide

async openCsvReportingPanel() {
log.debug('openCsvReportingPanel');
await pageObjects.share.openShareMenuItem('CSV Reports');
await PageObjects.share.openShareMenuItem('CSV Reports');
}

async openPdfReportingPanel() {
log.debug('openPdfReportingPanel');
await pageObjects.share.openShareMenuItem('PDF Reports');
await PageObjects.share.openShareMenuItem('PDF Reports');
}

async openPngReportingPanel() {
log.debug('openPngReportingPanel');
await pageObjects.share.openShareMenuItem('PNG Reports');
await PageObjects.share.openShareMenuItem('PNG Reports');
}

async clearToastNotifications() {
Expand Down Expand Up @@ -156,14 +156,14 @@ export function ReportingPageProvider({ getService, getPageObjects }: FtrProvide
log.debug('Reporting:setTimepickerInDataRange');
const fromTime = 'Sep 19, 2015 @ 06:31:44.000';
const toTime = 'Sep 19, 2015 @ 18:01:44.000';
await pageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
}

async setTimepickerInNoDataRange() {
log.debug('Reporting:setTimepickerInNoDataRange');
const fromTime = 'Sep 19, 1999 @ 06:31:44.000';
const toTime = 'Sep 23, 1999 @ 18:31:44.000';
await pageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
}
}
return new ReportingPage();
Expand Down

0 comments on commit 44df9ce

Please sign in to comment.