From a024568679058a07b97a2bb137490b631baaa8a8 Mon Sep 17 00:00:00 2001 From: WangQianliang Date: Mon, 3 Jun 2019 15:21:43 +0800 Subject: [PATCH] [Code] fix history functional test (#37332) * enable history functional test and fix flaky test --- .../code/public/components/main/side_tabs.tsx | 4 ++-- x-pack/test/functional/apps/code/history.ts | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/x-pack/legacy/plugins/code/public/components/main/side_tabs.tsx b/x-pack/legacy/plugins/code/public/components/main/side_tabs.tsx index 75bb7d4da4978..16e1a17d22a10 100644 --- a/x-pack/legacy/plugins/code/public/components/main/side_tabs.tsx +++ b/x-pack/legacy/plugins/code/public/components/main/side_tabs.tsx @@ -69,9 +69,9 @@ class CodeSideTabs extends React.PureComponent { return [ { id: Tabs.file, - name: 'Files', + 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/history.ts b/x-pack/test/functional/apps/code/history.ts index e024e21df502d..373458dc6bc64 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', () => { @@ -224,22 +224,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(); }); }); });