Exemplo n.º 1
0
        public void SearchSkill()
        {
            Global.ExcelLib.PopulateInCollection(Base.ExcelPath, "SearchSkill");
            GlobalDefinitions.Wait();
            TxtSearcSkill.SendKeys(ExcelLib.ReadData(2, "Category"));
            SearchIcon.Click();
            //Checking the right page
            Assert.AreEqual("Search", GlobalDefinitions.driver.Title);
            Base.test = Base.extent.StartTest("On Share Search page");
            TxtSubCategory.SendKeys(ExcelLib.ReadData(2, "SubCategory"));
            SearchUser.SendKeys(ExcelLib.ReadData(2, "SearchUser"));
            IList <IWebElement> optionsToSelect = GlobalDefinitions.driver.FindElements(By.XPath("//input[@placeholder='Search user']"));

            foreach (IWebElement options in optionsToSelect)
            {
                Console.WriteLine(options);
                if (options.Text.Equals(SearchUser))
                {
                    Console.WriteLine("Trying to select: " + SearchUser);
                    options.Click();
                    break;
                }
            }
            Onsite.Click();
            Online.Click();
            ShowAll.Click();
        }
Exemplo n.º 2
0
 internal void SelectLocationType()
 {
     //enter service type
     if (GlobalDefinitions.ExcelLib.ReadData(2, "LocationType") == "On-site")
     {
         Onsite.Click();
     }
     else
     {
         Online.Click();
     }
 }
Exemplo n.º 3
0
        internal void Filter()
        {
            GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//i[@class='search link icon']"));
            Searchlink.Click();

            GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("(//button[@class='ui button'])[1]"));
            Online.Click();
            GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("(//button[@class='ui button otherPage'])[last()-1]"));
            Navigatelast.Click();
            GlobalDefinitions.wait(40);
            ClickonlineSkill.Click();
            GlobalDefinitions.wait(60);
            String URL = GlobalDefinitions.driver.Url;

            Assert.AreEqual(URL, "http://192.168.99.100:5000/Account/Profile?id=5c621663bea4490005ebe9d2");
        }
