Esempio n. 1
0
 //This method searches skill by selecting sub category in search result page
 public void SearchSkillBySelectingSubCategory()
 {
     PopulateDataForSearchSkill();
     SearchSkillBySelectingCategory();
     Base.driver.WaitForClickableElement(By.XPath("//div[@class='ui link list']/a[11]"));
     SubCategory.Click();
 }
Esempio n. 2
0
        // Availability SubCategory option
        internal void SelectSubCategory()
        {
            Thread.Sleep(1500);
            Actions action_SubCategory = new Actions(GlobalDefinitions.driver);

            action_SubCategory.MoveToElement(SubCategory).Build().Perform();
            SubCategory.Click();
            IList <IWebElement> AvailableSubCategory = SubCategory.FindElements(By.TagName("option"));
            int countSubCategory = AvailableSubCategory.Count;

            for (int i = 0; i < countSubCategory; i++)
            {
                if (AvailableSubCategory[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory"))
                {
                    AvailableSubCategory[i].Click();
                    Global.Base.test.Log(LogStatus.Info, "Select the available SubCategory");
                }
            }
        }
Esempio n. 3
0
        internal void SearchSharedSkill()
        {
            Extension.WaitForElementDisplayed(Driver, By.CssSelector("input[placeholder='Search skills']"), 2);

            //Enter the title in search skill field and press enter
            SearchSkills.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title") + "\n");
            Extension.WaitForElementDisplayed(Driver, By.XPath("//b[text()='All Categories']/following-sibling::span"), 2);
            Thread.Sleep(2000);

            //Validate if All categories count is greater than 0
            GlobalDefinitions.ValidateBoolean(int.Parse(AllCategoriesCount.Text) > 0, "All Categories shown");

            //Validate Category and subcategory added count is greater than 0 when searched
            foreach (IWebElement Category in CategoriesList)
            {
                string CategoryValue = Category.Text.Replace(Category.FindElement(By.XPath("./*")).Text, "").TrimEnd();

                if (CategoryValue.ToLower() == GlobalDefinitions.ExcelLib.ReadData(2, "Category").ToLower())
                {
                    Category.Click();
                    GlobalDefinitions.ValidateBoolean(int.Parse(Category.FindElement(By.XPath("span")).Text) > 0, "Category shown");
                    IList <IWebElement> SubCategoryList = Driver.FindElements(By.XPath("//a[@role='listitem'][@class='item subcategory']"));
                    foreach (IWebElement SubCategory in SubCategoryList)
                    {
                        string SubCategoryValue = SubCategory.Text.Replace(SubCategory.FindElement(By.XPath("./*")).Text, "").TrimEnd();
                        if (SubCategoryValue.ToLower() == GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory").ToLower())
                        {
                            SubCategory.Click();
                            GlobalDefinitions.ValidateBoolean(int.Parse(SubCategory.FindElement(By.XPath("span")).Text) > 0, "SubCategory Shown");
                            Base.Image = SaveScreenShotClass.SaveScreenshot(Driver, "Report");
                            break;
                        }
                    }
                    break;
                }
            }
        }
Esempio n. 4
0
        internal void Share_Skill()
        {
            Console.WriteLine("Start of shareSkill Method");

            //extent Reports
            // Base.test = Base.extent.StartTest("Login Test");

            //Click on ShareSkill
            Share_skill.Click();
            Thread.Sleep(2000);

            //Populate the Excel Sheet
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill");
            Thread.Sleep(1000);

            //Enter Title
            Title.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Title"));
            Thread.Sleep(1000);

            //Enter Description
            Description.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Description"));
            Thread.Sleep(1000);

            //Click on Category
            Category.Click();

            //Enter Category
            var selectElement = new SelectElement(Category);

            selectElement.SelectByText(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Category"));
            Thread.Sleep(2000);

            //Click on Sub Category
            SubCategory.Click();
            Thread.Sleep(3000);

            //Enter Sub Category
            var selectElementSub = new SelectElement(SubCategory);

            selectElementSub.SelectByText(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Sub Category"));
            Thread.Sleep(1000);

            //Click on tags
            Tags.Click();

            //Enter a tag
            Tags.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Tags"));

            //Select a Service Type
            ServiceType.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Service Type"));

            //Select Location Type
            locationType.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Location Type"));

            //Click on Avaliable days
            StartDate.Click();

            Thread.Sleep(1000);

            //Select Available days
            StartDate.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Start Date"));

            //Click on Sunday Checkbox
            Checkbox.Click();

            Thread.Sleep(1000);

            //Select Start Time
            StartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Start Time"));

            //Select Skill Trade
            skillTrades.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Skill Trade"));

            //Select Skill-Exchange
            SkillExchange.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Skill Exchange"));

            Thread.Sleep(2000);

            //Click on plus icon of Work Samples
            Work_Samples.Click();

            Thread.Sleep(3000);

            //Call AutoIt to choose a file
            AutoItX.ControlFocus("Open", "", "Edit1");
            AutoItX.ControlSetText("Open", "", "Edit1", @"D:\kavya\AutoIt");
            AutoItX.ControlClick("Open", "", "Button1");

            //Select Active
            Active.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Active"));

            //Click on Save
            Save.Click();
        }
        public void EditSkills()
        {
            //Populate the Excel Sheet
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ManageListings");
            Thread.Sleep(4000);

            //Click on ManageListings button
            Thread.Sleep(5000);
            Global.GlobalDefinitions.driver.Navigate().Refresh();
            ML.Click();
            Thread.Sleep(4000);

            while (true)

            {
                var j = 1;

                while (j <= 10)

                {
                    // identify 2nd row of table. Then extact the text and assign to a variable

                    var Category1 = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr[" + j + "]/td[2]")).Text;
                    var EditBtn   = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr[" + j + "]/td[8]/i[2]"));
                    //compare the text with the expected text. "Graphics & Design"

                    if (Category1 == (Global.GlobalDefinitions.ExcelLib.ReadData(2, "Category1")))

                    {
                        //Click on Edit Button
                        EditBtn.Click();
                        Thread.Sleep(3000);

                        // Adding Title
                        Title.Clear();
                        Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title"));
                        Thread.Sleep(500);

                        //Add Description
                        Description.Clear();
                        Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description"));
                        Thread.Sleep(3000);
                        //SaveBtn.Click();
                        Base.test.Log(LogStatus.Info, " Service Listing updated successfully");

                        //Add Category
                        Thread.Sleep(1500);
                        //Actions action = new Actions(GlobalDefinitions.driver);
                        //action.Click(Category);
                        Category.Click();
                        //action.MoveToElement(Category).Build().Perform();
                        Console.WriteLine("Clicked on the Category");
                        Thread.Sleep(2000);
                        IList <IWebElement> CategoryList = Category.FindElements(By.TagName("option"));
                        int Count = CategoryList.Count;
                        Thread.Sleep(500);
                        for (int i = 0; i < Count; i++)
                        {
                            Console.WriteLine("in");

                            if (CategoryList[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Category").Trim())
                            {
                                Thread.Sleep(1000);
                                CategoryList[i].Click();
                                Base.test.Log(LogStatus.Info, " Category Selected");
                            }
                        }

                        //Add SubCategory
                        SubCategory.Click();
                        Console.WriteLine("Clicked on the SubCategory");
                        Thread.Sleep(2000);
                        IList <IWebElement> SubCategoryList = SubCategory.FindElements(By.TagName("option"));
                        //int count = SubCatogeryList.Count;
                        Thread.Sleep(500);
                        for (int i = 0; i < SubCategoryList.Count; i++)
                        {
                            if (SubCategoryList[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory"))
                            //if (SubCatogeryList[i].Text == " Other".Trim())
                            {
                                Thread.Sleep(1000);
                                SubCategoryList[i].Click();
                                Base.test.Log(LogStatus.Info, " SubCategory Selected");
                            }
                        }


                        // Add Tags
                        Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags"));
                        Base.test.Log(LogStatus.Info, " Service Listing updated successfully");

                        // Select Service Type
                        Thread.Sleep(1000);
                        if (GlobalDefinitions.ExcelLib.ReadData(2, "Service Type") == "One-off service")
                        {
                            ServiceType.Click();
                        }
                        else
                        {
                            Servicetype.Click();
                        }
                        Base.test.Log(LogStatus.Info, "Service type Edited successfully");

                        //Select Location Type
                        Thread.Sleep(1000);
                        if (GlobalDefinitions.ExcelLib.ReadData(2, "Location Type") == "Online")
                        {
                            LocationType.Click();
                        }
                        else
                        {
                            Locationtype.Click();
                        }
                        Base.test.Log(LogStatus.Info, "Location Type Edited successfully");

                        //Monday Check Box Selection
                        Thread.Sleep(2000);
                        Boolean X = MondayCheckBox.Selected;

                        if (X == false)
                        {
                            MondayCheckBox.Click();
                        }

                        MondayStartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Start Time"));
                        Thread.Sleep(1000);
                        MondayEndTime.Clear();
                        MondayEndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "End Time"));
                        Thread.Sleep(1000);

                        //Tuesday Selection
                        //TuesdayCheckBox.Click();
                        //TuesdayStartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Start Time"));
                        //TuesdayEndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "End Time"));

                        //Days selection
                        Thursdaycheckbox.Click();
                        Thread.Sleep(2000);
                        ThursdayStartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Start Time"));
                        ThursdayEndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "End Time"));

                        //Selecting Skill Trade

                        if (GlobalDefinitions.ExcelLib.ReadData(2, "Skill Trade") == "Skill-exchange")
                        {
                            SkillTrade.Click();
                        }

                        else
                        {
                            Skilltrade.Click();
                        }
                        Base.test.Log(LogStatus.Info, " Service Listing updated successfully");

                        // Enter Skill Exchange
                        AutoItX3 autoItx = new AutoItX3();
                        SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange"));
                        autoItx.Send("{Enter}");
                        Thread.Sleep(3000);
                        Base.test.Log(LogStatus.Info, " Service Listing updated successfully");

                        //Upload WorkSample
                        Thread.Sleep(4000);
                        WorkSample.Click();
                        Thread.Sleep(1000);
                        AutoItX3 autoit = new AutoItX3();
                        autoit.WinActivate("Open");
                        autoit.Send(@"c:\users\rajesh jasti\Documents\Worksamples.xlsx");
                        Thread.Sleep(5000);
                        autoit.Send("{Enter}");
                        Base.test.Log(LogStatus.Info, "Work Sample Updated successfully");

                        // select Active
                        Thread.Sleep(1000);
                        if (GlobalDefinitions.ExcelLib.ReadData(2, "Active") == "Active")
                        {
                            ActiveBtn.Click();
                        }
                        else
                        {
                            Hidden.Click();
                        }

                        //Click on Save Button
                        SaveBtn.Click();
                        Base.test.Log(LogStatus.Info, " Service Listing updated successfully");
                        return;
                    }
                    j++;
                }
                var btnNext = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div/button[4]"));
                btnNext.Click();
            }
            var Title1 = (Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr[3]/td[2]")).Text);

            Assert.AreEqual("Test Analyst", Title1);
            Console.WriteLine(" Skills Edited Successfully");
        }
        ////Click on View Button
        //[FindsBy(How = How.XPath, Using = "//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr[1]/td[8]/i[1]")]
        //private IWebElement ViewBtn { get; set; }
        #endregion


        #region Add Skills

        public void AddShareSkills()
        {
            //Populate the Excel Sheet
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkills");
            Thread.Sleep(2000);

            //Click on ShareSkills
            Thread.Sleep(5000);
            Shareskills.Click();

            //Click on Title
            Thread.Sleep(5000);
            Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title"));
            Thread.Sleep(500);

            //Click on Description
            Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description"));
            Base.test.Log(LogStatus.Info, "Description Added Sucessfully");

            //Add Category
            Thread.Sleep(4000);
            //Actions action = new Actions(GlobalDefinitions.driver);
            //action.Click(Category);
            Category.Click();
            //action.MoveToElement(Category).Build().Perform();
            Console.WriteLine("Clicked on the Category");
            Thread.Sleep(2000);
            IList <IWebElement> CategoryList = Category.FindElements(By.TagName("option"));
            int Count = CategoryList.Count;

            Thread.Sleep(500);
            for (int i = 0; i < Count; i++)
            {
                Console.WriteLine("in");

                if (CategoryList[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Category").Trim())
                //if (CategoryList[i].Text == " Graphics & Design ".Trim())
                {
                    Thread.Sleep(1000);
                    CategoryList[i].Click();
                    Base.test.Log(LogStatus.Info, " Category Selected");
                }
            }

            //Add SubCategory
            SubCategory.Click();
            Console.WriteLine("Clicked on the SubCategory");
            Thread.Sleep(2000);
            IList <IWebElement> SubCatogeryList = SubCategory.FindElements(By.TagName("option"));

            //int count = SubCatogeryList.Count;
            Thread.Sleep(500);
            for (int i = 0; i < SubCatogeryList.Count; i++)
            {
                if (SubCatogeryList[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory").Trim())
                {
                    Thread.Sleep(1000);
                    SubCatogeryList[i].Click();
                    Base.test.Log(LogStatus.Info, " SubCategory Selected");
                }
            }

            // Add Tags
            AutoItX3 autoIt = new AutoItX3();

            Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags"));
            autoIt.Send("{Enter}");
            Base.test.Log(LogStatus.Info, " Tags Added successfully");

            // Select Service Type
            Thread.Sleep(1000);

            if (GlobalDefinitions.ExcelLib.ReadData(2, "Service Type") == " Hourly badis sevice ")
            {
                Servicetype.Click();
            }
            else
            {
                ServiceType.Click();
            }
            Base.test.Log(LogStatus.Info, "Service type Added successfully");

            //Select Location Type
            Thread.Sleep(1000);
            if (GlobalDefinitions.ExcelLib.ReadData(2, "Location Type") == "On-site")
            {
                Locationtype.Click();
            }
            else
            {
                LocationType.Click();
            }
            Base.test.Log(LogStatus.Info, "Location Type Edited successfully");

            //Monday selection
            MondayCheckBox.Click();
            MondayStartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Start Time"));
            Thread.Sleep(1000);
            MondayEndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "End Time"));
            Thread.Sleep(1000);

            //Tuesday Selection
            TuesdayCheckBox.Click();
            TuesdayStartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Start Time"));
            TuesdayEndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "End Time"));

            //Wednesday Selection
            Wednesdaycheckbox.Click();
            WednesdayStartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(4, "Start Time"));
            WednesdayEndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(4, "End Time"));

            //Selecting Skill Trade
            if (GlobalDefinitions.ExcelLib.ReadData(2, "Skill Trade") == "Credit")
            {
                Thread.Sleep(1000);
                Skilltrade.Click();
            }
            else
            {
                Thread.Sleep(1000);
                SkillTrade.Click();
            }
            Base.test.Log(LogStatus.Info, " Service Listing updated successfully");

            // Enter Credit
            Thread.Sleep(1000);
            Credit.Clear();
            Credit.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Credit"));
            Thread.Sleep(1000);
            Base.test.Log(LogStatus.Info, " Service Listing updated successfully");

            //Upload WorkSample
            Thread.Sleep(3000);
            WorkSample.Click();
            Thread.Sleep(1000);
            AutoItX3 autoit = new AutoItX3();

            autoit.WinActivate("Open");
            autoit.Send(@"c:\users\rajesh jasti\Documents\ProfilePhoto.jpg");
            Thread.Sleep(2000);
            autoit.Send("{Enter}");
            Base.test.Log(LogStatus.Info, "Image Edited successfully");

            //Selecting Active
            Thread.Sleep(4000);
            if (GlobalDefinitions.ExcelLib.ReadData(2, "Active") == "Hidden")
            {
                Hidden.Click();
            }
            else
            {
                ActiveBtn.Click();
            }

            //Click on Save Button
            SaveBtn.Click();
        }
Esempio n. 7
0
        public void AddNewShareSkill()
        {
            #region Navigate to Share Skills Page

            // Click on Share Skills Page
            ShareSkills.Click();
            Thread.Sleep(1000);

            //Populate the excel data
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill");

            // Enter Title
            Title.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Title"));
            Base.test.Log(LogStatus.Info, "Title has been successfully entered");

            //Enter description
            Description.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Description"));
            Base.test.Log(LogStatus.Info, "Description has been successfully entered");

            //click on category dropdown menu
            Thread.Sleep(500);
            Category.Click();
            Thread.Sleep(1000);


            //Select the category
            ProgrammingandTech.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Category"));
            Thread.Sleep(1000);


            //Click on subcatogory drop down option
            Thread.Sleep(1000);
            SubCategory.Click();

            //Select the Sub-Category option
            SubCategory.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Subcategory"));
            SubCategory.SendKeys(Keys.Enter);
            Base.test.Log(LogStatus.Info, "SubCategory has been successfully entered");
            QA.Click();


            //Enter Tags
            Tags.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Tags"));
            Tags.SendKeys(Keys.Enter);
            Base.test.Log(LogStatus.Info, "TagName has been successfully entered");

            //Select service type
            //ServiceTypeHourly.Click();

            if (GlobalDefinitions.ExcelLib.ReadData(2, "Service Type") == "Hourly basis service")
            {
                ServiceTypeHourly.Click();
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "Service Type") == "One-off service")
            {
                ServiceTypeOneOff.Click();
            }

            //Select Location Type
            //LocationTypeOnline.Click();
            if (GlobalDefinitions.ExcelLib.ReadData(2, "Location Type") == "Online")
            {
                LocationTypeOnline.Click();
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "Location Type") == "On-site")
            {
                LocationTypeOnsite.Click();
            }



            //Click the start date
            StartDate.Click();
            Thread.Sleep(500);

            //Select the date
            Thread.Sleep(500);
            StartDate.SendKeys(Keys.Backspace);
            StartDate.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Start Date"));

            //Select the end Date
            Thread.Sleep(1000);
            EndDate.SendKeys(Keys.Backspace);
            EndDate.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "End Date"));

            //Select the Days available
            selectDays.Click();
            Thread.Sleep(500);

            //Select starttime
            Thread.Sleep(1000);
            StartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Start Time"));

            //Select EndTime
            Thread.Sleep(1000);
            EndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "End Time"));

            //Select Skill Trade
            Credit.Click();
            Thread.Sleep(500);
            if (GlobalDefinitions.ExcelLib.ReadData(2, "Skill Trade") == "Skill-exchange")
            {
                RequiredSkills.Click();
                RequiredSkills.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill Trade"));
                RequiredSkills.SendKeys(Keys.Enter);
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "Skill Trade") == "Credit")
            {
                CreditAmount.Click();
                CreditAmount.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Credit Amount"));
                CreditAmount.SendKeys(Keys.Enter);

                //Enter credit amount
                // CreditAmount.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Credit Amount"));

                //Select the stats
                // StatusActive.Click();
                //Thread.Sleep(500);
                if (GlobalDefinitions.ExcelLib.ReadData(2, "Status") == "Active")
                {
                    StatusActive.Click();
                }
                else if (GlobalDefinitions.ExcelLib.ReadData(2, "Status") == "Hidden")
                {
                    StatusHidden.Click();
                }

                //Save the Share Skill
                Thread.Sleep(500);
                SaveShareSkills.Click();
                Thread.Sleep(500);


                //Verify if newShared skill is saved
                Thread.Sleep(3000);
                string ShareSkillSucess = Global.GlobalDefinitions.driver.FindElement(By.CssSelector("#listing-management-section > div:nth-child(3) > div:nth-child(2) > table > thead > tr > th:nth-child(1)")).Text;

                if (ShareSkillSucess == "Image")
                {
                    Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Saved Skill Successful");
                }
                else
                {
                    Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Saving Skill Unsuccessful");
                }
            }
        }
