public void Create_NSX_With_OK_Status(String Name, String Origin) { String Code = (new Random().Next(1, 99999999)).ToString(); Login(); driver.Navigate().GoToUrl(homeURL + "/app/admin/nsx-add"); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(7); WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(60)); wait.Until(e => e.FindElement(By.Id("nsx_code"))); Thread.Sleep(8000); //Act; driver.FindElement(By.Id("nsx_code")).SendKeys(Code); driver.FindElement(By.Id("nsx_name")).SendKeys(Name); driver.FindElement(By.Id("nsx_from")).SendKeys(Origin); driver.FindElement(By.XPath("/html/body/app-root/ng-component/div/div/div[2]/ng-component/div/div[1]/ul/li[1]")).Click(); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30); //Check with value of DB //CM_NSX_DTO input = new CM_NSX_DTO(Code, Name, Origin); CM_NSX_DTO finalRow = DataProvider.Instance.GetData <CM_NSX_DTO>("NhaSanXuat_Search", new { NSX_CODE = Code, RECORD_STATUS = 1 }).ToList().FirstOrDefault(); //Assert Assert.AreEqual(Code, finalRow.NSX_CODE); Assert.AreEqual(Name, finalRow.NSX_NAME); Assert.AreEqual(Origin, finalRow.NSX_FROM); driver.Close(); }
public void Update_NSX_With_OK_Status() { String Name = "SYM " + new Random().Next().ToString(); Login(); driver.Navigate().GoToUrl(homeURL + "/app/admin/nsx-list"); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(15); Thread.Sleep(8000); //Act IWebElement ele = driver.FindElement(By.XPath("/html/body/app-root/ng-component/div/div/div[2]/ng-component/div[2]/div[2]/div/div/div/div/p-table/div/div/div/div[2]/table/tbody/tr[1]")); IJavaScriptExecutor executor = (IJavaScriptExecutor)driver; executor.ExecuteScript("arguments[0].click();", ele); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(7); IWebElement ele1 = driver.FindElement(By.XPath("/html/body/app-root/ng-component/div/div/div[2]/ng-component/div[1]/ul/li[3]")); IJavaScriptExecutor executor1 = (IJavaScriptExecutor)driver; executor1.ExecuteScript("arguments[0].click();", ele1); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(7); WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(60)); wait.Until(e => e.FindElement(By.Id("nsx_name")).GetAttribute("value") != ""); IWebElement eleEdit = driver.FindElement(By.XPath("/html/body/app-root/ng-component/div/div/div[2]/ng-component/div/div[1]/ul/li[1]")); IJavaScriptExecutor executorEdit = (IJavaScriptExecutor)driver; executorEdit.ExecuteScript("arguments[0].click();", eleEdit); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30); //Act; driver.FindElement(By.Id("nsx_name")).SendKeys(Keys.Control + "a"); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(7); driver.FindElement(By.Id("nsx_name")).SendKeys("\u0008"); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(7); wait.Until(e => e.FindElement(By.Id("nsx_name")).GetAttribute("value") == ""); driver.FindElement(By.Id("nsx_name")).SendKeys(Name); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(7); //wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(By.Id("btnSaveNTX"))); IWebElement eleUpdate = driver.FindElement(By.XPath("/html/body/app-root/ng-component/div/div/div[2]/ng-component/div/div[1]/ul/li[1]")); IJavaScriptExecutor executorUpdate = (IJavaScriptExecutor)driver; executorUpdate.ExecuteScript("arguments[0].click();", eleUpdate); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30); String Code = driver.FindElement(By.Id("nsx_code")).GetAttribute("value"); //Check with value of DB CM_NSX_DTO finalRow = DataProvider.Instance.GetData <CM_NSX_DTO>("NhaSanXuat_Search", new { NSX_CODE = Code, RECORD_STATUS = 1 }).ToList().FirstOrDefault(); //Assert Assert.AreEqual(Name, finalRow.NSX_NAME); driver.Close(); }
public void Cancel_Delete_NSX() { Login(); driver.Navigate().GoToUrl(homeURL + "/app/admin/nsx-list"); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(15); //Act Thread.Sleep(8000); //Act //IReadOnlyCollection<IWebElement> dataRow = driver.FindElements(By.Name("dataRow")); //driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(7); driver.Navigate().GoToUrl(homeURL + "/app/admin/nsx-list"); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(15); Thread.Sleep(8000); //Act IWebElement ele = driver.FindElement(By.XPath("/html/body/app-root/ng-component/div/div/div[2]/ng-component/div[2]/div[2]/div/div/div/div/p-table/div/div/div/div[2]/table/tbody/tr[1]")); IJavaScriptExecutor executor = (IJavaScriptExecutor)driver; executor.ExecuteScript("arguments[0].click();", ele); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(7); IWebElement ele1 = driver.FindElement(By.XPath("/html/body/app-root/ng-component/div/div/div[2]/ng-component/div[1]/ul/li[3]")); IJavaScriptExecutor executor1 = (IJavaScriptExecutor)driver; executor1.ExecuteScript("arguments[0].click();", ele1); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(7); WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(60)); wait.Until(e => e.FindElement(By.Id("nsx_name")).GetAttribute("value") != ""); IWebElement eleDel = driver.FindElement(By.XPath("/html/body/app-root/ng-component/div/div/div[2]/ng-component/div/div[1]/ul/li[2]")); IJavaScriptExecutor executorDel = (IJavaScriptExecutor)driver; executorDel.ExecuteScript("arguments[0].click();", eleDel); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(7); IWebElement eleYes = driver.FindElement(By.XPath("/html/body/div/div/div[4]/div[1]/button")); IJavaScriptExecutor executorYes = (IJavaScriptExecutor)driver; executorYes.ExecuteScript("arguments[0].click();", eleYes); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30); String Code = driver.FindElement(By.Id("nsx_code")).GetAttribute("value"); //Check with value of DB CM_NSX_DTO finalRow = DataProvider.Instance.GetData <CM_NSX_DTO>("NhaSanXuat_Search", new { NSX_CODE = Code, RECORD_STATUS = 1 }).ToList().FirstOrDefault(); //Assert Assert.AreEqual("1", finalRow.RECORD_STATUS); driver.Close(); }
public PagedResultDto <CM_NSX_DTO> CM_NSX_Search(CM_NSX_DTO filterInput) { if (filterInput.RECORD_STATUS == null) { filterInput.RECORD_STATUS = "1"; } var list = procedureHelper.GetData <CM_NSX_DTO>("NhaSanXuat_Search", filterInput).ToList(); var totalCount = list.Count(); return(new PagedResultDto <CM_NSX_DTO>( totalCount, list )); }
public IDictionary <string, object> CM_NSX_Update(CM_NSX_DTO input) { return(procedureHelper.GetData <dynamic>("NhaSanXuat_Update", input).FirstOrDefault()); }
public IDictionary <string, object> CM_NSX_Insert(CM_NSX_DTO input) { input.RECORD_STATUS = "1"; return(procedureHelper.GetData <dynamic>("NhaSanXuat_Insert", input).FirstOrDefault()); }
public PagedResultDto <CM_NSX_DTO> CM_NSX_Search([FromBody] CM_NSX_DTO filterInput) { return(NSXAppService.CM_NSX_Search(filterInput)); }
public IDictionary <string, object> CM_NSX_Update([FromBody] CM_NSX_DTO input) { return(NSXAppService.CM_NSX_Update(input)); }