Exemple #1
0
        private void StartIisExpress()
        {
            int PortNumber = int.Parse(this.BaseUrl.Substring(this.BaseUrl.LastIndexOf(':') + 1, 5));

            var app = new WebApplication(ProjectLocation.FromFolder("PPCRental"), PortNumber);

            app.AddEnvironmentVariable("UITests");
            WebServer = new IisExpressWebServer(app);
            WebServer.Start("Release");
        }
        private void StartIisExpress()
        {
            //int PortNumber = int.Parse(SeleniumController.BaseUrl.Substring(SeleniumController.BaseUrl.LastIndexOf(':') + 1, 5));
            int PortNumber = int.Parse(BaseUrl.Substring((BaseUrl.LastIndexOf(':') + 1), (BaseUrl.LastIndexOf('/') - (BaseUrl.LastIndexOf(':') + 1))));

            var app = new WebApplication(ProjectLocation.FromFolder("PPC_Rental"), PortNumber);

            app.AddEnvironmentVariable("UITests");
            WebServer = new IisExpressWebServer(app);
            WebServer.Start("Release");
        }
Exemple #3
0
        public void SetUp()
        {
            var app = new WebApplication(ProjectLocation.FromFolder("ContosoUniversity"), 12365);

            app.AddEnvironmentVariable("FunctionalTests");
            WebServer = new IisExpressWebServer(app);
            WebServer.Start("Release");

            Browser       = Browsers.Chrome;
            _mvcUrlHelper = new MvcUrlHelper(RouteConfig.RegisterRoutes(new RouteCollection()));
        }
Exemple #4
0
        public static void Init(TestContext context)
        {
            var app = new WebApplication(ProjectLocation.FromFolder("Fundraise.MvcExample"), 12365);

            WebServer = new IisExpressWebServer(app);
            WebServer.Start();
            Browser = new FirefoxDriver();

            // Create a test user
            Browser.Manage().Window.Maximize();
            Browser.Navigate().GoToUrl("http://localhost:12365/Account/Register");

            var emailBox = Browser.FindElementById("Email");

            emailBox.SendKeys(email);

            var passwordBox = Browser.FindElementById("Password");

            passwordBox.SendKeys("test1234");

            var confirmPasswordBox = Browser.FindElementById("ConfirmPassword");

            confirmPasswordBox.SendKeys("test1234");

            var submitButton = Browser.FindElementById("RegisterSubmit");

            submitButton.Submit();

            try
            {
                var wait    = new WebDriverWait(Browser, TimeSpan.FromSeconds(10));
                var element = wait.Until(ExpectedConditions.UrlToBe("http://localhost:59702/"));
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception while waiting for 'Edit' link: " + ex.Message);
                Console.WriteLine("Final URL was " + Browser.Url);
                var screenshot2 = Browser.GetScreenshot();
                screenshot2.SaveAsFile("login-error.png");
                if (Browser.PageSource.IndexOf("<code><pre>") > 0)
                {
                    Console.WriteLine(Browser.PageSource.Substring(Browser.PageSource.IndexOf("<code><pre>")));
                }
                else
                {
                    Console.WriteLine("Final page title was: " + Browser.Title);
                }
            }
            Console.WriteLine("complete ClassInitialize");
        }