Esempio n. 8
0
        public void AddService()
        {
            Global.GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ServiceListing");

            //click Shareskill button
            ShareSkillBtn.Click();
            GlobalDefinitions.wait(2000);

            Base.test.Log(LogStatus.Info, "Starting adding Service");

            //enter Title
            Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title"));

            //enter Description
            Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description"));

            //select Category
            if (Category.Displayed)
            {
                Category.Click();
            }
            else
            {
                GlobalDefinitions.wait(2000);
            }

            for (int i = 0; i < CategoryOptions.Count; i++)
            {
                if (GlobalDefinitions.ExcelLib.ReadData(2, "Category") == CategoryOptions[i].Text)
                {
                    CategoryOptions[i].Click();
                    Base.test.Log(LogStatus.Info, "Selected Category successfully");
                }
            }

            GlobalDefinitions.wait(2000);

            //select SubCategory
            SubCategory.Click();
            for (int i = 0; i < SubCategoryOptions.Count; i++)
            {
                if (GlobalDefinitions.ExcelLib.ReadData(2, "Sub Category") == SubCategoryOptions[i].Text)
                {
                    SubCategoryOptions[i].Click();
                    Base.test.Log(LogStatus.Info, "Selected Sub Category successfully");
                }
            }

            //Enter Tags
            Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags"));
            Tags.SendKeys(Keys.Enter);

            //Click Service Type

            if (GlobalDefinitions.ExcelLib.ReadData(2, "Service Type") == "One-off service")
            {
                OneOffServiceRadioBtn.Click();
                Base.test.Log(LogStatus.Info, "Selected Service Type successfully");
            }

            //Click Location Type
            if (GlobalDefinitions.ExcelLib.ReadData(2, "Location Type") == "On-site")
            {
                OnSiteRadioBtn.Click();
                Base.test.Log(LogStatus.Info, "Selected Location Type successfully");
            }

            //enter startDate
            StartDate.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Start Date"));
            Global.GlobalDefinitions.wait(1000);

            //enter EndDate
            if (!(string.IsNullOrEmpty(GlobalDefinitions.ExcelLib.ReadData(2, "End Date"))))
            {
                EndDate.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "End Date"));
            }

            //enter start time and end time and
            for (int i = 0; i < DaysLabel.Count; i++)
            {
                switch (DaysLabel[i].Text)
                {
                case "Mon":
                    if (!(string.IsNullOrEmpty(GlobalDefinitions.ExcelLib.ReadData(2, "Mon Start Time"))))
                    {
                        DaysCheckbox[i].Click();
                        StartTime[i].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Mon Start Time"));
                    }
                    if (!(string.IsNullOrEmpty(GlobalDefinitions.ExcelLib.ReadData(2, "Mon End Time"))))
                    {
                        EndTime[i].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Mon End Time"));
                    }
                    break;

                case "Tue":
                    if (!(string.IsNullOrEmpty(GlobalDefinitions.ExcelLib.ReadData(2, "Tue Start Time"))))
                    {
                        DaysCheckbox[i].Click();
                        Console.WriteLine("Inside tue if" + i + DaysLabel[i].Text);
                        StartTime[i].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tue Start Time"));
                    }
                    if (!(string.IsNullOrEmpty(GlobalDefinitions.ExcelLib.ReadData(2, "Tue End Time"))))
                    {
                        EndTime[i].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tue End Time"));
                    }
                    break;

                case "Wed":
                    //string.IsNullOrEmpty(var)
                    if (!(string.IsNullOrEmpty(GlobalDefinitions.ExcelLib.ReadData(2, "Wed Start Time"))))
                    {
                        DaysCheckbox[i].Click();
                        StartTime[i].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Wed Start Time"));
                    }
                    if (!(string.IsNullOrEmpty(GlobalDefinitions.ExcelLib.ReadData(2, "Wed End Time"))))
                    {
                        EndTime[i].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Wed End Time"));
                    }
                    break;

                case "Thu":
                    if (!(string.IsNullOrEmpty(GlobalDefinitions.ExcelLib.ReadData(2, "Thu Start Time"))))
                    {
                        DaysCheckbox[i].Click();
                        StartTime[i].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Thu Start Time"));
                    }
                    if (!(string.IsNullOrEmpty(GlobalDefinitions.ExcelLib.ReadData(2, "Thu Start Time"))))
                    {
                        EndTime[i].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Thu End Time"));
                    }
                    break;

                case "Fri":
                    if (!(string.IsNullOrEmpty(GlobalDefinitions.ExcelLib.ReadData(2, "Fri Start Time"))))
                    {
                        DaysCheckbox[i].Click();
                        StartTime[i].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Fri Start Time"));
                    }
                    if (!(string.IsNullOrEmpty(GlobalDefinitions.ExcelLib.ReadData(2, "Fri End Time"))))
                    {
                        EndTime[i].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Fri End Time"));
                    }
                    break;

                case "Sat":
                    if (!(string.IsNullOrEmpty(GlobalDefinitions.ExcelLib.ReadData(2, "Sat Start Time"))))
                    {
                        DaysCheckbox[i].Click();
                        StartTime[i].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Sat Start Time"));
                    }
                    if (!(string.IsNullOrEmpty(GlobalDefinitions.ExcelLib.ReadData(2, "Sat End Time"))))
                    {
                        EndTime[i].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Sat End Time"));
                    }
                    break;

                case "Sun":
                    if (!(string.IsNullOrEmpty(GlobalDefinitions.ExcelLib.ReadData(2, "sun Start Time"))))
                    {
                        DaysCheckbox[i].Click();
                        StartTime[i].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Sun Start Time"));
                    }
                    if (!(string.IsNullOrEmpty(GlobalDefinitions.ExcelLib.ReadData(2, "Sun End Time"))))
                    {
                        EndTime[i].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Sun End Time"));
                    }
                    break;

                default: break;
                }
            }


            //Click SkillTrade

            if (GlobalDefinitions.ExcelLib.ReadData(2, "Skill Trade") == "Skill-exchange")
            {
                if (SkillExchangeRadioBtn.Selected == true)
                {
                    Console.WriteLine("we are in if SkillExchangeRadioBtn.Selected == true");
                    SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill Exchange"));
                    SkillExchange.SendKeys(Keys.Enter);
                    Base.test.Log(LogStatus.Info, "Added skill Exchange successfully");
                }
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "Skill Trade") == "Credit")
            {
                CreditRadioBtn.Click();
                Credit.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Credit"));
                Base.test.Log(LogStatus.Info, "Added credit successfully");
            }

            //Approach 1: upload worksamples- if input field(text box) is present
            //WorkSamples.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2,"Work Samples"));
            //GlobalDefinitions.wait(3000);

            //Approach 2: Using AutoIT

            WorkSamples.Click();
            AutoItX3 autoIT = new AutoItX3();

            autoIT.WinActivate("Open");
            Thread.Sleep(1000);
            //autoIT.Send("C:\\Users\\gredd\\Desktop\\test.txt");
            autoIT.Send(GlobalDefinitions.ExcelLib.ReadData(2, "Work Samples"));
            Thread.Sleep(1000);
            autoIT.Send("{ENTER}");

            //Click Active status
            if (GlobalDefinitions.ExcelLib.ReadData(2, "Active") == "Hidden")
            {
                HiddenRadioBtn.Click();
                Base.test.Log(LogStatus.Info, "Selected status successfully");
            }

            //click save
            Save.Click();
            Base.test.Log(LogStatus.Info, "Saved Service successfully");
        }
