Пример #1
0
 public void AuthenticateAsGoogleUser()
 {
     Logger.Log("<-");
     var user = new User { Login = "******" };
     LoginToAcsProvider(user);
     Logger.Log("->");
 }
Пример #2
0
 public void AuthenticateAsYahooUser()
 {
     Logger.Log("<-");
     var user = new User { Login = "******" };
     LoginToAcsProvider(user);
     Logger.Log("->");
 }
Пример #3
0
 public void AuthenticateAsMicrosoftUser()
 {
     Logger.Log("<-");
     var user = new User { Login = "******" };
     LoginToAcsProvider(user);
     Logger.Log("->");
 }
Пример #4
0
 public void AuthenticateAsYahooUser()
 {
     Logger.Log("<-");
     var user = new User { Type = UserType.Yahoo };
     OpenIdentityProviderPage(user);
     LoginUser(user);
     Logger.Log("->");
 }
Пример #5
0
 public void AuthenticateAsMicrosoftUserToSkyDrive()
 {
     Logger.Log("<-");
     var user = new User { Login = "******" };
     FillUserCredentials(user);
     LoginUser(user);
     Logger.Log("->", LogType.MessageWithoutScreenshot);
 }
Пример #6
0
        public void AuthenticateAsYahooUser()
        {
            Logger.Log("<-");

            if (!IsElementExists(By.XPath("//*[@name='Yahoo!']")))
            {
                Click(By.XPath("//*[@id='MoreOptions']/a"));
            }
            Click(By.XPath("//*[@name='Yahoo!']"));

            var user = new User { Type = UserType.Yahoo };
            FillUserCredentials(user);
            Logger.Log(user.ToString());
            SetUserInfoAndSubmit(user);
            Logger.Log("->");
        }
Пример #7
0
        private void SetUserInfoAndSubmit(User user)
        {
            Logger.Log("<- user type: " + user.Type);

            switch (user.Type)
            {
                case UserType.Google:
                    TypeText(By.Id("Email"), user.Login);
                    TypeText(By.Id("Passwd"), user.Password);
                    Click(By.Id("signIn"));
                    break;
                case UserType.Yahoo:
                    TypeText(By.Id("username"), user.Login);
                    TypeText(By.Id("passwd"), user.Password);
                    Click(By.Id(".save"));
                    break;
                case UserType.Microsoft:
                    ClickElementAndType(By.Id("idDiv_PWD_UsernameExample"), user.Login);
                    ClickElementAndType(By.Id("idDiv_PWD_PasswordExample"), user.Password);
                    Click(By.XPath("//*[@id='idSIButton9']"));
                    break;
            }
            Logger.Log("->");
        }
Пример #8
0
 private void OpenIdentityProviderPage(User user)
 {
     Logger.Log("<- user type: " + user.Type);
     switch (user.Type)
     {
         case UserType.Google:
             Click(By.XPath("//*[@name='Google']"));
             break;
         case UserType.Yahoo:
             Click(By.XPath("//*[@name='Yahoo!']"));
             break;
         case UserType.Microsoft:
             Click(By.XPath("//*[@name='Windows Live™ ID']"));
             break;
     }
     Logger.Log("->");
 }
Пример #9
0
 private void LoginUser(User user)
 {
     Logger.Log("<-");
     FillUserCredentials(user);
     Logger.Log(user.ToString());
     SetUserInfoAndSubmit(user);
     AcceptSecurityWarning();
     Logger.Log("->");
 }
Пример #10
0
        protected User FillUserCredentials(User user)
        {
            var document = new XmlDocument();
            document.Load(GetValidAcountsXmlPath());

            switch (user.Type)
            {
                case UserType.Google:
                    user.Login = document.SelectSingleNode("//Accounts/google/login").InnerText;
                    user.Password = document.SelectSingleNode("//Accounts/google/password").InnerText;
                    break;
                case UserType.Microsoft:
                    user.Login = document.SelectSingleNode("//Accounts/microsoft/login").InnerText;
                    user.Password = document.SelectSingleNode("//Accounts/microsoft/password").InnerText;
                    break;
                case UserType.Yahoo:
                    user.Login = document.SelectSingleNode("//Accounts/yahoo/login").InnerText;
                    user.Password = document.SelectSingleNode("//Accounts/yahoo/password").InnerText;
                    break;
                default:
                    throw new Exception("Can not find user credentials, user: " + user);
            }

            return user;
        }
Пример #11
0
        private void SetUserInfoAndSubmit(User user)
        {
            Logger.Log("<- user type: " + user.Type);

            switch (user.Type)
            {
                case "google":
                    TypeText(By.Id("Email"), user.Login);
                    TypeText(By.Id("Passwd"), user.Password);
                    Click(By.Id("signIn"));
                    break;
                case "yahoo":
                    TypeText(By.Id("username"), user.Login);
                    TypeText(By.Id("passwd"), user.Password);
                    Click(By.Id(".save"));
                    break;
                case "microsoft":
                    ClickElementAndType(By.Id("idDiv_PWD_UsernameExample"), user.Login);
                    ClickElementAndType(By.Id("idDiv_PWD_PasswordExample"), user.Password);
                    Click(By.Id("idSIButton9"));
                    break;
            }
            Logger.Log("->", LogType.MessageWithoutScreenshot);
        }
Пример #12
0
 private void OpenIdentityProviderPage(User user)
 {
     Logger.Log("<- user type: " + user.Type);
     switch (user.Type)
     {
         case "google":
             Click(By.CssSelector("[name='Google']"));
             break;
         case "yahoo":
             Click(By.CssSelector("[name='Yahoo!']"));
             break;
         case "microsoft":
             Click(By.CssSelector("[name='Windows Live™ ID']"));
             break;
         default:
             throw new Exception("User type is not defined");
     }
     Logger.Log("->");
 }
Пример #13
0
 private void LoginUser(User user)
 {
     Logger.Log("<-");
     Logger.Log(user.ToString());
     SetUserInfoAndSubmit(user);
     AcceptSecurityWarning();
     Logger.Log("->", LogType.MessageWithoutScreenshot);
 }
Пример #14
0
 private void LoginToAcsProvider(User user)
 {
     Logger.Log("<-");
     FillUserCredentials(user);
     OpenIdentityProviderPage(user);
     LoginUser(user);
     Logger.Log("->");
 }
Пример #15
0
 private void LoginToAcsProvider(string email)
 {
     var user = new User { Login = email };
     LoginToAcsProvider(user);
 }
Пример #16
0
 private void FillUserCredentials(User user)
 {
     IEnumerable<User> users = GetUsersFromJson();
     if (users != null)
         foreach (User userData in users)
         {
             if (userData.Login == user.Login)
             {
                 user.Password = userData.Password;
                 user.Type = userData.Type;
                 break;
             }
         }
 }