public void TheDeliverySubmitTest(string supplier, string products) { navigation.Replenishment.Click(); navigation.Delivery.Click(); Thread.Sleep(2000); DeliveryPageModel delivery = new DeliveryPageModel(driver); for (int i = 0; ; i++) { if (i >= 60) Assert.Fail("timeout"); try { if (delivery.DeliveryFrame.Displayed) break; } catch (Exception) { } } driver.SwitchTo().Frame(delivery.DeliveryFrame); Thread.Sleep(1000); delivery.CreateDelivery.Click(); driver.SwitchTo().DefaultContent(); NewDeliveryPageModel newDelivery = new NewDeliveryPageModel(driver); for (int i = 0; ; i++) { if (i >= 60) Assert.Fail("timeout"); try { if (newDelivery.NewDeliveryFrame.Displayed) break; } catch (Exception) { } } driver.SwitchTo().Frame(newDelivery.NewDeliveryFrame); Random rand = new Random(); newDelivery.SupplierID.SendKeys(supplier); newDelivery.DispatchNumber.SendKeys(rand.Next(100000, 999999).ToString()); newDelivery.DeliveryDate.SendKeys(DateTime.Today.ToString("dd/MM/yyyy")); newDelivery.SaveDelivery.Click(); Thread.Sleep(1000); string[] productList = config[products].Split(','); foreach (string prod in productList) { newDelivery.QuickAddProductText.Clear(); newDelivery.QuickAddProductText.SendKeys(prod); newDelivery.QuickAddProductButton.Click(); Thread.Sleep(500); newDelivery.QuickAddProductQuantity.SendKeys(rand.Next(1, 11).ToString()); newDelivery.QuickAddProductQuantity.SendKeys(Keys.Enter); Thread.Sleep(1000); } newDelivery.SubmitDelivery.Click(); driver.SwitchTo().DefaultContent(); for (int i = 0; ; i++) { if (i >= 60) Assert.Fail("timeout"); try { if (delivery.DeliveryFrame.Displayed) break; } catch (Exception) { } } Logout(); }
public void TheDeliveryAdvancedSearchTest(string supplier, string products) { navigation.Replenishment.Click(); navigation.Delivery.Click(); Thread.Sleep(2000); DeliveryPageModel delivery = new DeliveryPageModel(driver); for (int i = 0; ; i++) { if (i >= 60) Assert.Fail("timeout"); try { if (delivery.DeliveryFrame.Displayed) break; } catch (Exception) { } } driver.SwitchTo().Frame(delivery.DeliveryFrame); Thread.Sleep(1000); delivery.CreateDelivery.Click(); driver.SwitchTo().DefaultContent(); NewDeliveryPageModel newDelivery = new NewDeliveryPageModel(driver); for (int i = 0; ; i++) { if (i >= 60) Assert.Fail("timeout"); try { if (newDelivery.NewDeliveryFrame.Displayed) break; } catch (Exception) { } } driver.SwitchTo().Frame(newDelivery.NewDeliveryFrame); Random rand = new Random(); newDelivery.SupplierID.SendKeys(supplier); newDelivery.DispatchNumber.SendKeys(rand.Next(100000, 999999).ToString()); newDelivery.DeliveryDate.SendKeys(DateTime.Today.ToString("dd/MM/yyyy")); newDelivery.SaveDelivery.Click(); Thread.Sleep(1000); string[] productList = config[products].Split(','); AdvancedSearchPageModel advancedSearch = new AdvancedSearchPageModel(driver); foreach (string prod in productList) { newDelivery.AdvancedSearch.Click(); for (int i = 0; ; i++) { if (i >= 60) Assert.Fail("timeout"); try { if (advancedSearch.AdvancedSearchFrame.Displayed) break; } catch (Exception) { } Thread.Sleep(1000); } driver.SwitchTo().Frame(advancedSearch.AdvancedSearchFrame); advancedSearch.ItemCode.SendKeys(prod); advancedSearch.SearchButton.Click(); for (int i = 0; ; i++) { if (i >= 60) Assert.Fail("timeout"); try { if (advancedSearch.SelectAll.Enabled) break; } catch (Exception) { } Thread.Sleep(1000); } advancedSearch.SelectAll.Click(); Thread.Sleep(500); driver.SwitchTo().DefaultContent(); driver.SwitchTo().Frame(newDelivery.NewDeliveryFrame); navigation.ConfirmPopup.Click(); driver.SwitchTo().Frame(advancedSearch.AdvancedSearchFrame); Thread.Sleep(500); shared.WaitForElementNotAppear(driver, driver.FindElement(By.ClassName("blockUI"))); advancedSearch.OKButton.Click(); driver.SwitchTo().DefaultContent(); driver.SwitchTo().Frame(newDelivery.NewDeliveryFrame); Thread.Sleep(500); } newDelivery.SubmitDelivery.Click(); driver.SwitchTo().DefaultContent(); for (int i = 0; ; i++) { if (i >= 60) Assert.Fail("timeout"); try { if (delivery.DeliveryFrame.Displayed) break; } catch (Exception) { } } Logout(); }