Esempio n. 9
0
        public void AddNewSkill()
        {
            #region Navigate to Share Skills Page
            // Click on Share Skills Page
            ShareSkill.WaitForElementClickable(_driver, 60);
            ShareSkill.Click();
            //Populate the excel data
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkills");

            #endregion


            #region Enter Title
            Title.WaitForElementClickable(_driver, 60);
            //Enter the data in Title textbox
            Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "title"));

            #endregion

            #region Enter Description

            //Enter the data in Description textbox
            Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "EnterDescription"));


            #endregion

            #region Category Drop Down

            // Click on Category Dropdown
            Category.Click();


            // Select Category from Category Drop Down
            var SelectElement = new SelectElement(Category);
            SelectElement.SelectByText((GlobalDefinitions.ExcelLib.ReadData(2, "category")));

            // Click on Sub-Category Dropdown
            SubCategory.Click();

            //Select Sub-Category from the Drop Down
            var SelectElement1 = new SelectElement(SubCategory);
            SelectElement1.SelectByText((GlobalDefinitions.ExcelLib.ReadData(2, "subcategory")));
            #endregion

            #region Tags
            // Eneter Tag
            Tag.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "TagName"));
            Tag.SendKeys(Keys.Enter);

            #endregion

            #region Service Type Selection

            // Service Type Selection

            if (GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType") == "Hourly basis service")
            {
                ServiceTypeHourly.Click();
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType") == "One-off service")
            {
                ServiceTypeOnOff.Click();
            }
            #endregion

            #region Select Location Type
            // Location Type Selection

            if (GlobalDefinitions.ExcelLib.ReadData(2, "SelectLocationType") == "On-site")
            {
                LocationTypeOnsite.Click();
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "SelectLocationType") == "Online")
            {
                LocationTypeOnline.Click();
            }
            #endregion

            #region Select Available Dates from Calendar
            // Select Start Date
            StartDate.Click();
            // Select End Date
            EndDate.Click();
            #endregion


            #region Select Skill Trade
            // Select Skill Trade

            if (GlobalDefinitions.ExcelLib.ReadData(2, "SelectSkillTrade") == "Skill-exchange")
            {
                RequiredSkills.Click();
                RequiredSkills.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "ExchangeSkill"));
                RequiredSkills.SendKeys(Keys.Enter);
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "SelectSkillTrade") == "Credit")
            {
                CreditAmount.Click();
                CreditAmount.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "AmountInExchange"));
                CreditAmount.SendKeys(Keys.Enter);
            }
            #endregion

            #region Select User Status
            // Select User Status

            if (GlobalDefinitions.ExcelLib.ReadData(2, "UserStatus") == "Active")
            {
                StatusActive.Click();
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "UserStatus") == "Hidden")
            {
                StatusHidden.Click();
            }
            #endregion


            #region Add Work Sample

            //Work Sample upload button path
            IWebElement upload = _driver.FindElement(By.XPath("//*[@id='selectFile']"));

            // Uploading File path
            var    GetCurrentDirectory = Directory.GetCurrentDirectory();
            String path = GetCurrentDirectory + @"\MarsFramework\Upload Files\Samplework.txt";
            upload.SendKeys(path);



            #endregion

            #region Save / Cancel Skill
            // Save or Cancel New Skill

            if (Global.GlobalDefinitions.ExcelLib.ReadData(2, "SaveOrCancel") == "Save")
            {
                SaveShareSkills.Click();
            }
            else if (Global.GlobalDefinitions.ExcelLib.ReadData(2, "SaveOrCancel") == "Cancel")
            {
                CancelShareSkills.Click();
            }
            #endregion


            #region Check whether New  skill created sucessfully

            string ShareSkillSucess = _driver.FindElement(By.LinkText("Manage Listings")).Text;

            if (ShareSkillSucess == "Manage Listings")
            {
                Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Shared Skill Successful");
            }
            else
            {
                Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Share Skill Unsuccessful");
            }
            #endregion
        }
