Skip to content

Commit

Permalink
[Code] fix flaky functional test (#43563) (#44354)
Browse files Browse the repository at this point in the history
* fix(code/frontend): fix flaky functional test
  • Loading branch information
WangQianliang authored Aug 29, 2019
1 parent a412365 commit d3266dc
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 13 deletions.
9 changes: 7 additions & 2 deletions x-pack/test/functional/apps/code/explore_repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ export default function exploreRepositoryFunctionalTests({

const FIND_TIME = config.get('timeouts.find');

// FLAKY: https://github.com/elastic/kibana/issues/43557
describe.skip('Explore Repository', function() {
describe('Explore Repository', function() {
this.tags('smoke');
describe('Explore a repository', () => {
const repositoryListSelector = 'codeRepositoryList codeRepositoryItem';
Expand Down Expand Up @@ -95,6 +94,8 @@ export default function exploreRepositoryFunctionalTests({
// open a file that does not exists
const url = `${PageObjects.common.getHostPort()}/app/code#/github.com/elastic/TypeScript-Node-Starter/tree/master/I_DO_NOT_EXIST`;
await browser.get(url);
await PageObjects.header.awaitKibanaChrome();

await retry.try(async () => {
const currentUrl: string = await browser.getCurrentUrl();
expect(
Expand Down Expand Up @@ -222,6 +223,8 @@ export default function exploreRepositoryFunctionalTests({
log.debug('it goes to a deep node of file tree');
const url = `${PageObjects.common.getHostPort()}/app/code#/github.com/elastic/TypeScript-Node-Starter/blob/master/src/models/User.ts`;
await browser.get(url);
await PageObjects.header.awaitKibanaChrome();

// Click breadcrumb does not affect file tree
await retry.try(async () => {
expect(await exists('codeFileBreadcrumb-src')).ok();
Expand Down Expand Up @@ -305,6 +308,8 @@ export default function exploreRepositoryFunctionalTests({
const notExistRepoUri = 'github.com/I_DO_NOT_EXIST/I_DO_NOT_EXIST';
const url = `${PageObjects.common.getHostPort()}/app/code#/${notExistRepoUri}`;
await browser.get(url);
await PageObjects.header.awaitKibanaChrome();

await retry.try(async () => {
const currentUrl: string = await browser.getCurrentUrl();
// should redirect to main page
Expand Down
9 changes: 6 additions & 3 deletions x-pack/test/functional/apps/code/file_tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ export default function exploreRepositoryFunctionalTests({
const PageObjects = getPageObjects(['common', 'header', 'security', 'code', 'home']);
const exists = async (selector: string) => testSubjects.exists(selector, { allowHidden: true });

// FLAKY: https://github.com/elastic/kibana/issues/43492
describe.skip('File Tree', function() {
describe('File Tree', function() {
this.tags('smoke');
const repositoryListSelector = 'codeRepositoryList codeRepositoryItem';

Expand Down Expand Up @@ -98,7 +97,11 @@ export default function exploreRepositoryFunctionalTests({

await browser.refresh();

await retry.tryForTime(15000, async () => {
await PageObjects.header.awaitKibanaChrome();

await testSubjects.waitForDeleted('.euiLoadingSpinner');

await retry.tryForTime(30000, async () => {
// should only open one folder at this time
expect(await exists('codeFileTreeNode-Directory-Icon-elastic/src/code-open')).ok();
expect(await exists('codeFileTreeNode-Directory-Icon-kibana/src/code-closed')).ok();
Expand Down
24 changes: 16 additions & 8 deletions x-pack/test/functional/apps/code/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ export default function manageRepositoriesFunctionalTests({
const find = getService('find');
const PageObjects = getPageObjects(['common', 'header', 'security', 'code', 'home']);

// FLAKY: https://github.com/elastic/kibana/issues/37859
describe.skip('History', function() {
const existsInvisible = async (selector: string) =>
await testSubjects.exists(selector, { allowHidden: true });

describe('History', function() {
this.tags('smoke');
const repositoryListSelector = 'codeRepositoryList codeRepositoryItem';

Expand Down Expand Up @@ -130,13 +132,14 @@ export default function manageRepositoriesFunctionalTests({
});
});

// FLAKY: https://github.com/elastic/kibana/issues/39163
it.skip('in search page, change language filters can go back and forward', async () => {
it('in search page, change language filters can go back and forward', async () => {
log.debug('it select typescript language filter');
const url = `${PageObjects.common.getHostPort()}/app/code#/search?q=string&p=&langs=typescript`;
const url = `${PageObjects.common.getHostPort()}/app/code#/search?q=string&langs=typescript`;
await browser.get(url);

await retry.try(async () => {
await PageObjects.header.awaitKibanaChrome();

await retry.tryForTime(300000, async () => {
const language = await (await find.byCssSelector(
'.euiFacetButton--isSelected'
)).getVisibleText();
Expand Down Expand Up @@ -180,14 +183,16 @@ export default function manageRepositoriesFunctionalTests({
log.debug('it goes back after line number changed');
const url = `${PageObjects.common.getHostPort()}/app/code#/github.com/elastic/TypeScript-Node-Starter`;
await browser.get(url);
await PageObjects.header.awaitKibanaChrome();

const lineNumber = 20;
await retry.try(async () => {
const existence = await testSubjects.exists('codeFileTreeNode-File-tsconfig.json');
const existence = await existsInvisible('codeFileTreeNode-File-tsconfig.json');
expect(existence).to.be(true);
});
await testSubjects.click('codeFileTreeNode-File-tsconfig.json');
await retry.try(async () => {
const existence = await testSubjects.exists('codeFileTreeNode-File-package.json');
const existence = await existsInvisible('codeFileTreeNode-File-package.json');
expect(existence).to.be(true);
});
await testSubjects.click('codeFileTreeNode-File-package.json');
Expand Down Expand Up @@ -227,6 +232,9 @@ export default function manageRepositoriesFunctionalTests({
await browser.get(url);
// refresh so language server will be initialized.
await browser.refresh();

await PageObjects.header.awaitKibanaChrome();

// wait for tab is not disabled
await PageObjects.common.sleep(5000);
await testSubjects.click('codeStructureTreeTab');
Expand Down

0 comments on commit d3266dc

Please sign in to comment.