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

[7.x] [functional tests] add some missing awaits (#65566) #65596

Merged
merged 2 commits into from
May 7, 2020
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 test/functional/apps/timelion/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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-*' });
});
Expand Down
4 changes: 2 additions & 2 deletions test/functional/page_objects/settings_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion test/functional/services/find.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ export async function FindProvider({ getService }: FtrProviderContext) {
value: string
): Promise<void> {
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));
});
Expand Down
4 changes: 2 additions & 2 deletions test/plugin_functional/test_suites/core_plugins/rendering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/functional/apps/index_management/home_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/functional/apps/lens/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function IndexManagementPageProvider({ getService }: FtrProviderContext)
});
},
async changeTabs(tab: 'indicesTab' | 'templatesTab') {
return await testSubjects.click(tab);
await testSubjects.click(tab);
},
};
}
2 changes: 1 addition & 1 deletion x-pack/test/functional/page_objects/lens_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions x-pack/test/functional/page_objects/security_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<WebElementWrapper> {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/functional/services/logs_ui/log_entry_rate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<WebElementWrapper> {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/functional/services/logs_ui/log_stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string[]> {
Expand Down
5 changes: 3 additions & 2 deletions x-pack/test/functional/services/uptime/monitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ export function UptimeMonitorProvider({ getService }: FtrProviderContext) {
async checkForPingListTimestamps(timestamps: string[]): Promise<void> {
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}`)
)
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down