Skip to content

Commit

Permalink
Merge branch 'master' into include-hjson-as-prod-dep
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Sep 30, 2020
2 parents 0644189 + 1ba706c commit fb8ddb3
Show file tree
Hide file tree
Showing 38 changed files with 370 additions and 65 deletions.
3 changes: 2 additions & 1 deletion examples/bfetch_explorer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
],
"exclude": [],
"references": [
{ "path": "../../src/core/tsconfig.json" }
{ "path": "../../src/core/tsconfig.json" },
{ "path": "../../src/plugins/kibana_react/tsconfig.json" },
]
}
3 changes: 2 additions & 1 deletion examples/embeddable_examples/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
],
"exclude": [],
"references": [
{ "path": "../../src/core/tsconfig.json" }
{ "path": "../../src/core/tsconfig.json" },
{ "path": "../../src/plugins/kibana_react/tsconfig.json" },
]
}
4 changes: 3 additions & 1 deletion examples/state_containers_examples/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
],
"exclude": [],
"references": [
{ "path": "../../src/core/tsconfig.json" }
{ "path": "../../src/core/tsconfig.json" },
{ "path": "../../src/plugins/kibana_utils/tsconfig.json" },
{ "path": "../../src/plugins/kibana_react/tsconfig.json" },
]
}
3 changes: 2 additions & 1 deletion examples/ui_action_examples/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
],
"exclude": [],
"references": [
{ "path": "../../src/core/tsconfig.json" }
{ "path": "../../src/core/tsconfig.json" },
{ "path": "../../src/plugins/kibana_react/tsconfig.json" },
]
}
3 changes: 2 additions & 1 deletion examples/ui_actions_explorer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
],
"exclude": [],
"references": [
{ "path": "../../src/core/tsconfig.json" }
{ "path": "../../src/core/tsconfig.json" },
{ "path": "../../src/plugins/kibana_react/tsconfig.json" },
]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"kbn:watch": "node scripts/kibana --dev --logging.json=false",
"build:types": "rm -rf ./target/types && tsc --p tsconfig.types.json",
"docs:acceptApiChanges": "node --max-old-space-size=6144 scripts/check_published_api_changes.js --accept",
"kbn:bootstrap": "node scripts/build_ts_refs && node scripts/register_git_hook",
"kbn:bootstrap": "node scripts/build_ts_refs --project tsconfig.refs.json && node scripts/register_git_hook",
"spec_to_console": "node scripts/spec_to_console",
"backport-skip-ci": "backport --prDescription \"[skip-ci]\"",
"storybook": "node scripts/storybook",
Expand Down
29 changes: 23 additions & 6 deletions src/dev/typescript/build_refs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,37 @@
*/

import execa from 'execa';
import Path from 'path';
import { run, ToolingLog } from '@kbn/dev-utils';