Esempio n. 10
0
        //public void AddNewShareSkill()

        internal void AddNewSkill()
        {
            {
                #region Enter the deatils

                //Click on Share Skill button
                Thread.Sleep(1000);
                ShareSkills.Click();
                Thread.Sleep(1000);

                //Populate the excel data
                GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkills");

                // Enter Title
                Title.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Title"));
                Base.test.Log(LogStatus.Info, "Title has been successfully entered");

                //Enter description
                Description.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Description"));
                Base.test.Log(LogStatus.Info, "Description has been successfully entered");

                //click on category dropdown menu
                Thread.Sleep(500);
                Category.Click();
                Thread.Sleep(1000);


                //Select the category
                Thread.Sleep(500);
                ProgrammingandTech.Click();
                Thread.Sleep(500);



                //Click on subcatogory drop down option
                Thread.Sleep(1000);
                SubCategory.Click();

                //Select the Sub-Category option
                Thread.Sleep(500);
                QA.Click();
                Thread.Sleep(500);

                //Enter Tags
                Tags.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Tags"));
                Tags.SendKeys(Keys.Enter);
                Base.test.Log(LogStatus.Info, "TagName has been successfully entered");

                //Select service type
                //ServiceTypeHourly.Click();

                if (GlobalDefinitions.ExcelLib.ReadData(2, "Service Type") == "Hourly basis service")
                {
                    ServiceTypeHourly.Click();
                }
                else if (GlobalDefinitions.ExcelLib.ReadData(2, "Service Type") == "One-off service")
                {
                    ServiceTypeOneOff.Click();
                }

                //Select Location Type
                //LocationTypeOnline.Click();
                if (GlobalDefinitions.ExcelLib.ReadData(2, "Location Type") == "Online")
                {
                    LocationTypeOnline.Click();
                }
                else if (GlobalDefinitions.ExcelLib.ReadData(2, "Location Type") == "On-site")
                {
                    LocationTypeOnsite.Click();
                }



                //Select the date
                Thread.Sleep(1000);
                StartDate.SendKeys(Keys.Delete);
                Thread.Sleep(2000);

                StartDate.SendKeys(Keys.Backspace);
                Thread.Sleep(1000);
                StartDate.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Start Date"));
                Console.WriteLine("Start date is : " + GlobalDefinitions.ExcelLib.ReadData(2, "Start Date"));

                //StartDate.SendKeys("25-07-2019");

                ////Select the end Date
                //EndDate.SendKeys("21-08-2019");
                Thread.Sleep(1000);
                EndDate.SendKeys(Keys.Delete);

                EndDate.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "End Date"));
                Thread.Sleep(2000);
                Console.WriteLine("End date is : " + GlobalDefinitions.ExcelLib.ReadData(2, "End Date"));
                //Select the Days available


                SelectDays.Click();
                Thread.Sleep(500);

                //Select starttime
                Thread.Sleep(1000);
                StartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Start Time"));
                Thread.Sleep(2000);
                Console.WriteLine("Start Time is : " + GlobalDefinitions.ExcelLib.ReadData(2, "Start Time"));
                //StartTime.SendKeys("12:00PM");

                //Select EndTime
                Thread.Sleep(1000);
                EndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "End Time"));
                Console.WriteLine("End Time is : " + GlobalDefinitions.ExcelLib.ReadData(2, "End Time"));
                //EndTime.SendKeys("3:00PM");

                //Select Skill Trade
                Credit.Click();
                Thread.Sleep(500);
                if (GlobalDefinitions.ExcelLib.ReadData(2, "Skill Trade") == "Skill-exchange")
                {
                    Skillstrade.Click();
                    Skillstrade.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill Trade"));
                    Skillstrade.SendKeys(Keys.Enter);
                }
                else if (GlobalDefinitions.ExcelLib.ReadData(2, "Skill Trade") == "Credit")
                {
                    CreditAmount.Click();
                    CreditAmount.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Credit Amount"));
                    CreditAmount.SendKeys(Keys.Enter);

                    //Enter credit amount
                    // CreditAmount.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Credit Amount"));

                    //Select the stats
                    // StatusActive.Click();
                    //Thread.Sleep(500);

                    //select Work Sample
                    Sample.Click();

                    AutoItX3 fileupload = new AutoItX3();
                    fileupload.WinActivate("Open");
                    Thread.Sleep(3000);
                    fileupload.Send(@"C:\Users\harpr\OneDrive\Documents\Testing.jpg");
                    Thread.Sleep(1000);
                    fileupload.Send("{ENTER}");


                    //Thread.Sleep(4000);



                    Console.WriteLine("File has been uploaded successfully");

                    if (GlobalDefinitions.ExcelLib.ReadData(2, "Status") == "Active")
                    {
                        Active.Click();
                    }
                    else if (GlobalDefinitions.ExcelLib.ReadData(2, "Status") == "Hidden")
                    {
                        Hidden.Click();
                    }

                    //Save the Share Skill
                    Thread.Sleep(500);
                    Save.Click();
                    Thread.Sleep(500);


                    //Verify if newShared skill is saved
                    Thread.Sleep(3000);
                    string ShareSkillSucess = Global.GlobalDefinitions.driver.FindElement(By.XPath("//th[contains(text(),'Image')]")).Text;

                    if (ShareSkillSucess == "Image")
                    {
                        Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Saved Skill Successful");
                    }
                    else
                    {
                        Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Saving Skill Unsuccessful");
                    }
                }
            }
            #endregion
        }
        public void EditSkill()
        {
            #region populate excel

            //Populate the excel data
            GlobalDefinitions.ExcelLib.PopulateInCollection(MarsResources.ExcelPath, "Managelisting");
            #endregion

            #region Enter Title
            Title.WaitForElementClickable(Global.Base.driver, 60);
            //Enter the data in Title textbox
            Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "title"));
            #endregion

            #region Enter Description
            //Enter the data in Description textbox
            Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "EnterDescription"));
            #endregion

            #region Category Drop Down

            // Click on Category Dropdown
            Category.Click();
            Thread.Sleep(1000);
            // Select Category from Category Drop Down
            var selectElement = new SelectElement(Category);
            selectElement.SelectByIndex(3);
            // Click on Sub-Category Dropdown
            SubCategory.Click();
            Thread.Sleep(1000);
            //Select Sub-Category from the Drop Down
            var SelectElement1 = new SelectElement(SubCategory);
            SelectElement1.SelectByIndex(4);
            #endregion

            #region Tags
            // Eneter Tag
            Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "TagName"));
            Tags.SendKeys(Keys.Enter);
            Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "TagName"));
            Tags.SendKeys(Keys.Enter);
            #endregion

            #region Service Type Selection
            // Service Type Selection
            if (GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType") == "Hourly basis service")
            {
                ServiceTypeHourly.Click();
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType") == "One-off service")
            {
                ServiceTypeOnOff.Click();
            }
            #endregion

            #region Select Location Type
            // Location Type Selection

            if (GlobalDefinitions.ExcelLib.ReadData(2, "SelectLocationType") == "On-site")
            {
                LocationTypeOnsite.Click();
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "SelectLocationType") == "Online")
            {
                LocationTypeOnline.Click();
            }
            #endregion

            #region Select Available Dates from Calendar
            // Select Start Date
            //StartDate.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "StartDate"));
            // Select End Date
            EndDate.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "EndDate"));
            // select available days and start time and End time
            for (int i = 2; i < 9; i++)
            {
                for (int j = 2; j < 9; j++)
                {
                    for (int k = 2; k < 9; k++)
                    {
                        IWebElement SatrtTime     = driver.FindElement(By.XPath("//div[" + i + "]/div[2]/input"));
                        IWebElement EndTime       = driver.FindElement(By.XPath("//div[" + j + "]/div[3]/input"));
                        IWebElement AvailableDays = driver.FindElement(By.XPath("//div[7]/div[2]/div/div[" + k + "]/div[1]/div/input"));
                        if (i == 2 && j == 2 && k == 2)
                        {
                            AvailableDays.Click();
                            SatrtTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "StartTime"));
                            EndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "EndTime"));
                        }
                        if (i == 3 && j == 3 && k == 3)
                        {
                            AvailableDays.Click();
                            SatrtTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "StartTime"));
                            EndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "EndTime"));
                        }
                        if (i == 4 && j == 4 && k == 4)
                        {
                            AvailableDays.Click();
                            SatrtTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(4, "StartTime"));
                            EndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(4, "EndTime"));
                        }
                    }
                }
            }
            #endregion
            #region Select Skill Trade
            // Select Skill Trade
            if (GlobalDefinitions.ExcelLib.ReadData(2, "SelectSkillTrade") == "Skill-exchange")
            {
                SkillExchange.Click();
                RequiredSkills.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "ExchangeSkill"));
                RequiredSkills.SendKeys(Keys.Enter);
                RequiredSkills.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "ExchangeSkill"));
                RequiredSkills.SendKeys(Keys.Enter);
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "SelectSkillTrade") == "Credit")
            {
                CreditAmount.Click();
                CreditAmount.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "AmountInExchange"));
                CreditAmount.SendKeys(Keys.Enter);
            }
            #endregion

            #region Select User Status
            // Select User Status

            if (GlobalDefinitions.ExcelLib.ReadData(2, "UserStatus") == "Active")
            {
                StatusActive.Click();
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "UserStatus") == "Hidden")
            {
                StatusHidden.Click();
            }
            #endregion

            #region Add Work Sample
            //Click on Work sample
            WorkSample.Click();
            //AutoIT
            AutoItX3 AutoIt = new AutoItX3();
            AutoIt.WinActivate("Open");
            Thread.Sleep(3000);
            AutoIt.Send(@"A:\AdvanceTask\StandardTask\TW.docx");
            Thread.Sleep(2000);
            AutoIt.Send("{ENTER}");
            #endregion

            #region Save / Cancel Skill
            // Save or Cancel New Skill
            if (Global.GlobalDefinitions.ExcelLib.ReadData(2, "SaveOrCancel") == "Save")
            {
                Save.Click();
            }
            else if (Global.GlobalDefinitions.ExcelLib.ReadData(2, "SaveOrCancel") == "Cancel")
            {
                Cancel.Click();
            }
            #endregion

            Thread.Sleep(3000);
            #region Check whether New  skill updated sucessfully

            //String expectedValue = GlobalDefinitions.ExcelLib.ReadData(2, "title");
            // Validate view listing through Page title
            String actualTitle = driver.Title;

            // Assert.AreEqual(actualTitle, "ListingManagement");

            if (actualTitle == "ListingManagement")
            {
                Assert.IsTrue(true);
                Global.Base.test.Log(Status.Pass, "Shared Skill Successful");
                SaveScreenShotClass.SaveScreenshot(driver, "AddShareSkill");
            }
            else
            {
                Console.WriteLine("Test failed");
                SaveScreenShotClass.SaveScreenshot(driver, "FailedAddShareSkill");
                Global.Base.test.Log(Status.Fail, "Share Skill Unsuccessful");
            }
            #endregion
        }
