Exemple #1
0
        internal void LoginSuccessfull()
        {
            // Populating the data from Excel
            ExcelLib.PopulateInCollection(Base.ExcelPath, "LoginPage");

            // Navigating to Login page using value from Excel
            Driver.driver.Navigate().GoToUrl(ExcelLib.ReadData(2, "Url"));

            // Sending the username
            Email.SendKeys(ExcelLib.ReadData(2, "Email"));

            // Sending the password
            PassWord.SendKeys(ExcelLib.ReadData(2, "Password"));

            // Clicking on the login button
            loginButton.Click();
        }
        public void rrdActive()
        {
            ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill");
            string             lActive = ExcelLib.ReadData(17, "InputValue");
            List <IWebElement> listrd  = new List <IWebElement>(rdActive.FindElements(By.TagName("input")));
            List <IWebElement> listtxt = new List <IWebElement>(rdActive.FindElements(By.TagName("label")));
            int i = 0;

            do
            {
                if (listtxt.ElementAt(i).Text.Equals(lActive))
                {
                    listrd.ElementAt(i).Click();
                }
                i = i + 1;
            } while (i < listtxt.Count());
        }
Exemple #3
0
        internal void Validation()
        {
            ExcelLib.PopulateInCollection(Base.ExcelPath, "Page");

            //check if user can navigate to page
            Driver.driver.Navigate().GoToUrl(ExcelLib.ReadData(2, "url"));
            string myrequest = Driver.GetTextValue(Driver.driver, ExcelLib.ReadData(9, "Locator"), ExcelLib.ReadData(9, "Value"));

            if (myrequest == "Contact US Form")
            {
                Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "User navigate to contact detail");
            }
            //click on Submit button
            Driver.ActionButton(Driver.driver, ExcelLib.ReadData(8, "Locator"), ExcelLib.ReadData(8, "Value"));
            Thread.Sleep(1000);
            //check if user can see validation msg for Firstname
            string Firstname = Driver.GetTextValue(Driver.driver, ExcelLib.ReadData(10, "Locator"), ExcelLib.ReadData(10, "Value"));

            if (Firstname == "Please Fill This Field")
            {
                Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "user can see validation msg for Firstname");
            }
            //check if user can see validation msg for Lastname
            string Lastname = Driver.GetTextValue(Driver.driver, ExcelLib.ReadData(11, "Locator"), ExcelLib.ReadData(11, "Value"));

            if (Lastname == "Please Fill This Field")
            {
                Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "user can see validation msg for Lastname");
            }

            //check if user can see validation msg for Email
            string Email = Driver.GetTextValue(Driver.driver, ExcelLib.ReadData(12, "Locator"), ExcelLib.ReadData(12, "Value"));

            if (Email == "Please Fill This Field")
            {
                Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "user can see validation msg for Email");
            }
            // check if user can see validation msg for message
            string message = Driver.GetTextValue(Driver.driver, ExcelLib.ReadData(13, "Locator"), ExcelLib.ReadData(13, "Value"));

            if (message == "Please Fill This Field")
            {
                Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "user can see validation msg for Message");
            }
        }
Exemple #4
0
        public void DeleteAsset()
        {
            // search for record and delete asset
            IList <IWebElement> deleteasset = GlobalDefinition.driver.FindElements(By.XPath("/div[@class='medium-12 columns']//div/h5[text()='Assets']"));
            int Dasset = deleteasset.Count;

            for (int n = 1; n <= Dasset; n++)
            //for (int i = 1; i == 10; i++)
            {
                Base.test.Log(LogStatus.Info, "Entered the delete search loop");
                string roomname     = GlobalDefinition.GetTextValue(GlobalDefinition.driver, ExcelLib.ReadData(27, "Locator"), ExcelLib.ReadData(27, "Value"));
                string assetname    = GlobalDefinition.GetTextValue(GlobalDefinition.driver, ExcelLib.ReadData(28, "Locator"), ExcelLib.ReadData(28, "Value"));
                string selectedroom = GlobalDefinition.GetTextValue(GlobalDefinition.driver, ExcelLib.ReadData(25, "Locator"), ExcelLib.ReadData(25, "Value"));

                if (roomname == selectedroom && assetname == ExcelLib.ReadData(23, "Input"))
                {
                    //Click on delete button
                    GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(29, "Locator"), ExcelLib.ReadData(29, "Value"));
                    GlobalDefinition.driver.SwitchTo().Alert().Accept();
                }
                else
                {
                    Base.test.Log(LogStatus.Fail, "Delete search not found");
                }
            }

            //Check if the asset is deleted
            for (int i = 1; i == 10; i++)
            {
                Base.test.Log(LogStatus.Info, "Entered the delete search loop");
                string roomname     = GlobalDefinition.GetTextValue(GlobalDefinition.driver, ExcelLib.ReadData(27, "Locator"), ExcelLib.ReadData(27, "Value"));
                string assetname    = GlobalDefinition.GetTextValue(GlobalDefinition.driver, ExcelLib.ReadData(28, "Locator"), ExcelLib.ReadData(28, "Value"));
                string selectedroom = GlobalDefinition.GetTextValue(GlobalDefinition.driver, ExcelLib.ReadData(25, "Locator"), ExcelLib.ReadData(25, "Value"));

                if (roomname == selectedroom && assetname == ExcelLib.ReadData(23, "Input"))
                {
                    Base.test.Log(LogStatus.Pass, "Asset not deleted");
                    return;
                }
                else
                {
                    Base.test.Log(LogStatus.Fail, "Asset deleted successfully");
                }
            }
        }
        internal void Existing_pwd()
        {
            ExcelLib.PopulateInCollection(Base.ExcelPath, "ChangePassword");
            //Skip
            Driver.ActionButton(Driver.driver, ExcelLib.ReadData(8, "Locator"), ExcelLib.ReadData(8, "Value"));
            Thread.Sleep(1000);

            //Profile icon
            Driver.ActionButton(Driver.driver, ExcelLib.ReadData(2, "Locator"), ExcelLib.ReadData(2, "Value"));
            Thread.Sleep(1000);

            //Change password button
            Driver.ActionButton(Driver.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "Value"));
            Thread.Sleep(1000);

            //Current Password
            Driver.Textbox(Driver.driver, ExcelLib.ReadData(4, "Locator"), ExcelLib.ReadData(4, "Value"), ExcelLib.ReadData(3, "Current PWD"));
            Thread.Sleep(1000);

            //New Password
            Driver.Textbox(Driver.driver, ExcelLib.ReadData(5, "Locator"), ExcelLib.ReadData(5, "Value"), ExcelLib.ReadData(3, "New PWD"));
            Thread.Sleep(1000);

            //Confirm new Password
            Driver.Textbox(Driver.driver, ExcelLib.ReadData(6, "Locator"), ExcelLib.ReadData(6, "Value"), ExcelLib.ReadData(3, "Confirm new PWD"));
            Thread.Sleep(1000);

            //Change Password button
            Driver.ActionButton(Driver.driver, ExcelLib.ReadData(7, "Locator"), ExcelLib.ReadData(7, "Value"));
            Thread.Sleep(1000);
            try
            {
                IWebElement errortext = Driver.driver.FindElement(By.Id("NewPasswordTxt-error"));
                string      msg       = errortext.Text;
                Assert.AreEqual("* New Password must differ from old password.", msg);
                string screenShotPath = SaveScreenShotClass.SaveScreenshot(Driver.driver, "ScreenShotName");
                Base.test.Log(LogStatus.Pass, "Unable to change password as the new password and old password values are same, the test passed" + Base.test.AddScreenCapture(screenShotPath));
            }
            catch (Exception e)
            {
                string screenShotPath = SaveScreenShotClass.SaveScreenshot(Driver.driver, "ScreenShotName");
                Base.test.Log(LogStatus.Fail, "Existing Password test failed" + Base.test.AddScreenCapture(screenShotPath));
                Base.test.Log(LogStatus.Info, e.Message + "There is an issue,Please check");
            }
        }
