/Orchard.Test/Orchard.Test/Modules/Users/Auto/RequestLostPasswordWithInvaildUserInfo.cs
C# | 89 lines | 55 code | 5 blank | 29 comment | 1 complexity | fbaf79b67db36a8c6ae0c8eab77cc19e MD5 | raw file
- /*
- Copyright (c) 2010, hiSoft
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of the hiSoft nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE HISOFT AND CONTRIBUTORS "AS IS" AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL HISOFT BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
- using System;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using Orchard.Test.Library;
- using Selenium;
-
- namespace Orchard.Test.Modules.Users.Auto
- {
- [TestClass]
- public class RequestLostPasswordWithInvaildUserInfo
- {
- private TestLibrary TestLibrary;
- private ISelenium selenium;
-
- [TestInitialize]
- public void SetupTest()
- {
- TestLibrary = TestLibrary.SetupTest(this.ToString());
- selenium = TestLibrary.Selenium;
- }
-
- [TestCleanup]
- public void TeardownTest()
- {
- TestLibrary.ShutDown();
- }
-
- [TestMethod]
- public void User_RequestLostPasswordWithInvaildUserInfo()
- {
- TestLibrary.UserHelper.LogOnAsAdmin();
- TestLibrary.ModuleHelper.EnableEmail();
- //TestLibrary.SettingHelper.ConfigureSmtpSettings("RecoverPassword@microsoft.com", "smtp.microsoft.com", "25", false, false, null, null);
- TestLibrary.SettingHelper.ConfigureSmtpSettingsByDefault();
- TestLibrary.SettingHelper.ConfigureUsersSettings(false, true, false, null, null, false, false, null);
- User user = null;
- try
- {
- //user = TestLibrary.UserHelper.AddUser(new UserSettings() { UserName = "v-haiyin", Email = "v-haiyin@microsoft.com" });
- user = TestLibrary.UserHelper.AddUser(new UserSettings() { UserName = TestLibrary.Consts.strLostPwdUserNameOf163, Email = TestLibrary.Consts.strLostPwdUserEmailOf163 });
- }
- catch (Exception ex)
- {
- if (!ex.ToString().Contains("Timed out after 30000ms"))
- Assert.IsTrue(false, "Bug#18035,Mybe Can not save UsersSettings, fail to save checkbox status." + ex.ToString());
- }
- TestLibrary.UserHelper.LogOff();
- selenium.Click("link=Sign In");
- selenium.WaitForPageToLoad("6000");
- selenium.Click("link=exact:Lost your Password?");
- System.Threading.Thread.Sleep(3000);
- selenium.Type("//input[@id='username']", "");
- selenium.Click("//button[@type='submit']");
- System.Threading.Thread.Sleep(3000);
- Assert.IsTrue(selenium.IsTextPresent("Invalid username or E-mail"),"Bug#18079 Maybe miss error messages.");
- selenium.Type("id=username", "w@");
- selenium.Click("//button[@type='submit']");
- System.Threading.Thread.Sleep(3000);
- Assert.IsFalse(selenium.IsTextPresent("Check your e-mail for the confirmation link"),"Bug#18079 Maybe when email/username is invalid,need prompt error messages.");
- //then, don't need to validate email
- }
- }
- }