-
Notifications
You must be signed in to change notification settings - Fork 919
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
[CCI] Add bluebird replaces for test/functional #4029
[CCI] Add bluebird replaces for test/functional #4029
Conversation
Signed-off-by: Alexei Karikov <karikov.alist.ru@gmail.com>
Codecov Report
@@ Coverage Diff @@
## main #4029 +/- ##
==========================================
+ Coverage 66.38% 66.43% +0.05%
==========================================
Files 3229 3229
Lines 62067 62067
Branches 9598 9598
==========================================
+ Hits 41201 41233 +32
+ Misses 18557 18530 -27
+ Partials 2309 2304 -5
Flags with carried forward coverage won't be shown. Click here to find out more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Nicksqain thank you for the contribute. If you need some help to understand when need to add await, let me know or go to office hour~
import expect from '@osd/expect'; | ||
// @ts-ignore | ||
import fetch from 'node-fetch'; | ||
import { FtrProviderContext } from '../ftr_provider_context'; | ||
// @ts-ignore not TS yet | ||
import getUrl from '../../../src/test_utils/get_url'; | ||
|
||
function delay(ms: number) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @AMoo-Miki mentioned in ur other PR, let's move delay func to @osd/utils
import { FtrProviderContext } from '../ftr_provider_context'; | ||
|
||
function delay(ms: number) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above comment
copySaveObjectsElement, | ||
}; | ||
}); | ||
return await Promise.all( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await
is not needed here. when you return a Promise from an async function, you don't need to use await.
inspectElement, | ||
}; | ||
}); | ||
return await Promise.all( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, we only need to use await within the async function passing to map because we need to wait for each Promise to resolve before we return an object with their resolved values. But when returning from an async function, we could just return the Promise directly without using await.
return await mapAsync(fieldNameCells, async (cell) => { | ||
return (await cell.getVisibleText()).trim(); | ||
}); | ||
return await Promise.all( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same issue as above
return await mapAsync(fieldNameCells, async (cell) => { | ||
return (await cell.getVisibleText()).trim(); | ||
}); | ||
return await Promise.all( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same issue
return await mapAsync(indexPatterns, async (index) => { | ||
return await index.getVisibleText(); | ||
}); | ||
return await Promise.all( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
@@ -55,6 +54,10 @@ const RETRY_CLICK_RETRY_ON_ERRORS = [ | |||
'StaleElementReferenceError', | |||
]; | |||
|
|||
function delay(ms: number) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same issue
Thanks for reviewing the code! |
@@ -193,53 +192,55 @@ export function SavedObjectsPageProvider({ getService, getPageObjects }: FtrProv | |||
|
|||
async getElementsInTable() { | |||
const rows = await testSubjects.findAll('~savedObjectsTableRow'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I don't think we need await
here as well, do we? As Promise.all() function already waits for all the promises to resolve before returning, it will not have to wait for the await keyword to resolve before continuing and that way might be bit more efficient.
Convert to draft for now, can be marked as ready once the comments are addressed. Thanks! |
@Nicksqain Due to an extended period without updates, we're going to close this issue for now. We appreciate your contribution and understand that priorities and availability can change. Please feel free to reopen this issue when you have the opportunity to revisit it. Thank you for your understanding. |
Description
Issues Resolved
Check List
yarn test:jest
yarn test:jest_integration
yarn test:ftr