Пример #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();
            }
        }
Пример #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();
            }
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }