예제 #1
0
        public void LoginUserAndShowHomeOld()
        {
            // Entsprechenden Testdatensatz generieren
            var user = new User("eric", "password");

            // Login-Elemente suchen udn füllen
            var usrTxtBox = new UITestControl();
            var pwTxtBox = new UITestControl();
            var btn = new UITestControl();

            // searchproperties hinzufügen und element suchen
            usrTxtBox.SearchProperties.Add("AutomationId", "username",PropertyExpressionOperator.EqualTo);
            usrTxtBox = usrTxtBox.FindMatchingControls()[0];

            // searchproperties hinzufügen und element suchen
            pwTxtBox.SearchProperties.Add("AutomationId", "password", PropertyExpressionOperator.EqualTo);
            pwTxtBox = pwTxtBox.FindMatchingControls()[0];

            // searchproperties hinzufügen und element suchen
            btn.SearchProperties.Add("AutomationId", "loginbtn", PropertyExpressionOperator.EqualTo);
            btn = btn.FindMatchingControls()[0];

            // Setze entsprechende Werte
            usrTxtBox.SetProperty("Text", user.Name);
            pwTxtBox.SetProperty("Text", user.Password);

            // LoginButton Clicken
            Mouse.Click(btn);

            // Die Willkommen-Message suchen und entsprechend verifizieren
            var welcomemsg = new UITestControl();
            welcomemsg.SearchProperties.Add("AutomationId", "welcomemsg", PropertyExpressionOperator.EqualTo);

            StringAssert.Contains(welcomemsg.GetProperty("Text").ToString(), "Willkommen, eric");
        }
예제 #2
0
        public static void PerformLogin(User user)
        {
            var usrTxtBox = ElementFinder.FindElementById("username");
            var pwTxtBox = ElementFinder.FindElementById("password");

            // Setze entsprechende Werte
            usrTxtBox.SetProperty("Text", user.Name);
            pwTxtBox.SetProperty("Text", user.Password);

            // LoginButton Clicken

            var btn = ElementFinder.FindElementById("loginbtn");
            Mouse.Click(btn);
        }
예제 #3
0
 public static User CreateUser(string name, string password)
 {
     var user = new User(name, password);
     return user;
 }