Beispiel #1
0
        public void SetText_OnHtmlEdit_Succeeds()
        {
            //Arrange
            using (var webPage = new TempWebPage(
                       @"<html>
    <head>
        <title>test</title>
    </head>
    <body>
        <div id=""div1"">
            <input type=""text""/>
        </div>
    </body>
</html>"))
            {
                var      browserWindow = BrowserWindow.Launch(webPage.FilePath);
                HtmlDiv  div           = browserWindow.Find <HtmlDiv>(By.Id("div1"));
                HtmlEdit inputTextBox  = div.Find <HtmlEdit>();

                //Act
                inputTextBox.Text = "text";

                //Assert
                Assert.AreEqual("text", inputTextBox.Text);

                browserWindow.Close();
            }
        }
Beispiel #2
0
        public void SetText_OnHtmlEdit_Succeeds()
        {
            //Arrange
            using (TempFile tempFile = new TempFile(
                       @"<html>
    <head>
        <title>test</title>
    </head>
    <body>
        <div id=""div1"">
            <input type=""text""/>
        </div>
    </body>
</html>"))
            {
                BrowserWindow.Launch(tempFile.FilePath);
                var      window       = new BrowserWindowUnderTest("test");
                HtmlDiv  div          = window.Find <HtmlDiv>(By.Id("div1"));
                HtmlEdit inputTextBox = div.Find <HtmlEdit>();

                //Act
                inputTextBox.Text = "text";

                //Assert
                Assert.AreEqual("text", inputTextBox.Text);

                window.Close();
            }
        }
Beispiel #3
0
        private HtmlControl CheckValidationMessage()
        {
            HtmlDiv searchscopeButton = new HtmlDiv(_bw);

            searchscopeButton.SearchProperties.Add(HtmlDiv.PropertyNames.Class, "validation-summary-errors text-danger");
            searchscopeButton.Find();

            HtmlControl text = new HtmlControl(searchscopeButton);

            text.SearchProperties.Add(HtmlTextArea.PropertyNames.InnerText, "Invalid login attempt.");

            return(text);
        }
Beispiel #4
0
        public MainObjects CheckLogin(string username)
        {
            HtmlDiv searchscopeButton = new HtmlDiv(_bw);

            searchscopeButton.SearchProperties.Add(HtmlDiv.PropertyNames.Class, "navbar-right");
            searchscopeButton.Find();

            HtmlControl text = new HtmlControl(searchscopeButton);

            text.SearchProperties.Add(HtmlTextArea.PropertyNames.InnerText, "Hello " + username + "!");
            text.Find();

            return(this);
        }
Beispiel #5
0
        private HtmlInputButton GetLoginButton()
        {
            HtmlDiv searchscopeButton = new HtmlDiv(_bw);

            searchscopeButton.SearchProperties.Add(HtmlDiv.PropertyNames.Id, "login-button");
            searchscopeButton.Find();

            HtmlInputButton btn = new HtmlInputButton(searchscopeButton);

            btn.SearchProperties.Add(HtmlButton.PropertyNames.Type, "submit");
            btn.SearchProperties.Add(HtmlButton.PropertyNames.ValueAttribute, "Log in");

            return(btn);
        }
Beispiel #6
0
        public MainObjects Logout()
        {
            HtmlDiv searchscopeButton = new HtmlDiv(_bw);

            searchscopeButton.SearchProperties.Add(HtmlDiv.PropertyNames.Class, "navbar-right");
            searchscopeButton.Find();

            HtmlHyperlink btn = new HtmlHyperlink(searchscopeButton);

            btn.SearchProperties.Add(HtmlTextArea.PropertyNames.Id, "helloLink");
            Mouse.Click(btn);

            HtmlHyperlink btn2 = new HtmlHyperlink(searchscopeButton);

            btn2.SearchProperties.Add(HtmlHyperlink.PropertyNames.Id, "logoutLink");
            Mouse.Click(btn2);

            return(this);
        }