Skip to content

Commit

Permalink
Fixed TS warnings in E2E tests (elastic#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonStoltz authored and cee-chen committed Jun 9, 2020
1 parent 7b86720 commit 4bac2a5
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import expect from '@kbn/expect';
import { EsArchiver } from 'src/es_archiver';
import { AppSearchService, IEngine } from '../../../../services/app_search_service';
import { Browser } from '../../../../../../../test/functional/services/browser';
import { FtrProviderContext } from '../../../ftr_provider_context';
import { Browser } from '../../../../../../../test/functional/services/common';
import { FtrProviderContext } from '../../../../ftr_provider_context';

export default function enterpriseSearchSetupEnginesTests({
getService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { FtrProviderContext } from '../../ftr_provider_context';
import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ loadTestFile }: FtrProviderContext) {
describe('Enterprise Search', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';
import { FtrProviderContext } from '../../../../ftr_provider_context';

export default function enterpriseSearchSetupGuideTests({
getService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { FtrProviderContext } from '../../ftr_provider_context';
import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ loadTestFile }: FtrProviderContext) {
describe('Enterprise Search', function () {
Expand Down
12 changes: 12 additions & 0 deletions x-pack/test/functional_enterprise_search/ftr_provider_context.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { GenericFtrProviderContext } from '@kbn/test/types/ftr';

import { pageObjects } from './page_objects';
import { services } from './services';

export type FtrProviderContext = GenericFtrProviderContext<typeof services, typeof pageObjects>;
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,24 @@
*/

import { FtrProviderContext } from '../ftr_provider_context';
import { TestSubjects } from '../../../../../test/functional/services/test_subjects';
import { TestSubjects } from '../../../../test/functional/services/common';
import { WebElementWrapper } from '../../../../test/functional/services/lib/web_element_wrapper';

export function AppSearchPageProvider({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['common']);
const testSubjects = getService('testSubjects') as TestSubjects;

return {
async navigateToPage() {
async navigateToPage(): Promise<void> {
return await PageObjects.common.navigateToApp('app_search');
},

async getEngineLinks() {
async getEngineLinks(): Promise<WebElementWrapper[]> {
const engines = await testSubjects.find('appSearchEngines');
return await testSubjects.findAllDescendant('engineNameLink', engines);
},

async getMetaEngineLinks() {
async getMetaEngineLinks(): Promise<WebElementWrapper[]> {
const metaEngines = await testSubjects.find('appSearchMetaEngines');
return await testSubjects.findAllDescendant('engineNameLink', metaEngines);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const makeRequest = <T>(method: string, path: string, body?: object): Promise<T>
reject(e);
}

if (res.statusCode > 299) {
if (res.statusCode && res.statusCode > 299) {
reject('Error calling App Search API: ' + JSON.stringify(responseBody));
}

Expand Down

0 comments on commit 4bac2a5

Please sign in to comment.