Exemple #6
0
        public void SignInwithValidCredential()
        {
            SignIn loginobj = new SignIn();

            //Populate the excel data
            ExcelLib.PopulateInCollection(ExcelPath, "SignIn");
            loginobj.LoginSteps(ExcelLib.ReadData(2, "Username"), ExcelLib.ReadData(2, "Password"));

            //Verify if signout button is enabled
            IWebElement SignOut = Driver.FindElement(By.XPath("//button[text()='Sign Out']"));

            Assert.IsTrue(SignOut.Enabled, "SignOut button isn't enabled");
            //Verify if user is navigated to Profile Page
            string expectedTitle = "Profile";
            string actualTitle   = Driver.Title;

            Assert.AreEqual(expectedTitle, actualTitle, "SignIn Failed");
        }
Exemple #7
0
        //Edit an existing Advertised Jobs
        internal void EditAdvertisedJobs()
        {
            //To skip the highlighted option
            SkipButton?.Click();
            System.Threading.Thread.Sleep(5000);
            // Populating the data from Excel
            ExcelLib.PopulateInCollection(Base.ExcelPath, "AdvisedJobs");
            System.Threading.Thread.Sleep(3000);
            OwnersSelect.Click();
            System.Threading.Thread.Sleep(3000);
            AdvertisedJob.Click();
            System.Threading.Thread.Sleep(3000);

            EditForJob.Click();
            EditedMaximumBudget.Clear();
            EditedMaximumBudget.SendKeys(ExcelLib.ReadData(3, "EditedValue"));
            SaveEdit.Click();
        }
Exemple #8
0
        //Passed, ServiceDetails page not function well
        public void ViewListings()
        {
            //Populate the Excel Sheet
            ExcelLib.PopulateInCollection(ExcelPath, "ManageListings");
            string title = ExcelLib.ReadData(2, "Title");

            //Search the service in Listings and click view
            var manageListingsInstance = new ManageListings();

            manageListingsInstance.ClickManageListings();
            manageListingsInstance.ClickView(title);

            //Verify if user is able to click view and view the service details successfully
            string expectedTitle = "Service Detail";
            string actualTitle   = Driver.Title;

            Assert.That(actualTitle, Is.EqualTo(expectedTitle), "Open Service Detail page failed");
        }
Exemple #9
0
        public void AvailabiDesLnk()
        {
            // AvailDesicon.WaitForElementClickable(Global.Base.driver, 60).Click();

            ExcelLib.PopulateInCollection(MarsResources.ExcelPath, "Profile");
            Thread.Sleep(2000);
            AvailDesicon.Click();
            Thread.Sleep(1000);
            Descriptiontxt.SendKeys(Keys.Control + "a");
            Descriptiontxt.SendKeys(Keys.Delete);
            Descriptiontxt.SendKeys(ExcelLib.ReadData(2, "Description"));
            BtnDesSave.Click();
            Thread.Sleep(5000);
            Driver.SwitchTo().Window(Driver.WindowHandles.Last());
            // verify Description is save successfully
            Assert.AreEqual(Driver.FindElement(By.XPath("/html/body/div[1]/div")).Text, "Description has been saved successfully");
            Driver.SwitchTo().DefaultContent();
        }
        internal void SaveFinanceDetails(int TestDataSet)
        {
            try
            {
                //Enter the testdata into the relevant input fields
                PurchasePrice.SendKeys(ExcelLib.ReadData(TestDataSet, "PurchasePrice"));
                Mortgage.SendKeys(ExcelLib.ReadData(TestDataSet, "Mortgage"));
                HomeValue.SendKeys(ExcelLib.ReadData(TestDataSet, "HomeValue"));
                Thread.Sleep(1000);

                //Click on the Next Button to move to the Tenant Details
                NextButton.Click();
            }
            catch (Exception e)
            {
                Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Error, "Error occured when entering Finance Details for the new property: " + e.Message.ToString());
            }
        }
        // Add a new Skill
        internal void AddNewSkill()
        {
            //Click Add New button
            AddNewSkillButton.Click();

            //Enter the language and level
            Extension.WaitForElementDisplayed(Driver, By.XPath("//input[@placeholder='Add Skill']"), 2);
            AddSkill.SendKeys(ExcelLib.ReadData(2, "Skill"));
            SelectDropDown(ChooseSkillLevel, "SelectByText", ExcelLib.ReadData(2, "Level"));

            //Click Add button
            AddSkillButton.Click();

            Base.Image = SaveScreenShotClass.SaveScreenshot(Driver, "Report");

            //Validate message
            Extension.MessageValidation(ExcelLib.ReadData(2, "Skill") + " has been added to your skills");
        }
