Esempio n. 1
0
        public void GetHtmlRow_ById_Succeeds()
        {
            // Arrange
            using (var webPage = new TempWebPage(
                       @"<html>
    <head>
        <title>test</title>
    </head>
    <body>
        <table class=""cart"" cellspacing=""0"">
          <tbody>
            <tr id=""555002_gp2"">
                <td>
                    banana
                </td>
            </tr>
          </tbody>
        </table>
    </body>
</html>"))
            {
                var browserWindow = BrowserWindow.Launch(webPage.FilePath);

                // Act
                HtmlRow row = browserWindow.Find <HtmlRow>(By.Id("555002_gp2"));

                // Assert
                Assert.IsTrue(row.Exists);

                browserWindow.Close();
            }
        }
Esempio n. 2
0
        public HtmlControl GetRow(int rowIndex)
        {
            HtmlRow htmlRow = new HtmlRow(this);

            htmlRow.SearchProperties[HtmlRow.PropertyNames.RowIndex] = rowIndex.ToString();
            return(htmlRow);
        }
Esempio n. 3
0
        public void GetHtmlRow_ById_Succeeds()
        {
            // Arrange
            using (TempFile tempFile = new TempFile(
                       @"<html>
    <head>
        <title>test</title>
    </head>
    <body>
        <table class=""cart"" cellspacing=""0"">
          <tbody>
            <tr id=""555002_gp2"">
                <td>
                    banana
                </td>
            </tr>
          </tbody>
        </table>
    </body>
</html>"))
            {
                BrowserWindow.Launch(tempFile.FilePath);
                var window = new BrowserWindowUnderTest("test");

                // Act
                HtmlRow row = window.Find <HtmlRow>(By.Id("555002_gp2"));

                // Assert
                Assert.IsTrue(row.Exists);

                window.Close();
            }
        }
Esempio n. 4
0
 private HtmlRow GetRow(string fullName)
 {
     HtmlRow row = new HtmlRow(GetStudentsTable);
     row.SearchProperties.Add(HtmlRow.PropertyNames.InnerText, fullName, PropertyExpressionOperator.Contains);
     row.DrawHighlight();
     return row;
 }
Esempio n. 5
0
        private HtmlRow GetRow(string fullName)
        {
            HtmlRow row = new HtmlRow(GetStudentsTable);

            row.SearchProperties.Add(HtmlRow.PropertyNames.InnerText, fullName, PropertyExpressionOperator.Contains);
            row.DrawHighlight();
            return(row);
        }
Esempio n. 6
0
        public void HtmlRowTest_GetContent()
        {
            HtmlRow row = new HtmlRow(BasicTestPage);

            row.SearchProperties.Add(HtmlRow.PropertyNames.Id, "rowWithId");

            row.GetContent().Should().Equal("Item 102", "Item 112");
        }
Esempio n. 7
0
        public void HtmlRowTest_ByRowIndex_FindMatchingControls()
        {
            HtmlRow row = new HtmlRow(BasicTestPage);

            row.SearchProperties.Add(HtmlRow.PropertyNames.RowIndex, "2");

            row.FindMatchingControls()[1].InnerText.Should().Be("Item 102 Item 112");
        }
Esempio n. 8
0
        public void HtmlRowTest_ByRowIndex()
        {
            HtmlRow row = new HtmlRow(BasicTestPage);

            row.SearchProperties.Add(HtmlRow.PropertyNames.RowIndex, "2");

            row.InnerText.Should().Be("Item 001 Item 011");
        }
Esempio n. 9
0
        public void HtmlRowTest_ByInnerText()
        {
            HtmlRow row = new HtmlRow(BasicTestPage);

            row.SearchProperties.Add(HtmlRow.PropertyNames.InnerText, "Item 112", PropertyExpressionOperator.Contains);

            row.InnerText.Should().Be("Item 102 Item 112");
        }
Esempio n. 10
0
        public void HtmlRowTest_ById()
        {
            HtmlRow row = new HtmlRow(BasicTestPage);

            row.SearchProperties.Add(HtmlRow.PropertyNames.Id, "rowWithId");

            row.InnerText.Should().Be("Item 102 Item 112");
        }
Esempio n. 11
0
        public virtual RowBase CreateRow(string alternateRowCss = null)
        {
            HtmlRow row = new HtmlRow();

            ApplyStyleToRow(row, alternateRowCss);
            RowsCount++;
            return(row);
        }
Esempio n. 12
0
        public void HtmlRowTest_Cells()
        {
            HtmlRow row = new HtmlRow(BasicTestPage);

            row.SearchProperties.Add(HtmlRow.PropertyNames.Id, "rowWithId");

            row.Cells.Should().HaveCount(2);
            row.Cells.GetValuesOfControls().Should().Equal("Item 102", "Item 112");
        }
Esempio n. 13
0
        public void HtmlCellTest_ByTagInstance()
        {
            HtmlRow  row  = new HtmlRow(BasicTestPage);
            HtmlCell cell = new HtmlCell(row);

            cell.SearchProperties.Add(HtmlCell.PropertyNames.TagInstance, "4");

            cell.InnerText.Should().Be("Item 012");
        }
Esempio n. 14
0
        private UITestControl GetColumnInfo(string header, string fullName)
        {
            //1 Get Header Table
            HtmlCell headerTable = new HtmlCell(GetStudentsTable);

            headerTable.SearchProperties.Add(HtmlCell.PropertyNames.TagName, "TH");
            headerTable.SearchProperties.Add(HtmlCell.PropertyNames.InnerText, header, PropertyExpressionOperator.Contains);

            //2 Get Column Index Position
            int headerIndex = headerTable.ColumnIndex;

            //3 Get Row
            HtmlRow row = GetRow(fullName);

            //4 Match info
            return(row.Cells[headerIndex]);
        }
Esempio n. 15
0
        public void UITestControlNotFoundExceptionTest_BasicCheck()
        {
            HtmlRow row = new HtmlRow(BasicTestPage);

            row.SearchProperties.Add(HtmlRow.PropertyNames.Id, "invalidId");
            row.SearchProperties.Add(HtmlRow.PropertyNames.InnerText, "invalidInnerText");
            row.FilterProperties.Add(HtmlRow.PropertyNames.Class, "invalidClass", PropertyExpressionOperator.Contains);
            row.Exists.Should().BeFalse();

            string expectedMessage =
                "Unable to find ui control control matching search criteria:\r\n" +
                "\tSearchProperties: tagname.EqualTo(tr) and id.EqualTo(invalidId) and innertext.EqualTo(invalidInnerText)" +
                "\tFilterProperties: class.Contains(invalidClass)";

            Action action = () => row.InnerText.ToString();

            action.ShouldThrow <UITestControlNotFoundException>()
            .WithMessage(expectedMessage);
        }
Esempio n. 16
0
		public virtual RowBase CreateRow(string alternateRowCss=null){
			HtmlRow row = new HtmlRow();
			ApplyStyleToRow (row, alternateRowCss);
			RowsCount++;
			return row;
		}