Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        public void employee_can_edit_his_company_profile()
        {
            //Arrange
            var company = TestData.Company2;

            //Act
            EditCompanyPage.ModifyCompanyProfileWith(company);
            EditCompanyPage.GoTo();

            //Assert
            AreEqual(EditCompanyPage.FirstCompany, company);
        }
Exemplo n.º 3
0
        public void addCompany()
        {
            IWebDriver driver = new ChromeDriver();
            HomePage   home   = new HomePage(driver);

            globals.expRpt.createTest("Add Company Test");
            globals.expRpt.logReportStatement(AventStack.ExtentReports.Status.Pass, "The Company added Sucessfully");
            globals.expRpt.flushReport();


            AddCompanyPage  addCompany    = new AddCompanyPage(driver);
            EditCompanyPage editCompany   = new EditCompanyPage(driver);
            EditCompanyPage searchCompany = 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();



                    JArray companies = (JArray)data["companies"];
                    for (int i = 0; i < companies.Count; i++)
                    {
                        // compare the loaded screen with the expected screen
                        Assert.AreEqual("Company List", home.getText());

                        // hit add a company button
                        addCompany.clickAddCompany();

                        // compare the loaded screen with the expected screen
                        Assert.AreEqual("Company Information", addCompany.getcompanyInfor());
                        // enter comapny details

                        globals.expRpt.logReportStatement(AventStack.ExtentReports.Status.Pass, "Enter Comapny details");

                        addCompany.setCompanyName(companies[i]["Company_Name"].ToString());
                        addCompany.setCustomerType((string)companies[i]["Customer_Type"]);
                        addCompany.setadminUserName((string)companies[i]["Admin_Username"]);
                        //IF email is not there create the use ELSE check the validation "//li[contains(text(),'The email address [email protected] is already taken')]"
                        addCompany.setemailAddress(companies[i]["Email"].ToString());
                        addCompany.setPassword((string)companies[i]["passwordcreate"]);
                        addCompany.setconfirmPassword((string)companies[i]["passwordcreate"]);
                        addCompany.setcompanyType((string)companies[i]["companyType"]);
                        addCompany.setreportingFrequency((string)companies[i]["reportingFrequency"]);
                        addCompany.clickdonationTappoint();
                        addCompany.clickbankSetting();
                        addCompany.setpinpadFile((string)companies[i]["pinpadFile"]);

                        driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3000);
                        addCompany.clickCreate();

                        driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3000);

                        // compare the loaded screen with the expected screen
                        Assert.AreEqual("Company List", home.getText());
                        driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3000);


                        //// search for the created company
                        //searchCompany.enterCompanyName(companies[i]["Company_Name"].ToString());
                        //editCompany.clickGo();

                        //driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3000);

                        //Assert.AreEqual("Edit a company", editCompany.geteditcompanyBanner());

                        //if (editCompany.geteditcompanyBanner().Equals("Edit a company"))
                        //{
                        //    globals.expRpt.logReportStatement(AventStack.ExtentReports.Status.Pass, "The company created sucessfully");
                        //}
                        //else
                        //{
                        //    globals.expRpt.logReportStatement(AventStack.ExtentReports.Status.Fail, "The company is not in the system");
                        //}
                    }
                }

            driver.Close();
            driver.Quit();
            driver.Dispose();
        }
Exemplo n.º 4
0
        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();
        }
Exemplo n.º 5
0
 public void EditTestsInitialize()
 {
     LoginPage.GoTo();
     LoginPage.LoginAs(TestData.Employee1);
     EditCompanyPage.GoTo();
 }
Exemplo n.º 6
0
        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();
        }