Exemple #12
0
        public void GivenIMAlreadyUnderTheSendRequestPageOfAGivenProperty()
        {
            ExcelLib.PopulateInCollection(Base.ExcelPath, "Send Request");
            String propertyName = ExcelLib.ReadData(2, "Property Name");

            //go to my properties page from dashboard
            DashboardPage dashBoard = new DashboardPage();

            dashBoard.GoToMyPropertiesPage();

            //search a property
            MyPropertiesPage myProperty = new MyPropertiesPage();

            myProperty.SearchAPropertySuccessfully(propertyName);

            // go to  send request page
            myProperty.SendRequest();
        }
Exemple #13
0
        public void SignInwithInvalidCredential()
        {
            var loginObj = new SignIn();

            ExcelLib.PopulateInCollection(ExcelPath, "SignIn");
            loginObj.LoginSteps(ExcelLib.ReadData(3, "Username"), ExcelLib.ReadData(3, "Password"));


            //Verify if user is able to see "Send Verification Email" button
            IWebElement SendEmailBtn = Driver.FindElement(By.XPath("//button[@id='submit-btn']"));

            Assert.IsTrue(SendEmailBtn.Enabled, "User failed to view Send Vefication Email button");
            //Verify if user receives error message
            string expectedMsg = "Confirm your email";
            string actualMsg   = Driver.FindElement(By.XPath("/html/body/div/div[@class='ns-box-inner']")).Text;

            Assert.AreEqual(expectedMsg, actualMsg, "Getting expected message failed");
        }
Exemple #14
0
        internal void POInsPage()
        {
            //Populating data from Excel
            ExcelLib.PopulateInCollection(Base.ExcelPath, "POInspection");

            //Wait 2 seconds till alert is present
            Driver.wait(2);
            //Accepting alert.

            Console.WriteLine("Accept Message");
            Driver.wait(10);
            Driver.ActionButton(Driver.driver, ExcelLib.ReadData(2, "Locator"), ExcelLib.ReadData(2, "Value"));

            //Click on PO Link
            Thread.Sleep(1000);
            Driver.wait(50);
            Driver.ActionButton(Driver.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "Value"));
        }
        internal string nameOfAddedProperty(int rowNumber)
        {
            try
            {
                ExcelLib.PopulateInCollection(Base.ExcelPath, "AddProperty");
                Driver.wait(2);

                string propertyName = ExcelLib.ReadData(rowNumber, "PropertyName");
                Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Name of added property found");
                return(propertyName);
            }
            catch (Exception ex)
            {
                Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Name of added property not found because of Exception " + ex.ToString());
                Assert.Fail("Exception " + ex.ToString() + " occured while getting the name of added property");
                return(null);
            }
        }
Exemple #16
0
        internal void SearchAName()
        {
            //Thread.Sleep(8000);
            IAlert alt = GlobalDefinitions.driver.SwitchTo().Alert();

            GlobalDefinitions.wait(4);
            alt.Accept();
            //Populate the excel sheet
            ExcelLib.PopulateInCollection(Base.ExcelPath, "HomePage");
            //IAlert alt = GlobalDefinitions.driver.SwitchTo().Alert();
            // alt.Dismiss();
            GlobalDefinitions.wait(4);
            //Enter the Name or word on the Search box
            GlobalDefinitions.TextBox(GlobalDefinitions.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "LocatorValue"), ExcelLib.ReadData(3, "InputValue"));
            GlobalDefinitions.wait(3);
            //Click on Search
            GlobalDefinitions.ActionButton(GlobalDefinitions.driver, ExcelLib.ReadData(4, "Locator"), ExcelLib.ReadData(4, "LocatorValue"));
        }
Exemple #17
0
        public void FinanceDetails()
        {
            //Enter Purchase Prise value
            PurchasePrice.SendKeys(ExcelLib.ReadData(2, "PurchasePrice"));
            Driver.wait(2000);

            //Enter Mortgage value
            Mortgage.SendKeys(ExcelLib.ReadData(2, "Mortgage"));
            Driver.wait(2000);

            //Enter Home Value
            HomeValue.SendKeys(ExcelLib.ReadData(2, "HomeValue"));
            Driver.wait(2000);

            //Clicking on next button
            NextFinance.Click();
            Thread.Sleep(1000);
        }
Exemple #18
0
        public void chkSlider()
        {
            btnManagingListing.Click();
            //Populate the Excel Sheet
            ExcelLib.PopulateInCollection(Base.ExcelPath, "ManageListings");
            Thread.Sleep(1000);
            string             title  = ExcelLib.ReadData(2, "InputValue");
            List <IWebElement> listTd = new List <IWebElement>(ListingsTable.FindElements(By.TagName("td")));

            for (int i = 0; i < listTd.Count; i++)
            {
                if (listTd.ElementAt(i).Text.Equals(title))
                {
                    listTd.ElementAt(i + 4).Click();
                    break;
                }
            }
        }
