Skip to content

Commit

Permalink
Sync 7.10 branch with reporting repo (#33)
Browse files Browse the repository at this point in the history
Sync 7.10 branch with reporting repo
  • Loading branch information
joshuali925 authored Jan 13, 2023
2 parents 3e0d379 + 76a8794 commit 61213f9
Show file tree
Hide file tree
Showing 201 changed files with 42,455 additions and 282 deletions.
18 changes: 18 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": { "node": "10" }
}
],
"@babel/preset-react",
"@babel/preset-typescript"
],
"plugins": [
"@babel/plugin-transform-modules-commonjs",
["@babel/plugin-transform-runtime", { "regenerator": true }],
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread"
]
}
78 changes: 78 additions & 0 deletions .cypress/integration/01-create.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* 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('Visits Reporting homepage', () => {
cy.visit('http://localhost:5601/app/opendistro_kibana_reports#/');
cy.location('pathname', { timeout: 60000 }).should(
'include',
'/opendistro_kibana_reports'
);
});

it('Visit Create page', () => {
cy.visit('http://localhost:5601/app/opendistro_kibana_reports#/');
cy.location('pathname', { timeout: 60000 }).should(
'include',
'/opendistro_kibana_reports'
);
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('http://localhost:5601/app/opendistro_kibana_reports#/');
cy.location('pathname', { timeout: 60000 }).should(
'include',
'/opendistro_kibana_reports'
);
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('.euiComboBox').click({ force: true });

// create an on-demand report definition
cy.get('#createNewReportDefinition').click({ force: true });
});

it('Create a new scheduled report definition', () => {
cy.visit('http://localhost:5601/app/opendistro_kibana_reports#/');
cy.location('pathname', { timeout: 60000 }).should(
'include',
'/opendistro_kibana_reports'
);
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');

// set report trigger to Schedule option
cy.get('[type="radio"]').check({ force: true });

// create scheduled report definition
cy.get('#createNewReportDefinition').click({ force: true });
});
});
92 changes: 92 additions & 0 deletions .cypress/integration/02-edit.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
* 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 edit page, update name and description', () => {
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.get('#editReportDefinitionButton').should('exist');

cy.get('#editReportDefinitionButton').click();

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

cy.wait(1000);

// update the report name
cy.get('#reportSettingsName').type(' update name');

// update report description
cy.get('#reportSettingsDescription').type(' update description');

cy.get('#editReportDefinitionButton').click({ force: true });
});

it('Visit edit page, change report source and trigger', () => {
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.get('#editReportDefinitionButton').should('exist');

cy.get('#editReportDefinitionButton').click();

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

cy.wait(1000);
cy.get('#visualizationReportSource').check({ force: true });

cy.get('#Schedule').check({ force: true });
cy.get('#editReportDefinitionButton').click({ force: true });
});

it('Visit edit page, change report source back', () => {
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.get('#editReportDefinitionButton').should('exist');

cy.get('#editReportDefinitionButton').click();

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

cy.wait(1000);

cy.get('#dashboardReportSource').check({ force: true });

cy.get('#editReportDefinitionButton').click({ force: true });
});
});
57 changes: 57 additions & 0 deletions .cypress/integration/03-details.spec.ts
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');
});
});
117 changes: 117 additions & 0 deletions .cypress/integration/04-download.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/*
* 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('Download from reporting homepage', () => {
cy.visit('http://localhost:5601/app/opendistro_kibana_reports#/');
cy.location('pathname', { timeout: 60000 }).should(
'include',
'/opendistro_kibana_reports'
);

cy.wait(12500);
cy.get('#landingPageOnDemandDownload').click({ force: true });
cy.get('body').then($body => {
if ($body.find('#downloadInProgressLoadingModal').length > 0) {
return;
}
else {
assert(false);
}
})
});

it('Download pdf from in-context menu', () => {
cy.visit('http://localhost:5601/app/dashboards#');
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('http://localhost:5601/app/dashboards#');
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('http://localhost:5601/app/discover#');
cy.wait(5000);

// open saved search list
cy.get('button.euiButtonEmpty:nth-child(3) > span:nth-child(1) > span:nth-child(1)').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('http://localhost:5601/app/opendistro_kibana_reports#/');
cy.location('pathname', { timeout: 60000 }).should(
'include',
'/opendistro_kibana_reports'
);
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');

// create an on-demand report definition
cy.get('#createNewReportDefinition').click({ force: true });

cy.wait(10000);

// visit the details page of the newly created on-demand definition
cy.get('#reportDefinitionDetailsLink').first().click();

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

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

cy.get('#generateReportFromDetailsButton').click({ force: true });

cy.get('#downloadInProgressLoadingModal');
});
});
Loading

0 comments on commit 61213f9

Please sign in to comment.