Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Reporting/Tests] Unskip "Download reports" test #195685

Merged
merged 5 commits into from
Oct 17, 2024
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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -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}`);
});
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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');
});
});
});
};