public void viewPaymentTerminalGroup() { IWebDriver driver = new ChromeDriver(); LoginPage loginP = new LoginPage(driver); HomePage home = new HomePage(driver); JSONReader JSRead = new JSONReader(); globals.expRpt.createTest("Payment Terminals Groups"); globals.expRpt.logReportStatement(AventStack.ExtentReports.Status.Pass, "Payment Terminals Groups"); globals.expRpt.flushReport(); EditCompanyPage editCompany = new EditCompanyPage(driver); CommonFunctions comFunc = new CommonFunctions(driver); // ViewPaymentTerminalGroupPage paymentterminalgroup = new ViewPaymentTerminalGroupPage(driver); ViewPaymentTerminalGroupPage paymentterminalgroup = new ViewPaymentTerminalGroupPage(driver); string fullpath = comFunc.getDatasourcePath(); using (StreamReader file = File.OpenText(fullpath)) using (JsonTextReader reader = new JsonTextReader(file)) { JObject data = (JObject)JToken.ReadFrom(reader); comFunc.loginToApplication(); // compare the loaded screen with the expected screen Assert.AreEqual("Company List", home.getText()); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30000); // search for the company.. update to "Company_Name" later paymentterminalgroup.enterCompanyName(data["setupCompany_Name2"].ToString()); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30000); editCompany.clickGo(); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30000); paymentterminalgroup.clickVisittoEdit(); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30000); Assert.AreEqual("QUESTAutoComp01", paymentterminalgroup.getcompanyDetailstoview()); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30000); paymentterminalgroup.clickPaymentTerminalsDropdown(); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30000); paymentterminalgroup.clickPaymentTerminalGroups(); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30000); // compare the loaded screen with the expected screen Assert.AreEqual("Payment Terminal Groups", paymentterminalgroup.getPaymentTerminalGroupText()); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30000); // click the view button // paymentterminalgroup.clickPaymentTerminalGroups(); } driver.Close(); driver.Quit(); }
public void editCompany() { IWebDriver driver = new ChromeDriver(); HomePage home = new HomePage(driver); globals.expRpt.createTest("Edit company test"); globals.expRpt.logReportStatement(AventStack.ExtentReports.Status.Pass, "The Company updated sucessfully"); globals.expRpt.flushReport(); EditCompanyPage editCompany = new EditCompanyPage(driver); CommonFunctions comFunc = new CommonFunctions(driver); string fullpath = comFunc.getDatasourcePath(); using (StreamReader file = File.OpenText(fullpath)) using (JsonTextReader reader = new JsonTextReader(file)) { JObject data = (JObject)JToken.ReadFrom(reader); comFunc.loginToApplication(); Assert.AreEqual("Company List", home.getText()); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30000); // search for the company.. update "Company_Name" later editCompany.enterCompanyName(data["searchtoEditCompany_Name"].ToString()); editCompany.clickGo(); //searchCompany.enterCompanyName(data["searchtoEditCompany_Name"].ToString()); //editCompany.clickGo(); editCompany.setrowCount(data["Row_Count"].ToString()); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(300); //click edit editCompany.clickEdit(); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(300); //compare the loaded screen with the expected screen Assert.AreEqual("Edit a company", editCompany.geteditcompanyBanner()); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(300); //enter comapny details globals.expRpt.logReportStatement(AventStack.ExtentReports.Status.Info, "Update the Company name"); editCompany.setCompanyName(data["editCompany_Name"].ToString()); globals.expRpt.logReportStatement(AventStack.ExtentReports.Status.Info, "Update the Company type"); editCompany.setCompanyName(data["editCustomer_Type"].ToString()); globals.expRpt.logReportStatement(AventStack.ExtentReports.Status.Info, "Save Company details"); //editCompany.clickcontactSurcharging(); editCompany.clickSave(); //Assert.AreEqual("No data available!", editCompany.getnoCompany()); if (home.getText().Equals("Company List")) { globals.expRpt.logReportStatement(AventStack.ExtentReports.Status.Pass, "Company details updated sucessfully"); } else { globals.expRpt.logReportStatement(AventStack.ExtentReports.Status.Fail, "Company is not in the system to edit"); } } driver.Close(); driver.Quit(); }
public void createPaymentTerminalGroup() { IWebDriver driver = new ChromeDriver(); HomePage home = new HomePage(driver); globals.expRpt.createTest("Create Payment Terminals Groups"); globals.expRpt.logReportStatement(AventStack.ExtentReports.Status.Pass, "Create Payment Terminals Groups"); globals.expRpt.flushReport(); EditCompanyPage editCompany = new EditCompanyPage(driver); CommonFunctions comFunc = new CommonFunctions(driver); ViewPaymentTerminalGroupPage paymentterminalgroup = new ViewPaymentTerminalGroupPage(driver); CreatePaymentTerminalGroupPage addPyamentTerminalGroup = new CreatePaymentTerminalGroupPage(driver); string fullpath = comFunc.getDatasourcePath(); using (StreamReader file = File.OpenText(fullpath)) using (JsonTextReader reader = new JsonTextReader(file)) { JObject data = (JObject)JToken.ReadFrom(reader); comFunc.loginToApplication(); // compare the loaded screen with the expected screen Assert.AreEqual("Company List", home.getText()); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30000); // search for the company.. update to "Company_Name" later paymentterminalgroup.enterCompanyName(data["setupCompany_Name2"].ToString()); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30000); editCompany.clickGo(); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30000); paymentterminalgroup.clickVisittoEdit(); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30000); Assert.AreEqual("QUESTAutoComp01", paymentterminalgroup.getcompanyDetailstoview()); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30000); paymentterminalgroup.clickPaymentTerminalsDropdown(); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30000); paymentterminalgroup.clickPaymentTerminalGroups(); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30000); // compare the loaded screen with the expected screen Assert.AreEqual("Payment Terminal Groups", paymentterminalgroup.getPaymentTerminalGroupText()); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30000); // click the add Payment terminal Group button addPyamentTerminalGroup.clickaddPyamentTerminalGroup(); // enter payment Terminal Group details globals.expRpt.logReportStatement(AventStack.ExtentReports.Status.Info, "Enter Comapny Details"); addPyamentTerminalGroup.setPaymentTerminalName(data["StoreName"].ToString()); addPyamentTerminalGroup.setdeliveryLine(data["pt_deliveryLine"].ToString()); addPyamentTerminalGroup.setSuburb(data["pt_postalSuburb"].ToString()); addPyamentTerminalGroup.setState(data["pt_state"].ToString()); addPyamentTerminalGroup.setpostalCode(data["pt_postalCode"].ToString()); addPyamentTerminalGroup.setCountry(data["pt_country"].ToString()); addPyamentTerminalGroup.setdeliveryAddresscheckbox(); addPyamentTerminalGroup.clickSavePaymentterminals(); } driver.Close(); driver.Quit(); driver.Dispose(); }