Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Reporting] Functional test structure & improvements #114298

Merged
1 change: 0 additions & 1 deletion vars/kibanaPipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,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 @@ -56,7 +56,6 @@ export default async function ({ readConfigFile }) {
resolve(__dirname, './apps/transform'),
resolve(__dirname, './apps/reporting_management'),
resolve(__dirname, './apps/management'),
resolve(__dirname, './apps/reporting'),
resolve(__dirname, './apps/lens'), // smokescreen tests cause flakiness in other tests

// This license_management file must be last because it is 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