-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[x-pack/test] convert PO to typescript, improve find/testSubject usage #77389
[x-pack/test] convert PO to typescript, improve find/testSubject usage #77389
Conversation
@@ -17,7 +17,6 @@ | |||
* under the License. | |||
*/ | |||
|
|||
import { Key } from 'selenium-webdriver'; |
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.
Using browser
service instead so that we can easily migrate to other test library
import { parse } from 'url'; | ||
import { FtrProviderContext } from '../ftr_provider_context'; |
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.
fixing import
await testSubjects.click('upgrade_assistant'); | ||
}); | ||
} | ||
|
||
async expectUpgradeAssistant() { | ||
return await retry.try(async () => { | ||
log.debug(`expectUpgradeAssistant()`); | ||
expect(testSubjects.exists('upgradeAssistantRoot')).to.be.true; | ||
expect(await testSubjects.exists('upgradeAssistantRoot')).to.equal(true); |
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.
missing await could be a reason of flakiness
@@ -27,7 +27,7 @@ export function EndpointPolicyPageProvider({ getService, getPageObjects }: FtrPr | |||
*/ | |||
async findFirstActionsButton() { | |||
await this.ensureIsOnPolicyPage(); | |||
return (await testSubjects.findAll('policyActionsButton'))[0]; | |||
return await testSubjects.find('policyActionsButton'); |
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.
testSubjects.find
wraps driver.findElement
that will return the first element in DOM with specified locator and throw exception in case it is not in DOM. It is better than searching for an array and selecting by index when array can be empty.
💚 Build SucceededBuild metrics
To update your PR or re-run it, just comment with: |
@@ -36,8 +36,7 @@ export function EndpointPolicyPageProvider({ getService, getPageObjects }: FtrPr | |||
async launchAndFindDeleteModal() { | |||
const actionsButton = await this.findFirstActionsButton(); | |||
await actionsButton.click(); | |||
const deleteAction = await testSubjects.find('policyDeleteButton'); | |||
await deleteAction.click(); | |||
await testSubjects.click('policyDeleteButton'); |
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.
@dmlemeshko will testSubjects.click()
wait for the test subject to appear before it attempts the click?
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.
Yes @charlie-pichette, it will. If you need to change default timeout, you can pass it this way:
await testSubjects.click('policyDeleteButton', 25000);
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.
Changes to the security solution files look good to me. Thanks for making the changes @dmlemeshko. 👍
elastic#77389) # Conflicts: # test/functional/page_objects/vega_chart_page.ts # x-pack/test/functional/page_objects/gis_page.ts # x-pack/test/functional/page_objects/uptime_page.ts # x-pack/test/security_solution_endpoint/page_objects/ingest_manager_create_package_policy_page.ts
Summary
Checklist
Delete any items that are not applicable to this PR.
For maintainers