public void Registertest() { IWebDriver driver = new ChromeDriver(); driver.Url = ConfigurationManager.AppSettings["URL"]; //Passing the url to the driver Login_Page loginpage = new Login_Page(driver); //Creating the instance of login page Logout_Page logout_Page = new Logout_Page(driver); //creating the instance of logout page Register_Page register_Page = new Register_Page(driver); var credentials = db.Execute_query(login_Query); //Getting the result of query into variable foreach (KeyValuePair <String, String> entry in credentials) { loginpage.LoginToApplication(entry.Key, entry.Value); } var register_data = db.Execute_register_query(register_Query); register_Page.add_credentials(register_data["Name"], register_data["Gender"], register_data["DOB"], register_data["Addr"], register_data["City"], register_data["State"], register_data["Pinno"], register_data["Telephoneno"], register_data["EmailID"], register_data["Password"]); int cust_id = register_Page.get_id(); string insert_Query = "insert into add_newaccount(cust_id, initial_deposit) " + "Values('" + cust_id + "', '" + 10000 + "')"; db.Execute_insert_query(insert_Query); register_Page.click_continue_link(); logout_Page.LogoutFromApplication(); driver.Close(); }
public void LoginTest() { IWebDriver driver = new ChromeDriver(); driver.Url = ConfigurationManager.AppSettings["URL"]; //Passing the url to the driver Login_Page loginpage = new Login_Page(driver); //Creating the instance of login page Logout_Page logout_Page = new Logout_Page(driver); //creating the instance of logout page var credentials = db.Execute_query(Query); //Getting the result of query into variable foreach (KeyValuePair <String, String> entry in credentials) { loginpage.LoginToApplication(entry.Key, entry.Value); IAlert alert = loginpage.alertHandle(); if (alert == null) { logout_Page.LogoutFromApplication(); loginpage.refresh(); } // loginpage.refresh(); }//end forEach driver.Close(); } //end TestMethod
public void Deletetest() { IWebDriver driver = new ChromeDriver(); driver.Url = ConfigurationManager.AppSettings["URL"]; //Passing the url to the driver driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); Login_Page loginpage = new Login_Page(driver); //Creating the instance of login page Logout_Page logout_Page = new Logout_Page(driver); //creating the instance of logout page Delete_Page delete_Page = new Delete_Page(driver); var credentials = db.Execute_query(login_Query); //Getting the result of query into variable foreach (KeyValuePair <String, String> entry in credentials) { loginpage.LoginToApplication(entry.Key, entry.Value); } delete_Page.click_Deletecustomer_Link(); var result = db.Execute_delete_query(select_Query); delete_Page.enter_CustomerID(result[0]); String delete_Query = "delete from add_newaccount where cust_id = " + Int32.Parse(result[0]); String result1 = db.Execute_delete_query(delete_Query).ToString(); delete_Page.click_Submit(); delete_Page.handleAlert(); logout_Page.LogoutFromApplication(); driver.Close(); }