Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

Cypress Tests for Details Pages #169

Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 3 additions & 1 deletion kibana-reports/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"test:browser": "plugin-helpers test:browser",
"build": "plugin-helpers build",
"test:jest": "../../node_modules/.bin/jest --config ./test/jest.config.js",
"test": "jest --config ./test/jest.config.js"
"test": "jest --config ./test/jest.config.js",
"cypress:run": "./node_modules/.bin/cypress run",
"cypress:open": "./node_modules/.bin/cypress open"
},
"dependencies": {
"@babel/core": "^7.10.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ exports[`<ReportDefinitions /> panel render component 1`] = `
>
<button
class="euiLink euiLink--primary"
id="reportDefinitionDetailsLink"
type="button"
>
test report name
Expand Down Expand Up @@ -378,6 +379,7 @@ exports[`<ReportDefinitions /> panel render component 1`] = `
>
<button
class="euiLink euiLink--primary"
id="reportDefinitionDetailsLink"
type="button"
>
test report name 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ exports[`<ReportsTable /> panel render component 1`] = `
>
<button
class="euiLink euiLink--primary"
id="reportDetailsLink"
type="button"
>
test report table item
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ exports[`<ReportDefinitionDetails /> panel render 5 hours recurring definition d
>
<button
class="euiButton euiButton--danger"
id="deleteReportDefinitionButton"
type="button"
>
<span
Expand All @@ -62,6 +63,7 @@ exports[`<ReportDefinitionDetails /> panel render 5 hours recurring definition d
>
<button
class="euiButton euiButton--primary"
id="changeStatusFromDetailsButton"
type="button"
>
<span
Expand All @@ -80,6 +82,7 @@ exports[`<ReportDefinitionDetails /> panel render 5 hours recurring definition d
>
<button
class="euiButton euiButton--primary euiButton--fill"
id="editReportDefinitionButton"
type="button"
>
<span
Expand Down Expand Up @@ -515,6 +518,7 @@ exports[`<ReportDefinitionDetails /> panel render disabled daily definition, cli
>
<button
class="euiButton euiButton--danger"
id="deleteReportDefinitionButton"
type="button"
>
<span
Expand All @@ -533,6 +537,7 @@ exports[`<ReportDefinitionDetails /> panel render disabled daily definition, cli
>
<button
class="euiButton euiButton--primary"
id="changeStatusFromDetailsButton"
type="button"
>
<span
Expand All @@ -551,6 +556,7 @@ exports[`<ReportDefinitionDetails /> panel render disabled daily definition, cli
>
<button
class="euiButton euiButton--primary euiButton--fill"
id="editReportDefinitionButton"
type="button"
>
<span
Expand Down Expand Up @@ -986,6 +992,7 @@ exports[`<ReportDefinitionDetails /> panel render on demand definition details 1
>
<button
class="euiButton euiButton--danger"
id="deleteReportDefinitionButton"
type="button"
>
<span
Expand All @@ -1004,6 +1011,7 @@ exports[`<ReportDefinitionDetails /> panel render on demand definition details 1
>
<button
class="euiButton euiButton--primary"
id="changeStatusFromDetailsButton"
type="button"
>
<span
Expand All @@ -1022,6 +1030,7 @@ exports[`<ReportDefinitionDetails /> panel render on demand definition details 1
>
<button
class="euiButton euiButton--primary euiButton--fill"
id="editReportDefinitionButton"
type="button"
>
<span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,10 @@ export function ReportDefinitionDetails(props) {
reportDefinitionDetails.status === 'Active' ? 'Disable' : 'Enable';

return (
<EuiButton onClick={() => changeScheduledReportDefinitionStatus(status)}>
<EuiButton
onClick={() => changeScheduledReportDefinitionStatus(status)}
id={'changeStatusFromDetailsButton'}
>
{status}
</EuiButton>
);
Expand Down Expand Up @@ -427,7 +430,10 @@ export function ReportDefinitionDetails(props) {

const showActionButton =
reportDefinitionDetails.triggerType === ON_DEMAND ? (
<EuiButton onClick={() => generateReportFromDetails()}>
<EuiButton
onClick={() => generateReportFromDetails()}
id={'generateReportFromDetailsButton'}
>
Generate report
</EuiButton>
) : (
Expand Down Expand Up @@ -484,7 +490,11 @@ export function ReportDefinitionDetails(props) {
gutterSize="l"
>
<EuiFlexItem grow={false}>
<EuiButton color={'danger'} onClick={deleteReportDefinition}>
<EuiButton
color={'danger'}
onClick={deleteReportDefinition}
id={'deleteReportDefinitionButton'}
>
Delete
</EuiButton>
</EuiFlexItem>
Expand All @@ -497,6 +507,7 @@ export function ReportDefinitionDetails(props) {
`opendistro_kibana_reports#/edit/${reportDefinitionId}`
);
}}
id={'editReportDefinitionButton'}
>
Edit
</EuiButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ export function ReportDefinitions(props) {
field: 'reportName',
name: 'Name',
render: (name) => (
<EuiLink onClick={() => navigateToDefinitionDetails(name)}>
<EuiLink
onClick={() => navigateToDefinitionDetails(name)}
id={'reportDefinitionDetailsLink'}
>
{name}
</EuiLink>
),
Expand Down
1 change: 1 addition & 0 deletions kibana-reports/public/components/main/reports_table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export function ReportsTable(props) {
`opendistro_kibana_reports#/report_details/${item.id}`
);
}}
id={'reportDetailsLink'}
>
{reportName}
</EuiLink>
Expand Down
14 changes: 7 additions & 7 deletions kibana-reports/target/public/.kbn-optimizer-cache
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/context_menu/context_menu_ui.js": 1602615223597.9368,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/context_menu/context_menu.js": 1603300578409.5425,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/main/main_utils.tsx": 1603750634663.138,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/main/main.tsx": 1604354927555.6038,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/main/report_definition_details/report_definition_details.tsx": 1603828853540.1113,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/main/report_definitions_table.tsx": 1604001285081.5144,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/main/main.tsx": 1604425633624.3005,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/main/report_definition_details/report_definition_details.tsx": 1604440812976.1387,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/main/report_definitions_table.tsx": 1604440812992.7307,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/main/report_details/report_details.tsx": 1603756386321.6716,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/main/reports_table.tsx": 1604001285082.6892,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/create/create_report_definition.tsx": 1604354939550.9988,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/main/reports_table.tsx": 1604440813123.168,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/create/create_report_definition.tsx": 1604425633626.3604,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/delivery/delivery_constants.tsx": 1603729854219.1372,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/delivery/delivery.tsx": 1603915798674.0212,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/delivery/email.tsx": 1603915571755.3118,
Expand All @@ -103,11 +103,11 @@
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/report_settings/index.ts": 1599059974552.1404,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/report_settings/report_settings_constants.tsx": 1603729854230.4272,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/report_settings/report_settings_helpers.tsx": 1603830779520.467,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/report_settings/report_settings.tsx": 1604354954027.6428,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/report_settings/report_settings.tsx": 1604425633636.2595,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/report_settings/time_range.tsx": 1603845287269.1287,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/report_trigger/index.ts": 1599059974556.8005,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/report_trigger/report_trigger_constants.tsx": 1604354984673.3975,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/report_trigger/report_trigger.tsx": 1604354965586.7837,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/report_trigger/report_trigger.tsx": 1604425633644.8135,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/report_trigger/timezone.tsx": 1603729854238.0894,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/utils/index.ts": 1603414462623.5815,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/index.scss": 1603729854239.3784,
Expand Down
18 changes: 12 additions & 6 deletions kibana-reports/target/public/1.plugin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion kibana-reports/target/public/1.plugin.js.map

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions kibana-reports/test/cypress/integration/create.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ describe('Cypress', () => {

// create an on-demand report definition
cy.get('#createNewReportDefinition').click();

// cy.location('pathname').should('include', '/opendistro_kibana_reports#/');
});

it('Create a new scheduled report definition', () => {
Expand Down
57 changes: 57 additions & 0 deletions kibana-reports/test/cypress/integration/details.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* 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('Cypress', () => {
it('Visit report definition details page', () => {
cy.visit('http://localhost:5601/app/opendistro_kibana_reports#/');
cy.location('pathname', { timeout: 60000 }).should(
'include',
'/opendistro_kibana_reports'
);

cy.wait(12500);

cy.get('#reportDefinitionDetailsLink').first().click();

cy.url().should('include', 'report_definition_details');

cy.get('#deleteReportDefinitionButton').should('exist');

cy.get('#editReportDefinitionButton').should('exist');

if (cy.get('body').contains('Schedule details')) {
cy.wait(1000);
cy.get('#changeStatusFromDetailsButton').click();
} else {
cy.wait(1000);
cy.get('#generateReportFromDetailsButton').click();
}

cy.get('#deleteReportDefinitionButton').click();
});

it('Visit report details page', () => {
cy.visit('http://localhost:5601/app/opendistro_kibana_reports#/');
cy.location('pathname', { timeout: 60000 }).should(
'include',
'/opendistro_kibana_reports'
);

cy.wait(12500);
cy.get('#reportDetailsLink').first().click();

cy.url().should('include', 'report_details');
});
});