Exemplo n.º 4
0
        internal void Addingdate()
        {
            Actions actions = new Actions(Global.GlobalDefinitions.driver);



            //Populate the Excel sheet
            Global.GlobalDefinitions.ExcelLib.PopulateInCollection(Global.Base.ExcelPath, "Share_Skill");

            //click on share skill
            SSbutton.Click();
            Thread.Sleep(2000);

            //Click on title
            Title.Click();
            Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title"));

            //clic on description
            Description.Click();
            Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description"));

            //Click on Category
            actions.MoveToElement(Category).Build().Perform();
            Thread.Sleep(1000);
            IList <IWebElement> Select_Cat = Category.FindElements(By.TagName("option"));

            Console.WriteLine("List of category" + Select_Cat);
            int categorycount = Select_Cat.Count;

            for (int i = 0; i < categorycount; i++)
            {
                if (Select_Cat[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Category"))
                {
                    Select_Cat[i].Click();
                    Console.WriteLine("Category is" + Select_Cat[i].Text);
                    Base.test.Log(LogStatus.Info, "Selected Category");
                }
            }

            //Click on Sub Category
            actions.MoveToElement(SubCategory).Build().Perform();
            Thread.Sleep(1000);
            IList <IWebElement> Select_SubCat = SubCategory.FindElements(By.TagName("option"));

            Console.WriteLine("List of category" + Select_SubCat);
            int Scategorycount = Select_SubCat.Count;

            for (int i = 0; i < Scategorycount; i++)
            {
                if (Select_SubCat[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Sub-Category"))
                {
                    Select_SubCat[i].Click();
                    Console.WriteLine("Category is" + Select_SubCat[i].Text);
                    Base.test.Log(LogStatus.Info, "Selected Category");
                }
            }

            //Add tags
            actions.MoveToElement(Tags).Build().Perform();
            string tag1 = GlobalDefinitions.ExcelLib.ReadData(2, "Tags");
            string tag2 = GlobalDefinitions.ExcelLib.ReadData(3, "Tags");
            string tag3 = GlobalDefinitions.ExcelLib.ReadData(4, "Tags");

            Tags.SendKeys(tag1);
            Tags.SendKeys(Keys.Enter);

            Thread.Sleep(2000);
            Tags2.Click();
            // actions.MoveToElement(Tags2).Build().Perform();
            Tags2.SendKeys(tag2);

            Thread.Sleep(1000);
            //actions.MoveToElement(Tags).Build().Perform();
            //Tags.SendKeys(tag3);



            //Select service type
            actions.MoveToElement(ServiceType).Build().Perform();
            IList <IWebElement> ST = ServiceType.FindElements(By.XPath("//div/input[@name='serviceType']/following-sibling :: label"));

            for (int i = 0; i < ST.Count; i++)
            {
                Console.WriteLine("service from web" + ST[i].Text);
                if (ST[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType"))
                {
                    HourlyService.Click();
                }
                else
                {
                    One_off_service.Click();
                }
                break;
            }

            //Select Location type
            actions.MoveToElement(LocationType).Build().Perform();
            IList <IWebElement> LT = ServiceType.FindElements(By.XPath("//div/input[@name='locationType']/following-sibling :: label"));

            for (int i = 0; i < LT.Count; i++)
            {
                Console.WriteLine("service from web" + LT[i].Text);
                if (LT[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "LocationType"))
                {
                    Onsite.Click();
                }
                else
                {
                    Online.Click();
                }
                break;
            }


            //Click on start date
            Startdate.Click();

            Thread.Sleep(1000);
            //Enter start date
            string s1 = Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartDate");

            string[] s = s1.Split(' ');
            Console.WriteLine("1st part of string:" + s[0]);
            Console.WriteLine("2nd part of string:" + s[1]);
            string SD = s[0];

            Startdate.SendKeys(SD);

            //click on enddate
            Enddate.Click();
            //Enter End date
            string E1 = Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndDate");

            string[] E = E1.Split(' ');
            Console.WriteLine("Enddate 1st part is:" + E[0]);
            Console.WriteLine("End date second part is:" + E[1]);
            string ED = E[0];

            Enddate.SendKeys(ED);

            Thread.Sleep(1000);
            //Enter day
            actions.MoveToElement(Days).Build().Perform();
            IList <IWebElement> Day_Name = Days.FindElements(By.XPath("//div[@class='ui checkbox']/input/following-sibling :: label"));

            Console.WriteLine("Days are" + Day_Name);
            IList <IWebElement> Day_check = Days.FindElements(By.XPath("//input[@tabindex='0' and @type='checkbox']"));

            Console.WriteLine("Day checkbox" + Day_check);
            Thread.Sleep(1000);
            int Day_Count      = Day_Name.Count;
            int DayCheck_Count = Day_check.Count;

            for (int i = 0; i < Day_Count; i++)
            {
                if (Day_Name[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Day"))
                {
                    int j = i;
                    Day_check[j].Click();
                    Console.WriteLine("selected day is" + Day_Name[i]);
                }
            }

            //Enter starttime
            Start_Time.Click();
            string t1 = Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartTime");

            Console.WriteLine("Starttime is:" + t1);
            Start_Time.SendKeys(t1);

            //Enter Endtime
            End_Time.Click();
            string ET = Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndTime");

            Console.WriteLine("Endtime is:" + ET);
            End_Time.SendKeys(ET);

            //Select SkillExchange
            actions.MoveToElement(Skill_trade).Build().Perform();
            IList <IWebElement> Skill_E = Skill_trade.FindElements(By.XPath("//div/input[@name='skillTrades']/following-sibling :: label"));
            int SkillCount = Skill_E.Count;

            Console.WriteLine("count of radio buttons:" + SkillCount);
            for (int i = 0; i < SkillCount; i++)
            {
                if (Skill_E[i].Text == GlobalDefinitions.ExcelLib.ReadData(3, "SkillTrade"))
                {
                    Console.WriteLine("Skil is" + Skill_E[i].Text);
                    Skill_Exchange.Click();
                    actions.MoveToElement(Add_tags).Build().Perform();
                    string Tag = GlobalDefinitions.ExcelLib.ReadData(2, "SkillExchange");
                    Add_tags.SendKeys(Tag);
                    Base.test.Log(LogStatus.Info, "Selected skill");
                }

                else
                {
                    Credit.Click();
                    actions.MoveToElement(Add_credit).Build().Perform();
                    string Cr = GlobalDefinitions.ExcelLib.ReadData(2, "Credit");
                    Add_credit.SendKeys(Cr);
                }
                break;
            }


            //Click on Worksample
            PlusIcon.Click();

            //Performing the upload file operation using AutoIT

            AutoItX3 autoIT = new AutoItX3();

            autoIT.WinActivate("Open");
            Thread.Sleep(3000);
            string sample1 = GlobalDefinitions.ExcelLib.ReadData(2, "WorkSample");

            Console.WriteLine("file path is" + sample1);
            Thread.Sleep(2000);
            autoIT.Send(@sample1);
            Thread.Sleep(3000);
            autoIT.Send("{Enter}");
            Thread.Sleep(2000);

            //Downloading the file
            Download.Click();

            //Deleting a file
            Delete.Click();
            Thread.Sleep(500);

            actions.MoveToElement(Active).Build().Perform();
            IList <IWebElement> Active_Name = Active.FindElements(By.XPath("//div[@class='ui radio checkbox']/input[@name='isActive']/following-sibling :: label"));

            Console.WriteLine("Days are" + Active_Name);
            IList <IWebElement> Active_radio = Active.FindElements(By.XPath("//input[@name='isActive' and @type='radio']"));

            Console.WriteLine("Day checkbox" + Active_radio);
            Thread.Sleep(1000);
            int Active_Count = Active_Name.Count;

            for (int i = 0; i < Active_Count; i++)
            {
                if (Active_Name[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Active"))
                {
                    int j = i;
                    Active_radio[j].Click();
                }
            }

            //click on save
            actions.MoveToElement(Buttons).Build().Perform();
            IList <IWebElement> BT = ServiceType.FindElements(By.XPath("//input[@type='button']"));

            for (int i = 0; i < BT.Count; i++)
            {
                Console.WriteLine("Button from web" + BT.Count);
                if (GlobalDefinitions.ExcelLib.ReadData(2, "Buttons") == "Save")
                {
                    Save.Click();
                }
                else
                {
                    Cancel.Click();
                }
                break;
            }


            string text = Global.GlobalDefinitions.driver.Title;

            if (text == "ServiceListing")
            {
                Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Share skill page");
            }
            else
            {
                Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Not valid page");
            }
        }
Exemplo n.º 5
0
        internal void EditShareSkill()
        {
            GlobalDefinitions.ExcelLib.PopulateInCollection(@"C:\Users\Rammy\Desktop\marsframework\MarsFramework\ExcelData\TestDataShareSkill.xlsx", "ShareSkill");
            GlobalDefinitions.wait(30);

            //Click on ShareSkill button
            ShareSkillButton.Click();

            //Wait
            GlobalDefinitions.wait(30);

            //Enter data in Title textbox
            Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Title"));
            string TitleTextbox = Title.GetAttribute("Value");

            if (TitleTextbox.Length == 0)
            {
                Assert.IsEmpty("Title");
            }

            //Enter data in Description textbox
            Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Description"));
            Assert.That(Description.Text, Is.EqualTo(GlobalDefinitions.ExcelLib.ReadData(3, "Description")));

            CategoryDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Category"));
            CategoryDropDown.Click();

            SubCategoryDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "SubCategory"));
            SubCategoryDropDown.Click();

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

            //Click on Hourly basis service or One-off service
            if (GlobalDefinitions.ExcelLib.ReadData(3, "Service Type") == "Hourly basis service")
            {
                Hourlybasisservice.Click();
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(3, "Service Type") == "One-off service")
            {
                OneOffservice.Click();
            }

            //Click on On-site or Online
            if (GlobalDefinitions.ExcelLib.ReadData(3, "Location Type") == "On-site")
            {
                OnSite.Click();
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(3, "Location Type") == "Online")
            {
                Online.Click();
            }

            //Wait
            GlobalDefinitions.wait(60);

            //Convert excel dateformat to C# - Enter data in Staredate
            string dateformat   = "dd / MM / yyyy";
            string sdate        = GlobalDefinitions.ExcelLib.ReadData(3, "Startdate");
            string newStartDate = DateTime.Parse(sdate).ToString(dateformat);

            StartDateDropDown.SendKeys(newStartDate);

            string StartDate = StartDateDropDown.GetAttribute("Value");

            if (StartDate.Length == 0)
            {
                Assert.IsEmpty("Startdate");
            }

            //Convert excel dateformat to C# - Enter data in Enddate
            string edate      = GlobalDefinitions.ExcelLib.ReadData(3, "Enddate");
            string newEndDate = DateTime.Parse(edate).ToString(dateformat);

            EndDateDropDown.SendKeys(newEndDate);

            string EndDate = EndDateDropDown.GetAttribute("Value");

            if (EndDate.Length == 0)
            {
                Assert.IsEmpty("Enddate");
            }

            //Wait
            GlobalDefinitions.wait(60);

            //Click on a day
            Days.Click();

            //Convert excel timeformat to C# - enter data in Starttime
            string timeformat   = "hh:mmtt";
            string stime        = GlobalDefinitions.ExcelLib.ReadData(3, "Starttime");
            string newStartTime = DateTime.Parse(stime).ToString(timeformat);

            StartTimeDropDown.SendKeys(newStartTime);

            string Start = StartTimeDropDown.GetAttribute("Value");

            if (Start.Length == 0)
            {
                Assert.IsEmpty("Starttime");
            }

            //Convert excel timeformat to C# - enter data in Endtime
            string etime      = GlobalDefinitions.ExcelLib.ReadData(3, "Endtime");
            string newEndTime = DateTime.Parse(etime).ToString(timeformat);

            EndTimeDropDown.SendKeys(newEndTime);

            string End = EndTimeDropDown.GetAttribute("Value");

            if (End.Length == 0)
            {
                Assert.IsEmpty("Endtime");
            }

            //Click on Skill-exchange or Credit
            if (GlobalDefinitions.ExcelLib.ReadData(3, "SkillTrade") == "Skill-exchange")
            {
                SkillExchangeOption.Click();
                SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange"));
                SkillExchange.SendKeys(Keys.Enter);
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(3, "SkillTrade") == "Credit")
            {
                CreditOption.Click();
                CreditAmount.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Credit"));
            }


            //Click on Active or Hidden
            ActiveOption.Click();
            if (GlobalDefinitions.ExcelLib.ReadData(3, "Active") == "Active")
            {
                ActiveOption.Click();
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(3, "Active") == "Hidden")
            {
                HiddenOption.Click();
            }

            //Upload a file
            WorkSample.Click();
            GlobalDefinitions.wait(20);
            string path = GlobalDefinitions.ExcelLib.ReadData(3, "WorkSample");

            AutoItX.WinActivate("File Upload");

            //Wait
            GlobalDefinitions.wait(60);

            AutoItX.Send(path);
            AutoItX.Send("{ENTER}");

            Save.Click();

            Assert.That(ManageTitle.Text, Is.EqualTo("Voice Actor"));
        }
Exemplo n.º 6
0
        internal void EnterShareSkill()
        {
            //Explicit wait
            GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//a[contains(.,'Share Skill')]"));

            //click shareskill
            ShareSkillButton.Click();

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

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

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

            // Select on Category Dropdown
            GlobalDefinitions.wait(10);
            SelectElement catg = new SelectElement(CategoryDropDown);

            catg.SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Category"));

            //Select on SubCategory Dropdown
            GlobalDefinitions.wait(10);
            SelectElement subcatg = new SelectElement(SubCategoryDropDown);

            subcatg.SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory"));

            //Enter Tag names in textbox
            Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags"));
            Tags.SendKeys(Keys.Return);

            //Select the Service type
            if (GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType") == "Hourly basis")
            {
                Hourly.Click();
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType") == "One-off")
            {
                Oneoff.Click();
            }

            //Select the Location type
            if (GlobalDefinitions.ExcelLib.ReadData(2, "LocationType") == "On-site")
            {
                Onsite.Click();
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "LocationType") == "Online")
            {
                Online.Click();
            }

            //Click on Start Date dropdown
            StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate"));

            //Click on End Date dropdown
            EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Enddate"));

            //Select available days
            Days.Click();

            //Select startTime
            StartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"));

            //select endtime
            EndTimeDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"));

            if (GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade") == "Skill-Exchange")
            {
                //select SkillTradeOption
                SkillTradeOption.Click();
                //Enter SkillExchange
                SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange"));
                SkillExchange.SendKeys(Keys.Return);
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade") == "Credit")
            {
                Credit.Click();
                Creditvalue.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Credit"));
                Creditvalue.SendKeys(Keys.Enter);
            }
            //Click worksample
            Worksample.Click();
            //Worksample.SendKeys("path");

            //upload file using AutoIT
            AutoItX3 autoit = new AutoItX3();

            //Activate so that next action happens on this window
            autoit.WinActivate("Open");
            //autoit.Send(@"D:\Shareskillmars\FileUploadScript.exe");
            autoit.Send(@"D:\Shareskillmars\sample.txt");
            autoit.Send("{ENTER}");
            Thread.Sleep(10000);

            //Select user option
            if (GlobalDefinitions.ExcelLib.ReadData(2, "UserStatus") == "Active")
            {
                StatusActive.Click();
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "UserStatus") == "Hidden")
            {
                StatusHidden.Click();
            }

            //click save or cancel
            if (Global.GlobalDefinitions.ExcelLib.ReadData(2, "SaveOrCancel") == "Save")
            {
                Save.Click();
            }
            else if (Global.GlobalDefinitions.ExcelLib.ReadData(2, "SaveOrCancel") == "Cancel")
            {
                Cancel.Click();
            }
        }
Exemplo n.º 7
0
        public void ShareskillListings()
        {
            //Populate the Excel Sheet
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill");
            Thread.Sleep(1000);

            //Click on Share Skill Button
            Shareskillbutton.Click();
            Thread.Sleep(1000);

            //Enter the Details
            //Enter Title from Excel Sheet
            Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title"));
            Thread.Sleep(1000);

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

            //Click on Category dropdown box
            Category.Click();
            Thread.Sleep(1000);
            //Select cartegory option from excel sheet by iterating the list of elements
            //I have declared CategoryOption as a IList<Iwebelement>
            int count = CategoryOption.Count;

            for (int i = 0; i < count; i++)
            {
                if (CategoryOption[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "CategoryOption"))
                {
                    CategoryOption[i].Click();
                }
            }

            Thread.Sleep(500);

            //Click on subcategory drop down box
            Subcategory.Click();
            Thread.Sleep(1000);

            //Click on 3 option from the dropdown
            int countsubcat = SubcategoryOption.Count;

            for (int i = 0; i < countsubcat; i++)
            {
                if (SubcategoryOption[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "SubCategoryOption"))
                {
                    SubcategoryOption[i].Click();
                }
            }
            Thread.Sleep(500);

            //Enter Tag from the Excel sheet
            Tag.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags"));
            Thread.Sleep(500);
            Tag.SendKeys(Keys.Enter);

            //Service Type as One-off service
            if (GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType") == "Oneoff service")
            {
                OneOffService.Click();
            }
            else
            {
                HourlyBasisService.Click();
            }
            Thread.Sleep(500);

            //Location Type as On-site
            if (GlobalDefinitions.ExcelLib.ReadData(2, "LocationType") == "Onsite")
            {
                OnSite.Click();
            }
            else
            {
                Online.Click();
            }
            Thread.Sleep(500);

            //Enter Strt and End dates of Available days
            startDate.Click();
            Thread.Sleep(500);
            startDate.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "StartDate"));
            Thread.Sleep(500);
            endDate.Click();
            endDate.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "EndDate"));
            Thread.Sleep(500);

            //Enter the Available days and their Start and End Time from the Excel Sheet
            String availabledays = GlobalDefinitions.ExcelLib.ReadData(2, "Available");
            String starttimes    = GlobalDefinitions.ExcelLib.ReadData(2, "StartTime");
            String endtimes      = GlobalDefinitions.ExcelLib.ReadData(2, "EndTime");

            String[] availabledaysarray = new String[] { };
            availabledaysarray = availabledays.Split(',');
            int arraycount = availabledaysarray.Count();

            String[] starttimesarray = new String[] { };
            starttimesarray = starttimes.Split(',');
            int starttimecount = starttimesarray.Count();


            String[] endtimesarray = new String[] { };
            endtimesarray = endtimes.Split(',');
            int endtimecount = endtimesarray.Count();

            for (int i = 0; i < arraycount; i++)
            {
                switch (availabledaysarray[i])
                {
                case "sun":
                    sunday.Click();
                    sunstarttime.SendKeys(starttimesarray[i]);
                    sunendTime.SendKeys(endtimesarray[i]);
                    break;

                case "mon":
                    monday.Click();
                    monstarttime.SendKeys(starttimesarray[i]);
                    monendTime.SendKeys(endtimesarray[i]);
                    break;

                case "tue":
                    tuesday.Click();
                    tuestarttime.SendKeys(starttimesarray[i]);
                    tueendTime.SendKeys(endtimesarray[i]);
                    break;

                case "wed":
                    wednesday.Click();
                    wedstarttime.SendKeys(starttimesarray[i]);
                    wedendTime.SendKeys(endtimesarray[i]);
                    break;

                case "thu":
                    thursday.Click();
                    thustarttime.SendKeys(starttimesarray[i]);
                    thuendTime.SendKeys(endtimesarray[i]);
                    break;

                case "fri":
                    friday.Click();
                    fristarttime.SendKeys(starttimesarray[i]);
                    friendTime.SendKeys(endtimesarray[i]);
                    break;

                case "sat":
                    saturday.Click();
                    satstarttime.SendKeys(starttimesarray[i]);
                    satendTime.SendKeys(endtimesarray[i]);
                    break;
                }
            }

            //Skill Trade as Credit/SkillExchange
            if (GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade") == "Credit")
            {
                credit.Click();
                Thread.Sleep(500);
                //Credit charge as 6 per hour from Excel sheet
                creditCharge.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "CreditCharges"));
                Thread.Sleep(500);
            }
            else
            {
                skillExchange.Click();
                Thread.Sleep(500);
                skillexchangetag.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "SkillExchangetag"));
                Thread.Sleep(500);
            }

            //Work samples
            workSample.Click();
            AutoItX3 autolt = new AutoItX3();

            autolt.WinActivate("Open");
            autolt.Send(GlobalDefinitions.ExcelLib.ReadData(2, "WorkSample"));
            //autolt.Send(@"E:\Competition Task1\Mars Automation framework\MarsFramework\MarsFramework\Empty.docx");
            Thread.Sleep(1000);
            autolt.Send("{ENTER}");


            //Set Active as Hidden/Active
            if (GlobalDefinitions.ExcelLib.ReadData(2, "ActiveService") == "Hidden")
            {
                Hidden.Click();
            }
            else
            {
                Active.Click();
            }

            //Save the form
            Save.Click();
            Thread.Sleep(1000);
        }
Exemplo n.º 8
0
        //[FindsBy(How = How.XPath, Using = "//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr/td[4]")]
        //private IWebElement ItemToDelete { get; set; }

        //[FindsBy(How = How.XPath, Using = "")]
        //private IWebElement  { get; set; }

        //[FindsBy(How = How.XPath, Using = "")]
        //private IWebElement  { get; set; }



        #endregion

        internal void AddSkill()
        {
            //Populate the Excel sheet
            Global.GlobalDefinitions.ExcelLib.PopulateInCollection(Global.Base.ExcelPath, "Skill");

            ShareSkillBtn.Click();
            Global.GlobalDefinitions.wait(5);

            TitleTextbox.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Title"));

            DescriptionTextbox.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Description"));

            CategoryDropdown.Click();
            var category      = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[3]/div[2]/div/div/select"));
            var selectElement = new SelectElement(category);

            selectElement.SelectByIndex(3);

            SubcategoryDropdown.Click();
            var subcategory    = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[3]/div[2]/div/div[2]/div[1]/select"));
            var selectElement1 = new SelectElement(subcategory);

            selectElement1.SelectByIndex(3);

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

            TagsTextbox1.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(3, "Tags"));
            TagsTextbox1.SendKeys(Keys.Enter);

            OneoffService.Click();
            Thread.Sleep(500);
            HourlyService.Click();
            Thread.Sleep(500);

            OnSite.Click();
            Thread.Sleep(500);
            Online.Click();


            StartdateTextbox.Click();
            StartdateTextbox.SendKeys(DateTime.Now.AddDays(5).ToString("dd/MM/yyyy"));

            EnddateTextbox.Click();
            EnddateTextbox.SendKeys(DateTime.Now.AddMonths(1).ToString("dd/MM/yyyy"));

            SunCheckBox.Click();
            SunStartTime.Click();
            SunStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartHour"));
            SunStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartMinutes"));
            SunStartTime.SendKeys(Keys.Up);
            SunEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndHour"));
            SunEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndMinutes"));
            SunEndTime.SendKeys(Keys.ArrowDown);

            MonCheckBox.Click();
            MonStartTime.Click();
            MonStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartHour"));
            MonStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartMinutes"));
            MonStartTime.SendKeys(Keys.Up);
            MonEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndHour"));
            MonEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndMinutes"));
            MonEndTime.SendKeys(Keys.ArrowDown);

            TueCheckBox.Click();
            TueStartTime.Click();
            TueStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartHour"));
            TueStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartMinutes"));
            TueStartTime.SendKeys(Keys.Up);
            TueEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndHour"));
            TueEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndMinutes"));
            TueEndTime.SendKeys(Keys.ArrowDown);

            WedCheckBox.Click();
            WedStartTime.Click();
            WedStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartHour"));
            WedStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartMinutes"));
            WedStartTime.SendKeys(Keys.Up);
            WedEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndHour"));
            WedEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndMinutes"));
            WedEndTime.SendKeys(Keys.ArrowDown);

            ThuCheckBox.Click();
            ThuStartTime.Click();
            ThuStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartHour"));
            ThuStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartMinutes"));
            ThuStartTime.SendKeys(Keys.Up);
            ThuEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndHour"));
            ThuEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndMinutes"));
            ThuEndTime.SendKeys(Keys.ArrowDown);

            FriCheckBox.Click();
            FriStartTime.Click();
            FriStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartHour"));
            FriStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartMinutes"));
            FriStartTime.SendKeys(Keys.Up);
            FriEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndHour"));
            FriEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndMinutes"));
            FriEndTime.SendKeys(Keys.ArrowDown);

            SatCheckBox.Click();
            SatStartTime.Click();
            SatStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartHour"));
            SatStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartMinutes"));
            SatStartTime.SendKeys(Keys.Up);
            SatEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndHour"));
            SatEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndMinutes"));
            SatEndTime.SendKeys(Keys.ArrowDown);

            SkillExchangeButton.Click();
            SkillExchangeTag.Click();
            SkillExchangeTag.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "SkillToExchange"));
            SkillExchangeTag.SendKeys(Keys.Enter);

            CreditButton.Click();
            CreditAmount.Click();
            CreditAmount.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "CreditAmount"));

            PlusCircleIcon.Click();


            //Upload file
            AutoItX3 autoIt = new AutoItX3();

            autoIt.WinActivate("Open");
            autoIt.Send(@"C:\Users\Nemesis\Pictures\TanslatePix\zodiac.jpg");
            Thread.Sleep(500);
            autoIt.Send("{ENTER}");

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

            AutoItX3 autoIt1 = new AutoItX3();

            autoIt1.WinActivate("Open");
            Thread.Sleep(500);
            autoIt1.Send(@"C:\Users\Nemesis\Pictures\TanslatePix\doggie.jpg");
            Thread.Sleep(500);
            autoIt1.Send("{ENTER}");

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

            HiddenRadioButton.Click();
            Thread.Sleep(1000);
            ActiveRadioButton.Click();

            SaveButton.Click();

            Global.GlobalDefinitions.wait(5);


            //Add Skill Verification
            ManageListingsTab.Click();

            Global.GlobalDefinitions.wait(5);

            string ExpectedText = Global.GlobalDefinitions.ExcelLib.ReadData(2, "Description");
            string ActualText   = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr/td[4]")).Text;

            if (ExpectedText.Equals(ActualText))
            {
                Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Add Skill Successful");
                String img = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "AddSkill_Pass");
                test.Log(LogStatus.Info, "Image example: " + img);
            }
            else
            {
                Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Add Skill UnSuccessful");
                String img1 = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "AddSkill_Fail");
                test.Log(LogStatus.Info, "Image example: " + img1);
            }
        }