Skip to content

Commit

Permalink
[Reporting] Functional test structure & improvements (elastic#114298)
Browse files Browse the repository at this point in the history
* [Reporting] Functional test structure & improvements

* show the error of the report generation failure in the test failure

* update snapshot

* remove import to non-existent functional app test

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
tsullivan and kibanamachine committed Oct 14, 2021
1 parent 8175c4c commit 26168d3
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 80 deletions.
1 change: 0 additions & 1 deletion vars/kibanaPipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ def withGcsArtifactUpload(workerName, closure) {
'x-pack/test/**/screenshots/diff/*.png',
'x-pack/test/**/screenshots/failure/*.png',
'x-pack/test/**/screenshots/session/*.png',
'x-pack/test/functional/apps/reporting/reports/session/*.pdf',
'x-pack/test/functional/failure_debug/html/*.html',
'.es/**/*.hprof'
]
Expand Down

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

1 change: 1 addition & 0 deletions x-pack/plugins/reporting/public/notifier/job_failure.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const getFailureToast = (
})}
color="danger"
iconType="alert"
data-test-errorText={errorText}
>
{errorText}
</EuiCallOut>
Expand Down
18 changes: 18 additions & 0 deletions x-pack/test/functional/apps/reporting/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Reporting functional tests

Functional tests on report generation are under the applications that use reporting.

**PDF/PNG Report testing:**
- `x-pack/test/functional/apps/canvas/reports.ts`
- `x-pack/test/functional/apps/dashboard/reporting/screenshots.ts`
- `x-pack/test/functional/apps/lens/lens_reporting.ts`
- `x-pack/test/functional/apps/visualize/reporting.ts`

**CSV Report testing:**
- `x-pack/test/functional/apps/dashboard/reporting/download_csv.ts`
- `x-pack/test/functional/apps/discover/reporting.ts`

Reporting Management app tests are in `functional/apps/reporting_management`.

**Manage reports testing:**
- `x-pack/test/functional/apps/reporting_management`
14 changes: 0 additions & 14 deletions x-pack/test/functional/apps/reporting/index.ts

This file was deleted.

55 changes: 0 additions & 55 deletions x-pack/test/functional/apps/reporting/reporting.ts

This file was deleted.

1 change: 0 additions & 1 deletion x-pack/test/functional/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ export default async function ({ readConfigFile }) {
resolve(__dirname, './apps/transform'),
resolve(__dirname, './apps/reporting_management'),
resolve(__dirname, './apps/management'),
resolve(__dirname, './apps/reporting'),

//This upgrade assistant file needs to be run after the rest of the jobs because of
//it being destructive.
Expand Down
25 changes: 16 additions & 9 deletions x-pack/test/functional/page_objects/reporting_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export class ReportingPageObject extends FtrService {
private readonly retry = this.ctx.getService('retry');
private readonly security = this.ctx.getService('security');
private readonly testSubjects = this.ctx.getService('testSubjects');
private readonly find = this.ctx.getService('find');
private readonly share = this.ctx.getPageObject('share');
private readonly timePicker = this.ctx.getPageObject('timePicker');

Expand All @@ -33,15 +34,21 @@ export class ReportingPageObject extends FtrService {
async getReportURL(timeout: number) {
this.log.debug('getReportURL');

const url = await this.testSubjects.getAttribute(
'downloadCompletedReportButton',
'href',
timeout
);

this.log.debug(`getReportURL got url: ${url}`);

return url;
try {
const url = await this.testSubjects.getAttribute(
'downloadCompletedReportButton',
'href',
timeout
);
this.log.debug(`getReportURL got url: ${url}`);

return url;
} catch (err) {
const errorTextEl = await this.find.byCssSelector('[data-test-errorText]');
const errorText = await errorTextEl.getAttribute('data-test-errorText');
const newError = new Error(`Test report failed: ${errorText}: ${err}`);
throw newError;
}
}

async removeForceSharedItemsContainerSize() {
Expand Down

0 comments on commit 26168d3

Please sign in to comment.