Skip to content

Conversation

@jesusalvino
Copy link
Contributor

Purpose

Adding the Unit test for the PR #14317

Declarations

Check these if you believe they are true

  • The codebase is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document.
  • This PR modifies some build requirements and the readme is updated
  • This PR contains no files larger than 50 MB

Reviewers

@mjkkirschner

FYIs

@QilongTang

@github-actions
Copy link

github-actions bot commented Aug 29, 2023

⚠️ [run-bin-diff] - Files Added/Deleted::72 new file(s) have been added and 153 file(s) have been deleted!
⚠️ [run-bin-diff-net60-windows] - Files Added/Deleted::12 new file(s) have been added and 29 file(s) have been deleted!
(Updated: 2023-09-06-17:36:53)

/// <summary>
/// Overrides the Exit base class method to custom handling
/// </summary>
public override void Exit()
Copy link
Member

@mjkkirschner mjkkirschner Aug 29, 2023

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.

Copy link
Contributor Author

@jesusalvino jesusalvino Sep 4, 2023

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.

image

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.

bool? xisToastNotificationVisible = ViewModel.MainGuideManager?.ExitTourPopupIsVisible;
ViewModel.PreferencesViewModel.SelectedLanguage = selectedLanguage == "English" ? "Español" : "English";

DispatcherUtil.DoEvents();
Copy link
Member

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>
Copy link
Contributor

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..

Copy link
Contributor Author

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";
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@QilongTang QilongTang merged commit 8bb226c into DynamoDS:RC2.19.0_master Sep 7, 2023
@QilongTang
Copy link
Contributor

@jesusalvino Please cherry-pick this

@QilongTang QilongTang added this to the 2.19.0 milestone Sep 7, 2023
@jesusalvino
Copy link
Contributor Author

@jesusalvino Please cherry-pick this

Done #14395

QilongTang pushed a commit that referenced this pull request Sep 11, 2023
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants