Skip to content

Commit

Permalink
Add integration test for the partial results example plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
dokmic committed Sep 27, 2021
1 parent c5215e8 commit 882b437
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/examples/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export default async function ({ readConfigFile }) {
require.resolve('./expressions_explorer'),
require.resolve('./index_pattern_field_editor_example'),
require.resolve('./field_formats'),
require.resolve('./partial_results'),
],
services: {
...functionalConfig.get('services'),
Expand Down
47 changes: 47 additions & 0 deletions test/examples/partial_results/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import expect from '@kbn/expect';
import { FtrProviderContext } from 'test/functional/ftr_provider_context';

// eslint-disable-next-line import/no-default-export
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const testSubjects = getService('testSubjects');
const PageObjects = getPageObjects(['common']);

describe('Partial Results Example', function () {
before(async () => {
this.tags('ciGroup2');
await PageObjects.common.navigateToApp('partialResultsExample');

const element = await testSubjects.find('example-help');

await element.click();
await element.click();
await element.click();
});

it('should trace mouse events', async () => {
const events = await Promise.all(
(
await testSubjects.findAll('example-column-event')
).map((wrapper) => wrapper.getVisibleText())
);
expect(events).to.eql(['mousedown', 'mouseup', 'click']);
});

it('should keep track of the events number', async () => {
const counters = await Promise.all(
(
await testSubjects.findAll('example-column-count')
).map((wrapper) => wrapper.getVisibleText())
);
expect(counters).to.eql(['3', '3', '3']);
});
});
}

0 comments on commit 882b437

Please sign in to comment.