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] bundle git repo for functional test #44547

Merged
merged 2 commits into from
Sep 6, 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
61 changes: 13 additions & 48 deletions x-pack/test/functional/apps/code/code_intelligence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { REPO_ROOT } from '@kbn/dev-utils';
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
import { load as repoLoad, unload as repoUnload } from './repo_archiver';

export default function codeIntelligenceFunctionalTests({
getService,
getPageObjects,
}: FtrProviderContext) {
// const esArchiver = getService('esArchiver');
const esArchiver = getService('esArchiver');
const testSubjects = getService('testSubjects');
const retry = getService('retry');
const log = getService('log');
Expand Down Expand Up @@ -77,58 +79,21 @@ export default function codeIntelligenceFunctionalTests({
};

before(async () => {
// Navigate to the code app.
await PageObjects.common.navigateToApp('code');
await PageObjects.header.waitUntilLoadingHasFinished();

// Prepare a git repository for the test
await PageObjects.code.fillImportRepositoryUrlInputBox(
'https://github.com/elastic/TypeScript-Node-Starter'
await repoLoad(
'github.com/elastic/TypeScript-Node-Starter',
'typescript_node_starter',
config.get('kbnTestServer.installDir') || REPO_ROOT
);
// Click the import repository button.
await PageObjects.code.clickImportRepositoryButton();

await retry.tryForTime(300000, async () => {
const repositoryItems = await testSubjects.findAll(repositoryListSelector);
expect(repositoryItems).to.have.length(1);
expect(await repositoryItems[0].getVisibleText()).to.equal(
'elastic/TypeScript-Node-Starter'
);

// Wait for the index to start.
await retry.try(async () => {
expect(await exists('repositoryIndexOngoing')).to.be(true);
});
// Wait for the index to end.
await retry.try(async () => {
expect(await exists('repositoryIndexDone')).to.be(true);
});
});
await esArchiver.load('code/repositories/typescript_node_starter');
});

after(async () => {
// Navigate to the code app.
await PageObjects.common.navigateToApp('code');
await PageObjects.header.waitUntilLoadingHasFinished();

// Clean up the imported repository
await PageObjects.code.clickDeleteRepositoryButton();
await retry.try(async () => {
expect(await exists('confirmModalConfirmButton')).to.be(true);
});

await testSubjects.click('confirmModalConfirmButton');

await retry.tryForTime(300000, async () => {
const repositoryItems = await testSubjects.findAll(repositoryListSelector);
expect(repositoryItems).to.have.length(0);
});
await retry.tryForTime(300000, async () => {
const repositoryItems = await testSubjects.findAll(repositoryListSelector);
expect(repositoryItems).to.have.length(0);
});

await PageObjects.security.logout();
await esArchiver.unload('code/repositories/typescript_node_starter');
await repoUnload(
'github.com/elastic/TypeScript-Node-Starter',
config.get('kbnTestServer.installDir') || REPO_ROOT
);
});

beforeEach(async () => {
Expand Down
70 changes: 21 additions & 49 deletions x-pack/test/functional/apps/code/explore_repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { REPO_ROOT } from '@kbn/dev-utils';
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
import { load as repoLoad, unload as repoUnload } from './repo_archiver';

export default function exploreRepositoryFunctionalTests({
getService,
getPageObjects,
}: FtrProviderContext) {
// const esArchiver = getService('esArchiver');
const esArchiver = getService('esArchiver');
const browser = getService('browser');
const testSubjects = getService('testSubjects');
const retry = getService('retry');
Expand All @@ -24,69 +26,39 @@ export default function exploreRepositoryFunctionalTests({

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

// FLAKY https://github.com/elastic/kibana/issues/44572
// FLAKY https://github.com/elastic/kibana/issues/42111
// FLAKY https://github.com/elastic/kibana/issues/44286
// FLAKY https://github.com/elastic/kibana/issues/43557
// FLAKY https://github.com/elastic/kibana/issues/42567
describe.skip('Explore Repository', function() {
describe('Explore Repository', function() {
this.tags('smoke');
describe('Explore a repository', () => {
const repositoryListSelector = 'codeRepositoryList codeRepositoryItem';

before(async () => {
// Navigate to the code app.
await PageObjects.common.navigateToApp('code');
await PageObjects.header.waitUntilLoadingHasFinished();

// Prepare a git repository for the test
await PageObjects.code.fillImportRepositoryUrlInputBox(
'https://github.com/elastic/TypeScript-Node-Starter'
await repoLoad(
'github.com/elastic/TypeScript-Node-Starter',
'typescript_node_starter',
config.get('kbnTestServer.installDir') || REPO_ROOT
);
// Click the import repository button.
await PageObjects.code.clickImportRepositoryButton();

await retry.tryForTime(10000, async () => {
const repositoryItems = await testSubjects.findAll(repositoryListSelector);
expect(repositoryItems).to.have.length(1);
expect(await repositoryItems[0].getVisibleText()).to.equal(
'elastic/TypeScript-Node-Starter'
);
});

// Wait for the index to start.
await retry.try(async () => {
expect(await exists('repositoryIndexOngoing')).to.be(true);
});
// Wait for the index to end.
await retry.try(async () => {
expect(await exists('repositoryIndexDone')).to.be(true);
});
await esArchiver.load('code/repositories/typescript_node_starter');
});

after(async () => {
await PageObjects.security.logout();
await esArchiver.unload('code/repositories/typescript_node_starter');
await repoUnload(
'github.com/elastic/TypeScript-Node-Starter',
config.get('kbnTestServer.installDir') || REPO_ROOT
);
});

beforeEach(async () => {
// Navigate to the code app.
await PageObjects.common.navigateToApp('code');
await PageObjects.header.waitUntilLoadingHasFinished();

// Clean up the imported repository
await PageObjects.code.clickDeleteRepositoryButton();

await retry.try(async () => {
expect(await exists('confirmModalConfirmButton')).to.be(true);
});

await testSubjects.click('confirmModalConfirmButton');

await retry.tryForTime(300000, async () => {
const repositoryItems = await testSubjects.findAll(repositoryListSelector);
expect(repositoryItems).to.have.length(0);
});

await PageObjects.security.logout();
// Enter the first repository from the admin page.
await testSubjects.click(repositoryListSelector);
});

beforeEach(async () => {
afterEach(async () => {
// Navigate to the code app.
await PageObjects.common.navigateToApp('code');
await PageObjects.header.waitUntilLoadingHasFinished();
Expand Down
54 changes: 14 additions & 40 deletions x-pack/test/functional/apps/code/file_tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { REPO_ROOT } from '@kbn/dev-utils';
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
import { load as repoLoad, unload as repoUnload } from './repo_archiver';

export default function exploreRepositoryFunctionalTests({
getService,
getPageObjects,
}: FtrProviderContext) {
// const esArchiver = getService('esArchiver');
const esArchiver = getService('esArchiver');
const browser = getService('browser');
const testSubjects = getService('testSubjects');
const retry = getService('retry');
const config = getService('config');
const PageObjects = getPageObjects(['common', 'header', 'security', 'code', 'home']);
const exists = async (selector: string) => testSubjects.exists(selector, { allowHidden: true });

Expand All @@ -23,28 +26,12 @@ export default function exploreRepositoryFunctionalTests({
const repositoryListSelector = 'codeRepositoryList codeRepositoryItem';

before(async () => {
// Navigate to the code app.
await PageObjects.common.navigateToApp('code');
await PageObjects.header.waitUntilLoadingHasFinished();

// Prepare a git repository for the test
await PageObjects.code.fillImportRepositoryUrlInputBox(
'https://github.com/elastic/code-examples_flatten-directory.git'
await repoLoad(
'github.com/elastic/code-examples_flatten-directory',
'code_examples_flatten_directory',
config.get('kbnTestServer.installDir') || REPO_ROOT
);
// Click the import repository button.
await PageObjects.code.clickImportRepositoryButton();

await retry.tryForTime(10000, async () => {
const repositoryItems = await testSubjects.findAll(repositoryListSelector);
expect(repositoryItems).to.have.length(1);
expect(await repositoryItems[0].getVisibleText()).to.equal(
'elastic/code-examples_flatten-directory'
);
});

await retry.try(async () => {
expect(await exists('repositoryIndexOngoing')).to.be(true);
});
await esArchiver.load('code/repositories/code_examples_flatten_directory');
});

beforeEach(async () => {
Expand All @@ -57,25 +44,12 @@ export default function exploreRepositoryFunctionalTests({
});

after(async () => {
// Navigate to the code app.
await PageObjects.common.navigateToApp('code');
await PageObjects.header.waitUntilLoadingHasFinished();

// Clean up the imported repository
await PageObjects.code.clickDeleteRepositoryButton();

await retry.try(async () => {
expect(await exists('confirmModalConfirmButton')).to.be(true);
});

await testSubjects.click('confirmModalConfirmButton');

await retry.tryForTime(300000, async () => {
const repositoryItems = await testSubjects.findAll(repositoryListSelector);
expect(repositoryItems).to.have.length(0);
});

await PageObjects.security.logout();
await repoUnload(
'github.com/elastic/code-examples_flatten-directory',
config.get('kbnTestServer.installDir') || REPO_ROOT
);
await esArchiver.unload('code/repositories/code_examples_flatten_directory');
});

it('tree should be loaded', async () => {
Expand Down
Binary file not shown.
Binary file not shown.
45 changes: 16 additions & 29 deletions x-pack/test/functional/apps/code/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { REPO_ROOT } from '@kbn/dev-utils';
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
import { load as repoLoad, unload as repoUnload } from './repo_archiver';

export default function manageRepositoriesFunctionalTests({
getService,
getPageObjects,
}: FtrProviderContext) {
// const esArchiver = getService('esArchiver');
const esArchiver = getService('esArchiver');
const testSubjects = getService('testSubjects');
const retry = getService('retry');
const log = getService('log');
Expand All @@ -25,50 +27,35 @@ export default function manageRepositoriesFunctionalTests({
const existsInvisible = async (selector: string) =>
await testSubjects.exists(selector, { allowHidden: true });

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

describe('browser history can go back while exploring code app', () => {
let driver: any;
before(async () => {
await repoLoad(
'github.com/elastic/TypeScript-Node-Starter',
'typescript_node_starter',
config.get('kbnTestServer.installDir') || REPO_ROOT
);
await esArchiver.load('code/repositories/typescript_node_starter');

// Navigate to the code app.
await PageObjects.common.navigateToApp('code');
await PageObjects.header.waitUntilLoadingHasFinished();

log.debug('Code test import repository');
// Fill in the import repository input box with a valid git repository url.
await PageObjects.code.fillImportRepositoryUrlInputBox(
'https://github.com/elastic/TypeScript-Node-Starter'
);
// Click the import repository button.
await PageObjects.code.clickImportRepositoryButton();

const webDriver = await getService('__webdriver__').init();
driver = webDriver.driver;
});
// after(async () => await esArchiver.unload('code'));

after(async () => {
// Navigate to the code app.
await PageObjects.common.navigateToApp('code');
await PageObjects.header.waitUntilLoadingHasFinished();

// Clean up the imported repository
await PageObjects.code.clickDeleteRepositoryButton();
await retry.try(async () => {
expect(await testSubjects.exists('confirmModalConfirmButton')).to.be(true);
});

await testSubjects.click('confirmModalConfirmButton');

await retry.tryForTime(300000, async () => {
const repositoryItems = await testSubjects.findAll(repositoryListSelector);
expect(repositoryItems).to.have.length(0);
});

await PageObjects.security.logout();
await esArchiver.unload('code/repositories/typescript_node_starter');
await repoUnload(
'github.com/elastic/TypeScript-Node-Starter',
config.get('kbnTestServer.installDir') || REPO_ROOT
);
});

it('from admin page to source view page can go back and forward', async () => {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/functional/apps/code/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export default function codeApp({ loadTestFile }: FtrProviderContext) {
loadTestFile(require.resolve('./search'));
loadTestFile(require.resolve('./explore_repository'));
loadTestFile(require.resolve('./code_intelligence'));
loadTestFile(require.resolve('./with_security'));
loadTestFile(require.resolve('./history'));
loadTestFile(require.resolve('./file_tree'));
loadTestFile(require.resolve('./with_security'));
});
}
1 change: 0 additions & 1 deletion x-pack/test/functional/apps/code/manage_repositories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export default function manageRepositoriesFunctionalTests({
await PageObjects.common.navigateToApp('code');
await PageObjects.header.waitUntilLoadingHasFinished();
});
// after(async () => await esArchiver.unload('code'));

after(async () => {
await PageObjects.security.logout();
Expand Down
Loading