public static void DeleteTeam(MvcWebApp app, Guid Id) { app.NavigateTo <TeamController>(c => c.Delete(Id)); app.FindFormFor <TeamEditModel>().Submit(); app.WaitForElementToBeVisible(By.CssSelector("div.summary-success"), TimeSpan.FromSeconds(1)); app.UrlShouldMapTo <TeamController>(c => c.Index()); }
private void StartSmpt4Dev() { MvcWebApp.AddPreTestCallback(PrepareForTest); _server = new Server(_portNumber); _server.Start(); Processor.MessageReceived += ProcessorOnMessageReceived; }
public void Authenticate(MvcWebApp mvcWebApp) { mvcWebApp.NavigateTo <AuthController>(c => c.Login()); mvcWebApp.FindFormFor <LoginForm>() .Field(f => f.EmailAddress).SetValueTo("*****@*****.**") .Field(f => f.Password).SetValueTo("Password1") .Submit(); }
public void Authenticate(MvcWebApp app) { app.NavigateTo<HomeController>(c => c.LogOn("/Account")); app.FindFormFor<LogOnModel>() .Field(f => f.Username).SetValueTo("admin") .Field(f => f.Password).SetValueTo("admin") .Submit(); }
public void Authenticate(MvcWebApp app) { app.NavigateTo <HomeController>(c => c.LogOn("/Account")); app.FindFormFor <LogOnModel>() .Field(f => f.Username).SetValueTo("admin") .Field(f => f.Password).SetValueTo("admin") .Submit(); }
public void Authenticate(MvcWebApp mvcWebApp) { mvcWebApp.NavigateTo("Logon","Account"); mvcWebApp.FindFormFor<LogOnModel>() .Field(m => m.UserName).SetValueTo("*****@*****.**") .Field(m => m.Password).SetValueTo("RealPassword") .Submit(); }
public void Authenticate(MvcWebApp mvcWebApp) { mvcWebApp.NavigateTo<AccountController>(c => c.Login(string.Empty)); mvcWebApp.FindFormFor<LoginViewModel>() .Field(m => m.UserName).SetValueTo("*****@*****.**") .Field(m => m.Password).SetValueTo("RealPassword") .Submit(); }
public static void ClassInit(TestContext testContext) { // Make sure relative paths are frozen in case the app's CurrentDir changes WorkingDirectory = Path.GetFullPath(WorkingDirectory); GitPath = Path.GetFullPath(GitPath); RepositoryDirectory = Path.Combine(WorkingDirectory, RepositoryName); app = new MvcWebApp(); }
public void Authenticate(MvcWebApp mvcWebApp) { mvcWebApp.NavigateTo <AccountController>(c => c.Login(string.Empty)); mvcWebApp.FindFormFor <LoginViewModel>() .Field(m => m.UserName).SetValueTo("*****@*****.**") .Field(m => m.Password).SetValueTo("RealPassword") .Submit(); }
public void Authenticate(MvcWebApp app) { app.NavigateTo<AuthenticationController>(c => c.LogOn()); app.Browser.Manage().Cookies.DeleteAllCookies(); app.FindFormFor<LogOnForm>().Field(f => f.EmailAddress) .SetValueTo("*****@*****.**").Field(f => f.Password) .SetValueTo("TestPassword01") .Submit(); }
public void InitTest() { // We can't use ClassInitialize in a base class if (app == null) { app = new MvcWebApp(); ITH = new IntegrationTestHelpers(app); } Console.WriteLine("TestInit"); ITH.LoginAndResetDatabase(); }
public void InitTest() { // We can't use ClassInitialize in a base class if (app == null) { app = new MvcWebApp(); ITH = new IntegrationTestHelpers(app); } Console.WriteLine("TestInit"); ITH.LoginAndResetDatabase(); }
public static void ClassInit(TestContext testContext) { // Make sure relative paths are frozen in case the app's CurrentDir changes // WorkingDirectory = Path.GetFullPath(WorkingDirectory); // GitPath = Path.GetFullPath(GitPath); // RepositoryDirectory = Path.Combine(WorkingDirectory, RepositoryName); List <string> not_found = new List <string>(); foreach (var version in GitVersions) { var git = String.Format(GitPath, version); if (File.Exists(git)) { installedgits.Add(new GitInstance { GitExe = git, Resources = new MsysgitResources(version) }); } else { not_found.Add(git); } } if (!installedgits.Any()) { Assert.Fail(string.Format("Please ensure that you have at least one git installation in '{0}'.", string.Join("', '", not_found.Select(n => Path.GetFullPath(n))))); } lc = AssemblyStartup.LoadedConfig; AdminCredentials = lc.getUrlLogin("admin") + "@"; UserCredentials = lc.getUrlLogin("user") + "@"; Directory.CreateDirectory(WorkingDirectory); if (AnyCredentialHelperExists(installedgits.Last())) { /* At the moment there is no reliable way of overriding credential.helper on a global basis. * See the other comments for all the other bugs found so far. * Having a credential helper set makes it impossible to check in non authorized login * after a login with username and password has been done. */ Assert.Fail("Cannot have any credential.helpers configured for integration tests."); } app = new MvcWebApp(); ITH = new IntegrationTestHelpers(app, lc); RepositoryUrlWithCredentials = String.Format(RepositoryUrlTemplate, AdminCredentials, ".git", RepositoryName); RepositoryUrlWithoutCredentials = String.Format(RepositoryUrlTemplate, String.Empty, String.Empty, RepositoryName); Url = string.Format(RepositoryUrlTemplate, string.Empty, string.Empty, string.Empty); BareUrl = Url.TrimEnd('/'); }
public void Should_create_food() { var app = new MvcWebApp(); app.NavigateTo <FoodController>(c => c.Index()); app.FindLinkTo <FoodController>(x => x.New()).Click(); app.FindFormFor <EditFoodForm>() .Field(f => f.Name).SetValueTo("Rice milk") .Submit(); //assert app.AllText().Contains("saved"); }
public void Should_create_food() { var app = new MvcWebApp(); app.NavigateTo<FoodController>(c => c.Index()); app.FindLinkTo<FoodController>(x => x.New()).Click(); app.FindFormFor<EditFoodForm>() .Field(f => f.Name).SetValueTo("Rice milk") .Submit(); //assert app.AllText().Contains("saved"); }
public void EnsureCookiePersistBetweenBrowserRestart() { app.NavigateTo <HomeController>(c => c.LogOff()); // in case the cookie is set app.NavigateTo <RepositoryController>(c => c.Index(null, null)); app.Browser.Manage().Cookies.DeleteAllCookies(); Thread.Sleep(TimeSpan.FromSeconds(5)); // give it some time to delete the cookies app.NavigateTo <AccountController>(c => c.Detail(new Guid("7479fc09-2c0b-4e93-a2cf-5e4bbf6bab4f"))); app.UrlShouldMapTo <HomeController>(c => c.LogOn("/Account/Detail/7479fc09-2c0b-4e93-a2cf-5e4bbf6bab4f")); var form = app.FindFormFor <LogOnModel>(); var chkField = form.Field(f => f.Username).SetValueTo("admin") .Field(f => f.Password).SetValueTo("admin") .Field(f => f.RememberMe).Field; ITH.SetCheckbox(chkField, true); form.Submit(); app.UrlShouldMapTo <AccountController>(c => c.Detail(new Guid("7479fc09-2c0b-4e93-a2cf-5e4bbf6bab4f"))); MvcWebApp.Driver.Shutdown(); app = new MvcWebApp(); ITH = new IntegrationTestHelpers(app, lc); app.NavigateTo <AccountController>(c => c.Detail(new Guid("7479fc09-2c0b-4e93-a2cf-5e4bbf6bab4f"))); app.UrlShouldMapTo <AccountController>(c => c.Detail(new Guid("7479fc09-2c0b-4e93-a2cf-5e4bbf6bab4f"))); // ok we re logged in with success. // Now let's make sure we can unset remember me app.NavigateTo <HomeController>(c => c.LogOff()); app.NavigateTo <HomeController>(c => c.LogOn("")); form = app.FindFormFor <LogOnModel>(); chkField = form.Field(f => f.Username).SetValueTo("admin") .Field(f => f.Password).SetValueTo("admin") .Field(f => f.RememberMe).Field; ITH.SetCheckbox(chkField, false); form.Submit(); app.UrlShouldMapTo <RepositoryController>(c => c.Index(null, null)); MvcWebApp.Driver.Shutdown(); app = new MvcWebApp(); ITH = new IntegrationTestHelpers(app, lc); app.NavigateTo <AccountController>(c => c.Detail(new Guid("7479fc09-2c0b-4e93-a2cf-5e4bbf6bab4f"))); app.UrlShouldMapTo <HomeController>(c => c.LogOn("/Account/Detail/7479fc09-2c0b-4e93-a2cf-5e4bbf6bab4f")); }
public void EnsureCookiePersistBetweenBrowserRestart() { app.NavigateTo<HomeController>(c => c.LogOff()); // in case the cookie is set app.NavigateTo<RepositoryController>(c => c.Index(null, null)); app.Browser.Manage().Cookies.DeleteAllCookies(); Thread.Sleep(TimeSpan.FromSeconds(5)); // give it some time to delete the cookies app.NavigateTo<RepositoryController>(c => c.Index(null, null)); app.UrlShouldMapTo<HomeController>(c => c.LogOn("/Repository/Index")); var form = app.FindFormFor<LogOnModel>(); var chkField = form.Field(f => f.Username).SetValueTo("admin") .Field(f=> f.Password).SetValueTo("admin") .Field(f => f.RememberMe).Field; ITH.SetCheckbox(chkField, true); form.Submit(); app.UrlShouldMapTo<RepositoryController>(c => c.Index(null, null)); MvcWebApp.Driver.Shutdown(); app = new MvcWebApp(); app.NavigateTo<RepositoryController>(c => c.Index(null, null)); app.UrlShouldMapTo<RepositoryController>(c => c.Index(null, null)); // ok we re logged in with success. // Now let's make sure we can unset remember me app.NavigateTo<HomeController>(c => c.LogOff()); app.NavigateTo<HomeController>(c => c.LogOn("")); form = app.FindFormFor<LogOnModel>(); chkField = form.Field(f => f.Username).SetValueTo("admin") .Field(f=> f.Password).SetValueTo("admin") .Field(f => f.RememberMe).Field; ITH.SetCheckbox(chkField, false); form.Submit(); app.UrlShouldMapTo<RepositoryController>(c => c.Index(null, null)); MvcWebApp.Driver.Shutdown(); app = new MvcWebApp(); ITH = new IntegrationTestHelpers(app, lc); app.NavigateTo<RepositoryController>(c => c.Index(null, null)); app.UrlShouldMapTo<HomeController>(c => c.LogOn("/Repository/Index")); }
public static void SetupTestRun() { if (IsRun) { return; } string msBuild = ToolLocationHelper.GetPathToBuildToolsFile("msbuild.exe", "16.0"); var config = new SpecsForMvcConfig(); config.UseIISExpress() .With(Project.Named("WeatherApp.FrontEnd")) .UseMSBuildExecutableAt(msBuild); config.BuildRoutesUsing(r => RouteConfig.RegisterRoutes(r)); config.UseBrowser(BrowserDriver.InternetExplorer); config.PostOperationDelay(new TimeSpan(0, 0, 0, 4)); _host = new SpecsForIntegrationHost(config); _host.Start(); app = new MvcWebApp(); IsRun = true; }
public IntegrationTestHelpers(MvcWebApp app, LoadedConfig cc) { _app = app; _lc = cc; }
public IntegrationTestHelpers(MvcWebApp app) { _app = app; }
public static string SuccessMessage(this MvcWebApp app) { var element = app.Browser.FindElements(By.ClassName("alert-success")).FirstOrDefault(); return(element == null ? null : element.Text); }
public static void ClassInit(TestContext testContext) { // Make sure relative paths are frozen in case the app's CurrentDir changes // WorkingDirectory = Path.GetFullPath(WorkingDirectory); // GitPath = Path.GetFullPath(GitPath); // RepositoryDirectory = Path.Combine(WorkingDirectory, RepositoryName); List<string> not_found = new List<string>(); foreach (var version in GitVersions) { var git = String.Format(GitPath, version); if (File.Exists(git)) { installedgits.Add(new GitInstance { GitExe = git, Resources = new MsysgitResources(version) }); } else { not_found.Add(git); } } if (!installedgits.Any()) { Assert.Fail(string.Format("Please ensure that you have at least one git installation in '{0}'.", string.Join("', '", not_found.Select(n => Path.GetFullPath(n))))); } lc = AssemblyStartup.LoadedConfig; AdminCredentials = lc.getUrlLogin("admin") + "@"; UserCredentials = lc.getUrlLogin("user") + "@"; Directory.CreateDirectory(WorkingDirectory); if (AnyCredentialHelperExists(installedgits.Last())) { /* At the moment there is no reliable way of overriding credential.helper on a global basis. * See the other comments for all the other bugs found so far. * Having a credential helper set makes it impossible to check in non authorized login * after a login with username and password has been done. */ Assert.Fail("Cannot have any credential.helpers configured for integration tests."); } app = new MvcWebApp(); ITH = new IntegrationTestHelpers(app, lc); RepositoryUrlWithCredentials = String.Format(RepositoryUrlTemplate, AdminCredentials, ".git", RepositoryName); RepositoryUrlWithoutCredentials = String.Format(RepositoryUrlTemplate, String.Empty, String.Empty, RepositoryName); Url = string.Format(RepositoryUrlTemplate, string.Empty, string.Empty, string.Empty); BareUrl = Url.TrimEnd('/'); }
public static void MyClassInitialize(TestContext testContext) { //arrange app = new MvcWebApp(); }
public static Mailbox Mailbox(this MvcWebApp app) { return(Mvc.Smtp.Mailbox.Current); }
public static void MyClassInitialize(TestContext testContext) { //arrange app = new MvcWebApp(); }
public static void InitialTest(TestContext testContext) { app = new MvcWebApp(); }
public static void ClassInit(TestContext testContext) { app = new MvcWebApp(); }