Skip to content

Commit

Permalink
Update functional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davismcphee committed Nov 8, 2024
1 parent 42d9800 commit 1be22ed
Show file tree
Hide file tree
Showing 20 changed files with 1,076 additions and 1,558 deletions.

This file was deleted.

96 changes: 96 additions & 0 deletions test/functional/apps/discover/context_awareness/_framework.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/*
* 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import kbnRison from '@kbn/rison';
import expect from '@kbn/expect';
import type { FtrProviderContext } from '../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const { common, discover } = getPageObjects(['common', 'discover']);
const testSubjects = getService('testSubjects');
const dataViews = getService('dataViews');
const dataGrid = getService('dataGrid');
const retry = getService('retry');

describe('framework', () => {
describe('ES|QL mode', () => {
describe('custom context', () => {
it('should render formatted record in doc viewer using formatter from custom context', async () => {
const state = kbnRison.encode({
dataSource: { type: 'esql' },
query: { esql: 'from my-example-logs | sort @timestamp desc' },
});
await common.navigateToActualUrl('discover', `?_a=${state}`, {
ensureCurrentUrl: false,
});
await discover.waitUntilSearchingHasFinished();
await dataGrid.clickRowToggle({ rowIndex: 0, defaultTabId: 'doc_view_example' });
await retry.try(async () => {
const formattedRecord = await testSubjects.find(
'exampleDataSourceProfileDocViewRecord'
);
expect(await formattedRecord.getVisibleText()).to.be(
JSON.stringify(
{
'@timestamp': '2024-06-10T16:00:00.000Z',
'agent.name': 'java',
'agent.name.text': 'java',
'data_stream.type': 'logs',
'log.level': 'debug',
message: 'This is a debug log',
'service.name': 'product',
'service.name.text': 'product',
},
null,
2
)
);
});
});
});
});

describe('data view mode', () => {
describe('custom context', () => {
it('should render formatted record in doc viewer using formatter from custom context', async () => {
await common.navigateToActualUrl('discover', undefined, {
ensureCurrentUrl: false,
});
await dataViews.switchTo('my-example-logs');
await discover.waitUntilSearchingHasFinished();
await dataGrid.clickRowToggle({ rowIndex: 0, defaultTabId: 'doc_view_example' });
await retry.try(async () => {
const formattedRecord = await testSubjects.find(
'exampleDataSourceProfileDocViewRecord'
);
expect(await formattedRecord.getVisibleText()).to.be(
JSON.stringify(
{
'@timestamp': ['2024-06-10T16:00:00.000Z'],
'agent.name': ['java'],
'agent.name.text': ['java'],
'data_stream.type': ['logs'],
'log.level': ['debug'],
message: ['This is a debug log'],
'service.name': ['product'],
'service.name.text': ['product'],
_id: 'XdQFDpABfGznVC1bCHLo',
_index: 'my-example-logs',
_score: null,
},
null,
2
)
);
});
});
});
});
});
}
55 changes: 0 additions & 55 deletions test/functional/apps/discover/context_awareness/_root_profile.ts

This file was deleted.

Loading

0 comments on commit 1be22ed

Please sign in to comment.