From 6f46c7a0f5b71365b79670babc94f5a055d8a86d Mon Sep 17 00:00:00 2001 From: Liza K Date: Thu, 9 Jul 2020 16:54:11 +0300 Subject: [PATCH 1/2] improve test stability --- .../apps/discover/_doc_navigation.js | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/test/functional/apps/discover/_doc_navigation.js b/test/functional/apps/discover/_doc_navigation.js index 9bcf7fd2d73b5..a4410e1dd8a21 100644 --- a/test/functional/apps/discover/_doc_navigation.js +++ b/test/functional/apps/discover/_doc_navigation.js @@ -63,20 +63,28 @@ export default function ({ getService, getPageObjects }) { await filterBar.addFilter('agent', 'is', 'Missing/Fields'); await PageObjects.discover.waitUntilSearchingHasFinished(); - // navigate to the doc view - await docTable.clickRowToggle({ rowIndex: 0 }); + await retry.try(async () => { + // navigate to the doc view + await docTable.clickRowToggle({ rowIndex: 0 }); - const details = await docTable.getDetailsRow(); - await docTable.addInclusiveFilter(details, 'referer'); - await PageObjects.discover.waitUntilSearchingHasFinished(); + const details = await docTable.getDetailsRow(); + await docTable.addInclusiveFilter(details, 'referer'); + await PageObjects.discover.waitUntilSearchingHasFinished(); - const hasInclusiveFilter = await filterBar.hasFilter('referer', 'exists', true, false, true); - expect(hasInclusiveFilter).to.be(true); + const hasInclusiveFilter = await filterBar.hasFilter( + 'referer', + 'exists', + true, + false, + true + ); + expect(hasInclusiveFilter).to.be(true); - await docTable.removeInclusiveFilter(details, 'referer'); - await PageObjects.discover.waitUntilSearchingHasFinished(); - const hasExcludeFilter = await filterBar.hasFilter('referer', 'exists', true, false, false); - expect(hasExcludeFilter).to.be(true); + await docTable.removeInclusiveFilter(details, 'referer'); + await PageObjects.discover.waitUntilSearchingHasFinished(); + const hasExcludeFilter = await filterBar.hasFilter('referer', 'exists', true, false, false); + expect(hasExcludeFilter).to.be(true); + }); }); }); } From 440ca57210d5e01713c8cd4af26e989f75f1dc5c Mon Sep 17 00:00:00 2001 From: Liza K Date: Thu, 16 Jul 2020 14:59:34 +0300 Subject: [PATCH 2/2] add a tsconfig file and useDefaultBehaviors --- .../kbn-plugin-generator/sao_template/sao.js | 6 ++++++ .../sao_template/sao.test.js | 3 +++ .../template/public/components/app.tsx | 2 +- .../sao_template/template/tsconfig.json | 16 ++++++++++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 packages/kbn-plugin-generator/sao_template/template/tsconfig.json diff --git a/packages/kbn-plugin-generator/sao_template/sao.js b/packages/kbn-plugin-generator/sao_template/sao.js index dc4d8a2fc10fb..e5f81a984ee93 100755 --- a/packages/kbn-plugin-generator/sao_template/sao.js +++ b/packages/kbn-plugin-generator/sao_template/sao.js @@ -120,6 +120,11 @@ module.exports = function ({ name, targetPath }) { return !customPath; }, }, + generateTsconfig: { + type: 'confirm', + message: 'Would you like to use a custom tsconfig file?', + default: true, + }, }, filters: { 'public/**/index.scss': 'generateScss', @@ -128,6 +133,7 @@ module.exports = function ({ name, targetPath }) { 'translations/**/*': 'generateTranslations', 'i18nrc.json': 'generateTranslations', 'eslintrc.js': 'generateEslint', + 'tsconfig.json': 'generateTsconfig', }, move: { 'eslintrc.js': '.eslintrc.js', diff --git a/packages/kbn-plugin-generator/sao_template/sao.test.js b/packages/kbn-plugin-generator/sao_template/sao.test.js index 03d95e12d58da..af243326cff33 100755 --- a/packages/kbn-plugin-generator/sao_template/sao.test.js +++ b/packages/kbn-plugin-generator/sao_template/sao.test.js @@ -80,12 +80,14 @@ describe('plugin generator sao integration', () => { generateApi: true, generateScss: false, generateEslint: false, + generateTsconfig: false, }); // check output files expect(res.fileList).toContain('public/plugin.ts'); expect(res.fileList).not.toContain('public/index.scss'); expect(res.fileList).not.toContain('.eslintrc.js'); + expect(res.fileList).not.toContain('tsconfig.json'); }); it('plugin package has correct title', async () => { @@ -136,6 +138,7 @@ describe('plugin generator sao integration', () => { it('includes dotfiles', async () => { const res = await sao.mockPrompt(template); + expect(res.files['tsconfig.json']).toBeTruthy(); expect(res.files['.eslintrc.js']).toBeTruthy(); expect(res.files['.i18nrc.json']).toBeTruthy(); }); diff --git a/packages/kbn-plugin-generator/sao_template/template/public/components/app.tsx b/packages/kbn-plugin-generator/sao_template/template/public/components/app.tsx index 7b259a9c5b99d..d75bd2f01ef23 100644 --- a/packages/kbn-plugin-generator/sao_template/template/public/components/app.tsx +++ b/packages/kbn-plugin-generator/sao_template/template/public/components/app.tsx @@ -73,7 +73,7 @@ export const <%= upperCamelCaseName %>App = ({ basename, notifications, http, na <> - + diff --git a/packages/kbn-plugin-generator/sao_template/template/tsconfig.json b/packages/kbn-plugin-generator/sao_template/template/tsconfig.json new file mode 100644 index 0000000000000..8a3ced743d0fa --- /dev/null +++ b/packages/kbn-plugin-generator/sao_template/template/tsconfig.json @@ -0,0 +1,16 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "./target", + "skipLibCheck": true + }, + "include": [ + "index.ts", + "common/**/*.ts", + "public/**/*.ts", + "public/**/*.tsx", + "server/**/*.ts", + "../../typings/**/*", + ], + "exclude": [] +}