[Discover][Context] Add functional test, convert to TypeScript (#108481)

This commit is contained in:
Matthias Wilhelm 2021-08-16 11:39:20 +02:00 committed by GitHub
parent 72742d0d50
commit 45ec64f99e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 39 additions and 7 deletions

View file

@ -6,6 +6,8 @@
* Side Public License, v 1.
*/
import { FtrProviderContext } from '../../ftr_provider_context';
const TEST_FILTER_COLUMN_NAMES = [
[
'agent',
@ -14,7 +16,7 @@ const TEST_FILTER_COLUMN_NAMES = [
['extension', 'jpg'],
];
export default function ({ getService, getPageObjects }) {
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const retry = getService('retry');
const browser = getService('browser');
const docTable = getService('docTable');

View file

@ -7,12 +7,13 @@
*/
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
const TEST_INDEX_PATTERN = 'date-nanos';
const TEST_DEFAULT_CONTEXT_SIZE = 1;
const TEST_STEP_SIZE = 3;
export default function ({ getService, getPageObjects }) {
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const kibanaServer = getService('kibanaServer');
const docTable = getService('docTable');
const security = getService('security');

View file

@ -7,12 +7,13 @@
*/
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
const TEST_INDEX_PATTERN = 'date_nanos_custom_timestamp';
const TEST_DEFAULT_CONTEXT_SIZE = 1;
const TEST_STEP_SIZE = 3;
export default function ({ getService, getPageObjects }) {
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const kibanaServer = getService('kibanaServer');
const docTable = getService('docTable');
const security = getService('security');

View file

@ -7,6 +7,7 @@
*/
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
const TEST_COLUMN_NAMES = ['@message'];
const TEST_FILTER_COLUMN_NAMES = [
@ -14,7 +15,7 @@ const TEST_FILTER_COLUMN_NAMES = [
['geo.src', 'IN'],
];
export default function ({ getService, getPageObjects }) {
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const retry = getService('retry');
const docTable = getService('docTable');
const filterBar = getService('filterBar');

View file

@ -6,13 +6,15 @@
* Side Public License, v 1.
*/
import { FtrProviderContext } from '../../ftr_provider_context';
const TEST_INDEX_PATTERN = 'logstash-*';
const TEST_ANCHOR_ID = 'AU_x3_BrGFA8no6QjjaI';
const TEST_ANCHOR_FILTER_FIELD = 'geo.src';
const TEST_ANCHOR_FILTER_VALUE = 'IN';
const TEST_COLUMN_NAMES = ['extension', 'geo.src'];
export default function ({ getService, getPageObjects }) {
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const docTable = getService('docTable');
const filterBar = getService('filterBar');
const retry = getService('retry');

View file

@ -6,15 +6,18 @@
* Side Public License, v 1.
*/
import { FtrProviderContext } from '../../ftr_provider_context';
const TEST_INDEX_PATTERN = 'logstash-*';
const TEST_ANCHOR_ID = 'AU_x3_BrGFA8no6QjjaI';
const TEST_DEFAULT_CONTEXT_SIZE = 2;
const TEST_STEP_SIZE = 2;
export default function ({ getService, getPageObjects }) {
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const kibanaServer = getService('kibanaServer');
const retry = getService('retry');
const docTable = getService('docTable');
const browser = getService('browser');
const PageObjects = getPageObjects(['context']);
let expectedRowLength = 2 * TEST_DEFAULT_CONTEXT_SIZE + 1;
@ -70,5 +73,25 @@ export default function ({ getService, getPageObjects }) {
}
);
});
it('should show 101 records when 50 newer and 50 older records are requests', async function () {
const predecessorCountPicker = await PageObjects.context.getPredecessorCountPicker();
await predecessorCountPicker.clearValueWithKeyboard();
await predecessorCountPicker.pressKeys('50');
await predecessorCountPicker.pressKeys(browser.keys.ENTER);
const successorCountPicker = await PageObjects.context.getSuccessorCountPicker();
await successorCountPicker.clearValueWithKeyboard();
await successorCountPicker.pressKeys('50');
await successorCountPicker.pressKeys(browser.keys.ENTER);
await retry.waitFor(
`number of rows displayed after clicking load more successors is ${expectedRowLength}`,
async function () {
const rows = await docTable.getRowsText();
return rows.length === 101;
}
);
});
});
}

View file

@ -6,7 +6,9 @@
* Side Public License, v 1.
*/
export default function ({ getService, getPageObjects, loadTestFile }) {
import { FtrProviderContext } from '../../ftr_provider_context';
export default function ({ getService, getPageObjects, loadTestFile }: FtrProviderContext) {
const browser = getService('browser');
const esArchiver = getService('esArchiver');
const PageObjects = getPageObjects(['common']);