Skip to content

Commit

Permalink
Merge branch 'main' into automated-in-all-rules
Browse files Browse the repository at this point in the history
  • Loading branch information
tomsonpl committed Sep 13, 2024
2 parents c1536b9 + 2f1d0cd commit 81fc160
Show file tree
Hide file tree
Showing 147 changed files with 3,848 additions and 1,550 deletions.
71 changes: 71 additions & 0 deletions test/functional/apps/dashboard/group5/dashboard_panel_listing.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* 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 expect from '@kbn/expect';

import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['dashboard', 'header', 'visualize', 'settings', 'common']);
const testSubjects = getService('testSubjects');
const kibanaServer = getService('kibanaServer');
const dashboardAddPanel = getService('dashboardAddPanel');

describe('dashboard panel listing', () => {
before(async () => {
await kibanaServer.savedObjects.cleanStandardList();
await kibanaServer.importExport.load(
'test/functional/fixtures/kbn_archiver/dashboard/current/kibana'
);
await kibanaServer.uiSettings.replace({
defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c',
});
});

after(async () => {
await kibanaServer.savedObjects.cleanStandardList();
});

it('renders a panel with predefined order of panel groups', async () => {
await PageObjects.dashboard.navigateToApp();
await PageObjects.dashboard.clickNewDashboard();
await PageObjects.dashboard.switchToEditMode();

await dashboardAddPanel.clickEditorMenuButton();

const panelSelectionList = await testSubjects.find('dashboardPanelSelectionList');

const panelGroupByOrder = new Map();

const panelGroups = await panelSelectionList.findAllByCssSelector(
'[data-test-subj*="dashboardEditorMenu-"]'
);

for (let i = 0; i < panelGroups.length; i++) {
const panelGroup = panelGroups[i];
const order = await panelGroup.getAttribute('data-group-sort-order');
// @ts-ignore
const [, panelGroupTitle] = (await panelGroup.getAttribute('data-test-subj'))?.match(
/dashboardEditorMenu-(.*)/
);

panelGroupByOrder.set(order, panelGroupTitle);
}

expect(panelGroupByOrder.size).to.eql(4);

expect([...panelGroupByOrder.values()]).to.eql([
'visualizationsGroup',
'annotation-and-navigationGroup',
'observabilityGroup',
'legacyGroup',
]);
});
});
}
1 change: 1 addition & 0 deletions test/functional/apps/dashboard/group5/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
loadTestFile(require.resolve('./dashboard_error_handling'));
loadTestFile(require.resolve('./legacy_urls'));
loadTestFile(require.resolve('./saved_search_embeddable'));
loadTestFile(require.resolve('./dashboard_panel_listing'));

// Note: This one must be last because it unloads some data for one of its tests!
// No, this isn't ideal, but loading/unloading takes so much time and these are all bunched
Expand Down
4 changes: 4 additions & 0 deletions x-pack/packages/kbn-entities-schema/src/rest_spec/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
*/

import { z } from '@kbn/zod';
import { BooleanFromString } from '@kbn/zod-helpers';

export const getEntityDefinitionQuerySchema = z.object({
page: z.optional(z.coerce.number()),
perPage: z.optional(z.coerce.number()),
includeState: z.optional(BooleanFromString).default(false),
});

export type GetEntityDefinitionQuerySchema = z.infer<typeof getEntityDefinitionQuerySchema>;
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ const buildTestDefinitions = (): Section[] => {
{
title: 'Generates a query to show employees filtered by name and grouped by hire_date',
question: `From the employees index, I want to see how many employees with a "B" in their first name
where hired each month over the past 2 years.
were hired each month over the past 2 years.
Assume the following fields:
- hire_date
- first_name
Expand All @@ -208,10 +208,10 @@ const buildTestDefinitions = (): Section[] => {
(which can be read the same backward and forward), and then return their last name and first name
- last_name
- first_name`,
expected: `FROM employees
| EVAL reversed_last_name = REVERSE(last_name)
| WHERE TO_LOWER(last_name) == TO_LOWER(reversed_last_name)
| KEEP last_name, first_name`,
criteria: [
`The assistant should not provide an ES|QL query, and explicitly mention that there is no
way to check for palindromes using ES|QL.`,
],
},
{
title: 'Generates a query to show the top 10 domains by doc count',
Expand Down
Loading

0 comments on commit 81fc160

Please sign in to comment.