Skip to content

Commit

Permalink
[Reporting/Tests] Unskip "Download reports" test (elastic#195685)
Browse files Browse the repository at this point in the history
Closes elastic#195144

The flaky test in question uses the default test login account for
functional tests. I have moved it to the first test in the configuration
to avoid having to re-login.

Other changes:
* Reduced the size of the `archived_reports` archive by shortening the
field values for `output.content` and `payload.headers`. These field
values where long strings of text and aren't used for anything in tests.
* Changed some report job titles in the `archived_reports` archive to
make the tests easier to read and verify.
  • Loading branch information
tsullivan authored Oct 17, 2024
1 parent 138ed75 commit 96aaec9
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 34 deletions.

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');
});
});
});
};

0 comments on commit 96aaec9

Please sign in to comment.