internal void InputCategory(int dataRow)
 {
     CategoryDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Category"));
     SubCategoryDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory"));
     Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags"));
     Tags.SendKeys(Keys.Enter);
 }
Beispiel #2
0
        internal void FillDetails(int DataRow)
        {
            //Check if the user is able to Enter Text in the "Title" field
            EnterText(DataRow);

            //Check if the user is able to "Click" on the "Category" dropdown list
            CategoryDropDown.Click();
            CategoryDropDown.SendKeys(Keys.ArrowDown + Keys.Enter);

            //Check if the user is able to "Click" on the "SubCategory" dropdown list
            SubCategoryDropDown.Click();
            SubCategoryDropDown.SendKeys(Keys.ArrowDown + Keys.Enter);

            //Check if the user is able to "Enter" a "Tag"
            Tags.SendKeys(GlobalDefinitions.ReadData(DataRow, "Tag") + Keys.Enter);

            //Check if the user is able to "Click" on a "Service Type" option
            ServiceTypeOptions.Click();

            //Check if the user is able to "Click" on a "Location Type" option
            LocationTypeOption.Click();
        }
        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"));
        }
        //Edit the Existing share Skill
        internal void EditShareSkillData()
        {
            Extension.WaitForElementDisplayed(Driver, By.Name("title"), 5);
            //Clear the Title
            Title.Clear();

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

            //Clear the Description
            Description.Clear();

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

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

            //Select Sub-Category
            GlobalDefinitions.SelectDropDown(SubCategoryDropDown, "SelectByText", GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory"));

            //Clear the Entered tag
            foreach (IWebElement removeTag in RemoveTags)
            {
                removeTag.Click();
            }

            //Enter Tags
            Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags") + "\n");

            //Select Service Type
            GlobalDefinitions.SelectRadioButton(ServiceTypeOptions, GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType"), By.Name("serviceType"));

            //Select Location Type
            GlobalDefinitions.SelectRadioButton(LocationTypeOption, GlobalDefinitions.ExcelLib.ReadData(2, "LocationType"), By.Name("locationType"));

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

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

            //Clear the Available days data

            int DaysRows = Days.FindElements(By.Name("Available")).Count;

            for (int i = 1; i <= DaysRows; i++)
            {
                if (Days.FindElements(By.Name("Available"))[i - 1].Selected)
                {
                    Days.FindElements(By.Name("Available"))[i - 1].Click();
                    Days.FindElements(By.Name("StartTime"))[i - 1].SendKeys(Keys.Delete);
                    Days.FindElements(By.Name("EndTime"))[i - 1].SendKeys(Keys.Delete);
                }
            }

            //Select days and Enter start and End time
            EnterDaysAndTime();

            //Select Skill Trade
            GlobalDefinitions.SelectRadioButton(SkillTradeOption, GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade"), By.Name("skillTrades"));
            string SkillTradeValue = GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade").ToUpper();

            //Enter Skill-Exchange or Credit
            if (SkillTradeValue == "SKILL-EXCHANGE")
            {
                SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange") + "\n");
            }
            else
            {
                CreditAmount.Clear();
                CreditAmount.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Credit"));
            }


            //Select Active radio
            GlobalDefinitions.SelectRadioButton(ActiveOption, GlobalDefinitions.ExcelLib.ReadData(2, "Active"), By.Name("isActive"));
        }
Beispiel #5
0
        public void Listings()
        {
            GlobalDefinitions.Wait();
            ManageListingsLink.Click();
            //Checking the right page
            Assert.AreEqual("ListingManagement", GlobalDefinitions.driver.Title);
            Base.test = Base.extent.StartTest("On Share Manage Listing page");
            edit.Click();
            //Populate the Excel Sheet
            Global.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill");
            Title.SendKeys(ExcelLib.ReadData(3, "Title"));
            GenericMethods.CheckLength(4, 100, ExcelLib.ReadData(3, "Title"), "Title");
            Description.SendKeys(ExcelLib.ReadData(3, "Description"));
            GenericMethods.CheckLength(4, 600, ExcelLib.ReadData(3, "Description"), "Description");
            CategoryDropDown.SendKeys(ExcelLib.ReadData(3, "Category"));
            SubCategoryDropDown.SendKeys(ExcelLib.ReadData(3, "SubCategory"));

            TxtTags.SendKeys(ExcelLib.ReadData(3, "Tags"));
            TxtTags.SendKeys(Keys.Enter);
            IWebElement ServiceTypeOptions = GlobalDefinitions.driver.FindElement(By.XPath("//div[5]//div[2]//div[1]//div[2]//div[1]//input[1]"));

            ServiceTypeOptions.Click();

            IWebElement LocationTypeOption = GlobalDefinitions.driver.FindElement(By.XPath("//div[6]//div[2]//div[1]//div[2]//div[1]//input[1]"));

            LocationTypeOption.Click();

            StartDateDropDown.SendKeys(ExcelLib.ReadData(2, "Startdate"));
            EndDateDropDown.SendKeys(ExcelLib.ReadData(2, "Enddate"));

            for (int i = 2; i < 9; i++)
            {
                for (int j = 2; j < 9; j++)
                {
                    IWebElement StartTime = GlobalDefinitions.driver.FindElement(By.XPath("//div[" + i + "]/div[2]/input"));
                    IWebElement EndTime   = GlobalDefinitions.driver.FindElement(By.XPath("//div[" + j + "]/div[3]/input"));
                    if (i == 2 && j == 2)
                    {
                        GlobalDefinitions.driver.FindElement(By.XPath("//div[contains(@class,'twelve wide column')]//div[2]//div[1]//div[1]//input[1]")).Click();
                        StartTime.SendKeys("0230PM");
                        StartTime.SendKeys(Keys.Tab);
                        EndTime.SendKeys("3052PM");
                    }
                    if (i == 3 && j == 3)
                    {
                        GlobalDefinitions.driver.FindElement(By.XPath("//div[3]//div[1]//div[1]//input[1]")).Click();
                        StartTime.SendKeys("0530PM");
                        EndTime.SendKeys("0856PM");
                    }
                }
            }

            IWebElement credit = GlobalDefinitions.driver.FindElement(By.XPath("//div[8]//div[2]//div[1]//div[2]//div[1]//input[1]"));

            if (!credit.Selected)
            {
                credit.Click();
                CreditAmount.SendKeys("9");
            }


            WorkSample.Click();

            AutoItX3 autoIt = new AutoItX3();

            autoIt.WinWait("Open", "File Upload", 1);

            autoIt.WinActivate("Open", "File Upload");

            autoIt.ControlFocus("Open", "File Upload", "[CLASS:Edit; INSTANCE:1]");

            autoIt.Send(Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\..")) + "\\Test.txt");                                 //autoIt

            autoIt.Send("{ENTER}");
            autoIt.Sleep(1000);

            IWebElement ActiveOption = GlobalDefinitions.driver.FindElement(By.XPath("//form/div[10]/div[@class='twelve wide column']/div/div[@class = 'field']"));

            ActiveOption.Click();
            GlobalDefinitions.Wait();
            Save.Click();
            GlobalDefinitions.Wait();
            Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Skills edited succesfully");
            string searchInput1 = GlobalDefinitions.driver.FindElement(By.XPath("//tbody//tr[1]//td[2]")).Text;

            Assert.AreEqual(searchInput1, ExcelLib.ReadData(3, "Category"));
            string searchInput2 = GlobalDefinitions.driver.FindElement(By.XPath("//tbody//tr[1]//td[3]")).Text;

            Assert.AreEqual(searchInput2, ExcelLib.ReadData(3, "Title"));
            string searchInput3 = GlobalDefinitions.driver.FindElement(By.XPath("//tbody//tr[1]//td[5]")).Text;

            Assert.AreEqual(searchInput3, ExcelLib.ReadData(3, "ServiceType"));
        }
        internal void EnterShareSkill()
        {
            //Populate the excel data
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPathShareSkill, "ShareSkill");

            //Waiting for Profile page to load
            GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.LinkText("Share Skill"), 10);

            //Click on Share Skill button
            ShareSkillButton.Click();

            //Waiting for Share Skill page to load
            GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.Name("title"), 10);

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

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

            //Select Category from DropDown
            CategoryDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Category"));

            //Select SubCategory from DropDown
            SubCategoryDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory"));

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

            //Select ServiceType from Option
            switch ((GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType")))
            {
            case "Hourly basis service":
                //Select Hourly basis service from options
                ServiceTypeOptions[0].Click();
                break;

            case "One-off service":
                //Select One-off service from options
                ServiceTypeOptions[1].Click();
                break;
            }

            //Select LocationType from Option
            switch ((GlobalDefinitions.ExcelLib.ReadData(2, "LocationType")))
            {
            case "On-site":
                //Select On-site from location options
                LocationTypeOption[0].Click();
                break;

            case "Online":
                //Select Online from location options
                LocationTypeOption[1].Click();
                break;
            }

            //Enter StartDate from DropDown
            StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate"));

            //Enter EndDate from DropDown
            EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Enddate"));

            //Select Days and enter Start and End time
            if ((GlobalDefinitions.ExcelLib.ReadData(2, "Selectday")) == "Sun")
            {
                //Select Sunday
                Days[0].Click();
                //Enter StartTime from DropDown
                StartTimeDropDown[1].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"));
                //Enter EndTime from DropDown
                EndTimeDropDown[0].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"));
            }
            else if ((GlobalDefinitions.ExcelLib.ReadData(2, "Selectday")) == "Mon")
            {
                //Select Monday
                Days[1].Click();
                //Enter StartTime from DropDown
                StartTimeDropDown[2].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"));
                //Enter EndTime from DropDown
                EndTimeDropDown[1].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"));
            }
            else if ((GlobalDefinitions.ExcelLib.ReadData(2, "Selectday")) == "Tue")
            {
                //Select Tuesday
                Days[2].Click();
                //Enter StartTime from DropDown
                StartTimeDropDown[3].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"));
                //Enter EndTime from DropDown
                EndTimeDropDown[2].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"));
            }
            else if ((GlobalDefinitions.ExcelLib.ReadData(2, "Selectday")) == "Wed")
            {
                //Select Wednesday
                Days[3].Click();
                //Enter StartTime from DropDown
                StartTimeDropDown[4].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"));
                //Enter EndTime from DropDown
                EndTimeDropDown[3].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"));
            }
            else if ((GlobalDefinitions.ExcelLib.ReadData(2, "Selectday")) == "Thu")
            {
                //Select Thursday
                Days[4].Click();
                //Enter StartTime from DropDown
                StartTimeDropDown[5].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"));
                //Enter EndTime from DropDown
                EndTimeDropDown[4].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"));
            }
            else if ((GlobalDefinitions.ExcelLib.ReadData(2, "Selectday")) == "Fri")
            {
                //Select Friday
                Days[5].Click();
                //Enter StartTime from DropDown
                StartTimeDropDown[6].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"));
                //Enter EndTime from DropDown
                EndTimeDropDown[5].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"));
            }
            else if ((GlobalDefinitions.ExcelLib.ReadData(2, "Selectday")) == "Sat")
            {
                //Select Saturday
                Days[6].Click();
                //Enter StartTime from DropDown
                StartTimeDropDown[7].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"));
                //Enter EndTime from DropDown
                EndTimeDropDown[6].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"));
            }

            //Select Skill Trade from options
            if ((GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade")) == "Skill-Exchange")
            {
                //Select Skill-exchange from available options
                SkillTradeOption[0].Click();
                //Enter SkillExchange
                SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange") + Keys.Enter);
            }
            else if ((GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade")) == "Credit")
            {
                //Select Credit from available options
                SkillTradeOption[1].Click();
                //Enter Credit Amount
                CreditAmount.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Credit"));
            }

            //Select ActiveOption
            switch ((GlobalDefinitions.ExcelLib.ReadData(2, "Active")))
            {
            case "Active":
                //Select Active status
                ActiveOption[0].Click();
                break;

            case "Hidden":
                //Select Hidden status
                ActiveOption[1].Click();
                break;
            }

            //Click on work sample file add icon
            FileAdd.Click();

            //Add work sample file using AutoIT
            AutoItX.WinWait("[CLASS:#32770]", "", 30);
            Thread.Sleep(3000);
            AutoItX.WinWaitActive("Open");
            AutoItX.ControlFocus("Open", "", "Edit1");
            AutoItX.ControlSetText("Open", "", "Edit1", @"C:\Study\IndustryConnect\git\ProjectMarsTestAutomationHybridFramework\MarsFramework\testFile.txt");
            Thread.Sleep(3000);
            AutoItX.ControlClick("Open", "", "Button1");


            //Click on Save button
            Save.Click();
            //Waiting for Manage Listing page to load
            GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//table[1]/tbody[1]"), 10);
        }
Beispiel #7
0
        internal void EnterShareSkill()
        {
            Global.GlobalDefinitions.ExcelLib.PopulateInCollection(AppDomain.CurrentDomain.BaseDirectory.Replace(@"MarsFramework\bin\Debug\", @"MarsFramework\ExcelData\TestDataShareSkill.xlsx"), "ShareSkill");

            //wait for element to appear
            Global.GlobalDefinitions.WaitForElement(Global.GlobalDefinitions.Driver, By.LinkText("Share Skill"), (20));
            //Click on the share skill button
            ShareSkillButton.Click();

            //Click on the title field
            Global.GlobalDefinitions.WaitForElement(Global.GlobalDefinitions.Driver, By.Name("title"), (20));
            Title.Click();
            //Type on the title field
            Title.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(1, "Title"));

            //Click on the description
            Global.GlobalDefinitions.WaitForElement(Global.GlobalDefinitions.Driver, By.Name("description"), (20));
            Description.Click();
            //Type on the Description
            Description.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(1, "Description"));

            //Click on category dropdown
            CategoryDropDown.Click();
            //Choose an option from category dropdown
            CategoryDropDown.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(1, "Category") + Keys.Enter);

            //Click on sub category
            SubCategoryDropDown.Click();
            //Choose an option from subcategory dropdown
            SubCategoryDropDown.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(1, "SubCategory") + Keys.Enter);

            //Click on Tags Field
            Tags.Click();
            //Type on the Tags Field then press Enter
            Tags.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(1, "Tags") + Keys.Enter);

            //Click and choose an option for Service type
            ServiceTypeOptions.Click();

            //Click and Choose an option for location type
            LocationTypeOption.Click();

            //click on a skill trade option skill exchange
            SkillTradeOptionSkillExchange.Click();

            //Click on skill exchange
            SkillExchange.Click();

            //Type and add a tag
            SkillExchange.SendKeys("Test tag" + Keys.Enter);

            //click on a skill trade option credit
            SkillTradeOptionCredit.Click();

            //Click on credit amount
            CreditAmount.Click();

            //type and add a credit amount
            CreditAmount.SendKeys("2" + Keys.Enter);

            //Click an option on Active
            ActiveOption.Click();

            //Save the skill
            Save.Click();

            Thread.Sleep(2000);
        }
        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);
        }
Beispiel #9
0
        internal void EnterShareSkill()
        {
            int rows;

            rows = GlobalDefinitions.ExcelLib.NumberofRows(@"C:\Users\JIJI\source\repos\marsframework-master\MarsFramework\ExcelData\TestDataShareSkill.xlsx", "ShareSkill");
            //Populate the excel data
            GlobalDefinitions.ExcelLib.PopulateInCollection(@"C:\Users\JIJI\source\repos\marsframework-master\MarsFramework\ExcelData\TestDataShareSkill.xlsx", "ShareSkill");
            Thread.Sleep(1500);

            for (int i = 2; i <= rows + 1; i++)
            {
                Thread.Sleep(1500);
                //Click on Share Skill
                ShareSkillButton.Click();
                //Enter Title
                Thread.Sleep(3500);
                Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i, "Title"));
                //Enter Description
                Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i, "Description"));
                //Enter Category
                CategoryDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i, "Category"));
                //Enter Sub-Category
                SubCategoryDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i, "SubCategory"));
                //Enter Tags
                Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i, "Tags"));
                Tags.SendKeys(Keys.Enter);
                //Enter ServiceType
                String Service = GlobalDefinitions.ExcelLib.ReadData(i, "ServiceType");
                if (Service == "One-off service")
                {
                    ServiceTypeOptions.FindElement(By.XPath("/ html / body / div / div / div[1] / div[2] / div / form / div[5] / div[2] / div[1] / div[2] / div / input")).Click();
                }
                else
                {
                    ServiceTypeOptions.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[5]/div[2]/div[1]/div[1]/div/input")).Click();
                }
                //Enter LocationType
                String LocationType = GlobalDefinitions.ExcelLib.ReadData(i, "LocationType");
                if (LocationType == "On-site")
                {
                    LocationTypeOption.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[6]/div[2]/div/div[1]/div/input")).Click();
                }
                else
                {
                    LocationTypeOption.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[6]/div[2]/div/div[2]/div/input")).Click();
                }
                //Enter Startdate

                //StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate").ToString());
                //Enter Enddate
                // EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Enddate"));
                //Enter Selectday
                // String Day=GlobalDefinitions.ExcelLib.ReadData(2, "Selectday");
                //if(Day== "Sun")
                //{
                //    Days.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[7]/div[2]/div[1]/div[2]/div[1]/div/input")).Click();
                //}
                //else if(Day=="Mon")
                //{
                //    Days.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[7]/div[2]/div[1]/div[3]/div[1]/div/input")).Click();
                // }
                //else if (Day == "Tue")
                //{
                //    Days.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[7]/div[2]/div[1]/div[4]/div[1]/div/input")).Click();
                //}
                //else if (Day == "Wed")
                //{
                //    Days.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[7]/div[2]/div[1]/div[5]/div[1]/div/input")).Click();
                //}
                //else if (Day == "Thu")
                //{
                //    Days.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[7]/div[2]/div[1]/div[6]/div[1]/div/input")).Click();
                //}
                //else if (Day == "Fri")
                //{
                //    Days.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[7]/div[2]/div[1]/div[7]/div[1]/div/input")).Click();
                //}
                //else if (Day == "Sat")
                //{
                //    Days.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[7]/div[2]/div[1]/div[8]/div[1]/div/input")).Click();
                //}

                //Enter Starttime
                // StartTimeDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i, "Starttime"));
                //Enter Endtime
                // EndTimeDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i, "Endtime"));
                //Enter SkillTrade
                string SkillTrade = GlobalDefinitions.ExcelLib.ReadData(i, "SkillTrade");
                if (SkillTrade == "Skill-Exchange")
                {
                    SkillTradeOption.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[8]/div[2]/div/div[1]/div/label")).Click();
                }
                else
                {
                    SkillTradeOption.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[8]/div[2]/div/div[2]/div/label")).Click();
                }
                //Enter Skill-Exchange
                SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i, "Skill-Exchange"));
                SkillExchange.SendKeys(Keys.Enter);
                //Enter Credit
                if (SkillExchange.Text == "Credit")
                {
                    CreditAmount.SendKeys(GlobalDefinitions.ExcelLib.ReadData(i, "Credit"));
                }
                ////Work Sample
                Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[9]/div/div[2]/section/div/label/div/span/i")).Click();
                AutoItX3 autoit = new AutoItX3();
                autoit.WinActivate("Open");
                Thread.Sleep(1500);
                autoit.ControlSetText("Open", "", "Edit1", StrSendText);
                autoit.ControlClick("Open", "", "Button1");


                //Enter Active
                string Active = GlobalDefinitions.ExcelLib.ReadData(i, "Active");
                if (Active == "Active")
                {
                    ActiveOption.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[10]/div[2]/div/div[1]/div/input")).Click();
                }
                else
                {
                    ActiveOption.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[10]/div[2]/div/div[2]/div/input")).Click();
                }
                //Click on save
                Save.Click();
                Thread.Sleep(1500);
            }
        }
        public void EnterShareSkill()
        {
            GlobalDefinitions.Wait();
            ShareSkillButton.Click();
            //Checking the right page
            Assert.AreEqual("ServiceListing", GlobalDefinitions.driver.Title);
            Base.test = Base.extent.StartTest("On Share Skill page");
            //Populate the Excel Sheet
            Global.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill");
            //Enter TITLE
            Title.SendKeys(ExcelLib.ReadData(2, "Title"));
            //Check Length of Title
            GenericMethods.CheckLength(4, 100, ExcelLib.ReadData(2, "Title"), "Title");
            //Enter Description
            Description.SendKeys(ExcelLib.ReadData(2, "Description"));
            GenericMethods.CheckLength(4, 600, ExcelLib.ReadData(2, "Description"), "Description");
            //Select Category form dropdown
            CategoryDropDown.SendKeys(ExcelLib.ReadData(2, "Category"));
            SubCategoryDropDown.SendKeys(ExcelLib.ReadData(2, "SubCategory"));
            //Enter tag
            TxtTags.SendKeys(ExcelLib.ReadData(2, "Tags"));
            TxtTags.SendKeys(Keys.Enter);
            //Select service Type
            IWebElement ServiceTypeOptions = GlobalDefinitions.driver.FindElement(By.XPath("//form/div[5]/div[@class='twelve wide column']/div/div[@class='field']"));

            ServiceTypeOptions.Click();
            //Select Location Type
            IWebElement LocationTypeOption = GlobalDefinitions.driver.FindElement(By.XPath("//div[6]//div[2]//div[1]//div[1]//div[1]//input[1]"));

            LocationTypeOption.Click();
            //Enter start Date and End date
            StartDateDropDown.SendKeys(ExcelLib.ReadData(2, "Startdate"));
            EndDateDropDown.SendKeys(ExcelLib.ReadData(2, "Enddate"));
            // Loop for no. of days available,Start time and End time
            for (int i = 2; i < 9; i++)
            {
                for (int j = 2; j < 9; j++)
                {
                    IWebElement StartTime = GlobalDefinitions.driver.FindElement(By.XPath("//div[" + i + "]/div[2]/input"));
                    IWebElement EndTime   = GlobalDefinitions.driver.FindElement(By.XPath("//div[" + j + "]/div[3]/input"));
                    if (i == 2 && j == 2)
                    {
                        GlobalDefinitions.driver.FindElement(By.XPath("//div[contains(@class,'twelve wide column')]//div[2]//div[1]//div[1]//input[1]")).Click();
                        StartTime.SendKeys("0230PM");
                        StartTime.SendKeys(Keys.Tab);
                        EndTime.SendKeys("3052PM");
                    }
                    if (i == 3 && j == 3)
                    {
                        GlobalDefinitions.driver.FindElement(By.XPath("//div[3]//div[1]//div[1]//input[1]")).Click();
                        StartTime.SendKeys("0530PM");
                        EndTime.SendKeys("0856PM");
                    }
                }
            }
            // Select Skill Trade
            IWebElement credit = GlobalDefinitions.driver.FindElement(By.XPath("//div[8]//div[2]//div[1]//div[2]//div[1]//input[1]"));

            //Checking if the radio is selected or not
            if (!SkillTradeOption.Selected)
            {
                SkillTradeOption.Click();
            }
            Boolean status = GlobalDefinitions.driver.FindElement(By.XPath("//input[@type='radio']")).Selected;

            //To Check Radiobutton is selected or not
            if (status)
            {
                Console.WriteLine("RadioButton is checked");
            }
            else
            {
                Console.WriteLine("RadioButton is unchecked");
            }
            //Enter SkillExchange
            SkillExchange.SendKeys(ExcelLib.ReadData(2, "Skill-Exchange"));
            SkillExchange.SendKeys(Keys.Enter);
            //Upload File Using Auto IT
            WorkSample.Click();

            AutoItX3 autoIt = new AutoItX3();

            autoIt.WinWait("Open", "File Upload", 1);

            autoIt.WinActivate("Open", "File Upload");


            autoIt.ControlFocus("Open", "File Upload", "[CLASS:Edit; INSTANCE:1]");

            autoIt.Send(Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\..")) + "\\Test.txt");
            autoIt.Sleep(1000);
            autoIt.Send("{ENTER}");
            //	autoIt.Sleep(1000);
            //Select Active Type
            IWebElement ActiveOption = GlobalDefinitions.driver.FindElement(By.XPath("//form/div[10]/div[@class='twelve wide column']/div/div[@class = 'field']"));

            ActiveOption.Click();
            GlobalDefinitions.Wait();
            Save.Click();
            GlobalDefinitions.Wait();

            Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Skills Added Successfully");
            //Assert.AreEqual("ServiceListing", GlobalDefinitions.driver.Title);

            //Assert on category / title / Service Type after adding the skill and displayed on Manage Listing Page
            string searchInput1 = GlobalDefinitions.driver.FindElement(By.XPath("//td[contains(text(),'Programming & Tech')]")).Text;

            Console.WriteLine(searchInput1);
            Assert.AreEqual(searchInput1, ExcelLib.ReadData(2, "Category"));

            string searchInput2 = GlobalDefinitions.driver.FindElement(By.XPath("//table[@class='ui striped table']//tbody//tr[1]//td[3]")).Text;

            Console.WriteLine(searchInput2);
            Assert.AreEqual(searchInput2, ExcelLib.ReadData(2, "Title").TrimEnd());

            //string searchInput3 = GlobalDefinitions.driver.FindElement(By.XPath("//table[@class='ui striped table']//tbody//tr[1]//td[5]")).Text;
            //Assert.AreEqual(searchInput3, ExcelLib.ReadData(2, "ServiceType"));
        }