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] First accessibility test #104410

Merged
merged 6 commits into from
Jul 9, 2021
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.

Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ class ReportListingUi extends Component<Props, State> {
return (
<>
<EuiPageHeader
data-test-subj="reportingPageHeader"
bottomBorder
pageTitle={
<FormattedMessage id="xpack.reporting.listing.reportstitle" defaultMessage="Reports" />
Expand Down Expand Up @@ -375,7 +376,7 @@ class ReportListingUi extends Component<Props, State> {
}),
render: (objectTitle: string, record: Job) => {
return (
<div>
<div data-test-subj="reportingListItemObjectTitle">
<div>{objectTitle}</div>
<EuiText size="s">
<EuiTextColor color="subdued">{record.object_type}</EuiTextColor>
Expand Down
76 changes: 76 additions & 0 deletions x-pack/test/accessibility/apps/reporting.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* 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 { FtrProviderContext } from '../ftr_provider_context';

import { JOB_PARAMS_RISON_CSV_DEPRECATED } from '../../reporting_api_integration/services/fixtures';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const { common } = getPageObjects(['common']);
const retry = getService('retry');
const a11y = getService('a11y');
const testSubjects = getService('testSubjects');
const supertestWithoutAuth = getService('supertestWithoutAuth');
const reporting = getService('reporting');
const esArchiver = getService('esArchiver');
const security = getService('security');

describe('Reporting', () => {
const createReportingUser = async () => {
await security.user.create(reporting.REPORTING_USER_USERNAME, {
password: reporting.REPORTING_USER_PASSWORD,
roles: ['reporting_user', 'data_analyst', 'kibana_user'], // Deprecated: using built-in `reporting_user` role grants all Reporting privileges
full_name: 'a reporting user',
});
};

const deleteReportingUser = async () => {
await security.user.delete(reporting.REPORTING_USER_USERNAME);
};

before(async () => {
await esArchiver.load('x-pack/test/functional/es_archives/reporting/logs');
await esArchiver.load('x-pack/test/functional/es_archives/logstash_functional');

await createReportingUser();
await reporting.loginReportingUser();
});

after(async () => {
await esArchiver.unload('x-pack/test/functional/es_archives/reporting/logs');
await esArchiver.unload('x-pack/test/functional/es_archives/logstash_functional');

await deleteReportingUser();
});

beforeEach(async () => {
// Add one report
await supertestWithoutAuth
.post(`/api/reporting/generate/csv`)
.auth(reporting.REPORTING_USER_USERNAME, reporting.REPORTING_USER_PASSWORD)
.set('kbn-xsrf', 'xxx')
.send({ jobParams: JOB_PARAMS_RISON_CSV_DEPRECATED })
.expect(200);

await retry.waitFor('Reporting app', async () => {
await common.navigateToApp('reporting');
return testSubjects.exists('reportingPageHeader');
});
});

afterEach(async () => {
await reporting.deleteAllReports();
});

it('List reports view', async () => {
await retry.waitForWithTimeout('A reporting list item', 5000, () => {
return testSubjects.exists('reportingListItemObjectTitle');
});
await a11y.testAppSnapshot();
});
});
}
1 change: 1 addition & 0 deletions x-pack/test/accessibility/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
require.resolve('./apps/security_solution'),
require.resolve('./apps/ml_embeddables_in_dashboard'),
require.resolve('./apps/remote_clusters'),
require.resolve('./apps/reporting'),
],

pageObjects,
Expand Down
2 changes: 2 additions & 0 deletions x-pack/test/functional/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { services as kibanaFunctionalServices } from '../../../../test/functiona
import { services as kibanaApiIntegrationServices } from '../../../../test/api_integration/services';
import { services as kibanaXPackApiIntegrationServices } from '../../api_integration/services';
import { services as commonServices } from '../../common/services';
import { ReportingFunctionalProvider } from '../../reporting_functional/services';

import {
MonitoringNoDataProvider,
Expand Down Expand Up @@ -107,5 +108,6 @@ export const services = {
dashboardDrilldownPanelActions: DashboardDrilldownPanelActionsProvider,
dashboardDrilldownsManage: DashboardDrilldownsManageProvider,
dashboardPanelTimeRange: DashboardPanelTimeRangeProvider,
reporting: ReportingFunctionalProvider,
searchSessions: SearchSessionsService,
};
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default function ({ getService }: FtrProviderContext) {
});

it('detects when reporting indices should be migrated due to missing ILM policy', async () => {
await reportingAPI.makeAllReportingPoliciesUnmanaged();
await reportingAPI.makeAllReportingIndicesUnmanaged();
// TODO: Remove "any" when no longer through type issue "policy_id" missing
await es.ilm.deleteLifecycle({ policy: ILM_POLICY_NAME } as any);

Expand All @@ -63,7 +63,7 @@ export default function ({ getService }: FtrProviderContext) {
});

it('detects when reporting indices should be migrated due to unmanaged indices', async () => {
await reportingAPI.makeAllReportingPoliciesUnmanaged();
await reportingAPI.makeAllReportingIndicesUnmanaged();
await supertestNoAuth
.post(`/api/reporting/generate/csv`)
.set('kbn-xsrf', 'xxx')
Expand Down
6 changes: 3 additions & 3 deletions x-pack/test/reporting_api_integration/services/scenarios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ export function createScenarios({ getService }: Pick<FtrProviderContext, 'getSer
.expect(200);
};

const makeAllReportingPoliciesUnmanaged = async () => {
log.debug('ReportingAPI.makeAllReportingPoliciesUnmanaged');
const makeAllReportingIndicesUnmanaged = async () => {
log.debug('ReportingAPI.makeAllReportingIndicesUnmanaged');
const settings: any = {
'index.lifecycle.name': null,
};
Expand Down Expand Up @@ -214,6 +214,6 @@ export function createScenarios({ getService }: Pick<FtrProviderContext, 'getSer
deleteAllReports,
checkIlmMigrationStatus,
migrateReportingIndices,
makeAllReportingPoliciesUnmanaged,
makeAllReportingIndicesUnmanaged,
};
}
Loading