public void Start() { ChromeOptions options = new ChromeOptions(); options.SetLoggingPreference(LogType.Browser, LogLevel.All); driver = new ChromeDriver(options); navigator = new Navigator(driver); adminPage = navigator.ToAdminPage(); catalogPage = navigator.ToAdminCatalogPage(adminPage); }
public void VerifyAddNewProduct() { string Tail = StringHelper.GetRandomString(4); Product newDuckInfo = new Product() { Name = "Donut Duck " + Tail, Status = true, Code = StringHelper.GetRandomNumberString(5), Category = new List <string>() { "Rubber Ducks" }, ProductGroup = new List <string>() { "Unisex" }, Quantity = "8", Image = "donut.jpg", DateFrom = DateHelper.DaysBeforeToday(2), DateTo = DateHelper.DaysAfterToday(2), Manufacter = "ACME Corp.", Keywords = Tail, ShortDescription = Tail, Description = $"test {Tail}", HeadTitle = Tail, MetaDescription = Tail, PurchasePrice = "15", Currency = "US Dollars", PriceUSD = "17", PriceEUR = "19" }; var Login = GoToLoginAdminPage(driver); var Home = Login.CorrectLogin("admin", "admin"); Home.SelectMenuItemByText("Catalog"); var Catalog = new AdminCatalogPage(driver); Catalog.AddNewProduct(newDuckInfo); var isNewProductAppearInAdmin = Catalog.AreElementsPresent(By.XPath($"//a[.='{newDuckInfo.Name}']")); var Shop = GoToShopPage(driver); var isNewProductAppearInShop = Shop.AreElementsPresent(By.XPath($"//*[@id='box-most-popular']//li//div[.='{newDuckInfo.Name}']")); var isNewProductFirstInLatestList = Shop.AreElementsPresent(By.XPath($"//*[@id='box-latest-products']//li[1]//div[.='{newDuckInfo.Name}']")); Assert.Multiple(() => { Assert.IsTrue(isNewProductAppearInAdmin, $"{newDuckInfo.Name} should be appeared in product list on Admin page"); Assert.IsTrue(isNewProductAppearInShop, $"{newDuckInfo.Name} should be appeared in product list on Shop page"); Assert.IsTrue(isNewProductFirstInLatestList, $"{newDuckInfo.Name} should be first in Latest list on Shop page"); }); }
public void VerifyLogsInChrome() { AdminLoginPage adminLoginPage = new AdminLoginPage(driver, wait); AdminCatalogPage adminCatalogPage = new AdminCatalogPage(driver, wait); AdminOrdersPage adminOrdersPage = new AdminOrdersPage(); adminLoginPage.Open(); adminLoginPage.Login("admin", "admin"); adminCatalogPage.Open(driver, wait); adminCatalogPage.OpenEachProduct(); adminOrdersPage.Open(driver, wait); adminOrdersPage.CreateNewOrder(driver, wait); }
public void BrowserLogs() { var productsInFirstCategory = catalogPage.GetAllProductslinkInCategory(1); for (int i = 0; i < productsInFirstCategory.Count; i++) { productsInFirstCategory[i].Сlick(); var logs = driver.Manage().Logs.GetLog("browser").ToArray(); PrintLogs(logs); Assert.IsEmpty(logs); catalogPage = navigator.ToAdminCatalogPage(adminPage); productsInFirstCategory = catalogPage.GetAllProductslinkInCategory(1); } }
public void AddProductInChrome() { AdminLoginPage adminLoginPage = new AdminLoginPage(driver, wait); AdminMyStorePage adminMyStorePage = new AdminMyStorePage(driver, wait); AdminCatalogPage adminCatalogPage = new AdminCatalogPage(driver, wait); AdminAddNewProductPage adminAddNewProductPage = new AdminAddNewProductPage(driver, wait); //general = new GeneralPage(); //general.GoToPage(driver, "http://localhost/litecart/admin", wait, "My Store"); adminLoginPage.Open(); adminLoginPage.Login("admin", "admin"); adminMyStorePage.GoToSection("Catalog"); adminCatalogPage.ClickAddNewProduct(); adminAddNewProductPage.CreateProduct("Test name", true, "test code1234", "Subcategory", "Subcategory", "Male", "12", "pcs", "3-5 days", "Temporary sold out", "D:\\Repository\\image.jpg", "01/01/2016", "02/02/2018", "ACME Corp.", "-- Select --", "test keyword1, test keyword2", "test short description", "test description line1\ntest description line2", "test head title", "test meta description", "13", "Euros", "-- Select --", "14.99", "15.88", "16.77", "17.66"); adminCatalogPage.VerifyProductExists("Test name"); }
public void VerifyBrowserLogs() { var Login = GoToLoginAdminPage(driver); var Home = Login.CorrectLogin("admin", "admin"); Home.SelectMenuItemByText("Catalog"); var Catalog = new AdminCatalogPage(driver); Catalog.SelectCategory("Rubber Ducks"); var ProductList = Catalog.GetProductList(); foreach (var product in ProductList) { var productPage = Catalog.SelectProduct(product); Console.WriteLine(product); foreach (LogEntry l in driver.Manage().Logs.GetLog("browser")) { Console.WriteLine(l); } productPage.driver.Navigate().Back(); Catalog = new AdminCatalogPage(driver); } }