Esempio n. 12
0
        public void EditSkill()
        {
            #region populate excel

            //Populate the excel data
            GlobalDefinitions.ExcelLib.PopulateInCollection(MarsResources.ExcelPath, "Managelisting");
            #endregion

            #region Enter Title
            Title.WaitForElementClickable(Global.Base.driver, 60);
            //Enter the data in Title textbox
            Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "title"));
            #endregion

            #region Enter Description
            //Enter the data in Description textbox
            Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "EnterDescription"));
            #endregion

            #region Category Drop Down

            // Click on Category Dropdown
            Category.Click();
            Thread.Sleep(1000);
            // Select Category from Category Drop Down
            var selectElement = new SelectElement(Category);
            selectElement.SelectByIndex(3);
            // Click on Sub-Category Dropdown
            SubCategory.Click();
            Thread.Sleep(1000);
            //Select Sub-Category from the Drop Down
            var SelectElement1 = new SelectElement(SubCategory);
            SelectElement1.SelectByIndex(4);
            #endregion

            #region Tags
            // Eneter Tag
            Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "TagName"));
            Tags.SendKeys(Keys.Enter);
            Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "TagName"));
            Tags.SendKeys(Keys.Enter);
            #endregion

            #region Service Type Selection
            // Service Type Selection
            if (GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType") == "Hourly basis service")
            {
                ServiceTypeHourly.Click();
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType") == "One-off service")
            {
                ServiceTypeOnOff.Click();
            }
            #endregion

            #region Select Location Type
            // Location Type Selection

            if (GlobalDefinitions.ExcelLib.ReadData(2, "SelectLocationType") == "On-site")
            {
                LocationTypeOnsite.Click();
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "SelectLocationType") == "Online")
            {
                LocationTypeOnline.Click();
            }
            #endregion

            #region Select Available Dates from Calendar
            // Select Start Date
            //StartDate.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "StartDate"));
            // Select End Date
            EndDate.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "EndDate"));

            // select available days and start time and End time


            IList <IWebElement> Sttim = driver.FindElements(By.Name("StartTime"));
            IList <IWebElement> Edtim = driver.FindElements(By.Name("EndTime"));
            IList <IWebElement> Ckbx  = driver.FindElements(By.XPath("(//input[@name='Available'])"));

            if (Ckbx.Count != 0)
            {
                //Selecting checkboxes for days from Monday to Friday
                for (int i = 1; i <= Ckbx.Count - 2; i++)
                {
                    //Verify whether checkbox is not selected
                    if (!Ckbx.ElementAt(i).Selected)
                    {
                        Ckbx.ElementAt(i).Click();
                    }
                    //Validating the Count

                    Sttim.ElementAt(i).SendKeys(GlobalDefinitions.ExcelLib.ReadData(i + 1, "StartTime"));
                    Thread.Sleep(2000);
                    Edtim.ElementAt(i).SendKeys(GlobalDefinitions.ExcelLib.ReadData(i + 1, "EndTime"));
                    Thread.Sleep(2000);
                }
            }

            #endregion
            #region Select Skill Trade
            // Select Skill Trade
            if (GlobalDefinitions.ExcelLib.ReadData(2, "SelectSkillTrade") == "Skill-exchange")
            {
                SkillExchange.Click();
                RequiredSkills.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "ExchangeSkill"));
                RequiredSkills.SendKeys(Keys.Enter);
                RequiredSkills.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "ExchangeSkill"));
                RequiredSkills.SendKeys(Keys.Enter);
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "SelectSkillTrade") == "Credit")

            {
                Credit.Click();
                CreditAmount.Click();
                string input = GlobalDefinitions.ExcelLib.ReadData(2, "AmountInExchange");

                int result = Int32.Parse(input);

                if (result >= 10)
                {
                    SaveScreenShotClass.SaveScreenshot(driver, "More than One digit not Possible");
                    Global.Base.test.Log(Status.Fail, "Two Digit not Added ");
                    Assert.Fail("Entering more than One digit not Possible");
                }
                else
                {
                    CreditAmount.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "AmountInExchange"));
                    CreditAmount.SendKeys(Keys.Enter);
                }
            }
            #endregion

            #region Select User Status
            // Select User Status

            if (GlobalDefinitions.ExcelLib.ReadData(2, "UserStatus") == "Active")
            {
                StatusActive.Click();
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "UserStatus") == "Hidden")
            {
                StatusHidden.Click();
            }
            #endregion



            #region Save / Cancel Skill
            // Save or Cancel New Skill
            if (Global.GlobalDefinitions.ExcelLib.ReadData(2, "SaveOrCancel") == "Save")
            {
                Save.Click();
            }
            else if (Global.GlobalDefinitions.ExcelLib.ReadData(2, "SaveOrCancel") == "Cancel")
            {
                Cancel.Click();
            }
            #endregion

            Thread.Sleep(3000);
            #region Check whether New  skill updated sucessfully

            //String expectedValue = GlobalDefinitions.ExcelLib.ReadData(2, "title");
            // Validate view listing through Page title
            String actualTitle = driver.Title;

            // Assert.AreEqual(actualTitle, "ListingManagement");

            if (actualTitle == "ListingManagement")
            {
                Assert.IsTrue(true);
                Global.Base.test.Log(Status.Pass, "Shared Skill Successful");
                SaveScreenShotClass.SaveScreenshot(driver, "AddShareSkill");
            }
            else
            {
                Console.WriteLine("Test failed");
                SaveScreenShotClass.SaveScreenshot(driver, "FailedAddShareSkill");
                Global.Base.test.Log(Status.Fail, "Share Skill Unsuccessful");
            }
            #endregion
        }
