NUnit Forms Code to Dismiss a Modal Form (not a messagebox).


/ Published in: C#
Save to your folder(s)

The trick to this is that you must find the class name of the form. The caption won't cut it for non-messagebox modals.


Copy this code and paste it in your HTML
  1. [Test]
  2. public void SendTransaction()
  3. {
  4. FormTester ft = LaunchForm();
  5. FillFormDetails(ft);
  6. ButtonTester bt = new ButtonTester("cmdApply", ft.Properties);
  7. ExpectModal("UpdateInfo","CloseUpdateWindow");
  8. bt.Click();
  9. }
  10.  
  11. private void CloseUpdateWindow()
  12. {
  13. FormTester ft = new FormTester("UpdateInfo");
  14. Assert.IsTrue(ft.Text == "Updated successfully");
  15. ft.Close();
  16. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.