Exemple #19
0
        public void SignInInvalid()
        {
            SignIn Signinobj = new SignIn();

            //Populate the excel data
            ExcelLib.PopulateInCollection(ExcelPath, "SignIn");
            Signinobj.LoginSteps(ExcelLib.ReadData(3, "Username"), ExcelLib.ReadData(3, "Password"));
            try
            {
                //Verify "Send Verification Email" button
                IWebElement EmailVerifyBtn = driver.FindElement(By.XPath("//button[@id='submit-btn']"));
                Assert.IsTrue(EmailVerifyBtn.Enabled, "User failed to login successfully");
            }
            catch
            {
                Base.test.Log(LogStatus.Info, "Signup please and go to registration page");
            }
        }
        /// <summary>
        /// Search the property which just be created.
        /// </summary>
        public void SearchPropertiesWhichAdded()
        {
            //get input data from Excel
            ExcelLib.PopulateInCollection(Base.ExcelPath, "PropertyDetails");
            // get the Property Name which just input
            string propertyNameexpected = ExcelLib.ReadData(2, "PropertyName");

            //fill the search box and click the search button
            FillSearchBoxAndCLickSearch(propertyNameexpected);
            //wait for the page jumps
            while (!Driver.driver.Url.Contains("SearchString"))
            {
                Thread.Sleep(100);
            }

            //search the result and verify it.
            CheckResults(propertyNameexpected);
        }
Exemple #21
0
        public void EditLanguage()
        {
            {
                Global.ExcelLib.PopulateInCollection(Base.ExcelPath, "AddSkills");
                GlobalDefinitions.Wait();        //for editing skill details
                EditLang.Click();
                AddLangText.Clear();
                AddLangText.SendKeys(ExcelLib.ReadData(7, "Language"));

                //Selecting the language level
                IWebElement   LanguageLevelDrpdwn = GlobalDefinitions.driver.FindElement(By.XPath("//select[@name='level']"));
                SelectElement chooseLanguageLevel = new SelectElement(LanguageLevelDrpdwn);
                //select.SelectByText(ConstantHelpers.LevelFluent);
                var languageLevelData = ExcelLib.ReadData(2, "ChooseLangLevel");
                chooseLanguageLevel.SelectByValue(languageLevelData);
                AddLang.Click();
            }
        }
        public void Description()
        {
            // click on Description
            IWebElement Des = driver.FindElement(By.XPath("// h3[contains(text(),'Description')]/span/i"));

            Des.WaitForElementClickable(Global.Base.driver, 60).Click();
            // Populate Login page test data collection
            ExcelLib.PopulateInCollection(MarsResources.ExcelPath, "Profile");
            // Tell us more about yourself.
            driver.FindElement(By.XPath("//div[@class='field  ']/textarea")).SendKeys(ExcelLib.ReadData(2, "Description"));
            // click on save
            driver.FindElement(By.XPath("//button[@class='ui teal button'][@type='button']")).Click();
            Thread.Sleep(5000);
            driver.SwitchTo().Window(driver.WindowHandles.Last());
            // verify Description is save successfully
            Assert.AreEqual(driver.FindElement(By.XPath("/html/body/div[1]/div")).Text, "Description has been saved successfully");
            driver.SwitchTo().DefaultContent();
        }
 private void ExecuteExportToExcel(object parameter)
 {
     try
     {
         if (SelectedProject != null)
         {
             ExcelLib xl = new ExcelLib();
             xl.MakeProjectReport((Window)parameter, GetProjectReport(ConvertObjToInt(SelectedProject["ProjectID"])));
             xl = null;
         }
     }
     catch
     {
         IMessageBoxService msg = new MessageBoxService();
         msg.ShowMessage("There was a problem creating the Excel report", "Unable to create Excel report", GenericMessageBoxButton.OK, GenericMessageBoxIcon.Error);
         msg = null;
     }
 }
Exemple #24
0
            public void PO_AddANewProperty(string TestDataSheetName, int TestDataSetNumber)
            {
                // Create a toggle for the test to log events
                test = extent.StartTest("Add a New Property");
                //Set the excel path and sheet name for the test data for the test case
                ExcelLib.PopulateInCollection(Base.ExcelPath, TestDataSheetName);

                // Create a Property Details page object to add a new property
                PropertyDetails PropertyDetailsObj = new PropertyDetails();

                //Verify that the new listing is displayed in the "My Properties" page
                //Proceed to verification if the property was added successfully
                if (PropertyDetailsObj.AddNewProperty(TestDataSetNumber) == true)
                {
                    PropertyOwner PropertyOwnerObj = new PropertyOwner();
                    PropertyOwnerObj.VerifyNewProperty(TestDataSetNumber);
                }
            }
Exemple #25
0
        public void ThenASkillDetailsGetsAddedSuccessfully()
        {
            Global.ExcelLib.PopulateInCollection(Base.ExcelPath, "AddSkills");
            //Asserting the Language text

            String ActualSkill = GlobalDefinitions.driver.FindElement(By.XPath("//td[contains(text(),'C#')]")).Text;

            Assert.AreEqual(ActualSkill, ExcelLib.ReadData(2, "Skill"));
            Console.WriteLine("Skill" + " " + ActualSkill + " " + "is added");
            GlobalDefinitions.Wait();

            String ActualSkill1 = GlobalDefinitions.driver.FindElement(By.XPath("//td[contains(text(),'POM')]")).Text;

            Assert.AreEqual(ActualSkill1, ExcelLib.ReadData(3, "Skill"));
            Console.WriteLine("Skill" + " " + ActualSkill1 + " " + "is added");
            GlobalDefinitions.Wait();

            String ActualSkill2 = GlobalDefinitions.driver.FindElement(By.XPath("//td[contains(text(),'Nunit')]")).Text;

            Assert.AreEqual(ActualSkill2, ExcelLib.ReadData(4, "Skill"));
            Console.WriteLine("Skill" + " " + ActualSkill2 + " " + "is added");
            //Reading Language Level from Data excel sheet



            //Asserting the Skill level
            String ActualLevel = GlobalDefinitions.driver.FindElement(By.XPath("//td[contains(text(),'Intermediate')]")).Text;

            Assert.AreEqual(ActualLevel, ExcelLib.ReadData(2, "ChooseSkillLevel"));
            Console.WriteLine("Level" + " " + ActualLevel + " " + "is added");
            GlobalDefinitions.Wait();

            String ActualLevel1 = GlobalDefinitions.driver.FindElement(By.XPath("//td[contains(text(),'Expert')]")).Text;

            Assert.AreEqual(ActualLevel1, ExcelLib.ReadData(3, "ChooseSkillLevel"));
            Console.WriteLine("Level" + " " + ActualLevel1 + " " + "is added");
            GlobalDefinitions.Wait();

            String ActualLevel2 = GlobalDefinitions.driver.FindElement(By.XPath("//td[contains(text(),'Expert')]")).Text;

            Assert.AreEqual(ActualLevel2, ExcelLib.ReadData(4, "ChooseSkillLevel"));
            Console.WriteLine("Level" + " " + ActualLevel2 + " " + "is added");
            //Base.TearDown();
        }
