diff --git a/x-pack/test/functional/apps/reporting_management/__snapshots__/report_listing.snap b/x-pack/test/functional/apps/reporting_management/__snapshots__/report_listing.snap index 88ab59d795d94..1b400a835285a 100644 --- a/x-pack/test/functional/apps/reporting_management/__snapshots__/report_listing.snap +++ b/x-pack/test/functional/apps/reporting_management/__snapshots__/report_listing.snap @@ -5,13 +5,13 @@ Array [ Object { "actions": "", "createdAt": "2021-07-19 @ 10:29 PM", - "report": "Automated report", + "report": "report jobtype: csv", "status": "Done, warnings detected", }, Object { "actions": "", "createdAt": "2021-07-19 @ 06:47 PM", - "report": "Discover search [2021-07-19T11:47:35.995-07:00]", + "report": "report jobtype: csv_searchsource", "status": "Done", }, Object { diff --git a/x-pack/test/functional/es_archives/reporting/archived_reports/data.json.gz b/x-pack/test/functional/es_archives/reporting/archived_reports/data.json.gz index a214c166c2430..e03ee31171577 100644 Binary files a/x-pack/test/functional/es_archives/reporting/archived_reports/data.json.gz and b/x-pack/test/functional/es_archives/reporting/archived_reports/data.json.gz differ diff --git a/x-pack/test/reporting_functional/reporting_and_security/download.ts b/x-pack/test/reporting_functional/reporting_and_security/download.ts new file mode 100644 index 0000000000000..3a0af56793e6b --- /dev/null +++ b/x-pack/test/reporting_functional/reporting_and_security/download.ts @@ -0,0 +1,53 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import expect from '@kbn/expect'; +import { FtrProviderContext } from '../ftr_provider_context'; + +// eslint-disable-next-line import/no-default-export +export default ({ getService, getPageObjects }: FtrProviderContext) => { + const PageObjects = getPageObjects(['common', 'reporting', 'dashboard']); + const testSubjects = getService('testSubjects'); + const esArchiver = getService('esArchiver'); + + describe('Download report', () => { + // use archived reports to allow reporting_user to view report jobs they've created + before(async () => { + await esArchiver.load('x-pack/test/functional/es_archives/reporting/archived_reports'); + }); + + after(async () => { + await esArchiver.unload('x-pack/test/functional/es_archives/reporting/archived_reports'); + }); + + it('user can access download link', async () => { + const reportId = 'krazcyw4156m0763b503j7f9'; + + await PageObjects.common.navigateToApp('reporting'); + await testSubjects.existOrFail('reportJobListing'); + + const reportInfoLink = await testSubjects.find(`viewReportingLink-${reportId}`); + expect(await reportInfoLink.getVisibleText()).to.be('report jobtype: csv_searchsource'); // report title indicates the jobtype + + // can download the report + await testSubjects.existOrFail(`reportDownloadLink-${reportId}`); + }); + + it('user can access download link for export type that is no longer supported', async () => { + const reportId = 'krb7arhe164k0763b50bjm29'; + + await PageObjects.common.navigateToApp('reporting'); + await testSubjects.existOrFail('reportJobListing'); + + const reportInfoLink = await testSubjects.find(`viewReportingLink-${reportId}`); + expect(await reportInfoLink.getVisibleText()).to.be('report jobtype: csv'); // report title indicates the **removed** jobtype + + // can download the report + await testSubjects.existOrFail(`reportDownloadLink-${reportId}`); + }); + }); +}; diff --git a/x-pack/test/reporting_functional/reporting_and_security/index.ts b/x-pack/test/reporting_functional/reporting_and_security/index.ts index ec7afea96f194..19cca824e7056 100644 --- a/x-pack/test/reporting_functional/reporting_and_security/index.ts +++ b/x-pack/test/reporting_functional/reporting_and_security/index.ts @@ -19,6 +19,7 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { await reportingFunctional.createTestReportingUser(); }); + loadTestFile(require.resolve('./download')); // uses `test_user` login: must be first suite loadTestFile(require.resolve('./security_roles_privileges')); loadTestFile(require.resolve('./management')); }); diff --git a/x-pack/test/reporting_functional/reporting_and_security/management.ts b/x-pack/test/reporting_functional/reporting_and_security/management.ts index b1a6c107b9bb7..b083c8974328b 100644 --- a/x-pack/test/reporting_functional/reporting_and_security/management.ts +++ b/x-pack/test/reporting_functional/reporting_and_security/management.ts @@ -13,7 +13,6 @@ export default ({ getService, getPageObjects }: FtrProviderContext) => { const testSubjects = getService('testSubjects'); const browser = getService('browser'); const reportingFunctional = getService('reportingFunctional'); - const esArchiver = getService('esArchiver'); describe('Access to Management > Reporting', () => { before(async () => { @@ -55,36 +54,5 @@ export default ({ getService, getPageObjects }: FtrProviderContext) => { await PageObjects.dashboard.expectOnDashboard(dashboardTitle); }); - - // FLAKY: https://github.com/elastic/kibana/issues/195144 - // FLAKY: https://github.com/elastic/kibana/issues/194731 - describe.skip('Download report', () => { - // use archived reports to allow reporting_user to view report jobs they've created - before('log in as reporting user', async () => { - await esArchiver.load('x-pack/test/functional/es_archives/reporting/archived_reports'); - }); - - after(async () => { - await esArchiver.unload('x-pack/test/functional/es_archives/reporting/archived_reports'); - }); - - it('user can access download link', async () => { - await reportingFunctional.loginReportingUser(); - await PageObjects.common.navigateToApp('reporting'); - await testSubjects.existOrFail('reportJobListing'); - - await testSubjects.existOrFail('reportDownloadLink-kraz9db6154g0763b5141viu'); - }); - - it('user can access download link for export type that is no longer supported', async () => { - await reportingFunctional.loginReportingUser(); - await PageObjects.common.navigateToApp('reporting'); - await testSubjects.existOrFail('reportJobListing'); - - // The "csv" export type, aka CSV V1, was removed and can no longer be created. - // Downloading a report of this export type does still work - await testSubjects.existOrFail('reportDownloadLink-krb7arhe164k0763b50bjm31'); - }); - }); }); };