forked from opensearch-project/reporting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path01-create.spec.ts
129 lines (105 loc) · 4.34 KB
/
01-create.spec.ts
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
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/
/*
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
describe('Adding sample data', () => {
it('Adds sample data', () => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/home#/tutorial_directory/sampleData`);
cy.get('div[data-test-subj="sampleDataSetCardflights"]').contains(/(Add|View) data/).click();
cy.wait(3000);
cy.visit(`${Cypress.env('opensearchDashboards')}/app/home#/tutorial_directory/sampleData`);
cy.get('div[data-test-subj="sampleDataSetCardecommerce"]').contains(/(Add|View) data/).click();
cy.wait(3000);
cy.visit(`${Cypress.env('opensearchDashboards')}/app/home#/tutorial_directory/sampleData`);
cy.get('div[data-test-subj="sampleDataSetCardlogs"]').contains(/(Add|View) data/).click();
cy.wait(3000);
});
});
describe('Cypress', () => {
it('Visits Reporting homepage', () => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/reports-dashboards#/`);
cy.location('pathname', { timeout: 60000 }).should(
'include',
'/reports-dashboards'
);
});
it('Visit Create page', () => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/reports-dashboards#/`);
cy.location('pathname', { timeout: 60000 }).should(
'include',
'/reports-dashboards'
);
cy.wait(12500); // wait for the page to load
cy.get('#createReportHomepageButton').click({ force: true });
});
it('Create a new on-demand report definition', () => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/reports-dashboards#/`);
cy.location('pathname', { timeout: 60000 }).should(
'include',
'/reports-dashboards'
);
cy.wait(12500);
cy.get('#createReportHomepageButton').click();
// enter a report name
cy.get('#reportSettingsName').type('Create cypress test on-demand report');
// enter a report description
cy.get('#reportSettingsDescription').type('Description for cypress test');
// select a report source
cy.get('[data-test-subj="comboBoxInput"]').eq(0).click({ force: true });
// select drop-down option in report source list
cy.contains('[Logs] Web Traffic').click();
cy.wait(500);
// create an on-demand report definition
cy.get('#createNewReportDefinition').click({ force: true });
cy.wait(12500);
// check that re-direct to
cy.get('#reportDefinitionDetailsLink').should('exist');
});
it('Create a new scheduled report definition', () => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/reports-dashboards#/`);
cy.location('pathname', { timeout: 60000 }).should(
'include',
'/reports-dashboards'
);
cy.wait(12500);
cy.get('#createReportHomepageButton').click();
// enter a report name
cy.get('#reportSettingsName').type('Create cypress test scheduled report');
// enter a report description
cy.get('#reportSettingsDescription').type('Description for cypress test');
// select a report source
cy.get('[data-test-subj="comboBoxInput"]').eq(0).click({ force: true });
// select drop-down option in report source list
cy.contains('[Logs] Web Traffic').click();
cy.wait(500);
// set report trigger to Schedule option
cy.get('[type="radio"]').check({ force: true });
// set source back to saved search for testing purpose
cy.get('#savedSearchReportSource').check({ force: true });
// create scheduled report definition
cy.get('#createNewReportDefinition').click({ force: true });
cy.wait(12500);
// check that re-direct to
cy.get('#reportDefinitionDetailsLink').should('exist');
});
});