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

Report Deletion via UI- functional test #64031

Merged
merged 9 commits into from
Apr 24, 2020
Merged
Show file tree
Hide file tree
Changes from 5 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
3 changes: 3 additions & 0 deletions test/functional/services/test_subjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ export function TestSubjectsProvider({ getService }: FtrProviderContext) {
const WAIT_FOR_EXISTS_TIME = config.get('timeouts.waitForExists');

class TestSubjects {
findByCssSelector(arg0: string) {
throw new Error('Method not implemented.');
}
rashmivkulkarni marked this conversation as resolved.
Show resolved Hide resolved
public async exists(selector: string, options: ExistsOptions = {}): Promise<boolean> {
const { timeout = WAIT_FOR_EXISTS_TIME, allowHidden = false } = options;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,12 @@ export class ReportDeleteButton extends PureComponent<Props, State> {

return (
<Fragment>
<EuiButton onClick={() => this.showConfirm()} iconType="trash" color={'danger'}>
<EuiButton
onClick={() => this.showConfirm()}
iconType="trash"
color={'danger'}
data-test-subj="deleteReportButton"
>
{intl.formatMessage(
{
id: 'xpack.reporting.listing.table.deleteReportButton',
Expand Down
14 changes: 14 additions & 0 deletions x-pack/test/functional/apps/reporting_management/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { FtrProviderContext } from '../../ftr_provider_context';

export default ({ loadTestFile }: FtrProviderContext) => {
describe('reporting management app', function() {
this.tags('ciGroup7');
loadTestFile(require.resolve('./report_delete_pagination'));
});
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';

export default ({ getPageObjects, getService }: FtrProviderContext) => {
const pageObjects = getPageObjects(['common', 'reporting']);
const log = getService('log');
const retry = getService('retry');
const security = getService('security');

const testSubjects = getService('testSubjects');
const esArchiver = getService('esArchiver');

describe('Delete reports', function() {
before(async () => {
await security.testUser.setRoles(['global_discover_read', 'reporting_user']);
await esArchiver.load('empty_kibana');
await esArchiver.load('reporting/archived_reports');
await pageObjects.common.navigateToActualUrl('kibana', '/management/kibana/reporting');
rashmivkulkarni marked this conversation as resolved.
Show resolved Hide resolved
await testSubjects.existOrFail('reportJobListing', { timeout: 200000 });
});

after(async () => {
await esArchiver.unload('empty_kibana');
await esArchiver.unload('reporting/archived_reports');
await security.testUser.restoreDefaults();
});

it('Confirm report deletion works', async () => {
log.debug('Checking for reports.');

await retry.try(async () => {
await testSubjects.click('checkboxSelectRow-k9a9xlwl0gpe1457b10rraq3');
rashmivkulkarni marked this conversation as resolved.
Show resolved Hide resolved
});
const deleteButton = await testSubjects.find('deleteReportButton');
await retry.waitFor('delete button to become enabled', async () => {
return await deleteButton.isEnabled();
});
await deleteButton.click();
await testSubjects.exists('confirmModalBodyText');
await testSubjects.click('confirmModalConfirmButton');
await retry.try(async () => {
await testSubjects.waitForDeleted('checkboxSelectRow-k9a9xlwl0gpe1457b10rraq3');
});
});

// functional test for report pagination: https://github.com/elastic/kibana/pull/62881
it('Report pagination', async () => {
const previousButton = await testSubjects.find('pagination-button-previous');
expect(await previousButton.getAttribute('disabled')).to.be('true');
await testSubjects.click('pagination-button-1');
expect(await previousButton.getAttribute('disabled')).to.be(null);
rashmivkulkarni marked this conversation as resolved.
Show resolved Hide resolved
});
});
};
12 changes: 12 additions & 0 deletions x-pack/test/functional/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export default async function({ readConfigFile }) {
resolve(__dirname, './apps/cross_cluster_replication'),
resolve(__dirname, './apps/remote_clusters'),
resolve(__dirname, './apps/transform'),
resolve(__dirname, './apps/reporting_management'),
// This license_management file must be last because it is destructive.
resolve(__dirname, './apps/license_management'),
],
Expand Down Expand Up @@ -228,6 +229,17 @@ export default async function({ readConfigFile }) {
kibana: [],
},

global_discover_read: {
kibana: [
{
feature: {
discover: ['read'],
},
spaces: ['*'],
},
],
},

//Kibana feature privilege isn't specific to advancedSetting. It can be anything. https://github.com/elastic/kibana/issues/35965
test_api_keys: {
elasticsearch: {
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
"type": "index",
"value": {
"aliases": {
},
"index": ".reporting-2020.04.19",
"mappings": {
"properties": {
"attempts": {
"type": "short"
},
"browser_type": {
"type": "keyword"
},
"completed_at": {
"type": "date"
},
"created_at": {
"type": "date"
},
"created_by": {
"type": "keyword"
},
"jobtype": {
"type": "keyword"
},
"kibana_id": {
"type": "keyword"
},
"kibana_name": {
"type": "keyword"
},
"max_attempts": {
"type": "short"
},
"meta": {
"properties": {
"layout": {
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
},
"type": "text"
},
"objectType": {
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
},
"type": "text"
}
}
},
"output": {
"properties": {
"content": {
"enabled": false,
"type": "object"
},
"content_type": {
"type": "keyword"
},
"csv_contains_formulas": {
"type": "boolean"
},
"max_size_reached": {
"type": "boolean"
},
"size": {
"type": "long"
}
}
},
"payload": {
"enabled": false,
"type": "object"
},
"priority": {
"type": "byte"
},
"process_expiration": {
"type": "date"
},
"started_at": {
"type": "date"
},
"status": {
"type": "keyword"
},
"timeout": {
"type": "long"
}
}
},
"settings": {
"index": {
"auto_expand_replicas": "0-1",
"number_of_replicas": "0",
"number_of_shards": "1",
"prefer_v2_templates": "false"
}
}
}
}
6 changes: 6 additions & 0 deletions x-pack/test/functional/page_objects/reporting_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,12 @@ export function ReportingPageProvider({ getService, getPageObjects }) {
const toTime = 'Sep 23, 1999 @ 18:31:44.000';
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
}

async canReportBeCreated() {
rashmivkulkarni marked this conversation as resolved.
Show resolved Hide resolved
await this.clickGenerateReportButton();
const success = await this.checkForReportingToasts();
return success;
}
}

return new ReportingPage();
Expand Down