public void UnsuccessfulAdministrationLogin()
        {
            bool result;
            using (var browser = new IE("http://localhost:1200/"))
            {
                browser.Link(Find.ByText("Admin")).Click();
                browser.TextField(Find.ById("UserName")).TypeText("admin");
                browser.TextField(Find.ById("Password")).TypeText("admin");

                browser.Element(Find.ByValue("Log On")).Click();

                result = browser.ContainsText("Login was unsuccessful.");
            }

            Assert.That(result, "Browser Url is incorrect");
        }
        public void SuccessfulAdministrationLogin()
        {
            var browserUrl = string.Empty;
            using (var browser = new IE("http://localhost:1200/"))
            {
                browser.Link(Find.ByText("Admin")).Click();
                browser.TextField(Find.ById("UserName")).TypeText("administrator");
                browser.TextField(Find.ById("Password")).TypeText("password123!");

                browser.Element(Find.ByValue("Log On")).Click();
                browser.WaitForComplete(2);

                browserUrl = browser.Url;
            }

            Assert.That(browserUrl.Contains("/StoreManager"), string.Format("Browser Url is incorrect - it is actually {0}", browserUrl));
        }
        public void Login_Successful_Should_Have_LogOut_Link()
        {
            using (var browser = new IE())
            {
                browser.GoTo("http://localhost:1100/");

                browser.BringToFront();

                browser.Link(Find.ByText("Admin")).Click();

                //browser.Element(x => x.)

                browser.TextField(Find.ById("UserName")).TypeText("administrator");

                browser.TextField(Find.ById("Password")).TypeText("password123!");

                browser.Element(Find.BySelector("input.LogOn")).Click();

                Assert.IsTrue(browser.Link(Find.ByText("Log Out")).Exists);

                browser.Link(Find.ByText("Log Out")).Click();

            }
        }
        public void Login_UnSuccessful_Should_Have_Error()
        {
            var browser = new IE();

                browser.GoTo("http://localhost:1100/");

                browser.BringToFront();

                browser.Link(Find.ByText("Admin")).Click();

                browser.TextField(Find.ById("UserName")).TypeText("admin");

                browser.TextField(Find.ById("Password")).TypeText("1234");

                browser.Element(Find.BySelector("input.LogOn")).Click();

                Assert.IsTrue(browser.ContainsText("Login was unsuccessful."));
        }
        public void Login_WithoutUsernameAndPassword_Should_Have_ErrorMessage()
        {
            using (var browser = new IE())
            {
                browser.GoTo("http://localhost:1100/");

                browser.BringToFront();

                browser.Link(Find.ByText("Admin")).Click();

                browser.Element(Find.BySelector("input.LogOn")).Click();

                Assert.IsTrue(browser.ContainsText("The User name field is required"));

                Assert.IsTrue(browser.ContainsText("The Password field is required."));
            }
        }
Exemplo n.º 6
-1
        public string PassportCheck()
        {
            string strreturn = "";
            using (var browser = new IE("https://www.world-check.com/portal/mod_perl/Login/"))
            {
                if (Find.ByName("username"))
                {
                    browser.TextField(Find.ByName("username")).TypeText("nzrbrt0002");
                    browser.TextField(Find.ByName("password")).TypeText("Go8ahE5s");
                    browser.Image(Find.ByName("submitted")).Click();
                }

                browser.GoTo("https://www.world-check.com/portal/mod_perl/PassportCheck");

                browser.TextField(Find.ByName("givenName")).TypeText("Jim");
                browser.TextField(Find.ByName("lastName")).TypeText("Smith");
                browser.RadioButton(Find.ByName("sexg") && Find.ByValue("M")).Click();
                browser.Span(Find.ById("issuingState-CAN")).Click();
                browser.TextField(Find.ByName("dateOfBirthDay")).TypeText("29");
                browser.TextField(Find.ByName("dateOfBirthMonth")).TypeText("05");
                browser.TextField(Find.ByName("dateOfBirthYear")).TypeText("1978");
                browser.TextField(Find.ByName("passportNumber")).TypeText("WL745488");
                browser.TextField(Find.ByName("expireDateDay")).TypeText("10");
                browser.TextField(Find.ByName("expireDateMonth")).TypeText("07");
                browser.TextField(Find.ByName("expireDateYear")).TypeText("2014");
                browser.Button(Find.ByValue("VERIFY")).Click();

                var element = browser.Element(Find.ByClass("tablelinespacer"));
                var firsttd = element.NextSibling.NextSibling;
                strreturn = firsttd.Text.Replace("Lower Line:","");
                //Assert.IsTrue(browser.ContainsText("WatiN"));
            }
            return strreturn;
        }