Exemple #26
0
        internal void POSave()
        {
            try
            {
                //Select Tenant
                //  Thread.Sleep(1000);
                //  Driver.ActionButton(Driver.driver, ExcelLib.ReadData(6, "Locator"), ExcelLib.ReadData(5, "Value"));

                //Select Tenant option
                Thread.Sleep(1000);
                Driver.ActionButton(Driver.driver, ExcelLib.ReadData(7, "Locator"), ExcelLib.ReadData(7, "Value"));

                //Select Request Type
                // Thread.Sleep(1000);
                // Driver.ActionButton(Driver.driver, ExcelLib.ReadData(8, "Locator"), ExcelLib.ReadData(8, "Value"));

                //Select Request type option
                Thread.Sleep(1000);
                Driver.ActionButton(Driver.driver, ExcelLib.ReadData(9, "Locator"), ExcelLib.ReadData(9, "Value"));

                //Enter Due Date
                Thread.Sleep(1000);
                Driver.ActionButton(Driver.driver, ExcelLib.ReadData(10, "Locator"), ExcelLib.ReadData(10, "Value"),
                                    ExcelLib.ReadData(2, "DueDate"));

                //scroll the page down
                ((IJavaScriptExecutor)Driver.driver).ExecuteScript("window.scrollTo(0, document.body.scrollHeight - 50)");

                //Enter Description
                Thread.Sleep(1000);
                Driver.ActionButton(Driver.driver, ExcelLib.ReadData(11, "Locator"), ExcelLib.ReadData(11, "Value"),
                                    ExcelLib.ReadData(2, "Description"));

                //Click on Save button
                Thread.Sleep(1000);
                Driver.ActionButton(Driver.driver, ExcelLib.ReadData(14, "Locator"), ExcelLib.ReadData(14, "Value"));

                Console.WriteLine("Entered Inspection Request Details and Saved");
            }
            catch (Exception e)
            {
                Console.WriteLine("Cannot Save Inspection Request Details");
            }
        }
        internal void EditApplication()
        {
            try
            {
                LnqEdit.Click();
                //validate page navigation
                bool bPage = Driver.driver.PageSource.Contains("Edit Rental Appliaction");
                if (bPage)
                {
                    Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Navigated to Edit Rental Application Page");
                }

                else
                {
                    Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Page details not verified");
                }

                ExcelLib.PopulateInCollection(Base.ExcelPath, "TenantDetails");
                //Verify if the Tenant Count field is enalbled
                bool bEnableField = TxtNoOfTenant.Enabled;
                if (bEnableField)
                {
                    TxtNoOfTenant.SendKeys(ExcelLib.ReadData(2, "NoOfTenants"));
                }
                else
                {
                    Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Tenant Count Field not enabled");
                }
                bool bEnableNote = TxtNotes.Enabled;
                if (bEnableNote)
                {
                    TxtNotes.SendKeys(ExcelLib.ReadData(2, "Notes"));
                    Driver.wait(2);
                    BtnSave.Submit();
                    //validate the success message??
                }
                else
                {
                    Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Notes field not enabled");
                }
            }
            catch (Exception Ex)
            { string exceptionMsg = Ex.Message; }
        }
Exemple #28
0
        //enter listing retal details
        public void EnterListARetalDetails()
        {
            //click on Owners tab
            Owners.Click();

            //click on Properties tab
            Properties.Click();

            //click on "List As Rental" on the first property recording
            listAsRental.Click();

            //open the the data of ListAsRental sheet
            ExcelLib.PopulateInCollection(Base.ExcelPath, "ListAsRental");

            //write the data to title
            title.SendKeys(ExcelLib.ReadData(2, "title"));

            //write the data to description
            description.SendKeys(ExcelLib.ReadData(2, "description"));

            //write the data to movingCost
            movingCost.SendKeys(ExcelLib.ReadData(2, "movingCost"));

            //write the data to targetRent
            targetRent.SendKeys(ExcelLib.ReadData(2, "targetRent"));

            //write the data to availableDate
            availableDate.SendKeys(ExcelLib.ReadData(2, "availableDate"));

            //write the data to occupantCount
            occupantCount.SendKeys(ExcelLib.ReadData(2, "occupantCount"));

            Driver.wait(2);

            //click on save button
            saveBtn.Click();

            Driver.wait(2);

            //choose yes on the save confirmation
            IAlert alert = Driver.driver.SwitchTo().Alert();

            alert.Accept();
        }
