From 495f3a3fa88190aa270e5a94892cf0cf7db4038d Mon Sep 17 00:00:00 2001 From: wangqianliang Date: Tue, 7 May 2019 15:54:17 +0800 Subject: [PATCH 1/2] run code functional test on CI 40 times --- .ci/jobs.yml | 45 ++++-- .ci/run.sh | 2 +- .../apps/code/explore_repository.ts | 130 +++++++++--------- 3 files changed, 96 insertions(+), 81 deletions(-) diff --git a/.ci/jobs.yml b/.ci/jobs.yml index b2bc16859483b..ec3452adbe055 100644 --- a/.ci/jobs.yml +++ b/.ci/jobs.yml @@ -1,19 +1,4 @@ JOB: - - kibana-intake - - x-pack-intake - - kibana-ciGroup1 - - kibana-ciGroup2 - - kibana-ciGroup3 - - kibana-ciGroup4 - - kibana-ciGroup5 - - kibana-ciGroup6 - - kibana-ciGroup7 - - kibana-ciGroup8 - - kibana-ciGroup9 - - kibana-ciGroup10 - - kibana-ciGroup11 - - kibana-ciGroup12 - # make sure all x-pack-ciGroups are listed in test/scripts/jenkins_xpack_ci_group.sh - x-pack-ciGroup1 - x-pack-ciGroup2 - x-pack-ciGroup3 @@ -24,6 +9,36 @@ JOB: - x-pack-ciGroup8 - x-pack-ciGroup9 - x-pack-ciGroup10 + - x-pack-ciGroup11 + - x-pack-ciGroup12 + - x-pack-ciGroup13 + - x-pack-ciGroup14 + - x-pack-ciGroup15 + - x-pack-ciGroup16 + - x-pack-ciGroup17 + - x-pack-ciGroup18 + - x-pack-ciGroup19 + - x-pack-ciGroup20 + - x-pack-ciGroup21 + - x-pack-ciGroup22 + - x-pack-ciGroup23 + - x-pack-ciGroup24 + - x-pack-ciGroup25 + - x-pack-ciGroup26 + - x-pack-ciGroup27 + - x-pack-ciGroup28 + - x-pack-ciGroup29 + - x-pack-ciGroup30 + - x-pack-ciGroup31 + - x-pack-ciGroup32 + - x-pack-ciGroup33 + - x-pack-ciGroup34 + - x-pack-ciGroup35 + - x-pack-ciGroup36 + - x-pack-ciGroup37 + - x-pack-ciGroup38 + - x-pack-ciGroup39 + - x-pack-ciGroup40 # `~` is yaml for `null` exclude: ~ diff --git a/.ci/run.sh b/.ci/run.sh index bc8f73d07699d..fb5aca323f306 100755 --- a/.ci/run.sh +++ b/.ci/run.sh @@ -21,7 +21,7 @@ x-pack-intake) ./test/scripts/jenkins_xpack.sh ;; x-pack-ciGroup*) - export CI_GROUP="${JOB##x-pack-ciGroup}" + export CI_GROUP=2 ./test/scripts/jenkins_xpack_ci_group.sh ;; *) diff --git a/x-pack/test/functional/apps/code/explore_repository.ts b/x-pack/test/functional/apps/code/explore_repository.ts index 3fb2ffa9dc22f..6dea6dc12c8e7 100644 --- a/x-pack/test/functional/apps/code/explore_repository.ts +++ b/x-pack/test/functional/apps/code/explore_repository.ts @@ -8,7 +8,7 @@ import expect from '@kbn/expect'; import { TestInvoker } from './lib/types'; // eslint-disable-next-line import/no-default-export -export default function exploreRepositoryFunctonalTests({ +export default function exploreRepositoryFunctionalTests({ getService, getPageObjects, }: TestInvoker) { @@ -24,7 +24,7 @@ export default function exploreRepositoryFunctonalTests({ const FIND_TIME = config.get('timeouts.find'); // FLAKY https://github.com/elastic/kibana/issues/35944 - describe.skip('Explore Repository', () => { + describe('Explore Repository', () => { describe('Explore a repository', () => { const repositoryListSelector = 'codeRepositoryList codeRepositoryItem'; @@ -229,71 +229,71 @@ export default function exploreRepositoryFunctonalTests({ }); // TODO(qianliang): blocked by https://github.com/elastic/code/issues/1163 - // it('Click file/directory on the right panel', async () => { - // log.debug('Click file/directory on the right panel'); - - // // Wait the file tree to be rendered and click the 'src' folder on the file tree. - // await retry.try(async () => { - // expect(await testSubjects.exists('codeFileExplorerNode-src')).to.be(true); - // }); - - // await testSubjects.click('codeFileExplorerNode-src'); - // await retry.try(async () => { - // expect(await testSubjects.exists('codeFileExplorerNode-models')).to.be(true); - // }); - - // await testSubjects.click('codeFileExplorerNode-models'); - // // Then the 'models' folder on the file tree. - // await retry.try(async () => { - // expect(await testSubjects.exists('codeFileExplorerNode-User.ts')).to.be(true); - // }); - - // await testSubjects.click('codeFileExplorerNode-User.ts'); - // // Then the 'User.ts' file on the file tree. - // await retry.try(async () => { - // expect(await testSubjects.exists('codeSourceViewer')).to.be(true); - // }); - // }); + it('Click file/directory on the right panel', async () => { + log.debug('Click file/directory on the right panel'); + + // Wait the file tree to be rendered and click the 'src' folder on the file tree. + await retry.try(async () => { + expect(await testSubjects.exists('codeFileExplorerNode-src')).to.be(true); + }); + + await testSubjects.click('codeFileExplorerNode-src'); + await retry.try(async () => { + expect(await testSubjects.exists('codeFileExplorerNode-models')).to.be(true); + }); + + await testSubjects.click('codeFileExplorerNode-models'); + // Then the 'models' folder on the file tree. + await retry.try(async () => { + expect(await testSubjects.exists('codeFileExplorerNode-User.ts')).to.be(true); + }); + + await testSubjects.click('codeFileExplorerNode-User.ts'); + // Then the 'User.ts' file on the file tree. + await retry.try(async () => { + expect(await testSubjects.exists('codeSourceViewer')).to.be(true); + }); + }); // TODO(qianliang): blocked by https://github.com/elastic/code/issues/1163 - // it('Navigate source file via structure tree', async () => { - // log.debug('Navigate source file via structure tree'); - // // Wait the file tree to be rendered and click the 'src' folder on the file tree. - // await retry.try(async () => { - // expect(await testSubjects.exists('codeFileExplorerNode-src')).to.be(true); - // }); - - // await testSubjects.click('codeFileExplorerNode-src'); - // await retry.try(async () => { - // expect(await testSubjects.exists('codeFileExplorerNode-models')).to.be(true); - // }); - - // await testSubjects.click('codeFileExplorerNode-models'); - // // Then the 'models' folder on the file tree. - // await retry.try(async () => { - // expect(await testSubjects.exists('codeFileExplorerNode-User.ts')).to.be(true); - // }); - - // await testSubjects.click('codeFileExplorerNode-User.ts'); - // // Then the 'User.ts' file on the file tree. - // await retry.try(async () => { - // expect(await testSubjects.exists('codeSourceViewer')).to.be(true); - // expect(await testSubjects.exists('codeStructureTreeTab')).to.be(true); - // }); - - // // Click the structure tree tab - // await testSubjects.click('codeStructureTreeTab'); - // await retry.tryForTime(300000, async () => { - // expect(await testSubjects.exists('codeStructureTreeNode-User')).to.be(true); - - // await testSubjects.click('codeStructureTreeNode-User'); - // await retry.tryForTime(120000, async () => { - // const currentUrl: string = await browser.getCurrentUrl(); - // log.info(`Jump to url: ${currentUrl}`); - // expect(currentUrl.indexOf('src/models/User.ts!L92:6') > 0).to.be(true); - // }); - // }); - // }); + it('Navigate source file via structure tree', async () => { + log.debug('Navigate source file via structure tree'); + // Wait the file tree to be rendered and click the 'src' folder on the file tree. + await retry.try(async () => { + expect(await testSubjects.exists('codeFileExplorerNode-src')).to.be(true); + }); + + await testSubjects.click('codeFileExplorerNode-src'); + await retry.try(async () => { + expect(await testSubjects.exists('codeFileExplorerNode-models')).to.be(true); + }); + + await testSubjects.click('codeFileExplorerNode-models'); + // Then the 'models' folder on the file tree. + await retry.try(async () => { + expect(await testSubjects.exists('codeFileExplorerNode-User.ts')).to.be(true); + }); + + await testSubjects.click('codeFileExplorerNode-User.ts'); + // Then the 'User.ts' file on the file tree. + await retry.try(async () => { + expect(await testSubjects.exists('codeSourceViewer')).to.be(true); + expect(await testSubjects.exists('codeStructureTreeTab')).to.be(true); + }); + + // Click the structure tree tab + await testSubjects.click('codeStructureTreeTab'); + await retry.tryForTime(300000, async () => { + expect(await testSubjects.exists('codeStructureTreeNode-User')).to.be(true); + + await testSubjects.click('codeStructureTreeNode-User'); + await retry.tryForTime(120000, async () => { + const currentUrl: string = await browser.getCurrentUrl(); + log.info(`Jump to url: ${currentUrl}`); + expect(currentUrl.indexOf('src/models/User.ts!L92:6') > 0).to.be(true); + }); + }); + }); it('goes to a repository which does not exist should render the 404 error page', async () => { log.debug('it goes to a repository which does not exist'); From 59376aefdad5a82721a22a188b8903ec1f420485 Mon Sep 17 00:00:00 2001 From: wangqianliang Date: Wed, 29 May 2019 21:22:36 +0800 Subject: [PATCH 2/2] enable history functional test --- .ci/jobs.yml | 45 +++++++------------ .ci/run.sh | 2 +- .../code/public/components/main/side_tabs.tsx | 2 +- .../apps/code/explore_repository.ts | 4 +- x-pack/test/functional/apps/code/history.ts | 14 +++--- 5 files changed, 26 insertions(+), 41 deletions(-) diff --git a/.ci/jobs.yml b/.ci/jobs.yml index ec3452adbe055..b2bc16859483b 100644 --- a/.ci/jobs.yml +++ b/.ci/jobs.yml @@ -1,4 +1,19 @@ JOB: + - kibana-intake + - x-pack-intake + - kibana-ciGroup1 + - kibana-ciGroup2 + - kibana-ciGroup3 + - kibana-ciGroup4 + - kibana-ciGroup5 + - kibana-ciGroup6 + - kibana-ciGroup7 + - kibana-ciGroup8 + - kibana-ciGroup9 + - kibana-ciGroup10 + - kibana-ciGroup11 + - kibana-ciGroup12 + # make sure all x-pack-ciGroups are listed in test/scripts/jenkins_xpack_ci_group.sh - x-pack-ciGroup1 - x-pack-ciGroup2 - x-pack-ciGroup3 @@ -9,36 +24,6 @@ JOB: - x-pack-ciGroup8 - x-pack-ciGroup9 - x-pack-ciGroup10 - - x-pack-ciGroup11 - - x-pack-ciGroup12 - - x-pack-ciGroup13 - - x-pack-ciGroup14 - - x-pack-ciGroup15 - - x-pack-ciGroup16 - - x-pack-ciGroup17 - - x-pack-ciGroup18 - - x-pack-ciGroup19 - - x-pack-ciGroup20 - - x-pack-ciGroup21 - - x-pack-ciGroup22 - - x-pack-ciGroup23 - - x-pack-ciGroup24 - - x-pack-ciGroup25 - - x-pack-ciGroup26 - - x-pack-ciGroup27 - - x-pack-ciGroup28 - - x-pack-ciGroup29 - - x-pack-ciGroup30 - - x-pack-ciGroup31 - - x-pack-ciGroup32 - - x-pack-ciGroup33 - - x-pack-ciGroup34 - - x-pack-ciGroup35 - - x-pack-ciGroup36 - - x-pack-ciGroup37 - - x-pack-ciGroup38 - - x-pack-ciGroup39 - - x-pack-ciGroup40 # `~` is yaml for `null` exclude: ~ diff --git a/.ci/run.sh b/.ci/run.sh index fb5aca323f306..bc8f73d07699d 100755 --- a/.ci/run.sh +++ b/.ci/run.sh @@ -21,7 +21,7 @@ x-pack-intake) ./test/scripts/jenkins_xpack.sh ;; x-pack-ciGroup*) - export CI_GROUP=2 + export CI_GROUP="${JOB##x-pack-ciGroup}" ./test/scripts/jenkins_xpack_ci_group.sh ;; *) diff --git a/x-pack/plugins/code/public/components/main/side_tabs.tsx b/x-pack/plugins/code/public/components/main/side_tabs.tsx index dcc4e5e11d0b6..16e1a17d22a10 100644 --- a/x-pack/plugins/code/public/components/main/side_tabs.tsx +++ b/x-pack/plugins/code/public/components/main/side_tabs.tsx @@ -71,7 +71,7 @@ class CodeSideTabs extends React.PureComponent { id: Tabs.file, name: 'File', content: fileTabContent, - 'data-test-subj': 'codeFileTreeTab', + 'data-test-subj': `codeFileTreeTab${this.sideTab === Tabs.file ? 'Active' : ''}`, }, { id: Tabs.structure, diff --git a/x-pack/test/functional/apps/code/explore_repository.ts b/x-pack/test/functional/apps/code/explore_repository.ts index 6dea6dc12c8e7..1a387e1769b71 100644 --- a/x-pack/test/functional/apps/code/explore_repository.ts +++ b/x-pack/test/functional/apps/code/explore_repository.ts @@ -8,7 +8,7 @@ import expect from '@kbn/expect'; import { TestInvoker } from './lib/types'; // eslint-disable-next-line import/no-default-export -export default function exploreRepositoryFunctionalTests({ +export default function exploreRepositoryFunctonalTests({ getService, getPageObjects, }: TestInvoker) { @@ -24,7 +24,7 @@ export default function exploreRepositoryFunctionalTests({ const FIND_TIME = config.get('timeouts.find'); // FLAKY https://github.com/elastic/kibana/issues/35944 - describe('Explore Repository', () => { + describe.skip('Explore Repository', () => { describe('Explore a repository', () => { const repositoryListSelector = 'codeRepositoryList codeRepositoryItem'; diff --git a/x-pack/test/functional/apps/code/history.ts b/x-pack/test/functional/apps/code/history.ts index 75d004b2c4fa5..80a462f6508e3 100644 --- a/x-pack/test/functional/apps/code/history.ts +++ b/x-pack/test/functional/apps/code/history.ts @@ -24,7 +24,7 @@ export default function manageRepositoriesFunctionalTests({ const PageObjects = getPageObjects(['common', 'header', 'security', 'code', 'home']); // FLAKY: https://github.com/elastic/kibana/issues/36495 - describe.skip('History', () => { + describe('History', () => { const repositoryListSelector = 'codeRepositoryList codeRepositoryItem'; describe('browser history can go back while exploring code app', () => { @@ -200,22 +200,22 @@ export default function manageRepositoriesFunctionalTests({ await PageObjects.common.sleep(5000); await testSubjects.click('codeStructureTreeTab'); await retry.try(async () => { - const tabText = await (await find.byCssSelector('.euiTab-isSelected')).getVisibleText(); - expect(tabText).to.equal('Structure'); + // if structure tree tab is active, file tree tab's `data-test-subj` would be `codeFileTreeTab` + expect(testSubjects.exists('codeFileTreeTab')).to.be.ok(); }); await browser.goBack(); await retry.try(async () => { - const tabText = await (await find.byCssSelector('.euiTab-isSelected')).getVisibleText(); - expect(tabText).to.equal('File'); + // if file tree tab is active, file tree tab's `data-test-subj` would be `codeFileTreeTabActive` + expect(testSubjects.exists('codeFileTreeTabActive')).to.be.ok(); }); await driver.navigate().forward(); await retry.try(async () => { - const tabText = await (await find.byCssSelector('.euiTab-isSelected')).getVisibleText(); - expect(tabText).to.equal('Structure'); + // if structure tree tab is active, file tree tab's `data-test-subj` would be `codeFileTreeTab` + expect(testSubjects.exists('codeFileTreeTab')).to.be.ok(); }); }); });