Ejemplo n.º 1
0
        internal void Service_Location(int dataRow)
        {
            string ServiceType = GlobalDefinitions.ExcelLib.ReadData(dataRow, "ServiceType");

            if (ServiceType == "Hourly basis service")
            {
                ServiceHourly.Click();
            }
            else
            {
                ServiceOneOff.Click();
            }

            string LocationType = GlobalDefinitions.ExcelLib.ReadData(dataRow, "LocationType");

            if (LocationType == "On-site")
            {
                LocationOnSite.Click();
            }
            else
            {
                LocationOnline.Click();
            }
        }
Ejemplo n.º 2
0
        internal void clickRadioBtn(int dataRow)
        {
            string serviceType = GlobalDefinitions.ExcelLib.ReadData(dataRow, "ServiceType");

            if (serviceType == "One-off service")
            {
                ServiceOneOff.Click();
            }
            else
            {
                ServiceHourly.Click();
            }

            string LocationType = GlobalDefinitions.ExcelLib.ReadData(dataRow, "LocationType");

            if (LocationType == "On-site")
            {
                LocationOnSite.Click();
            }
            else
            {
                LocationOnline.Click();
            }
        }
Ejemplo n.º 3
0
        internal bool ShareSkill()
        {
            try
            {
                //Populate From Excel
                GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill");
                Thread.Sleep(2000);

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

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

                Thread.Sleep(2000);
                //Select Category
                SelectElement Categories = new SelectElement(Category);
                Categories.SelectByText(ExcelLib.ReadData(2, "Category"));

                //select Sub category
                SelectElement SubCategories = new SelectElement(Subcategory);
                SubCategories.SelectByText(ExcelLib.ReadData(2, "Subcategory"));

                Thread.Sleep(2000);
                //Enter Tags
                TagInner.SendKeys(ExcelLib.ReadData(2, "Tags"));
                TagInner.SendKeys(Keys.Enter);

                //Service type
                string ServiceToSelect = ExcelLib.ReadData(2, "ServiceType");
                if (ServiceToSelect == "One-off service")
                {
                    ServiceOne.Click();
                }
                else if (ServiceToSelect == "Hourly basis service")
                {
                    ServiceHourly.Click();
                }

                //select Location type
                string Locationtype = ExcelLib.ReadData(2, "LocationType");
                if (Locationtype == "On-site")
                {
                    LocationOnsite.Click();
                }
                else if (Locationtype == "Online")
                {
                    LocationOnline.Click();
                }
                Thread.Sleep(2000);
                string   SDate     = ExcelLib.ReadData(2, "StartDate");
                string[] SDateForm = SDate.Split(' ');

                StartDate.SendKeys(SDateForm[0]);

                string   EDate     = ExcelLib.ReadData(2, "EndDate");
                string[] EDateForm = EDate.Split(' ');

                EndDate.SendKeys(EDateForm[0]);

                Thread.Sleep(2000);
                string days           = ExcelLib.ReadData(2, "AvailableDays");
                string DaysToLwercase = days.ToLower();

                string[] Dayslist = DaysToLwercase.Split(',');
                int      count    = Dayslist.Count();

                string   StartTimevalue = ExcelLib.ReadData(2, "StartTime");
                string[] Starttimelist  = StartTimevalue.Split(',');


                string   EndTimeValue = ExcelLib.ReadData(2, "EndTime");
                string[] EndTimelist  = EndTimeValue.Split(',');


                for (int i = 0; i <= count - 1; i++)
                {
                    if (Dayslist[i].ToLower() == "sunday")
                    {
                        GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='form-wrapper']//div[2]//div[1]//div[1]//input[1]")).Click();
                        IWebElement StartTime = GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='form-wrapper']//div[2]//div[2]//input[1]"));
                        IWebElement EndTime   = GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='form-wrapper']//div[2]//div[3]//input[1]"));
                        StartTime.SendKeys(Starttimelist[i]);
                        EndTime.SendKeys(EndTimelist[i]);
                    }
                    else if (Dayslist[i].ToLower() == "monday")
                    {
                        GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='form-wrapper']//div[3]//div[1]//div[1]//input[1]")).Click();
                        IWebElement StartTime = GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='form-wrapper']//div[3]//div[2]//input[1]"));
                        IWebElement EndTime   = GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='form-wrapper']//div[3]//div[3]//input[1]"));
                        StartTime.SendKeys(Starttimelist[i]);
                        EndTime.SendKeys(EndTimelist[i]);
                    }
                    else if (Dayslist[i].ToLower() == "tuesday")
                    {
                        GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='form-wrapper']//div[4]//div[1]//div[1]//input[1]")).Click();
                        IWebElement StartTime = GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='form-wrapper']//div[4]//div[2]//input[1]"));
                        IWebElement EndTime   = GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='form-wrapper']//div[4]//div[3]//input[1]"));
                        StartTime.SendKeys(Starttimelist[i]);
                        EndTime.SendKeys(EndTimelist[i]);
                    }

                    else if (Dayslist[i].ToLower() == "wednesday")
                    {
                        GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='form-wrapper']//div[5]//div[1]//div[1]//input[1]")).Click();
                        IWebElement StartTime = GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='form-wrapper']//div[5]//div[2]//input[1]"));
                        IWebElement EndTime   = GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='form-wrapper']//div[5]//div[3]//input[1]"));
                        StartTime.SendKeys(Starttimelist[i]);
                        EndTime.SendKeys(EndTimelist[i]);
                    }

                    else if (Dayslist[i].ToLower() == "thursday")
                    {
                        GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='form-wrapper']//div[6]//div[1]//div[1]//input[1]")).Click();
                        IWebElement StartTime = GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='form-wrapper']//div[6]//div[2]//input[1]"));
                        IWebElement EndTime   = GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='form-wrapper']//div[6]//div[3]//input[1]"));
                        StartTime.SendKeys(Starttimelist[i]);
                        EndTime.SendKeys(EndTimelist[i]);
                    }
                    else if (Dayslist[i].ToLower() == "friday")
                    {
                        GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='form-wrapper']//div[7]//div[1]//div[1]//input[1]")).Click();
                        IWebElement StartTime = GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='form-wrapper']//div[7]//div[2]//input[1]"));
                        IWebElement EndTime   = GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='form-wrapper']//div[7]//div[3]//input[1]"));
                        StartTime.SendKeys(Starttimelist[i]);
                        EndTime.SendKeys(EndTimelist[i]);
                    }

                    else if (Dayslist[i].ToLower() == "saturday")
                    {
                        GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='form-wrapper']//div[8]//div[1]//div[1]//input[1]")).Click();
                        IWebElement StartTime = GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='form-wrapper']//div[8]//div[2]//input[1]"));
                        IWebElement EndTime   = GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='form-wrapper']//div[8]//div[3]//input[1]"));
                        StartTime.SendKeys(Starttimelist[i]);
                        EndTime.SendKeys(EndTimelist[i]);
                    }
                }


                //select Skill trade
                string SkillTrade = ExcelLib.ReadData(2, "SkillTrade");
                if (SkillTrade == "Credit")
                {
                    Skillcredit.Click();
                    //Add credit
                    Credit.SendKeys(ExcelLib.ReadData(2, "Credit"));
                }
                else if (SkillTrade == "Skill-exchange")
                {
                    SkillExcha.Click();

                    //Add Skill Exchange
                    SkillExchange.SendKeys(ExcelLib.ReadData(2, "SkillExchange"));
                    SkillExchange.SendKeys(Keys.Enter);
                }

                Samples.Click();
                Thread.Sleep(2000);
                AutoItX3 file = new AutoItX3();
                file.WinActivate("Open");
                file.Send(ExcelLib.ReadData(2, "WorkSamples"));
                Thread.Sleep(1000);
                file.Send("{ENTER}");

                Thread.Sleep(2000);

                Save.Click();

                Thread.Sleep(2000);
                return(true);
            }

            catch (Exception e)
            {
                Base.test.Log(LogStatus.Fail, "Error in adding service" + e.Message);
                return(false);
            }
        }
        internal void Edit_InputData(int dataRow)
        {
            Thread.Sleep(2000);
            Title.Clear();
            Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title"));

            Description.Clear();
            Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description"));
            Thread.Sleep(2000);

            //CategoryDropDown.Clear();
            CategoryDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Category"));
            //CategoryDropDown.Click();

            Thread.Sleep(2000);
            SubCategoryDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory"));
            SubCategoryDropDown.Click();
            Tags.Clear();
            Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags"));
            Tags.SendKeys(Keys.Enter);
            Tags.Click();

            //Edit Service Type
            Thread.Sleep(2000);
            string ServiceType = GlobalDefinitions.ExcelLib.ReadData(dataRow, "ServiceType");

            if (ServiceType == "Hourly basis service")
            {
                ServiceHourly.Click();
            }
            else
            {
                ServiceOneOff.Click();
            }


            //Edit Location Type
            Thread.Sleep(2000);
            string LocationType = GlobalDefinitions.ExcelLib.ReadData(dataRow, "LocationType");

            if (LocationType == "Online")
            {
                LocationOnline.Click();
            }
            else
            {
                LocationOnSite.Click();
            }

            //Date and  time

            StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate"));
            // Fill End Date
            EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Enddate"));



            //Days.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Selectday"));

            //StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(dataRow, "Startdate") + Keys.Enter);
            //StartDateDropDown.Click();
            //EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(dataRow, "Enddate") + Keys.Enter);
            //EndDateDropDown.Click();



            StartTimeDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(dataRow, "StartTime") + Keys.Enter);
            StartTimeDropDown.Click();
            EndTimeDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(dataRow, "EndTime") + Keys.Enter);
            EndTimeDropDown.Click();

            SkillExchange.Click();
            SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(dataRow, "Skill-Exchange") + Keys.Enter);
            ActiveOption.Click();
            Thread.Sleep(2000);
        }