export async function buildRefs(log: ToolingLog) {
export async function buildAllRefs(log: ToolingLog) {
await buildRefs(log, 'tsconfig.refs.json');
await buildRefs(log, Path.join('x-pack', 'tsconfig.refs.json'));
}

async function buildRefs(log: ToolingLog, projectPath: string) {
try {
log.info('Building TypeScript projects refs...');
await execa(require.resolve('typescript/bin/tsc'), ['-b', 'tsconfig.refs.json']);
log.debug(`Building TypeScript projects refs for ${projectPath}...`);
await execa(require.resolve('typescript/bin/tsc'), ['-b', projectPath]);
} catch (e) {
log.error(e);
process.exit(1);
}
}

export async function runBuildRefs() {
run(async ({ log }) => {
await buildRefs(log);
});
run(
async ({ log, flags }) => {
await buildRefs(log, flags.project as string);
},
{
description: 'Build TypeScript projects',
flags: {
string: ['project'],
help: `
--project Required, path to the tsconfig.refs.file
`,
},
}
);
}
10 changes: 8 additions & 2 deletions src/dev/typescript/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ import { Project } from './project';

export const PROJECTS = [
new Project(resolve(REPO_ROOT, 'tsconfig.json')),
new Project(resolve(REPO_ROOT, 'src/test_utils/tsconfig.json')),
new Project(resolve(REPO_ROOT, 'src/core/tsconfig.json')),
new Project(resolve(REPO_ROOT, 'test/tsconfig.json'), { name: 'kibana/test' }),
new Project(resolve(REPO_ROOT, 'x-pack/tsconfig.json')),
new Project(resolve(REPO_ROOT, 'x-pack/test/tsconfig.json'), { name: 'x-pack/test' }),
new Project(resolve(REPO_ROOT, 'src/test_utils/tsconfig.json')),
new Project(resolve(REPO_ROOT, 'src/core/tsconfig.json')),
new Project(resolve(REPO_ROOT, 'x-pack/plugins/security_solution/cypress/tsconfig.json'), {
name: 'security_solution/cypress',
}),
Expand All @@ -47,6 +47,12 @@ export const PROJECTS = [
...glob
.sync('packages/*/tsconfig.json', { cwd: REPO_ROOT })
.map((path) => new Project(resolve(REPO_ROOT, path))),
...glob
.sync('src/plugins/*/tsconfig.json', { cwd: REPO_ROOT })
.map((path) => new Project(resolve(REPO_ROOT, path))),
...glob
.sync('x-pack/plugins/*/tsconfig.json', { cwd: REPO_ROOT })
.map((path) => new Project(resolve(REPO_ROOT, path))),
...glob
.sync('examples/*/tsconfig.json', { cwd: REPO_ROOT })
.map((path) => new Project(resolve(REPO_ROOT, path))),
Expand Down
4 changes: 2 additions & 2 deletions src/dev/typescript/run_type_check_cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import getopts from 'getopts';

import { execInProjects } from './exec_in_projects';
import { filterProjectsByFlag } from './projects';
import { buildRefs } from './build_refs';
import { buildAllRefs } from './build_refs';

export async function runTypeCheckCli() {
const extraFlags: string[] = [];
Expand Down Expand Up @@ -80,7 +80,7 @@ export async function runTypeCheckCli() {
process.exit();
}

await buildRefs(log);
await buildAllRefs(log);

const tscArgs = [
// composite project cannot be used with --noEmit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ class FilterEditorUI extends Component<Props, State> {
</EuiFlexItem>
<EuiFlexItem grow={false} className="filterEditor__hiddenItem" />
<EuiFlexItem grow={false}>
<EuiButtonEmpty size="xs" onClick={this.toggleCustomEditor}>
<EuiButtonEmpty
size="xs"
data-test-subj="editQueryDSL"
onClick={this.toggleCustomEditor}
>
{this.state.isCustomEditorOpen ? (
<FormattedMessage
id="data.filter.filterEditor.editFilterValuesButtonLabel"
Expand All @@ -133,6 +137,7 @@ class FilterEditorUI extends Component<Props, State> {

<EuiSwitch
id="filterEditorCustomLabelSwitch"
data-test-subj="createCustomLabel"
label={this.props.intl.formatMessage({
id: 'data.filter.filterEditor.createCustomLabelSwitchLabel',
defaultMessage: 'Create custom label?',
Expand Down
1 change: 1 addition & 0 deletions src/plugins/kibana_react/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"id": "kibanaReact",
"version": "kibana",
"ui": true,
"server": false,
"requiredBundles": ["kibanaUtils"]
}
17 changes: 17 additions & 0 deletions src/plugins/kibana_react/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
"emitDeclarationOnly": true,
"declaration": true,
"declarationMap": true
},
"include": [
"public/**/*",
"../../../typings/**/*"
],
"references": [
{ "path": "../kibana_utils/tsconfig.json" }
]
}
1 change: 1 addition & 0 deletions src/plugins/kibana_utils/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"id": "kibanaUtils",
"version": "kibana",
"ui": true,
"server": false,
"extraPublicDirs": [
"common",
"demos/state_containers/todomvc",
Expand Down
22 changes: 22 additions & 0 deletions src/plugins/kibana_utils/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
"emitDeclarationOnly": true,
"declaration": true,
"declarationMap": true
},
"include": [
"common/**/*",
"demos/**/*",
"public/**/*",
"server/**/*",
"index.ts",
"../../../typings/**/*"
],
"references": [
{ "path": "../../test_utils/tsconfig.json" },
{ "path": "../../core/tsconfig.json" }
]
}
4 changes: 4 additions & 0 deletions test/accessibility/apps/discover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.timePicker.setDefaultAbsoluteRange();
});

after(async () => {
await esArchiver.unload('logstash_functional');
});

it('Discover main page', async () => {
await a11y.testAppSnapshot();
});
Expand Down
95 changes: 95 additions & 0 deletions test/accessibility/apps/filter_panel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

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

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['common', 'discover', 'home']);
const a11y = getService('a11y');
const filterBar = getService('filterBar');
const testSubjects = getService('testSubjects');
const browser = getService('browser');

describe('Filter panel', () => {
before(async () => {
await PageObjects.common.navigateToUrl('home', '/tutorial_directory/sampleData', {
useActualUrl: true,
});
await PageObjects.home.addSampleDataSet('flights');
await PageObjects.common.navigateToApp('discover');
await PageObjects.discover.selectIndexPattern('kibana_sample_data_flights');
});

it('a11y test on add filter panel', async () => {
await PageObjects.discover.openAddFilterPanel();
await a11y.testAppSnapshot();
await filterBar.addFilter('OriginCityName', 'is', 'Rome');
});

it('a11y test on filter panel with custom label', async () => {
await filterBar.clickEditFilter('OriginCityName', 'Rome');
await testSubjects.click('createCustomLabel');
await a11y.testAppSnapshot();
});

it('a11y test on Edit filter as Query DSL panel', async () => {
await testSubjects.click('editQueryDSL');
await a11y.testAppSnapshot();
await browser.pressKeys(browser.keys.ESCAPE);
});

// the following tests filter panel options which changes UI
it('a11y test on filter panel options panel', async () => {
await filterBar.addFilter('DestCountry', 'is', 'AU');
await testSubjects.click('showFilterActions');
await a11y.testAppSnapshot();
});

it('a11y test on disable all filter options view', async () => {
await testSubjects.click('disableAllFilters');
await a11y.testAppSnapshot();
});

it('a11y test on pin filters view', async () => {
await testSubjects.click('showFilterActions');
await testSubjects.click('enableAllFilters');
await testSubjects.click('showFilterActions');
await testSubjects.click('pinAllFilters');
await a11y.testAppSnapshot();
});

it('a11y test on unpin all filters view', async () => {
await testSubjects.click('showFilterActions');
await testSubjects.click('unpinAllFilters');
await a11y.testAppSnapshot();
});

it('a11y test on invert inclusion of all filters view', async () => {
await testSubjects.click('showFilterActions');
await testSubjects.click('invertInclusionAllFilters');
await a11y.testAppSnapshot();
});

it('a11y test on remove all filtes view', async () => {
await testSubjects.click('showFilterActions');
await testSubjects.click('removeAllFilters');
await a11y.testAppSnapshot();
});
});
}
4 changes: 4 additions & 0 deletions test/accessibility/apps/management.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.settings.navigateTo();
});

after(async () => {
await esArchiver.unload('logstash_functional');
});

it('main view', async () => {
await a11y.testAppSnapshot();
});
Expand Down
1 change: 1 addition & 0 deletions test/accessibility/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
require.resolve('./apps/management'),
require.resolve('./apps/console'),
require.resolve('./apps/home'),
require.resolve('./apps/filter_panel'),
],
pageObjects,
services,
Expand Down
4 changes: 3 additions & 1 deletion test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
"interpreter_functional/plugins/**/*"
],
"references": [
{ "path": "../src/core/tsconfig.json" }
{ "path": "../src/core/tsconfig.json" },
{ "path": "../src/plugins/kibana_utils/tsconfig.json" },
{ "path": "../src/plugins/kibana_react/tsconfig.json" }
]
}
8 changes: 6 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"exclude": [
"src/**/__fixtures__/**/*",
"src/test_utils/**/*",
"src/core/**/*"
"src/core/**/*",
"src/plugins/kibana_utils/**/*",
"src/plugins/kibana_react/**/*"
// In the build we actually exclude **/public/**/* from this config so that
// we can run the TSC on both this and the .browser version of this config
// file, but if we did it during development IDEs would not be able to find
Expand All @@ -21,6 +23,8 @@
],
"references": [
{ "path": "./src/test_utils/tsconfig.json" },
{ "path": "./src/core/tsconfig.json" }
{ "path": "./src/core/tsconfig.json" },
{ "path": "./src/plugins/kibana_utils/tsconfig.json" },
{ "path": "./src/plugins/kibana_react/tsconfig.json" }
]
}
6 changes: 4 additions & 2 deletions tsconfig.refs.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"include": [],
"references": [
{ "path": "./src/test_utils" },
{ "path": "./src/core" },
{ "path": "./src/test_utils/tsconfig.json" },
{ "path": "./src/core/tsconfig.json" },
{ "path": "./src/plugins/kibana_utils/tsconfig.json" },
{ "path": "./src/plugins/kibana_react/tsconfig.json" },
]
}
4 changes: 3 additions & 1 deletion x-pack/examples/ui_actions_enhanced_examples/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
],
"exclude": [],
"references": [
{ "path": "../../../src/core/tsconfig.json" }
{ "path": "../../../src/core/tsconfig.json" },
{ "path": "../../../src/plugins/kibana_utils/tsconfig.json" },
{ "path": "../../../src/plugins/kibana_react/tsconfig.json" },
]
}
Loading

0 comments on commit fb8ddb3

Please sign in to comment.