-
Notifications
You must be signed in to change notification settings - Fork 114
/
Copy path04-download.spec.js
132 lines (106 loc) · 3.52 KB
/
04-download.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
/// <reference types="cypress" />
import { WAIT_TIME, BASE_PATH, TIMEOUT } from '../../../utils/constants';
describe('Cypress', () => {
// remove sample data
after(() => {
cy.visit(`${BASE_PATH}/app/home#/tutorial_directory/sampleData`, {
waitForGetTenant: true,
});
cy.get('div[data-test-subj="sampleDataSetCardflights"]')
.contains('Remove')
.click();
cy.wait(3000);
cy.visit(`${BASE_PATH}/app/home#/tutorial_directory/sampleData`, {
waitForGetTenant: true,
});
cy.get('div[data-test-subj="sampleDataSetCardecommerce"]')
.contains('Remove')
.click();
cy.wait(3000);
cy.visit(`${BASE_PATH}/app/home#/tutorial_directory/sampleData`, {
waitForGetTenant: true,
});
cy.get('div[data-test-subj="sampleDataSetCardlogs"]')
.contains('Remove')
.click();
cy.wait(3000);
});
it('Download pdf from in-context menu', () => {
cy.visit(`${BASE_PATH}/app/dashboards#`, {
waitForGetTenant: true,
});
cy.wait(5000);
// click first entry in dashboards page
cy.get(
'tr.euiTableRow:nth-child(1) > td:nth-child(2) > div:nth-child(2) > a:nth-child(1)'
).click({ force: true });
// click Reporting in-context menu
cy.get('#downloadReport > span:nth-child(1) > span:nth-child(1)').click({
force: true,
});
// download PDF
cy.get('#generatePDF > span:nth-child(1) > span:nth-child(2)').click({
force: true,
});
cy.get('#reportGenerationProgressModal');
});
it('Download png from in-context menu', () => {
cy.visit(`${BASE_PATH}/app/dashboards#`, {
waitForGetTenant: true,
});
cy.wait(5000);
// click first entry in dashboards page
cy.get(
'tr.euiTableRow:nth-child(1) > td:nth-child(2) > div:nth-child(2) > a:nth-child(1)'
).click({ force: true });
// click Reporting in-context menu
cy.get('#downloadReport > span:nth-child(1) > span:nth-child(1)').click({
force: true,
});
cy.get('#generatePNG').click({ force: true });
cy.get('#reportGenerationProgressModal');
});
it('Download csv from saved search in-context menu', () => {
cy.visit(`${BASE_PATH}/app/discover#`, {
waitForGetTenant: true,
});
cy.wait(5000);
// open saved search list
cy.get('[data-test-subj="discoverOpenButton"]').click({ force: true });
cy.wait(5000);
// click first entry
cy.get('li.euiListGroupItem:nth-child(1) > button:nth-child(1)').click({
force: true,
});
// open reporting menu
cy.get('#downloadReport').click({ force: true });
cy.get('#generateCSV').click({ force: true });
});
it('Download from Report definition details page', () => {
// create an on-demand report definition
cy.visit(`${BASE_PATH}/app/reports-dashboards#/`, {
waitForGetTenant: true,
});
cy.location('pathname', { timeout: TIMEOUT }).should(
'include',
'/reports-dashboards'
);
cy.wait(WAIT_TIME);
cy.get(
'tr.euiTableRow-isSelectable:nth-child(1) > td:nth-child(1) > div:nth-child(2) > button:nth-child(1)'
)
.first()
.click();
cy.url().should('include', 'report_definition_details');
cy.wait(WAIT_TIME);
cy.get('#generateReportFromDetailsFileFormat').should('exist');
cy.get('#generateReportFromDetailsFileFormat').click({ force: true });
cy.get('.euiToastHeader__title')
.contains('Successfully generated report')
.should('exist');
});
});