Esempio n. 13
0
        public void AddNewSkill()
        {
            #region Navigate to Share Skills Page
            // Click on Share Skills Page
            ShareSkill.WaitForElementClickable(Global.Base.driver, 60);
            ShareSkill.Click();
            //Populate the excel data
            GlobalDefinitions.ExcelLib.PopulateInCollection(MarsResources.ExcelPath, "ShareSkills");
            #endregion

            #region Enter Title
            Title.WaitForElementClickable(Global.Base.driver, 60);
            //Enter the data in Title textbox
            Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "title"));
            #endregion

            #region Enter Description
            //Enter the data in Description textbox
            Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "EnterDescription"));
            #endregion

            #region Category Drop Down

            // Click on Category Dropdown
            Category.Click();
            // Select Category from Category Drop Down
            var SelectElement = new SelectElement(Category);
            SelectElement.SelectByText((GlobalDefinitions.ExcelLib.ReadData(2, "category")));
            // Click on Sub-Category Dropdown
            SubCategory.Click();
            //Select Sub-Category from the Drop Down
            var SelectElement1 = new SelectElement(SubCategory);
            SelectElement1.SelectByText((GlobalDefinitions.ExcelLib.ReadData(2, "subcategory")));
            #endregion

            #region Tags
            // Eneter Tag
            Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "TagName"));
            Tags.SendKeys(Keys.Enter);
            Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "TagName"));
            Tags.SendKeys(Keys.Enter);
            #endregion

            #region Service Type Selection
            // Service Type Selection
            if (GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType") == "Hourly basis service")
            {
                ServiceTypeHourly.Click();
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType") == "One-off service")
            {
                ServiceTypeOnOff.Click();
            }
            #endregion

            #region Select Location Type
            // Location Type Selection

            if (GlobalDefinitions.ExcelLib.ReadData(2, "SelectLocationType") == "On-site")
            {
                LocationTypeOnsite.Click();
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "SelectLocationType") == "Online")
            {
                LocationTypeOnline.Click();
            }
            #endregion

            #region Select Available Dates from Calendar
            // Select Start Date
            //StartDate.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "StartDate"));
            // Select End Date

            EndDate.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "EndDate"));

            // select available days and start time and End time

            // select available days and start time and End time
            Thread.Sleep(3000);
            IList <IWebElement> Sttim = driver.FindElements(By.Name("StartTime"));

            IList <IWebElement> Edtim = driver.FindElements(By.Name("EndTime"));
            //Driver.FindElements(By.Name("EndTime"));
            IList <IWebElement> Ckbx = driver.FindElements(By.XPath("(//input[@name='Available'])"));

            if (Ckbx.Count != 0)
            {
                //Selecting checkboxes for days from Monday to Friday
                for (int i = 1; i <= Ckbx.Count - 2; i++)
                {
                    //Verify whether checkbox is not selected
                    if (!Ckbx.ElementAt(i).Selected)
                    {
                        Ckbx.ElementAt(i).Click();
                    }
                    Console.WriteLine(driver);
                    //Validating the Count


                    Sttim.ElementAt(i).SendKeys(GlobalDefinitions.ExcelLib.ReadData(i + 1, "StartTime"));
                    // Sttim.ElementAt(i).SendKeys("10:00");


                    /*  var Svalue = Sttim.ElementAt(i).GetAttribute("value");
                     * Console.WriteLine(Svalue);
                     * Sttim.ElementAt(i).SendKeys(Svalue);*/

                    Thread.Sleep(2000);
                    // Sttim.ElementAt(i).Clear();
                    Edtim.ElementAt(i).SendKeys(GlobalDefinitions.ExcelLib.ReadData(i + 1, "EndTime"));
                    // Edtim.ElementAt(i).SendKeys("18:00");
                    Thread.Sleep(2000);
                }
            }



            #endregion
            #region Select Skill Trade
            // Select Skill Trade
            if (GlobalDefinitions.ExcelLib.ReadData(2, "SelectSkillTrade") == "Skill-exchange")
            {
                SkillExchange.Click();
                RequiredSkills.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "ExchangeSkill"));
                RequiredSkills.SendKeys(Keys.Enter);
                RequiredSkills.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "ExchangeSkill"));
                RequiredSkills.SendKeys(Keys.Enter);
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "SelectSkillTrade") == "Credit")
            {
                CreditAmount.Click();
                CreditAmount.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "AmountInExchange"));
                CreditAmount.SendKeys(Keys.Enter);
            }
            #endregion

            #region Select User Status
            // Select User Status

            if (GlobalDefinitions.ExcelLib.ReadData(2, "UserStatus") == "Active")
            {
                StatusActive.Click();
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "UserStatus") == "Hidden")
            {
                StatusHidden.Click();
            }
            #endregion



            #region Save / Cancel Skill
            // Save or Cancel New Skill
            if (Global.GlobalDefinitions.ExcelLib.ReadData(2, "SaveOrCancel") == "Save")
            {
                Save.Click();
            }
            else if (Global.GlobalDefinitions.ExcelLib.ReadData(2, "SaveOrCancel") == "Cancel")
            {
                Cancel.Click();
            }
            #endregion
            Thread.Sleep(3000);
            #region Check whether New  skill created sucessfully

            //String expectedValue = GlobalDefinitions.ExcelLib.ReadData(2, "title");
            String actualTitle = driver.Title;
            //string ShareSkillSucess = Driver.FindElement(By.TagName("h2")).Text;
            if (actualTitle == "ListingManagement")
            {
                Assert.IsTrue(true);
                Global.Base.test.Log(Status.Pass, "Shared Skill Successful");
                SaveScreenShotClass.SaveScreenshot(driver, "AddShareSkill");
            }
            else
            {
                Console.WriteLine("Test failed");
                SaveScreenShotClass.SaveScreenshot(driver, "FailedAddShareSkill");
                Global.Base.test.Log(Status.Fail, "Share Skill Unsuccessful");
            }
            #endregion
        }