-
Notifications
You must be signed in to change notification settings - Fork 668
Adding the Unit Test TestToastNotificationClosingBehavior #14340
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
Adding the Unit Test TestToastNotificationClosingBehavior #14340
Conversation
|
|
| /// <summary> | ||
| /// Overrides the Exit base class method to custom handling | ||
| /// </summary> | ||
| public override void Exit() |
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 don't think this is a good idea.
You change the exit behavior of every test in this fixture and it will be unexpected for other developers.
instead of splitting the exit code up, perhaps you can just call close on the DynamoView and then see if your popup is still visible, then make exit do some null checks.
I would not spend too long on this, I prefer no test for this, to test code that will lead to hard to debug test failures later.
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 have updated the Test simplifying it, its feature passed locally (but throw error in the master-15 due to a different issue), even if it doesn't meet with your approval just let me know so I Can close it. Thanks.
I don't think this is a good idea. You change the exit behavior of every test in this fixture and it will be unexpected for other developers.
instead of splitting the exit code up, perhaps you can just call
closeon the DynamoView and then see if your popup is still visible, then make exit do some null checks.I would not spend too long on this, I prefer no test for this, to test code that will lead to hard to debug test failures later.
| bool? xisToastNotificationVisible = ViewModel.MainGuideManager?.ExitTourPopupIsVisible; | ||
| ViewModel.PreferencesViewModel.SelectedLanguage = selectedLanguage == "English" ? "Español" : "English"; | ||
|
|
||
| DispatcherUtil.DoEvents(); |
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.
be very careful using this - if you have to use it, you should add a matching DispatcherUtil.DoEvents(); call into the exit method of the test class so that AFTER the view is closed, the dispatcher queue is flushed.
|
|
||
| /// <summary> | ||
| /// Overrides the Exit base class method to custom handling | ||
| /// </summary> |
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.
the summary is below the function here..
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.
Done.
| DispatcherUtil.DoEvents(); | ||
| string selectedLanguage = (string)((ComboBox)preferencesWindow.FindName("LanguageCmb")).SelectedItem; | ||
|
|
||
| ViewModel.PreferencesViewModel.SelectedLanguage = selectedLanguage == "English" ? "Español" : "English"; |
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.
Don't we have constant strings defined for locales instead of hardcoding it here?
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.
Done.
|
@jesusalvino Please cherry-pick this |
Done #14395 |
…14395) * Adding the Unit Test TestToastNotificationClosingBehavior * Simplifying changes * Removing unnecessary summary * Reusing local values instead of harcoding --------- Co-authored-by: Jesus Alfredo Alviño <jesus.alfredo.alvino@autodesk.com>

Purpose
Adding the Unit test for the PR #14317
Declarations
Check these if you believe they are true
*.resxfilesReviewers
@mjkkirschner
FYIs
@QilongTang