Exemple #29
0
        // Edit Job under My Jobs Page
        internal void editJobSteps()
        {
            //populate data from excel
            ExcelLib.PopulateInCollection(Base.ExcelPath, "MyJob");

            try
            {
                //click on dashboard linq
                dashboard.Click();
                //click on My jobs linq
                myJobsLinq.Click();
                //Click on edit button fro the job
                editJob.Click();

                //verify we are in Edit Job Page
                Assert.IsTrue(Driver.driver.FindElement(By.TagName("body")).Text.Contains(editJobTitle));
                Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Page is navigated to Edit JOb page");

                //screen shot for edit job page
                String img = SaveScreenShotClass.SaveScreenshot(Driver.driver, "Edit Job Page");

                //select value from percentage done dropdown
                var selectValue = new SelectElement(percentage);
                selectValue.SelectByValue("60");

                //send text to note description field
                noteDescp.Clear();
                noteDescp.SendKeys(ExcelLib.ReadData(2, "Note"));
                //verify if save button is disabled
                if (btnSave.Enabled)
                {
                    btnSave.Click();
                }
                else
                {
                    Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Edit Job page is not filled correctly");
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #30
0
        // Find Title of property listed as rental
        internal string titleOfListedProperty(int rowNumber)
        {
            try
            {
                ExcelLib.PopulateInCollection(Base.ExcelPath, "ListAsRental");
                Driver.wait(2);


                string title = ExcelLib.ReadData(rowNumber, "Title");
                Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Title of listed property found");
                return(title);
            }
            catch (Exception ex)
            {
                Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Title of listed property not found because of Exception " + ex.ToString());
                Assert.Fail("Exception " + ex.ToString() + " occured while finding address of listed property");
                return(null);
            }
        }
        /// <summary>
        /// 判断导入评估数据文件格式是否正确
        /// </summary>
        /// <param name="strType"></param>
        /// <param name="path"></param>
        /// <param name="strPath"></param>
        /// <returns></returns>
        private bool IsImorCoreEvaluationDataFormat(string strPath)
        {
            bool IsRight = false;

            //重心数据
            if (strPath.EndsWith(".xml"))
            {
                XmlNode node = null;
                XmlDocument doc = new XmlDocument();
                doc.Load(strPath);

                node = doc.SelectSingleNode("重心离散点评估数据/离散点评估数据列表");
                if (node != null)
                {
                    IsRight = true;
                }
            }
            if (strPath.EndsWith(".xls") || strPath.EndsWith(".xlsx"))
            {
                ExcelLib OpExcel = new ExcelLib();
                //指定操作的文件
                OpExcel.OpenFileName = strPath;
                //打开文件
                if (OpExcel.OpenExcelFile() == false)
                {
                    return false;
                }
                //取得所有的工作表名称
                string[] strSheetsName = OpExcel.getWorkSheetsName();

                //默认操作第一张表
                OpExcel.SetActiveWorkSheet(1);
                System.Data.DataTable table;
                table = OpExcel.getAllCellsValue();
                OpExcel.CloseExcelApplication();

                if (table.Columns != null && table.Columns.Count > 0)
                {
                    if (table.Columns[0].Caption == "离散点重心坐标名称")
                    {
                        IsRight = true;
                    }
                }
            }

            return IsRight;
        }
        private List<ParaData> GetExcelRatioData(string strFilePath)
        {
            List<ParaData> lstParaData = null;
            try
            {
                if (File.Exists(strFilePath))
                {
                    ExcelLib OpExcel = new ExcelLib();
                    //指定操作的文件
                    OpExcel.OpenFileName = strFilePath;
                    //打开文件
                    if (OpExcel.OpenExcelFile() == false)
                    {
                        return lstParaData;
                    }
                    //取得所有的工作表名称
                    string[] strSheetsName = OpExcel.getWorkSheetsName();

                    //默认操作第一张表
                    OpExcel.SetActiveWorkSheet(1);
                    System.Data.DataTable table;
                    table = OpExcel.getAllCellsValue();
                    OpExcel.CloseExcelApplication();

                    int count = table.Rows.Count;
                    if (count > 0)
                    {
                        lstParaData = new List<ParaData>();
                        for (int i = 0; i < count; i++)
                        {
                            ParaData data = new ParaData();

                            data.paraName = table.Rows[i][0].ToString();
                            data.paraEnName = table.Rows[i][1].ToString();
                            data.paraUnit = table.Rows[i][2].ToString();
                            data.paraType = Convert.ToInt32(table.Rows[i][3].ToString());
                            data.paraValue = Convert.ToDouble(table.Rows[i][4].ToString());
                            data.strRemark = table.Rows[i][5].ToString();

                            lstParaData.Add(data);
                        }
                    }
                }
            }
            catch
            {
                XLog.Write("导入文件\"" + strFilePath + "\"格式错误");
                MessageBox.Show("导入文件\"" + strFilePath + "\"格式错误");
                return null;
            }

            return lstParaData;
        }
        /// <summary>
        /// 获取Excel文件的重量设计对象
        /// </summary>
        /// <param name="strFilePath"></param>
        /// <returns></returns>
        private WeightDesignData GetExcelWeightDesignData(string strFilePath)
        {
            WeightDesignData weightData = null;
            try
            {
                if (File.Exists(strFilePath))
                {
                    ExcelLib OpExcel = new ExcelLib();
                    //指定操作的文件
                    OpExcel.OpenFileName = strFilePath;
                    //打开文件
                    if (OpExcel.OpenExcelFile() == false)
                    {
                        return weightData;
                    }
                    //取得所有的工作表名称
                    string[] strSheetsName = OpExcel.getWorkSheetsName();

                    //默认操作第一张表
                    OpExcel.SetActiveWorkSheet(1);
                    System.Data.DataTable table;
                    table = OpExcel.getAllCellsValue();
                    OpExcel.CloseExcelApplication();

                    int count = table.Rows.Count;
                    if (count > 0)
                    {
                        string strSortName = string.Empty;

                        weightData = new WeightDesignData();
                        weightData.Id = bllDesignData.GetMaxId() + 1;
                        weightData.DesignData_Name = table.Rows[0][0].ToString();
                        weightData.DesignData_Submitter = table.Rows[0][1].ToString();
                        weightData.Helicopter_Name = table.Rows[0][2].ToString();
                        weightData.DataRemark = table.Rows[0][3].ToString();
                        weightData.LastModify_Time = table.Rows[0][4].ToString();
                        weightData.DesignTaking_Weight = Convert.ToDouble(table.Rows[0][5]);

                        if (table.Rows[0][6] is DBNull || table.Rows[0][6].ToString() == string.Empty)
                        {
                            weightData.MainSystem_Name = string.Empty;
                        }
                        else
                        {
                            strSortName = table.Rows[0][6].ToString();
                            string strMainSystemWeight = strSortName + "|";
                            string strFH = "、";

                            for (int i = 0; i < count; i++)
                            {
                                strMainSystemWeight += table.Rows[i][8].ToString() + strFH
                                    + table.Rows[i][7].ToString() + strFH + table.Rows[i][9].ToString() + strFH
                                      + table.Rows[i][10].ToString() + strFH + table.Rows[i][12].ToString() + "|";
                            }
                            weightData.MainSystem_Name = strMainSystemWeight;
                        }
                    }
                }
            }
            catch
            {
                XLog.Write("导入文件\"" + strFilePath + "\"格式错误");
                MessageBox.Show("导入文件\"" + strFilePath + "\"格式错误");
                return null;
            }

            return weightData;
        }
        private List<CorePointData> GetExcelListCorePointData(string strFilePath)
        {
            List<CorePointData> lstCorePtData = null;
            try
            {
                if (File.Exists(strFilePath))
                {
                    ExcelLib OpExcel = new ExcelLib();
                    //指定操作的文件
                    OpExcel.OpenFileName = strFilePath;
                    //打开文件
                    if (OpExcel.OpenExcelFile() == false)
                    {
                        return lstCorePtData;
                    }
                    //取得所有的工作表名称
                    string[] strSheetsName = OpExcel.getWorkSheetsName();

                    //默认操作第一张表
                    OpExcel.SetActiveWorkSheet(1);
                    System.Data.DataTable table;
                    //列标题重复
                    table = OpExcel.getAllCellsValue();
                    OpExcel.CloseExcelApplication();

                    int count = table.Rows.Count;

                    if (count > 0)
                    {
                        lstCorePtData = new List<CorePointData>();

                        for (int i = 0; i < table.Rows.Count; i++)
                        {
                            CorePointData pt = new CorePointData();

                            pt.pointName = table.Rows[i][0].ToString();
                            pt.pointXValue = Convert.ToDouble(table.Rows[i][3].ToString());
                            pt.pointYValue = Convert.ToDouble(table.Rows[i][4].ToString());

                            lstCorePtData.Add(pt);
                        }
                    }
                }
            }
            catch
            {
                XLog.Write("导入文件\"" + strFilePath + "\"格式错误");
                MessageBox.Show("导入文件\"" + strFilePath + "\"格式错误");
                return null;
            }

            return lstCorePtData;
        }
        private CoreEnvelopeDesign GetExcelCoreDesignData(string strFilePath)
        {
            CoreEnvelopeDesign CoreData = null;
            try
            {
                if (File.Exists(strFilePath))
                {
                    ExcelLib OpExcel = new ExcelLib();
                    //指定操作的文件
                    OpExcel.OpenFileName = strFilePath;
                    //打开文件
                    if (OpExcel.OpenExcelFile() == false)
                    {
                        return CoreData;
                    }
                    //取得所有的工作表名称
                    string[] strSheetsName = OpExcel.getWorkSheetsName();

                    //默认操作第一张表
                    OpExcel.SetActiveWorkSheet(1);
                    System.Data.DataTable table;
                    //列标题重复
                    table = OpExcel.getAllCellsValue();
                    OpExcel.CloseExcelApplication();

                    int count = table.Rows.Count;
                    string strCoreEnvelope = string.Empty;
                    if (count > 0)
                    {
                        CoreData = new CoreEnvelopeDesign();
                        CoreData.Id = bllCoreEnvelopeDesign.GetMaxId() + 1;

                        CoreData.DesignData_Name = table.Rows[0][0].ToString();
                        CoreData.DesignData_Submitter = table.Rows[0][1].ToString();
                        CoreData.Helicopter_Name = table.Rows[0][2].ToString();
                        CoreData.DataRemark = table.Rows[0][3].ToString();
                        CoreData.LastModify_Time = table.Rows[0][4].ToString();
                        CoreData.DesignTaking_Weight = Convert.ToDouble(table.Rows[0][5]);

                        if (table.Rows[0][6].ToString() != string.Empty)
                        {
                            for (int i = 0; i < table.Rows.Count; i++)
                            {
                                strCoreEnvelope += table.Rows[i][6].ToString() + ":" + "横坐标(毫米)、纵坐标(千米)、"
                                    + table.Rows[i][7].ToString() + "、" + table.Rows[i][8].ToString() + "|";
                            }
                            strCoreEnvelope = strCoreEnvelope.Substring(0, strCoreEnvelope.Length - 1);
                        }
                        CoreData.CoreEnvelope = strCoreEnvelope;
                    }
                }
            }
            catch
            {
                XLog.Write("导入文件\"" + strFilePath + "\"格式错误");
                MessageBox.Show("导入文件\"" + strFilePath + "\"格式错误");
                return null;
            }

            return CoreData;
        }
        /// <summary>
        /// 判断导入重心数据文件格式是否正确
        /// </summary>
        /// <param name="strType"></param>
        /// <param name="path"></param>
        /// <param name="strPath"></param>
        /// <returns></returns>
        private bool IsImorCoreDataFileFormat(string strType, string strPath)
        {
            bool IsRight = false;

            try
            {
                //重心数据
                if (strType == "core")
                {
                    if (strPath.EndsWith(".xml"))
                    {
                        XmlNode node = null;
                        XmlDocument doc = new XmlDocument();
                        doc.Load(strPath);

                        node = doc.SelectSingleNode("重心数据/重心坐标列表");
                        if (node != null)
                        {
                            IsRight = true;
                        }
                    }
                    if (strPath.EndsWith(".xls"))
                    {
                        ExcelLib OpExcel = new ExcelLib();
                        //指定操作的文件
                        OpExcel.OpenFileName = strPath;
                        //打开文件
                        if (OpExcel.OpenExcelFile() == false)
                        {
                            return false;
                        }
                        //取得所有的工作表名称
                        string[] strSheetsName = OpExcel.getWorkSheetsName();

                        //默认操作第一张表
                        OpExcel.SetActiveWorkSheet(1);
                        System.Data.DataTable table;
                        table = OpExcel.getAllCellsValue();
                        OpExcel.CloseExcelApplication();

                        if (table.Columns[0].Caption == "重心坐标点名称")
                        {
                            IsRight = true;
                        }
                    }
                }

                ///重量设计
                if (strType == "coreEnvelope")
                {
                    if (strPath.EndsWith(".xml"))
                    {
                        XmlNode node = null;
                        XmlDocument doc = new XmlDocument();
                        doc.Load(strPath);

                        node = doc.SelectSingleNode("重心包线设计数据/设计数据名称");
                        if (node != null)
                        {
                            IsRight = true;
                        }
                    }
                    if (strPath.EndsWith(".xls"))
                    {
                        ExcelLib OpExcel = new ExcelLib();
                        //指定操作的文件
                        OpExcel.OpenFileName = strPath;
                        //打开文件
                        if (OpExcel.OpenExcelFile() == false)
                        {
                            return false;
                        }
                        //取得所有的工作表名称
                        string[] strSheetsName = OpExcel.getWorkSheetsName();

                        //默认操作第一张表
                        OpExcel.SetActiveWorkSheet(1);
                        System.Data.DataTable table;
                        table = OpExcel.getAllCellsValue();
                        OpExcel.CloseExcelApplication();

                        if (table.Columns[0].Caption == "设计数据名称")
                        {
                            IsRight = true;
                        }
                    }
                }
            }
            catch
            {
                return false;
            }
            return IsRight;
        }
        /// <summary>
        /// 获取excle文件数据
        /// </summary>
        /// <param name="strFilePath"></param>
        /// <returns></returns>
        private List<ParaData> GetFileParaData(string strFilePath)
        {
            List<ParaData> lstParaData = new List<ParaData>();

            if (File.Exists(strFilePath))
            {
                ExcelLib OpExcel = new ExcelLib();
                //指定操作的文件
                OpExcel.OpenFileName = strFilePath;
                //打开文件
                if (OpExcel.OpenExcelFile() == false)
                {
                    return lstParaData;
                }
                //取得所有的工作表名称
                string[] strSheetsName = OpExcel.getWorkSheetsName();

                //默认操作第一张表
                OpExcel.SetActiveWorkSheet(1);
                System.Data.DataTable table;
                table = OpExcel.getAllCellsValue();
                OpExcel.CloseExcelApplication();

                int count = table.Rows.Count;

                for (int i = 0; i < count; i++)
                {
                    ParaData para = new ParaData();

                    para.paraName = table.Rows[i][0].ToString();
                    para.paraEnName = table.Rows[i][1].ToString();
                    para.paraUnit = table.Rows[i][2].ToString();
                    para.paraType = Convert.ToInt32(table.Rows[i][3].ToString());
                    para.paraValue = Convert.ToDouble(table.Rows[i][4].ToString());
                    para.strRemark = table.Rows[i][5].ToString();

                    lstParaData.Add(para);
                }
            }

            return lstParaData;
        }
        /// <summary>
        /// 获取离散评估数据
        /// </summary>
        /// <param name="strFilePath"></param>
        /// <returns></returns>
        private List<int> GetExcelCoreEvaluationData(string strFilePath)
        {
            lstCoreEvaluationData = null;
            //评估数据
            List<int> lstCoreEvaluation = null;

            if (File.Exists(strFilePath))
            {
                ExcelLib OpExcel = new ExcelLib();
                //指定操作的文件
                OpExcel.OpenFileName = strFilePath;
                //打开文件
                if (OpExcel.OpenExcelFile() == false)
                {
                    return lstCoreEvaluation;
                }
                //取得所有的工作表名称
                string[] strSheetsName = OpExcel.getWorkSheetsName();

                //默认操作第一张表
                OpExcel.SetActiveWorkSheet(1);
                System.Data.DataTable table;
                //列标题重复
                table = OpExcel.getAllCellsValue();
                OpExcel.CloseExcelApplication();

                int count = table.Rows.Count;

                if (count > 0)
                {
                    lstCoreEvaluationData = new List<CorePointData>();
                    lstCoreEvaluation = new List<int>();

                    int t = -1;
                    for (int i = 0; i < table.Rows.Count; i++)
                    {
                        CorePointData pt = new CorePointData();
                        pt.pointName = table.Rows[i][0].ToString();
                        pt.pointXValue = Convert.ToDouble(table.Rows[i][3].ToString());
                        pt.pointYValue = Convert.ToDouble(table.Rows[i][4].ToString());

                        t = Convert.ToInt32(table.Rows[i][5].ToString());
                        lstCoreEvaluation.Add(t);
                        lstCoreEvaluationData.Add(pt);
                    }
                }
            }

            return lstCoreEvaluation;
        }
        /// <summary>
        ///xls文件转换成WeightSortData类型
        /// </summary>
        /// <param name="strFilePath">文件路径</param>
        /// <returns>返回WeightSortData类型</returns>
        public static WeightSortData GetXlsImportSortData(string strFilePath)
        {
            WeightSortData sortData = null;
            try
            {
                if (File.Exists(strFilePath))
                {
                    ExcelLib OpExcel = new ExcelLib();
                    //指定操作的文件
                    OpExcel.OpenFileName = strFilePath;
                    //打开文件
                    if (OpExcel.OpenExcelFile() == false)
                    {
                        return sortData;
                    }
                    //取得所有的工作表名称
                    string[] strSheetsName = OpExcel.getWorkSheetsName();

                    //默认操作第一张表
                    OpExcel.SetActiveWorkSheet(1);
                    System.Data.DataTable table;
                    table = OpExcel.getAllCellsValue();
                    OpExcel.CloseExcelApplication();

                    int count = table.Rows.Count;
                    if (count > 0)
                    {
                        sortData = new WeightSortData();
                        sortData.sortName = table.Rows[0][0].ToString();

                        List<WeightData> lstWeightData = new List<WeightData>();
                        for (int i = 0; i < count; i++)
                        {
                            WeightData data = new WeightData();

                            data.nID = Convert.ToInt32(table.Rows[i][1].ToString());
                            data.weightName = table.Rows[i][2].ToString();
                            data.weightValue = Convert.ToDouble(table.Rows[i][4].ToString());
                            data.strRemark = table.Rows[i][5].ToString();
                            data.nParentID = Convert.ToInt32(table.Rows[i][6].ToString());

                            lstWeightData.Add(data);
                        }
                        sortData.lstWeightData = lstWeightData;
                    }
                }
            }
            catch
            {
                XLog.Write("导入文件\"" + strFilePath + "\"格式错误");
                MessageBox.Show("导入文件\"" + strFilePath + "\"格式错误");
                return null;
            }
            return sortData;
        }