Skip to content

Commit

Permalink
[Observability] [RAC] Add basic functional tests for observability al…
Browse files Browse the repository at this point in the history
…erts (#109876)

* Add basic functional tests for observability alerts
  • Loading branch information
Kerry350 committed Sep 1, 2021
1 parent b17d87e commit b74345c
Show file tree
Hide file tree
Showing 5 changed files with 788 additions and 0 deletions.
52 changes: 52 additions & 0 deletions x-pack/test/functional/apps/observability/alerts/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import expect from '@kbn/expect';
import querystring from 'querystring';
import { FtrProviderContext } from '../../../ftr_provider_context';

// Based on the x-pack/test/functional/es_archives/observability/alerts archive.
const DATE_WITH_DATA = {
rangeFrom: '2021-08-31T13:36:22.109Z',
rangeTo: '2021-09-01T13:36:22.109Z',
};

export default ({ getPageObjects, getService }: FtrProviderContext) => {
const esArchiver = getService('esArchiver');

describe('Observability alerts', function () {
this.tags('includeFirefox');

const pageObjects = getPageObjects(['common']);
const testSubjects = getService('testSubjects');

before(async () => {
await esArchiver.load('x-pack/test/functional/es_archives/observability/alerts');
await pageObjects.common.navigateToUrlWithBrowserHistory(
'observability',
'/alerts',
`?${querystring.stringify(DATE_WITH_DATA)}`
);
});

after(async () => {
await esArchiver.unload('x-pack/test/functional/es_archives/observability/alerts');
});

describe('Alerts table', () => {
it('Renders the table', async () => {
await testSubjects.existOrFail('events-viewer-panel');
});

it('Renders the correct number of cells', async () => {
// NOTE: This isn't ideal, but EuiDataGrid doesn't really have the concept of "rows"
const cells = await testSubjects.findAll('dataGridRowCell');
expect(cells.length).to.be(54);
});
});
});
};
1 change: 1 addition & 0 deletions x-pack/test/functional/apps/observability/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ export default function ({ loadTestFile }: FtrProviderContext) {
describe('Observability specs', function () {
this.tags('ciGroup6');
loadTestFile(require.resolve('./feature_controls'));
loadTestFile(require.resolve('./alerts'));
});
}
4 changes: 4 additions & 0 deletions x-pack/test/functional/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export default async function ({ readConfigFile }) {
'--timelion.ui.enabled=true',
'--savedObjects.maxImportPayloadBytes=10485760', // for OSS test management/_import_objects
'--xpack.observability.unsafe.cases.enabled=true',
'--xpack.observability.unsafe.alertingExperience.enabled=true', // NOTE: Can be removed once enabled by default
],
},
uiSettings: {
Expand Down Expand Up @@ -207,6 +208,9 @@ export default async function ({ readConfigFile }) {
securitySolution: {
pathname: '/app/security',
},
observability: {
pathname: '/app/observability',
},
},

// choose where screenshots should be saved
Expand Down
Binary file not shown.
Loading

0 comments on commit b74345c

Please sign in to comment.