Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Code] fix history functional test #37332

Merged
merged 2 commits into from
Jun 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion x-pack/plugins/code/public/components/main/side_tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class CodeSideTabs extends React.PureComponent<Props> {
id: Tabs.file,
name: 'File',
content: fileTabContent,
'data-test-subj': 'codeFileTreeTab',
'data-test-subj': `codeFileTreeTab${this.sideTab === Tabs.file ? 'Active' : ''}`,
},
{
id: Tabs.structure,
Expand Down
126 changes: 63 additions & 63 deletions x-pack/test/functional/apps/code/explore_repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in this PR, the explore-repository test is skipped, so do we need to keep the changes in this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep the change since we are gonna uncomment this any way

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');
Expand Down
14 changes: 7 additions & 7 deletions x-pack/test/functional/apps/code/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we change to codeStructureTreeTabActive which is more readable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to codeStructureTreeTabActive would affect explore_repository test, can we leave it for now

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();
});
});
});
Expand Down