-
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
[ML] Functional tests - fix typing issue #52167
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Testing again with checks during typing |
💚 Build Succeeded |
Summary:
Also, I've discussed this with @jgowdyelastic and we consider this a temporary fix until we find a way to make the job wizard input elements more stable for the automated typing. |
Pinging @elastic/ml-ui (:ml) |
} | ||
}); | ||
}); | ||
} |
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.
I'm not sure if this solution will be effective and stable:
- if the problem is that the letter may not be typed, it makes sense to reimplement
WebElementWrapper: type
function for ML tests. Wrapping existing code with 2 retries will slow things down and an additional check will not give a benefit if the wrong letter or in the letter is typed in the wrong order. - if the problem is that the field may be cleared during typing I suggest checking how the component re-rendering is triggered. Wrapping things with double retry will most like hide an issue the real user can face.
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.
But 500 passing tests means the opposite :)
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 thanks for the feedback!
Some explanations to this approach:
- We're already investigating the component and will (hopefully) fix it as soon as we know why it behaves that way, so this PR is only a temporary solution to fix typing until then (this is the 1st reason why I've implemented this as a separate method).
- The slowdown due to retries is expected. I've called the method
setValueWithChecks
to set the right expectations: when I cal something WithChecks, I expect it to be slower (2nd reason for a separate method). - I agree that the outer retry is probably not needed (but I think the same holds true for the
setValue
method). This will just retry the whole thing in case an error is thrown on the way, so it doesn't really hurt. For the inner retries:- The first block will retry to clear the field
- The second block does basically the following:
a. Type in the next character
b. Check if it was appended to the input value (give it 1 second time to appear there)
c. If it doesn't appear, try again, starting with step a. (retry for 5 seconds, then fail) - So I agree that it doesn't help to fix wrong letters or wrong order of letters. But that was not the scope of this fix, it should only check for missing letters.
- I can see how this new method
setValueWithChecks
is very specialized to (hopefully temporarily) fix a specific issue and might not be appropriate for thetestSubjects
service. Happy to move it to a ML specific location if you think that's better.
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.
@pheyos thank you for explaining the issue, it makes more sense now. Since you mentioned it is a temporary fix for ML-specific components, I suggest we don't put it in testSubjects.ts
: we probably don't want other teams to start using it?
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 agreed. I've moved the method to a common ML service in a11a340 .
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
import { MachineLearningCustomUrlsProvider } from './custom_urls'; | ||
|
||
export function MachineLearningJobWizardCommonProvider( | ||
{ getService }: FtrProviderContext, | ||
mlCommon: ProvidedType<typeof MachineLearningCommonProvider>, |
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.
In the future, I usually like to export this type from the module containing the provider so I can just import the MlCommon
type without having to use these long types everywhere.
in common.ts
export type MlCommon = ProvidedType<typeof MachineLearningCommonProvider>
in here
import { MlCommon } from './common'
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.
Good idea! I've created a PR for this: #52612
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.
LGTM
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.
LGTM. Thank you for update
I keep running into this, and the changes have two reviews, so I'm going to go ahead and merge this. |
* Use char by char typing in all text fields * Add dely before first typed charakter when typing char by char * Remove delay before typing again * Use clearCharByChar option for input fields * Revert "Use clearCharByChar option for input fields" This reverts commit e412d7b. * Revert "Use char by char typing in all text fields" This reverts commit 2fbccc5. * Disable jobCreatorUpdate for tests * Revert "Disable jobCreatorUpdate for tests" This reverts commit e178fd8. * Check typing char by char for job wizard inputs * Remove .only from anomaly detection suite * Move setValueWithChecks from testSubjects to a ML service # Conflicts: # x-pack/test/functional/services/machine_learning/index.ts # x-pack/test/functional/services/machine_learning/job_wizard_common.ts # x-pack/test/functional/services/ml.ts
* Use char by char typing in all text fields * Add dely before first typed charakter when typing char by char * Remove delay before typing again * Use clearCharByChar option for input fields * Revert "Use clearCharByChar option for input fields" This reverts commit e412d7b. * Revert "Use char by char typing in all text fields" This reverts commit 2fbccc5. * Disable jobCreatorUpdate for tests * Revert "Disable jobCreatorUpdate for tests" This reverts commit e178fd8. * Check typing char by char for job wizard inputs * Remove .only from anomaly detection suite * Move setValueWithChecks from testSubjects to a ML service # Conflicts: # x-pack/test/functional/services/machine_learning/index.ts # x-pack/test/functional/services/machine_learning/job_wizard_advanced.ts # x-pack/test/functional/services/machine_learning/job_wizard_common.ts # x-pack/test/functional/services/ml.ts
* Use char by char typing in all text fields * Add dely before first typed charakter when typing char by char * Remove delay before typing again * Use clearCharByChar option for input fields * Revert "Use clearCharByChar option for input fields" This reverts commit e412d7b. * Revert "Use char by char typing in all text fields" This reverts commit 2fbccc5. * Disable jobCreatorUpdate for tests * Revert "Disable jobCreatorUpdate for tests" This reverts commit e178fd8. * Check typing char by char for job wizard inputs * Remove .only from anomaly detection suite * Move setValueWithChecks from testSubjects to a ML service # Conflicts: # x-pack/test/functional/services/machine_learning/index.ts # x-pack/test/functional/services/machine_learning/job_wizard_common.ts # x-pack/test/functional/services/ml.ts
* [ML] Functional tests - fix typing issue (#52167) * Use char by char typing in all text fields * Add dely before first typed charakter when typing char by char * Remove delay before typing again * Use clearCharByChar option for input fields * Revert "Use clearCharByChar option for input fields" This reverts commit e412d7b. * Revert "Use char by char typing in all text fields" This reverts commit 2fbccc5. * Disable jobCreatorUpdate for tests * Revert "Disable jobCreatorUpdate for tests" This reverts commit e178fd8. * Check typing char by char for job wizard inputs * Remove .only from anomaly detection suite * Move setValueWithChecks from testSubjects to a ML service # Conflicts: # x-pack/test/functional/services/machine_learning/index.ts # x-pack/test/functional/services/machine_learning/job_wizard_advanced.ts # x-pack/test/functional/services/machine_learning/job_wizard_common.ts # x-pack/test/functional/services/ml.ts * fix bad merge
Summary
This PR fixes the typing flakiness in ML wizards, where sometimes the first letter isn't typed in.