Beispiel #1
0
 public void GoToHierarchyPage(Categories category, List<Categories> listOfNestedCategories)
 {
     var gridMainRowsCount = CategoryPage.Instance.GridPage.GridTable.BodyRows.Count - 1;
     HierachyCategoryPages.Instance.Navigate();
     HierachyCategoryPages.Instance.AssertNumberOfMainCategories(gridMainRowsCount);
     HierachyCategoryPages.Instance.AssertMainCategotyIsExpandable(category);
     HierachyCategoryPages.Instance.FindNestedCategories(category, listOfNestedCategories);
 }
        public static void AssertCategoryExist(this CategoryPage page, Categories category)
        {
            var numberOfRow = page.GridPage.FindRow("Категория", category.Name);
            var gridRow = page.GridPage.GridTable.Rows[numberOfRow - 1];

            Assert.AreEqual(gridRow.Cells[2].InnerText, category.Name);
            Assert.AreEqual(gridRow.Cells[3].InnerText, category.Order.ToString());
            category.Id = int.Parse(gridRow.Cells[1].InnerText);
        }
 internal static void AssertMainCategotyIsExpandable(this HierachyCategoryPages page, Categories category)
 {
     for (int i = 0; i < page.ListWithCategories.ChildNodes.Count; i++)
     {
         if (page.ListWithCategories.ChildNodes[i].InnerText == category.Name)
         {
             Assert.IsTrue(page.ListWithCategories.ChildNodes[i].ChildNodes[0].Children.Count == 2);
         }
     }
 }
Beispiel #4
0
 public void AddNestedCategory(Categories category, List<Categories> listOfNestedCategories)
 {
     CategoryPage.Instance.OpenNestedCategories(category);
     foreach (var nestedCategory in listOfNestedCategories)
     {
         CategoryPage.Instance.OpenNestedAddForm();
         CategoryFormPage.Instance.FillForm(nestedCategory);
         CategoryFormPage.Instance.UpdateForm();
     }
 }
 public static void AssertCategoryDoesntExist(this CategoryPage page, Categories category)
 {
     var all = page.GridPage.GridTable;
     foreach (var row in all.BodyRows)
     {
         foreach (var value in row.Cells)
         {
             Assert.IsFalse(value.InnerText.Contains(category.Name), "Category exist");
         }
     }
 }
Beispiel #6
0
        public void AddCategory(Categories category)
        {
            CategoryPage.Instance.Navigate();
            if (CategoryPage.Instance.CheckCategoryExist(category))
            {
                CategoryPage.Instance.DeleteCategory(category);
            }

            CategoryPage.Instance.OpenAddForm();
            CategoryFormPage.Instance.FillForm(category);
            CategoryFormPage.Instance.UpdateForm();
        }
        public static void AssertNameErrorMessage(this CategoryFormPage page, Categories category)
        {
            Assert.IsTrue(page.NameErrorMessage.IsEnabled);

            if (category.Name.Length >= 50)
            {
                Assert.AreEqual(page.NameErrorMessage.InnerText, CategoryForm.LongNameErrorMessage, string.Format("Invalid error message for long string in name"));
            }
            else if (category.Name.Length == 0)
            {
                Assert.AreEqual(page.NameErrorMessage.InnerText, CategoryForm.EmptyNameErrorMessage, string.Format("Invalid error message for empty string in name"));
            }
            else
            {
                Assert.AreEqual(page.NameErrorMessage.InnerText, CategoryForm.NameWithoutWords, string.Format("Invalid error message for no words string in name"));
            }
        }
        public static void AssertOrderErrorMessage(this InstanceFormPage page, Categories category)
        {
            Assert.IsTrue(page.OrderErrorMessage.IsEnabled);

            if (category.Order.Length > 10)
            {
                Assert.AreEqual(page.OrderErrorMessage.InnerText, CategoryForm.BigNumberErrorMessage, string.Format("Invalid error message for long string in name"));
            }
            else if (category.Order.Contains("."))
            {
                Assert.AreEqual(page.OrderErrorMessage.InnerText, CategoryForm.FloatNumberErrorMessage, string.Format("Invalid error message for no words string in name"));
            }
            else
            {
                Assert.AreEqual(page.OrderErrorMessage.InnerText, CategoryForm.EmptyOrderErrorMessage, string.Format("Invalid error message for empty string in name"));
            }
        }
Beispiel #9
0
 public void EditCategory(Categories category, Categories editCategory)
 {
     CategoryPage.Instance.OpenEditForm(category);
     CategoryFormPage.Instance.FillForm(editCategory);
     CategoryFormPage.Instance.UpdateForm();
 }
Beispiel #10
0
 public void AssertOrderErrorMessage(Categories category)
 {
     CategoryFormPage.Instance.AssertOrderErrorMessage(category);
 }
Beispiel #11
0
 public void AssertCategoryHierachy(Categories category, List<Categories> listOfNestedCategories)
 {
     var listFromSite = HierachyCategoryPages.Instance.NestedListWithCategories;
     HierachyCategoryPages.Instance.AssertNestedCategoriesAreOrderedRight(listOfNestedCategories);
 }
Beispiel #12
0
 public void AssertCategoryExist(Categories category)
 {
     CategoryPage.Instance.AssertCategoryExist(category);
 }