/// <summary> /// Run the code example. /// </summary> /// <param name="user">The DFP user object running the code example.</param> public override void Run(DfpUser user) { // Get the ProductService. ProductService productService = (ProductService) user.GetService(DfpService.v201511.ProductService); // Create a statement to get all products. StatementBuilder statementBuilder = new StatementBuilder() .OrderBy("id ASC") .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT); // Set default for page. ProductPage page = new ProductPage(); try { do { // Get products by statement. page = productService.getProductsByStatement(statementBuilder.ToStatement()); if (page.results != null && page.results.Length > 0) { int i = page.startIndex; foreach (Product product in page.results) { Console.WriteLine("{0}) Product with ID = '{1}' and name '{2}' was found.", i++, product.id, product.name); } } statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.GetOffset() < page.totalResultSetSize); Console.WriteLine("Number of results found: {0}", page.totalResultSetSize); } catch (Exception e) { Console.WriteLine("Failed to get all products. Exception says \"{0}\"", e.Message); } }
public void CheckTheTotalPriceOfTwoDifferentGoods() { Logger.Log.Info("CheckTheTotalPriceOfTwoDifferentGoods"); expectedProducts = new List <Product>(); expectedProducts.Add(ProductCreator.withManyColors_Black()); expectedProducts.Add(ProductCreator.withManyColors_ArchiveBeige()); string totalPrice = ""; ProductPage productPageCheckTheTotalPriceOfTwoDifferentGoods = new ProductPage(driver); try { productPageCheckTheTotalPriceOfTwoDifferentGoods.OpenPage(expectedProducts[0].URL) .AcceptCookies() .AddProductToBasket() .NavigateToBasket(); BasketPage basketPageCheckTheTotalPriceOfTwoDifferentGoods = productPageCheckTheTotalPriceOfTwoDifferentGoods.OpenPage(expectedProducts[1].URL) .AddProductToBasket() .NavigateToBasket(); products = basketPageCheckTheTotalPriceOfTwoDifferentGoods.GetProducts(); totalPrice = basketPageCheckTheTotalPriceOfTwoDifferentGoods.GetTotalPrice(); } catch (Exception ex) { Logger.ErrorHandler(driver, ex); } Assert.AreEqual(expectedProducts[0].name, products[0].name, "invalid name"); Assert.AreEqual(expectedProducts[0].color.ToLower(), products[0].color, "invalid color"); Assert.AreEqual(expectedProducts[0].size, products[0].size, "invalid size"); Assert.AreEqual(expectedProducts[0].item, products[0].item, "invalid item"); Assert.AreEqual(expectedProducts[0].personalisation, products[0].personalisation, "invalid personalisation"); Assert.AreEqual(expectedProducts[0].personalisationColor, products[0].personalisationColor, "invalid personalisation color"); Assert.AreEqual(expectedProducts[0].count, products[0].count, "invalid count"); Assert.AreEqual(expectedProducts[1].name, products[1].name, "invalid name"); Assert.AreEqual(expectedProducts[1].color.ToLower(), products[1].color, "invalid color"); Assert.AreEqual(expectedProducts[1].size, products[1].size, "invalid size"); Assert.AreEqual(expectedProducts[1].item, products[1].item, "invalid item"); Assert.AreEqual(expectedProducts[1].personalisation, products[1].personalisation, "invalid personalisation"); Assert.AreEqual(expectedProducts[1].personalisationColor, products[1].personalisationColor, "invalid personalisation color"); Assert.AreEqual(expectedProducts[1].count, products[1].count, "invalid count"); string productsTotalPrice = "£1,040"; Assert.AreEqual(productsTotalPrice, totalPrice, "invalid price"); }
private void produseToolStripMenuItem_Click(object sender, EventArgs e) { if (currentUser != null) { ProductPage.Show(); CommandPage.Hide(); LoginPage.Hide(); } else { LoginPage.Show(); ProductPage.Hide(); CommandPage.Hide(); } }
private static void enable(Guid sid) { if (sid != Guid.Empty) { try { Dictionary <string, object> obj = new Dictionary <string, object> (); obj ["t"] = DateTime.Now.Ticks; ProductPage.UpdateStatus(obj, true, true, false, res.ResourceManager.GetString("map_" + sid.ToString("N")), new List <string> (res.ResourceManager.GetString("pid_" + sid.ToString("N")).Split(new char [] { ',' }, StringSplitOptions.RemoveEmptyEntries)).ConvertAll <byte> (delegate(string s) { return(byte.Parse(s.Trim())); }).ToArray()); } catch (Exception ex) { writeColor(ex.Message, ConsoleColor.DarkGray); } } }
public void WhenIClickOnTheFirstResultOnceInTheDetailsPageCompareThisPriceVsTheAbove() { string expectedProductPrice = (string)ScenarioContext.Current["ProductPrice"]; ProductPage productPage = new ProductPage(); productPage.SelectFirstProduct(); ProductDetailsPage productDetailsPage = new ProductDetailsPage(); string actualProductPrice = productDetailsPage.GetProductDetailsPrice(); productDetailsPage.GetProductDetailsScreenShot(); Assert.AreEqual(expectedProductPrice, actualProductPrice, $"Expected: {expectedProductPrice} and Actual:{actualProductPrice} prices aren't equal."); }
private async void Product_OnClick(object sender, EventArgs e) { var view = (View)sender; var selectedProduct = (ProductModel)view.BindingContext; var productPage = new ProductPage() { BindingContext = new ProductViewModel() { ProductId = selectedProduct.Id } }; await Navigation.PushAsync(productPage); }
public string GetPropertyDisplayName(string name) { string resource = ProductPage.GetResource("Disp_" + name, new object[0]); RecordProperty propertyByName = this.Properties.GetPropertyByName(name); if (propertyByName != null) { return(this.GetPropertyDisplayName(propertyByName)); } if (!string.IsNullOrEmpty(resource)) { return(resource); } return(name); }
public void VerifyCurrencyPound() { ProductPage productPage = new ProductPage(browser); productPage.SearchForItem("iPhone"); productPage.productResultClick(); productPage.CurrencyClick(); productPage.PoundClick(); //Assert Price in Pounds var isMyPriceInPounds = productPage.txtPrice.Text.Contains("£"); //to find about characters Assert.IsTrue(isMyPriceInPounds); }
public void WriteInvalidReviewName() { ProductPage productPage = new ProductPage(browser); productPage.SearchForItem("iPhone"); productPage.productResultClick(); productPage.TabReviewClick(); productPage.WriteReview("Very good product. I recommend"); productPage.GiveRating(); productPage.clickReviewButton(); var reviewName = productPage.nameAlert.Text; Assert.AreEqual(reviewName, "Warning: Review Name must be between 3 and 25 characters!"); }
public App() { ChromeOptions options = new ChromeOptions(); options.AddArgument("start-maximized"); driver = new ChromeDriver(options); Context context = new Context(); context.SetDriver(driver); context.SetBaseUrl(baseUrl); homePage = new HomePage(context); cartPage = new CartPage(context); productPage = new ProductPage(context); }
public virtual string GetRecordVal(string prop, string val, string getProp) { DataSourceCache cache; CachedRecord record = null; if (DataSourceConsumer.dsCaches.TryGetValue(ProductPage.GuidLower(this.ContextID, false), out cache)) { record = cache.recordCache.Find(cachedRec => (cachedRec != null) && val.Equals(cachedRec[prop, string.Empty, this], StringComparison.InvariantCultureIgnoreCase)); } if (record != null) { return(record[getProp, string.Empty, this]); } return(string.Empty); }
public static string GetConfigLink(string tab) { foreach (SPWebApplication webApp in ProductPage.TryEach <SPWebApplication> (SPWebService.ContentService.WebApplications)) { if (!webApp.Properties.ContainsKey("Microsoft.Office.Server.SharedResourceProvider")) { foreach (SPSite site in webApp.Sites) { using (site) return(ProductPage.MergeUrlPaths(site.Url, "_layouts/" + SolutionNameCore + ".aspx?cfg=" + tab)); } } } return("http://localhost/_layouts/" + SolutionNameCore + ".aspx?cfg=" + tab); }
public void WriteInvalidReviewRaiting() { ProductPage productPage = new ProductPage(browser); productPage.SearchForItem("iPhone"); productPage.productResultClick(); productPage.TabReviewClick(); productPage.WriteName("AslamAshishRmabadKumar"); productPage.WriteReview("Very good product. I recommend"); productPage.clickReviewButton(); var reviewFail = productPage.failAlert.Text; Assert.AreEqual(reviewFail, "Warning: Please select a review rating!"); }
public ActionResult Index(int?pType, int?pPage) { ProductPage mProductPage = new ProductPage(); if (pType == null) { if (Session["OrderType"] != null) { pType = (int)Session["OrderType"]; } else { pType = 0; } } else { Session["OrderType"] = pType; } if (pPage == null) { if (Session["OrderPage"] != null) { pPage = (int)Session["OrderPage"]; } else { pPage = 1; } } else { Session["OrderPage"] = pPage; } #endregion /*Lay danh sach cac tin theo page*/ var mProductList = ProductsService.LayOrderTheoTrangAndType((int)pPage, 6, (int)pType); //lay danh sach cac kieu san pham if (mProductList.Count < 6) { mProductPage.IsEnd = true; } //Tao Html cho danh sach tin nay mProductPage.Html = V308HTMLHELPER.TaoDanhSachHoaDon(mProductList, (int)pPage); mProductPage.Page = (int)pPage; mProductPage.TypeId = (int)pType; return(View("Index", mProductPage)); }
public void InputProduct(Product product, IWebDriver driver) { HomePage homePage = new HomePage(driver); mainPage = homePage.ClickLink("All Products"); productPage = mainPage.CreateProduct(); productPage.InputProductName(product.productName); productPage.InputSupplierId(product.supplierId); productPage.InputCategoryId(product.categoryId); productPage.InputUnitPrice((product.unitPrice).ToString()); productPage.InputQuantityPerUnit(product.quantityPerUnit); productPage.InputUnitsInStock(product.unitsInStock); productPage.InputUnitsOnOrder(product.unitsOnOrder); productPage.InputReorderLevel(product.reorderLevel); productPage.submit(); }
public void TestingModule1() //Make first step to buy any item(1.Summary) { SearchPage searchPage = mainPage.SearchLineInput(nameOfItem); ProductPage pageOfProduct = searchPage.ClickOnChoosedItem(chooseItemToBuy); pageOfProduct.EnterQuantityOfItem(quantityOfItems) .AddItemToCart(addItemToCart) .WaitingSubmenuOpens(addItemToCart, implicitWait) .CloseSubmenu(exitButton); OrderPage orderPage = pageOfProduct.OpenShoppingCart(shoppingCart); orderPage.WaitingOrderPageOpens(proceedCheckout, implicitWait) .ProceedToCheckOut(proceedCheckout); }
public CategoryEditWindow(DataRowView id, CategoryService categoryService, ProductPage mw) { InitializeComponent(); this.Top = SystemParameters.PrimaryScreenHeight / 2; this.Left = SystemParameters.PrimaryScreenWidth / 2; productId = (int)id[0]; lb_id_aso.Content = id[0]; lb_product_name.Text = id["produkt"].ToString(); lb_id_kat.Content = id["id_kategorii"]; lb_nazwa_kat.Content = id["kategoria"]; this.categoryService = categoryService; this.mw = mw; LoadCategories(); System.Diagnostics.PresentationTraceSources.DataBindingSource.Switch.Level = System.Diagnostics.SourceLevels.Critical; }
protected override void RenderWebPart(HtmlTextWriter output) { try { if (!ProductPage.isEnabled) { using (SPSite adminSite = ProductPage.GetAdminSite()) output.Write(FilterToolPart.FORMAT_INFO_CONTROL, ProductPage.GetResource("NotEnabled", ProductPage.MergeUrlPaths(adminSite.Url, "/_layouts/roxority_FilterZen/default.aspx?cfg=enable"), "FilterZen"), "servicenotinstalled.gif", "noid"); } else if (CanRun && (DesignMode || WebPartManager.DisplayMode.AllowPageDesign || Exed || !IsEd)) { output.Write("<div><b>{0}</b> = <i>{1}</i></div>", Context.Server.HtmlEncode(EffectiveCellFieldName), Context.Server.HtmlEncode(ProductPage.Trim(CellValue))); } base.RenderWebPart(output); } catch { } }
public static void Aliexpress_E2E_Stock() { LandingPage landing = new LandingPage(driver); landing.ClosePopUpIfShown(); landing.SearchItem("iphone"); landing.ClickSearchButton(); SearchPage search = new SearchPage(driver); search.NavigateToSecondPage(); search.ClickProduct(); ProductPage product = new ProductPage(driver); BrowserUtilities.SwitchToNewestTab(driver); product.ValidateStock(); }
public void AddProductToCartFormCompletionRequired() { ProductPage productPage = new ProductPage(browser); productPage.OpenAppleMonitor(); productPage.FillForm(); productPage.ClickAddToCart(); var msgAlertRadioRequired = productPage.AlertRadioRequired.Text; Assert.AreEqual(msgAlertRadioRequired, "Radio required!"); var msgFileRequired = productPage.AlertFileRequired.Text; Assert.AreEqual(msgFileRequired, "File required!"); }
public void WriteInvalidReviewcharacters() { ProductPage productPage = new ProductPage(browser); productPage.SearchForItem("iPhone"); productPage.productResultClick(); productPage.TabReviewClick(); productPage.WriteName("AslamAshishRmabadKumar"); productPage.WriteReview("Very good."); productPage.GiveRating(); productPage.clickReviewButton(); var reviewCharacters = productPage.charactersAlert.Text; Assert.AreEqual(reviewCharacters, "Warning: Review Text must be between 25 and 1000 characters!"); }
public void ViewProduct() { Login_page login = new Login_page(driver); Home_page home = login.ExecuteLogin(); All_products_page allproducts = home.ExecuteAllProducts(); ProductPage page = allproducts.ViewSelected(); Assert.AreEqual("Chocolate cupcake with cherry", driver.FindElement(By.XPath("//input[@id='ProductName']")).GetAttribute("value")); Assert.IsTrue(driver.FindElement(By.XPath("//select[@id='CategoryId']")).Text.Contains("Confections")); Assert.IsTrue(driver.FindElement(By.XPath("//select[@id='SupplierId']")).Text.Contains("Pavlova, Ltd.")); Assert.AreEqual("15,0000", driver.FindElement(By.XPath("//input[@id='UnitPrice']")).GetAttribute("value")); Assert.AreEqual("10 - 150 g boxes", driver.FindElement(By.XPath("//input[@id='QuantityPerUnit']")).GetAttribute("value")); Assert.AreEqual("20", driver.FindElement(By.XPath("//input[@id='UnitsInStock']")).GetAttribute("value")); Assert.AreEqual("0", driver.FindElement(By.XPath("//input[@id='UnitsOnOrder']")).GetAttribute("value")); Assert.AreEqual("5", driver.FindElement(By.XPath("//input[@id='ReorderLevel']")).GetAttribute("value")); }
public void WriteValidReview() { ProductPage productPage = new ProductPage(browser); productPage.SearchForItem("iPhone"); productPage.productResultClick(); productPage.TabReviewClick(); productPage.WriteName("AslamAshishRmabadKumar"); productPage.WriteReview("Very good product. I recommend"); productPage.GiveRating(); productPage.clickReviewButton(); var reviewSuccessfully = productPage.successAlert.Text; Assert.AreEqual(reviewSuccessfully, "Thank you for your review. It has been submitted to the webmaster for approval."); }
public void VerifyCurrencyEuro() { ProductPage productPage = new ProductPage(browser); productPage.SearchForItem("iPhone"); productPage.productResultClick(); productPage.CurrencyClick(); productPage.EuroClick(); //Assert Price in Euro var isMyPriceInEuro = productPage.txtPrice.Text.Contains("€"); //to find about characters Assert.IsTrue(isMyPriceInEuro); }
public ProductPage GetProduct(int id) { var product = DbContext.Products.FirstOrDefault(x => x.ProductId == id); ProductPage productPage = new ProductPage { ProductId = product.ProductId, TypeId = product.TypeId, Cost = product.CostProduct, Count = product.CountInStock, Description = product.Description, Title = product.Title }; var images = (from i in DbContext.ImagesProd join i_p in DbContext.ImageProduct on i.ImageOfProductId equals i_p.ImageOfProductId where i_p.ProductId == id select i).ToList(); productPage.Images = new List <ImageOfProduct>(); productPage.Images.AddRange(images); return(productPage); }
protected override void RenderToolPart(HtmlTextWriter output) { if (!ProductPage.isEnabled) { using (SPSite site = ProductPage.GetAdminSite()) { output.Write("<div class=\"rox-error\">" + ProductPage.GetResource("NotEnabled", new object[] { ProductPage.MergeUrlPaths(site.Url, string.Concat(new object[] { "/_layouts/", ProductPage.AssemblyName, "/default.aspx?cfg=enable&r=", rnd.Next() })), ProductPage.GetTitle() }) + "</div>"); } } else { output.Write("<div class=\"rox-toolpart\">"); base.RenderToolPart(output); output.Write("</div>"); } }
//b. Adaugati in cos un produs ca si utilizator. -- fara sa fiu logat public void VerifyAddToCartAsGuest() { HomePage homePage = new HomePage(Driver); LoginPage loginPage = new LoginPage(Driver); ProductPage productPage = new ProductPage(Driver); //Arrange NavigateToUrl(SiteUrl); //Act homePage.VeziDetaliiProdus(); productPage.AdaugaInCos(); //Assert loginPage.VerifyElementContainsText(loginPage.AlertMessage, "Pentru a efectua aceasta actiune, va rugam sa va autentificati"); }
public void WHENLoadsThePageWithSearchedProduct(string p0) { //string expected_title = "Resultados da pesquisa"; string expected_title = "Search results"; //mudar linguagem do site acessado, erro ao comparar title String result_pageTitle = home_page.getPageTitle(); result_page.load_complete(); Assert.That(expected_title == result_pageTitle); name_product = result_page.getNameProduct(); result_page.chooseProduct(); product_page = new ProductPage(driver); }
public void SetupTest() { driver = new ChromeDriver(); verificationErrors = new StringBuilder(); driver.Manage().Window.Maximize(); driver.Manage().Timeouts().ImplicitWait = ImplicitWait; driver.Navigate().GoToUrl("http://automationpractice.com/index.php"); driver.Manage().Timeouts().ImplicitWait = ImplicitWait; Body mainPage = new Body(driver); ProductPage productPage = mainPage.ClickOnItem(); productPage.ClickOnAddToCardButton(); driver.Manage().Timeouts().ImplicitWait = ImplicitWait; productPage.ClickOnProceedToCheckout(); driver.Manage().Timeouts().ImplicitWait = ImplicitWait; }
/// <summary> /// Run the code example. /// </summary> /// <param name="user">The DFP user object running the code example.</param> public void Run(DfpUser user, long productTemplateId) { ProductService productService = (ProductService)user.GetService(DfpService.v201605.ProductService); // [START product_statement] MOE:strip_line // Create a statement to select products. StatementBuilder statementBuilder = new StatementBuilder() .Where("productTemplateId = :productTemplateId") .OrderBy("id ASC") .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT) .AddValue("productTemplateId", productTemplateId); // [END product_statement] MOE:strip_line // Retrieve a small amount of products at a time, paging through // until all products have been retrieved. ProductPage page = new ProductPage(); try { do { // [START get_some_products] MOE:strip_line page = productService.getProductsByStatement(statementBuilder.ToStatement()); // [END get_some_products] MOE:strip_line if (page.results != null) { // Print out some information for each product. int i = page.startIndex; foreach (Product product in page.results) { Console.WriteLine("{0}) Product with ID \"{1}\" and name \"{2}\" was found.", i++, product.id, product.name); } } statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.GetOffset() < page.totalResultSetSize); Console.WriteLine("Number of results found: {0}", page.totalResultSetSize); } catch (Exception e) { Console.WriteLine("Failed to get products. Exception says \"{0}\"", e.Message); } }
/// <summary> /// Run the code example. /// </summary> /// <param name="user">The DFP user object running the code example.</param> public void Run(DfpUser dfpUser, long productTemplateId) { ProductService productService = (ProductService)dfpUser.GetService(DfpService.v201702.ProductService); // [START product_statement] MOE:strip_line // Create a statement to select products. int pageSize = StatementBuilder.SUGGESTED_PAGE_LIMIT; StatementBuilder statementBuilder = new StatementBuilder() .Where("productTemplateId = :productTemplateId") .OrderBy("id ASC") .Limit(pageSize) .AddValue("productTemplateId", productTemplateId); // [END product_statement] MOE:strip_line // Retrieve a small amount of products at a time, paging through until all // products have been retrieved. int totalResultSetSize = 0; do { // [START get_some_products] MOE:strip_line ProductPage page = productService.getProductsByStatement( statementBuilder.ToStatement()); // [END get_some_products] MOE:strip_line // Print out some information for each product. if (page.results != null) { totalResultSetSize = page.totalResultSetSize; int i = page.startIndex; foreach (Product product in page.results) { Console.WriteLine( "{0}) Product with ID {1} and name \"{2}\" was found.", i++, product.id, product.name ); } } statementBuilder.IncreaseOffsetBy(pageSize); } while (statementBuilder.GetOffset() < totalResultSetSize); Console.WriteLine("Number of results found: {0}", totalResultSetSize); }
/// <summary> /// Run the code example. /// </summary> /// <param name="user">The DFP user object running the code example.</param> public override void Run(DfpUser user) { // Get the ProductService. ProductService productService = (ProductService) user.GetService(DfpService.v201508.ProductService); // Set the ID of the product template to filter products by. long productTemplateId = long.Parse(_T("INSERT_PRODUCT_TEMPLATE_ID_HERE")); // Create a statement to only select products that were created from a specific // product template. StatementBuilder statementBuilder = new StatementBuilder() .Where("WHERE productTemplateId = :productTemplateId") .OrderBy("name ASC") .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT) .AddValue("productTemplateId", productTemplateId); // Set default for page. ProductPage page = new ProductPage(); try { do { // Get products by statement. page = productService.getProductsByStatement(statementBuilder.ToStatement()); if (page.results != null && page.results.Length > 0) { int i = page.startIndex; foreach (Product product in page.results) { Console.WriteLine("{0}) Product with ID = '{1}' and name '{2}' was found.", i++, product.id, product.name); } } statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while(statementBuilder.GetOffset() < page.totalResultSetSize); Console.WriteLine("Number of results found: {0}", page.totalResultSetSize); } catch (Exception e) { Console.WriteLine("Failed to get products. Exception says \"{0}\"", e.Message); } }