Skip to content

Commit 9703d85

Browse files
Report Deletion via UI- functional test (#64031)
* 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>
1 parent cbf006c commit 9703d85

File tree

8 files changed

+204
-2
lines changed

8 files changed

+204
-2
lines changed

x-pack/plugins/reporting/public/components/buttons/report_delete_button.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,12 @@ export class ReportDeleteButton extends PureComponent<Props, State> {
8383

8484
return (
8585
<Fragment>
86-
<EuiButton onClick={() => this.showConfirm()} iconType="trash" color={'danger'}>
86+
<EuiButton
87+
onClick={() => this.showConfirm()}
88+
iconType="trash"
89+
color={'danger'}
90+
data-test-subj="deleteReportButton"
91+
>
8792
{intl.formatMessage(
8893
{
8994
id: 'xpack.reporting.listing.table.deleteReportButton',
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import { FtrProviderContext } from '../../ftr_provider_context';
8+
9+
export default ({ loadTestFile }: FtrProviderContext) => {
10+
describe('reporting management app', function() {
11+
this.tags('ciGroup7');
12+
loadTestFile(require.resolve('./report_delete_pagination'));
13+
});
14+
};
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import expect from '@kbn/expect';
8+
import { FtrProviderContext } from '../../ftr_provider_context';
9+
10+
export default ({ getPageObjects, getService }: FtrProviderContext) => {
11+
const pageObjects = getPageObjects(['common', 'reporting']);
12+
const log = getService('log');
13+
const retry = getService('retry');
14+
const security = getService('security');
15+
16+
const testSubjects = getService('testSubjects');
17+
const esArchiver = getService('esArchiver');
18+
19+
describe('Delete reports', function() {
20+
before(async () => {
21+
await security.testUser.setRoles(['global_discover_read', 'reporting_user']);
22+
await esArchiver.load('empty_kibana');
23+
await esArchiver.load('reporting/archived_reports');
24+
await pageObjects.common.navigateToActualUrl('kibana', '/management/kibana/reporting');
25+
await testSubjects.existOrFail('reportJobListing', { timeout: 200000 });
26+
});
27+
28+
after(async () => {
29+
await esArchiver.unload('empty_kibana');
30+
await esArchiver.unload('reporting/archived_reports');
31+
await security.testUser.restoreDefaults();
32+
});
33+
34+
it('Confirm single report deletion works', async () => {
35+
log.debug('Checking for reports.');
36+
await retry.try(async () => {
37+
await testSubjects.click('checkboxSelectRow-k9a9xlwl0gpe1457b10rraq3');
38+
});
39+
const deleteButton = await testSubjects.find('deleteReportButton');
40+
await retry.waitFor('delete button to become enabled', async () => {
41+
return await deleteButton.isEnabled();
42+
});
43+
await deleteButton.click();
44+
await testSubjects.exists('confirmModalBodyText');
45+
await testSubjects.click('confirmModalConfirmButton');
46+
await retry.try(async () => {
47+
await testSubjects.waitForDeleted('checkboxSelectRow-k9a9xlwl0gpe1457b10rraq3');
48+
});
49+
});
50+
51+
// functional test for report pagination: https://github.com/elastic/kibana/pull/62881
52+
it('Report pagination', async () => {
53+
const previousButton = await testSubjects.find('pagination-button-previous');
54+
expect(await previousButton.getAttribute('disabled')).to.be('true');
55+
await testSubjects.click('pagination-button-1');
56+
expect(await previousButton.getAttribute('disabled')).to.be(null);
57+
});
58+
});
59+
};

x-pack/test/functional/config.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ export default async function({ readConfigFile }) {
5757
resolve(__dirname, './apps/cross_cluster_replication'),
5858
resolve(__dirname, './apps/remote_clusters'),
5959
resolve(__dirname, './apps/transform'),
60+
resolve(__dirname, './apps/reporting_management'),
61+
6062
// This license_management file must be last because it is destructive.
6163
resolve(__dirname, './apps/license_management'),
6264
],
@@ -196,6 +198,10 @@ export default async function({ readConfigFile }) {
196198
pathname: '/app/kibana/',
197199
hash: '/management/elasticsearch/transform',
198200
},
201+
reporting: {
202+
pathname: '/app/kibana/',
203+
hash: '/management/kibana/reporting',
204+
},
199205
},
200206

201207
// choose where esArchiver should load archives from
@@ -228,6 +234,17 @@ export default async function({ readConfigFile }) {
228234
kibana: [],
229235
},
230236

237+
global_discover_read: {
238+
kibana: [
239+
{
240+
feature: {
241+
discover: ['read'],
242+
},
243+
spaces: ['*'],
244+
},
245+
],
246+
},
247+
231248
//Kibana feature privilege isn't specific to advancedSetting. It can be anything. https://github.com/elastic/kibana/issues/35965
232249
test_api_keys: {
233250
elasticsearch: {
-225 Bytes
Binary file not shown.
Binary file not shown.
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
{
2+
"type": "index",
3+
"value": {
4+
"aliases": {
5+
},
6+
"index": ".reporting-2020.04.19",
7+
"mappings": {
8+
"properties": {
9+
"attempts": {
10+
"type": "short"
11+
},
12+
"browser_type": {
13+
"type": "keyword"
14+
},
15+
"completed_at": {
16+
"type": "date"
17+
},
18+
"created_at": {
19+
"type": "date"
20+
},
21+
"created_by": {
22+
"type": "keyword"
23+
},
24+
"jobtype": {
25+
"type": "keyword"
26+
},
27+
"kibana_id": {
28+
"type": "keyword"
29+
},
30+
"kibana_name": {
31+
"type": "keyword"
32+
},
33+
"max_attempts": {
34+
"type": "short"
35+
},
36+
"meta": {
37+
"properties": {
38+
"layout": {
39+
"fields": {
40+
"keyword": {
41+
"ignore_above": 256,
42+
"type": "keyword"
43+
}
44+
},
45+
"type": "text"
46+
},
47+
"objectType": {
48+
"fields": {
49+
"keyword": {
50+
"ignore_above": 256,
51+
"type": "keyword"
52+
}
53+
},
54+
"type": "text"
55+
}
56+
}
57+
},
58+
"output": {
59+
"properties": {
60+
"content": {
61+
"enabled": false,
62+
"type": "object"
63+
},
64+
"content_type": {
65+
"type": "keyword"
66+
},
67+
"csv_contains_formulas": {
68+
"type": "boolean"
69+
},
70+
"max_size_reached": {
71+
"type": "boolean"
72+
},
73+
"size": {
74+
"type": "long"
75+
}
76+
}
77+
},
78+
"payload": {
79+
"enabled": false,
80+
"type": "object"
81+
},
82+
"priority": {
83+
"type": "byte"
84+
},
85+
"process_expiration": {
86+
"type": "date"
87+
},
88+
"started_at": {
89+
"type": "date"
90+
},
91+
"status": {
92+
"type": "keyword"
93+
},
94+
"timeout": {
95+
"type": "long"
96+
}
97+
}
98+
},
99+
"settings": {
100+
"index": {
101+
"auto_expand_replicas": "0-1",
102+
"number_of_replicas": "0",
103+
"number_of_shards": "1",
104+
"prefer_v2_templates": "false"
105+
}
106+
}
107+
}
108+
}

x-pack/test/functional/page_objects/reporting_page.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,5 @@ export function ReportingPageProvider({ getService, getPageObjects }) {
170170
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
171171
}
172172
}
173-
174173
return new ReportingPage();
175174
}

0 commit comments

Comments
 (0)