From 4619b4766960386fb4eeee797247a438aaca840a Mon Sep 17 00:00:00 2001 From: Spencer Date: Wed, 6 May 2020 23:37:01 -0700 Subject: [PATCH] [functional tests] add some missing awaits (#65566) (#65596) Co-authored-by: Elastic Machine --- test/functional/apps/timelion/index.js | 2 +- test/functional/page_objects/settings_page.ts | 4 ++-- test/functional/services/find.ts | 2 +- test/plugin_functional/test_suites/core_plugins/rendering.ts | 4 ++-- x-pack/test/functional/apps/index_management/home_page.ts | 2 +- x-pack/test/functional/apps/lens/index.ts | 2 +- x-pack/test/functional/page_objects/index_management_page.ts | 2 +- x-pack/test/functional/page_objects/lens_page.ts | 2 +- x-pack/test/functional/page_objects/security_page.js | 4 ++-- .../test/functional/services/logs_ui/log_entry_categories.ts | 2 +- x-pack/test/functional/services/logs_ui/log_entry_rate.ts | 2 +- x-pack/test/functional/services/logs_ui/log_stream.ts | 2 +- x-pack/test/functional/services/uptime/monitor.ts | 5 +++-- .../apps/triggers_actions_ui/home_page.ts | 4 ++-- .../page_objects/triggers_actions_ui_page.ts | 2 +- 15 files changed, 21 insertions(+), 20 deletions(-) diff --git a/test/functional/apps/timelion/index.js b/test/functional/apps/timelion/index.js index 3b5167addf4e6..021fa24397850 100644 --- a/test/functional/apps/timelion/index.js +++ b/test/functional/apps/timelion/index.js @@ -28,7 +28,7 @@ export default function({ getService, loadTestFile }) { before(async function() { log.debug('Starting timelion before method'); - browser.setWindowSize(1280, 800); + await browser.setWindowSize(1280, 800); await esArchiver.loadIfNeeded('logstash_functional'); await kibanaServer.uiSettings.replace({ defaultIndex: 'logstash-*' }); }); diff --git a/test/functional/page_objects/settings_page.ts b/test/functional/page_objects/settings_page.ts index 81d22838d1e8b..b7a6e10efd7dc 100644 --- a/test/functional/page_objects/settings_page.ts +++ b/test/functional/page_objects/settings_page.ts @@ -33,7 +33,7 @@ export function SettingsPageProvider({ getService, getPageObjects }: FtrProvider class SettingsPage { async clickNavigation() { - find.clickDisplayedByCssSelector('.app-link:nth-child(5) a'); + await find.clickDisplayedByCssSelector('.app-link:nth-child(5) a'); } async clickLinkText(text: string) { @@ -110,7 +110,7 @@ export function SettingsPageProvider({ getService, getPageObjects }: FtrProvider } async toggleAdvancedSettingCheckbox(propertyName: string) { - testSubjects.click(`advancedSetting-editField-${propertyName}`); + await testSubjects.click(`advancedSetting-editField-${propertyName}`); await PageObjects.header.waitUntilLoadingHasFinished(); await testSubjects.click(`advancedSetting-saveButton`); await PageObjects.header.waitUntilLoadingHasFinished(); diff --git a/test/functional/services/find.ts b/test/functional/services/find.ts index 312668b718dc0..bdcc5ba95e9fb 100644 --- a/test/functional/services/find.ts +++ b/test/functional/services/find.ts @@ -476,7 +476,7 @@ export async function FindProvider({ getService }: FtrProviderContext) { value: string ): Promise { log.debug(`Find.waitForAttributeToChange('${selector}', '${attribute}', '${value}')`); - retry.waitFor(`${attribute} to equal "${value}"`, async () => { + await retry.waitFor(`${attribute} to equal "${value}"`, async () => { const el = await this.byCssSelector(selector); return value === (await el.getAttribute(attribute)); }); diff --git a/test/plugin_functional/test_suites/core_plugins/rendering.ts b/test/plugin_functional/test_suites/core_plugins/rendering.ts index 097833750bc80..b8e26b8e6ffcb 100644 --- a/test/plugin_functional/test_suites/core_plugins/rendering.ts +++ b/test/plugin_functional/test_suites/core_plugins/rendering.ts @@ -40,8 +40,8 @@ export default function({ getService, getPageObjects }: PluginFunctionalProvider const find = getService('find'); const testSubjects = getService('testSubjects'); - const navigateTo = (path: string) => - browser.navigateTo(`${PageObjects.common.getHostPort()}${path}`); + const navigateTo = async (path: string) => + await browser.navigateTo(`${PageObjects.common.getHostPort()}${path}`); const navigateToApp = async (title: string) => { await appsMenu.clickLink(title); return browser.execute(() => { diff --git a/x-pack/test/functional/apps/index_management/home_page.ts b/x-pack/test/functional/apps/index_management/home_page.ts index 046b8ec44b9fa..5ed6064314af8 100644 --- a/x-pack/test/functional/apps/index_management/home_page.ts +++ b/x-pack/test/functional/apps/index_management/home_page.ts @@ -34,7 +34,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { describe('Index templates', () => { it('renders the index templates tab', async () => { // Navigate to the index templates tab - pageObjects.indexManagement.changeTabs('templatesTab'); + await pageObjects.indexManagement.changeTabs('templatesTab'); await pageObjects.header.waitUntilLoadingHasFinished(); diff --git a/x-pack/test/functional/apps/lens/index.ts b/x-pack/test/functional/apps/lens/index.ts index 857cbe15463b9..53e800bae3f6d 100644 --- a/x-pack/test/functional/apps/lens/index.ts +++ b/x-pack/test/functional/apps/lens/index.ts @@ -15,7 +15,7 @@ export default function({ getService, loadTestFile }: FtrProviderContext) { describe('lens app', () => { before(async () => { log.debug('Starting lens before method'); - browser.setWindowSize(1280, 800); + await browser.setWindowSize(1280, 800); await esArchiver.loadIfNeeded('logstash_functional'); await esArchiver.loadIfNeeded('lens/basic'); }); diff --git a/x-pack/test/functional/page_objects/index_management_page.ts b/x-pack/test/functional/page_objects/index_management_page.ts index 1ae23b24156d0..453b283ab969d 100644 --- a/x-pack/test/functional/page_objects/index_management_page.ts +++ b/x-pack/test/functional/page_objects/index_management_page.ts @@ -57,7 +57,7 @@ export function IndexManagementPageProvider({ getService }: FtrProviderContext) }); }, async changeTabs(tab: 'indicesTab' | 'templatesTab') { - return await testSubjects.click(tab); + await testSubjects.click(tab); }, }; } diff --git a/x-pack/test/functional/page_objects/lens_page.ts b/x-pack/test/functional/page_objects/lens_page.ts index c4dcf63941cd5..7425ed25728c2 100644 --- a/x-pack/test/functional/page_objects/lens_page.ts +++ b/x-pack/test/functional/page_objects/lens_page.ts @@ -150,7 +150,7 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont } await testSubjects.click('confirmSaveSavedObjectButton'); - retry.waitForWithTimeout('Save modal to disappear', 1000, () => + await retry.waitForWithTimeout('Save modal to disappear', 1000, () => testSubjects .missingOrFail('confirmSaveSavedObjectButton') .then(() => true) diff --git a/x-pack/test/functional/page_objects/security_page.js b/x-pack/test/functional/page_objects/security_page.js index 08895de815b39..ae26a831d4172 100644 --- a/x-pack/test/functional/page_objects/security_page.js +++ b/x-pack/test/functional/page_objects/security_page.js @@ -394,9 +394,9 @@ export function SecurityPageProvider({ getService, getPageObjects }) { }); } }) //clicking save button - .then(function() { + .then(async () => { log.debug('click save button'); - testSubjects.click('roleFormSaveButton'); + await testSubjects.click('roleFormSaveButton'); }) .then(function() { return PageObjects.common.sleep(5000); diff --git a/x-pack/test/functional/services/logs_ui/log_entry_categories.ts b/x-pack/test/functional/services/logs_ui/log_entry_categories.ts index b9a400b155679..70d8622e620ef 100644 --- a/x-pack/test/functional/services/logs_ui/log_entry_categories.ts +++ b/x-pack/test/functional/services/logs_ui/log_entry_categories.ts @@ -13,7 +13,7 @@ export function LogEntryCategoriesPageProvider({ getPageObjects, getService }: F return { async navigateTo() { - pageObjects.infraLogs.navigateToTab('log-categories'); + await pageObjects.infraLogs.navigateToTab('log-categories'); }, async getSetupScreen(): Promise { diff --git a/x-pack/test/functional/services/logs_ui/log_entry_rate.ts b/x-pack/test/functional/services/logs_ui/log_entry_rate.ts index 96c69e85aa0a4..ffaa6ce08a1dc 100644 --- a/x-pack/test/functional/services/logs_ui/log_entry_rate.ts +++ b/x-pack/test/functional/services/logs_ui/log_entry_rate.ts @@ -13,7 +13,7 @@ export function LogEntryRatePageProvider({ getPageObjects, getService }: FtrProv return { async navigateTo() { - pageObjects.infraLogs.navigateToTab('log-rate'); + await pageObjects.infraLogs.navigateToTab('log-rate'); }, async getSetupScreen(): Promise { diff --git a/x-pack/test/functional/services/logs_ui/log_stream.ts b/x-pack/test/functional/services/logs_ui/log_stream.ts index 75486534cf5cc..5fa950a86e696 100644 --- a/x-pack/test/functional/services/logs_ui/log_stream.ts +++ b/x-pack/test/functional/services/logs_ui/log_stream.ts @@ -15,7 +15,7 @@ export function LogStreamPageProvider({ getPageObjects, getService }: FtrProvide return { async navigateTo(params?: TabsParams['stream']) { - pageObjects.infraLogs.navigateToTab('stream', params); + await pageObjects.infraLogs.navigateToTab('stream', params); }, async getColumnHeaderLabels(): Promise { diff --git a/x-pack/test/functional/services/uptime/monitor.ts b/x-pack/test/functional/services/uptime/monitor.ts index a3e3d953e2eb7..b6689737e8618 100644 --- a/x-pack/test/functional/services/uptime/monitor.ts +++ b/x-pack/test/functional/services/uptime/monitor.ts @@ -38,8 +38,9 @@ export function UptimeMonitorProvider({ getService }: FtrProviderContext) { async checkForPingListTimestamps(timestamps: string[]): Promise { return retry.tryForTime(10000, async () => { await Promise.all( - timestamps.map(timestamp => - testSubjects.existOrFail(`xpack.uptime.pingList.ping-${timestamp}`) + timestamps.map( + async timestamp => + await testSubjects.existOrFail(`xpack.uptime.pingList.ping-${timestamp}`) ) ); }); diff --git a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/home_page.ts b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/home_page.ts index 2edab1b164a1b..bd793883eed90 100644 --- a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/home_page.ts +++ b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/home_page.ts @@ -29,7 +29,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { describe('Connectors tab', () => { it('renders the connectors tab', async () => { // Navigate to the connectors tab - pageObjects.triggersActionsUI.changeTabs('connectorsTab'); + await pageObjects.triggersActionsUI.changeTabs('connectorsTab'); await pageObjects.header.waitUntilLoadingHasFinished(); @@ -45,7 +45,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { describe('Alerts tab', () => { it('renders the alerts tab', async () => { // Navigate to the alerts tab - pageObjects.triggersActionsUI.changeTabs('alertsTab'); + await pageObjects.triggersActionsUI.changeTabs('alertsTab'); await pageObjects.header.waitUntilLoadingHasFinished(); diff --git a/x-pack/test/functional_with_es_ssl/page_objects/triggers_actions_ui_page.ts b/x-pack/test/functional_with_es_ssl/page_objects/triggers_actions_ui_page.ts index ca7f064e20690..2cd094f9045c5 100644 --- a/x-pack/test/functional_with_es_ssl/page_objects/triggers_actions_ui_page.ts +++ b/x-pack/test/functional_with_es_ssl/page_objects/triggers_actions_ui_page.ts @@ -120,7 +120,7 @@ export function TriggersActionsPageProvider({ getService }: FtrProviderContext) await find.clickDisplayedByCssSelector(`[data-test-subj="alertsList"] [title="${name}"]`); }, async changeTabs(tab: 'alertsTab' | 'connectorsTab') { - return await testSubjects.click(tab); + await testSubjects.click(tab); }, async toggleSwitch(testSubject: string) { const switchBtn = await testSubjects.find(testSubject);