Skip to content

Commit

Permalink
Report Deletion via UI- functional test (#64031)
Browse files Browse the repository at this point in the history
* report delete test

* removed the exclusive test

* new archived reports

* added pagination test

* implemented review changes

* Removed the unwanted method

* addressed the review comments

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
rashmivkulkarni and elasticmachine committed Apr 24, 2020
1 parent cbf006c commit 9703d85
Show file tree
Hide file tree
Showing 8 changed files with 204 additions and 2 deletions.
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,59 @@
/*
* 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');
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 single report deletion works', async () => {
log.debug('Checking for reports.');
await retry.try(async () => {
await testSubjects.click('checkboxSelectRow-k9a9xlwl0gpe1457b10rraq3');
});
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);
});
});
};
17 changes: 17 additions & 0 deletions x-pack/test/functional/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ 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 @@ -196,6 +198,10 @@ export default async function({ readConfigFile }) {
pathname: '/app/kibana/',
hash: '/management/elasticsearch/transform',
},
reporting: {
pathname: '/app/kibana/',
hash: '/management/kibana/reporting',
},
},

// choose where esArchiver should load archives from
Expand Down Expand Up @@ -228,6 +234,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"
}
}
}
}
1 change: 0 additions & 1 deletion x-pack/test/functional/page_objects/reporting_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,5 @@ export function ReportingPageProvider({ getService, getPageObjects }) {
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
}
}

return new ReportingPage();
}

0 comments on commit 9703d85

Please sign in to comment.