Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Application application;
- Window? window;
- ConditionFactory cf;
- [TestInitialize]
- public void TestInitialize()
- {
- application = Application.Launch(@"C:\Users\<user>\AppData\Roaming\Spotify\Spotify.exe");
- window = application.GetMainWindow(new UIA3Automation());
- cf = new ConditionFactory(new UIA3PropertyLibrary());
- System.Threading.Thread.Sleep(2000);
- }
- [TestCleanup]
- public void Cleanup()
- {
- System.Threading.Thread.Sleep(2000);
- application.Close();
- }
- [TestMethod]
- public void TestShouldNotRegisterWithIncorrectCredentials()
- {
- var email = "test";
- var password = "QWerty123#";
- var salutation = "Test";
- window.FindFirstDescendant(cf.ByName("ZAREJESTRUJ SIĘ")).AsButton().Invoke();
- System.Threading.Thread.Sleep(1500);
- window.FindFirstDescendant(cf.ByName("E-mail")).AsTextBox().Enter(email);
- System.Threading.Thread.Sleep(200);
- AutomationElement PasswordBox = null;
- PasswordBox = window.FindFirstDescendant(cf.ByAutomationId("GlueTextInput-4"));
- PasswordBox.FocusNative();
- Keyboard.Type(password);
- System.Threading.Thread.Sleep(200);
- window.FindFirstDescendant(cf.ByName("Jak mamy się do Ciebie zwracać?")).AsTextBox().Enter(salutation);
- window.FindFirstDescendant(cf.ByName("KONTYNUUJ")).AsButton().Invoke();
- System.Threading.Thread.Sleep(200);
- Assert.IsNotNull(window.FindFirstDescendant(cf.ByName("W tym formularzu jest 1 błąd, napraw go przed wysłaniem.")));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement