public ProductViewerWindow(SearchProductsPage caller, IProduct product) { InitializeComponent(); this.caller = caller; this.product = product; productTitleTextblock.Text = this.product.Name; productDesciptionTextblock.Text = this.product.Description; productStockCountTextblock.Text = this.product.UnitsInStock.ToString(); if (this.product.UnitsInStock > 1) { quantityToAdd.Maximum = (int)this.product.UnitsInStock; quantityToAdd.Minimum = 1; } else if (this.product.UnitsInStock == 1) { quantityToAdd.Minimum = quantityToAdd.Maximum = 1; } else { productStockCountTextblock.Text = "OUT OF STOCK"; quantityToAdd.Value = 0; quantityToAdd.IsEnabled = false; addQuantity.IsEnabled = false; tbQuantityInStock.Visibility = tbQuantityToAdd.Visibility = quantityToAdd.Visibility = addQuantity.Visibility = Visibility.Collapsed; } }
/// <summary> /// This method is designed to verify search result in search product page via Dashboard /// </summary> /// <param name="driver">Webdriver Object to drive the execution</param> public void verifyKeywordSearchResult(IWebDriver driver, String keyword) { SearchProductsPage searchProdPageElements = new SearchProductsPage(driver); try { if (generalLib.getStatusCode(driver.Url).Equals("OK") || generalLib.getStatusCode(driver.Url).Equals("Redirect")) { generalLib.clickOnWebElement(driver, new HomePage(driver).getKeywordSearchBtn()); if (generalLib.getStatusCode(driver.Url).Equals("OK") || generalLib.getStatusCode(driver.Url).Equals("Redirect")) { generalLib.normalWait(); Assert.Multiple(() => { Assert.AreEqual(searchProdPageElements.getSearchTextBox().GetAttribute ("value"), keyword, "Text in keyword textbox is not empty"); Assert.AreEqual(getProdCountInSupplierSection(driver), getTotalProductsForSearchResult(driver), "Total no of " + "product is not equal wih total product in supplier section "); }); } } } catch (Exception exp) { Console.WriteLine("`````Exception caught`````"); generalLib.takeScreenshot(driver, MethodBase.GetCurrentMethod().Name); //Take screenshot and the file saved in SreenShot folder generalLib.PrintAllLogs(driver); Console.WriteLine(exp.Message); } }
public App() { InitializeComponent(); NavigationPage navigationPage = new NavigationPage(); MainPage = navigationPage; SearchProductsPage root = new SearchProductsPage("diody"); navigationPage.PushAsync(root).Wait(); }
/// <summary> /// This method updates the quantity in searchProduct page and clicks on add to basket button /// </summary> /// <param name="driver">Webdriver Object to drive the execution</param> /// <param name="quantity"></param> public void updateQuantityInSearchProdctAndAddToBasket(IWebDriver driver, String quantity) { SearchProductsPage srchProdPageElements = new SearchProductsPage(driver); try { if (generalLib.getStatusCode(driver.Url).Equals("OK") || generalLib.getStatusCode(driver.Url).Equals("Redirect")) { generalLib.waitForPageLoad(driver); generalLib.enterDataInTextBox(driver, srchProdPageElements .getSearchPageQuantityTextBox(), quantity); generalLib.clickOnWebElement(driver, srchProdPageElements.getSearchPageAddToBasketBtn()); generalLib.waitForPageLoad(driver); } } catch (Exception exp) { Console.WriteLine("`````Exception caught`````"); generalLib.takeScreenshot(driver, MethodBase.GetCurrentMethod().Name); //Take screenshot and the file saved in SreenShot folder generalLib.PrintAllLogs(driver); Console.WriteLine(exp); } }