示例#1
0
        internal void FillSchedrule(int DataRow)
        {
            //Check if the user is able to click on a "Start Date" for the "Available days" field
            StartDateDropDown.Click();
            StartDateDropDown.Clear();
            StartDateDropDown.SendKeys(GlobalDefinitions.ReadData(DataRow, "StartDate"));

            //Check if the user is able to click on a "End Date" for the "Available days" field
            EndDateDropDown.Click();
            EndDateDropDown.Clear();
            EndDateDropDown.SendKeys(GlobalDefinitions.ReadData(DataRow, "EndDate"));

            //Check if the user is able to click on a "Day" checkbox for the "Available days" field
            for (var i = 1; i <= 5; i++)
            {
                Days[i].Click();
            }

            //Check if the user is able to select a "Start Time" for the "Available days" field
            StartTimeDropDown.SendKeys(GlobalDefinitions.ReadData(DataRow, "StartTime"));

            //Check if the user is able to select a "End Time" for the "Available days" field
            EndTimeDropDown.SendKeys(GlobalDefinitions.ReadData(DataRow, "EndTime"));

            //Check if the user is able to click on "Credits" as the "Skill Trade" option
            SkillTradeCreditsOption.Click();

            //Check if the user is able to enter a number for the "Credits" field
            CreditAmount.Clear();
            CreditAmount.SendKeys(GlobalDefinitions.ReadData(DataRow, "Credit"));

            //Check if the user is able to set an option for the "Active" field
            ActiveOption.Click();
        }
        public void Date_Time_Picker()
        {
            //Select Starting Date from Excel
            StartDateDropDown.SendKeys(ExcelLibHelper.ReadData(2, "Startdate"));

            //Select Ending Date from Excel
            EndDateDropDown.SendKeys(ExcelLibHelper.ReadData(2, "Enddate"));



            ////Select Starting time from Excel
            //StartTimeDropDown.SendKeys(ExcelLibHelp.ReadData(2, "Starttime"));
            ////Select Endignng time from Excel
            //StartTimeDropDown.SendKeys(ExcelLibHelp.ReadData(2, "Endtime"));


            for (int i = 1; i <= 7; i++)
            {
                var day_checkbox = Driver.driver.FindElement(By.XPath("(//input[contains(@name,'Available')])[" + i + "]"));
                var StartTime    = Driver.driver.FindElement(By.XPath("(//input[contains(@name,'StartTime')])[" + i + "]"));
                var EndTime      = Driver.driver.FindElement(By.XPath("(//input[contains(@name,'EndTime')])[" + i + "]"));
                var label        = Driver.driver.FindElement(By.XPath("//div[@class='fields'][" + (1 + i) + "]/div/div//label"));


                if (ExcelLibHelper.ReadData(2, "Selectday") == label.Text)
                {
                    Click_Action(day_checkbox);

                    StartTime.SendKeys(ExcelLibHelper.ReadData(2, "Starttime"));
                    EndTime.SendKeys(ExcelLibHelper.ReadData(2, "Endtime"));
                }
            }
        }
示例#3
0
        internal void EnterShareSkill()
        {
            //Populate the excel data
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill");
            //Click on Join button
            ShareSkillButton.Click();

            // Enter Title on ShareSkill page
            Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title"));

            // Enter discription on ShareSkill page
            Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description"));

            // Select category dropdown on share skil page
            CategoryDropDown.Click();

            // Enter tag names in taxbox
            Tags.Click();

            //Select service type type on share skill page
            ServiceTypeOptions.Click();

            // Select location type on share skill page
            LocationTypeOption.Click();

            // Sorting Start time
            StartTime.Click();

            // Select start date drop down
            StartDateDropDown.Click();

            // Select End date drop down on share skill page
            EndDateDropDown.Click();

            // Select available days
            Days.Click();

            // Select start time on share skill page
            StartTimeDropDown.Click();

            // Select end time on share skill page
            EndTimeDropDown.Click();

            // Click on skill trade option
            SkillTradeOption.Click();

            // Select skill exchange option
            SkillExchange.Click();

            // Enter credit ammount on share skill page
            CreditAmount.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "credit amount"));

            // Click on Active option on share skill page
            ActiveOption.Click();

            // click on save button on share skill page
            Save.Click();
            Thread.Sleep(2000);
        }
示例#4
0
        internal void EnterShareSkill()
        {
            WaitHelpers.ElementIsVisible(driver, "XPath", "//h3[contains(text(),'Title')]", 5);
            //Type in Title and Description
            Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title"));
            Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description"));

            //Select Category and Subcategory dropdown list
            new SelectElement(CategoryDropDown).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Category"));
            new SelectElement(SubCategoryDropDown).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory"));

            // Type in Tag and click enter
            Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags"));
            Tags.SendKeys(Keys.Enter);

            //Select Service Type
            ServiceType();

            //Select Location Type
            LocationType();

            //Select start date
            StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate"));

            //Select end date
            EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Enddate"));

            //Select day
            daySunday.Click();

            //Type in Start time and End time
            startTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"));
            endTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"));

            //Select Skill trade option
            SkillTradeOption.Click();

            //Skill-Exchange tag
            skillExchangeTag.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange"));
            skillExchangeTag.SendKeys(Keys.Enter);

            //Click on add file
            addFileIcon.Click();

            //Select file
            AutoItX3 autoIT = new AutoItX3();

            autoIT.WinWait("Open");
            autoIT.WinActivate("Open");
            autoIT.Send("C:\\Users\\User\\Documents\\SignInFeatureFile");
            autoIT.Send("{ENTER}");


            //Select Active
            activeOption.Click();

            //Click save button
            saveButton.Click();
        }
        public void SelectingDateAndTime()
        {
            //Getting the Today's date
            string StartDate = DateTime.Today.ToString("dd/MM/yyyy");

            //Entering the Start Date
            StartDateDropDown.SendKeys(StartDate);

            //Setting the End date as today's date plus 14days
            string EndDate = DateTime.Today.AddDays(14).ToString("dd/MM/yyyy");

            //Entering the End Date
            EndDateDropDown.SendKeys(EndDate);
            string EndDateValueFromApp = DateTime.Parse(EndDateDropDown.GetAttribute("value")).ToString("dd/MM/yyyy");

            int countStartTime        = GlobalDefinitions.driver.FindElements(By.XPath("//div[@class= 'four wide field']/input[@name = 'StartTime']")).Count;
            int countEndTime          = GlobalDefinitions.driver.FindElements(By.XPath("//div[@class= 'four wide field']/input[@name = 'EndTime']")).Count;
            int countWeekdaysCheckbox = GlobalDefinitions.driver.FindElements(By.XPath("//div[@class='ui checkbox']/input[@name = 'Available']")).Count;

            // Loop for no. of days available,Start time and End time
            try
            {
                for (int count = 2; count < countWeekdaysCheckbox; count++)
                {
                    IWebElement StartTime        = GlobalDefinitions.driver.FindElement(By.XPath("//div[" + count + "]/div[2]/input"));
                    IWebElement EndTime          = GlobalDefinitions.driver.FindElement(By.XPath("//div[" + count + "]/div[3]/input"));
                    IWebElement WeekDaysCheckbox = GlobalDefinitions.driver.FindElement(By.XPath("//div[" + count + "]/div[1]/div/input"));
                    string      WeekDaysName     = GlobalDefinitions.driver.FindElement(By.XPath("//div[" + count + "]/div[1]/div/label")).Text;

                    //Verifying if weekdays name is same as the weekdays data from excel
                    if (WeekDaysName == GlobalDefinitions.ExcelLib.ReadData(2, "Selectday"))
                    {
                        WeekDaysCheckbox.Click();
                        if (WeekDaysCheckbox.Selected == true)
                        {
                            Base.test.Log(LogStatus.Pass, WeekDaysName + " " + "checkbox is selected successfully");
                        }
                        else
                        {
                            Base.test.Log(LogStatus.Pass, WeekDaysName + " " + "checkbox is not selected successfully");
                        }

                        //Entering the Start Time
                        StartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"));
                        string StartTimeValueFromApp = DateTime.Parse(StartTime.GetAttribute("value")).ToString("hh:mmtt");
                        StartTime.SendKeys(Keys.Tab);

                        //Entering the End Time
                        EndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"));
                        break;
                    }
                }
            }
            catch (Exception e)
            {
                Base.test.Log(LogStatus.Fail, "Exception found for Day and Time", e.Message);
            }
        }
        //Enter Share Skill Data
        internal void EnterShareSkillData()
        {
            //Enter the Title
            Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title"));

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

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

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

            //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"));

            //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.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Credit"));
            }

            //upload Work Samples
            WorkSamples.Click();
            AutoItX.WinWait("Open", "File Upload", 1);
            AutoItX.WinActivate("Open");
            AutoItX.ControlFocus("Open", "File Upload", "[CLASS:Edit; INSTANCE:1]");
            AutoItX.Send(Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "..\\..\\ExcelData\\empty.txt"));
            AutoItX.Send("{Enter}");

            //Select Active radio
            GlobalDefinitions.SelectRadioButton(ActiveOption, GlobalDefinitions.ExcelLib.ReadData(2, "Active"), By.Name("isActive"));
        }
示例#7
0
 internal void AddDayTimeDetails(int dataRow)
 {
     StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(dataRow, "Startdate") + Keys.Enter);
     EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(dataRow, "Enddate") + Keys.Enter);
     DayMon.Click();
     StartTimeDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(dataRow, "Starttime") + Keys.Enter);
     EndTimeDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(dataRow, "Endtime") + Keys.Enter);
     SkillTradeExchange.Click();
     SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(dataRow, "Skill-Exchange") + Keys.Enter);
 }
        internal void AddShareSkill()
        {
            ExcelLib.PopulateInCollection(Base.ExcelPath, "ManageListings");

            GlobalDefinitions.WaitForElement(ShareSkillButton, 30);
            ShareSkillButton.Click();

            GlobalDefinitions.WaitForElement(Title, 30);
            Title.SendKeys(ExcelLib.ReadData(2, "Title"));

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

            Category(CategoryDropDown, ExcelLib.ReadData(2, "Category"));

            SubCategory(SubCategoryDropDown, ExcelLib.ReadData(2, "Sub Category"));

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

            OneOff.Click();

            OnLine.Click();

            StartDateDropDown.SendKeys(ExcelLib.ReadData(2, "Start Date"));

            EndDateDropDown.SendKeys(ExcelLib.ReadData(2, "End Date"));

            Sunday.Click();
            SundayStartTime.SendKeys(ExcelLib.ReadData(2, "Sunday Start Time"));
            SundayEndTime.SendKeys(ExcelLib.ReadData(2, "Sunday End Time"));

            Monday.Click();
            MondayStartTime.SendKeys(ExcelLib.ReadData(2, "Monday Start Time"));
            MondayEndTime.SendKeys(ExcelLib.ReadData(2, "Monday End Time"));

            Tuesday.Click();
            TuesdayStartTime.SendKeys(ExcelLib.ReadData(2, "Monday Start Time"));
            TuesdayEndTime.SendKeys(ExcelLib.ReadData(2, "Monday End Time"));

            CreditOption.Click();

            if (SkillExchangeOption.Selected)
            {
                SkillExchange.SendKeys(ExcelLib.ReadData(2, "Skill Exchange"));
            }
            else
            {
                CreditAmount.SendKeys(ExcelLib.ReadData(2, "Credit"));
            }

            Hidden.Click();

            Save.Click();
        }
        }//

        private void FillSkillDetails()
        {
            // loading Excelsheet data
            GlobalDefinitions.ExcelLib.PopulateInCollection(MarsResource.ShareSkillExcelPath, "ShareSkill");
            GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//a[contains(.,'Share Skill')]"), 10);
            // click on ShareSkillButton
            ShareSkillButton.Click();
            // Sending the data in title input field
            Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title"));
            //Sending the data in description input field
            Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description"));
            //selecting the element from category dropdown
            SelectElement Category = new SelectElement(CategoryDropDown);

            //Selecting the element by text
            Category.SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Category"));
            //selecting the element from subcategory dropdown
            SelectElement SubCategory = new SelectElement(SubCategoryDropDown);

            //Selecting the element by text
            SubCategory.SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory"));
            //Adding the tag in tags input field
            Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags") + "\n");
            //Selecting the service type option
            ServiceTypeOptions.Click();
            //Selecting the location type option
            LocationTypeOption.Click();
            //Selecting the start date
            StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate"));
            //selecting the end date
            EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Enddate"));
            //click on days button
            Days.Click();
            //sending the data in start time input field
            StartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"));
            //sending the data in end time input field
            EndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"));
            //click on skilltrade option
            SkillTradeOption.Click();
            //sending the data in skillexchange input field
            SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange") + "\n");
            //clicking on active option button
            ActiveOption.Click();

            // UploadImage.Click();
            //AutoITFileUpload.UploadFile();
            Save.Click();
        }
示例#10
0
        //enter share skill form
        internal void EnterShareSkill()
        {
            //enter Title
            Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title"));

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

            //enter Category
            new SelectElement(CategoryDropDown).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Category"));

            //enter SubCategory
            new SelectElement(SubCategoryDropDown).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory"));

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

            //enter service type
            SelectServiceType();

            //select location type
            SelectLocationType();

            //select start date
            StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate"));

            //select End date
            EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Enddate"));

            //select day and time
            SelectDayNTime();

            //select skill trade
            SelectSkillTrade();

            //upload file using autoit
            fileupload();

            //select active/hidden
            SelectActive();

            //click save
            Save.Click();
        }
示例#11
0
        internal void EditShareSkill()
        {
            GlobalDefinitions.waitClickableElement(GlobalDefinitions.driver, "XPath", "//div[@class = 'right item']/a");
            //Enter title
            GlobalDefinitions.ExcelLib.PopulateInCollection(@"C:\marsframework\MarsFramework\ExcelData\TestDataShareSkill.xlsx", "ShareSkill");
            Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title"));
            //Enter Description
            Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description"));
            //Select category from the dropdown
            SelectElement cd = new SelectElement(CategoryDropDown);

            cd.SelectByText(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Category"));
            //Select subcategory from the dropdown
            SelectElement scd = new SelectElement(SubCategoryDropDown);

            scd.SelectByText(Global.GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory"));
            //Send data in tag field and press enter
            Tags.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Tags"));
            Tags.SendKeys(Keys.Enter);
            //Select service type radiobutton
            ServiceTypeOptions.Click();
            //Select Location type radiobutton
            LocationTypeOption.Click();
            //Select Start Date DropDown
            StartDateDropDown.Click();
            //Enter end date
            EndDateDropDown.SendKeys("09082020");
            //Click on days
            Days.Click();
            //Select start time
            StartTime.Click();
            StartTimeDropDown.SendKeys("1024PM");
            //Select end time
            EndTimeDropDown.SendKeys("1126PM");
            //Select SkillTradeOption radiobutton
            SkillTradeOption.Click();
            //Send data in SkillExchange and press enter
            SkillExchange.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange"));
            SkillExchange.SendKeys(Keys.Enter);
            //Select active radiobutton
            ActiveOption.Click();
            //Click on Save button
            Save.Click();
        }
示例#12
0
        //Custom Method - Dynamic Table
        public void SelectDaytime()
        {
            StartDateDropDown.SendKeys(ExcelLibHelper.ReadData(2, "Startdate"));
            EndDateDropDown.SendKeys(ExcelLibHelper.ReadData(2, "Enddate"));
            for (int i = 0; i <= 6; i++)
            {
                var day       = Driver.driver.FindElement(By.CssSelector("input[name='Available'][index='" + i + "']"));
                var starttime = Driver.driver.FindElement(By.CssSelector("input[name='StartTime'][index='" + i + "']"));
                var endtime   = Driver.driver.FindElement(By.CssSelector("input[name='EndTime'][index='" + i + "']"));
                var label     = Driver.driver.FindElement(By.XPath("//div[@class='fields'][" + (2 + i) + "]/div/div//label"));

                if (ExcelLibHelper.ReadData(2, "Selectday") == label.Text)
                {
                    day.Click();
                    starttime.SendKeys(ExcelLibHelper.ReadData(2, "Starttime"));
                    endtime.SendKeys(ExcelLibHelper.ReadData(2, "Endtime"));
                }
            }
        }
        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);
        }
示例#14
0
        internal void EditShareSkill()
        {
            //Enabling the Share Skill Button
            ShareSkillButton.Click();

            //Navigating to the Share Skill Page
            GlobalDefinitions.driver.Navigate().GoToUrl("http://localhost:5000/Home/ServiceListing");

            //Populate the Excel Sheet from ShareSkillDetails sheet
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkillDetails");
            GlobalDefinitions.wait(5);

            //Reading the Excel file-Title
            Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title"));
            GlobalDefinitions.wait(5);

            //Reading the Excel file-Description
            Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description"));
            GlobalDefinitions.wait(5);

            //Selecting the Category Dropdown
            SelectElement categoryDropdown = new SelectElement(CategoryDropDown);

            //Initializing the Expected Category for Assertion/ Reading the Excel File-Category
            var expectedCategory = GlobalDefinitions.ExcelLib.ReadData(2, "Category");

            categoryDropdown.SelectByText(expectedCategory);
            GlobalDefinitions.wait(5);

            //Selecting the Subcategory Dropdown
            SelectElement subCategorydropdown = new SelectElement(SubCategoryDropDown);

            //Reading the excel file - Subcategory
            subCategorydropdown.SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Select Subcategory"));
            GlobalDefinitions.wait(5);


            //Clearing the existing tags before sending new Tags/Reading the Excel File - Tags
            Tags.Clear();
            Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags"));
            Tags.SendKeys(Environment.NewLine);

            //Clicking the Service Type radio button
            HourlyBasisService.Click();
            OneOffService.Click();

            //Clicking the Location Type radio button
            OnSiteLocationType.Click();
            OnlineLocationType.Click();

            //Clicking the Skill Trade radio button (Skill-exchange)
            SkillExchangeBtn.Click();
            GlobalDefinitions.wait(5);

            //Reading the Excel File - Skill Exchange Tags
            SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill Exchange"));

            //Clicking the Skill Trade radio button (Credit)
            CreditOptionBtn.Click();
            GlobalDefinitions.wait(5);

            //Reading the Excel File - Credit Charge
            CreditAmount.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Credit"));

            //Clicking the Active radio button
            ActiveOption.Click();
            HiddenOption.Click();
            GlobalDefinitions.wait(10);


            //Populate the Excel Sheet from Time Sheet
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "Time");

            //Reading the excel file for StartDate
            StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Start Date"));

            //Reading the excel file for EndDate
            EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "End Date"));


            //Using a for loop for reading the excel file including the days[Checkboxes]
            for (var i = 2; i <= 8; i++)
            {
                //Reading the days checkbox element starting on the 2nd row [i-2]
                AvailableCheckBoxes[i - 2].Click();


                //Readtime = converting the string format to Date time format (see GlobalDefinitions changes)
                var excelStartTime = GlobalDefinitions.ExcelLib.ReadTime(i, "Start Time");

                //passing the value of excelStartTime as ex: (0700am) since the system is not accepting spaces
                var startTime = excelStartTime.ToString("hhmmtt");


                //Readtime = converting the string format to Date time format (see GlobalDefinitions changes)
                var excelEndTime = GlobalDefinitions.ExcelLib.ReadTime(i, "End Time");
                var endTime      = excelEndTime.ToString("hhmmtt");

                //Reading data from excel file starting on the 2nd row
                StartTimes[i - 2].SendKeys(startTime);
                EndTimes[i - 2].SendKeys(endTime);
            }

            //Saving Skills
            Save.Click();
            GlobalDefinitions.wait(20);

            //Assertion if the actual category is the same as the expected category
            var actualCategory = GlobalDefinitions.driver.FindElement(By.XPath($"//td[normalize-space()='{expectedCategory}']")).Text;

            Assert.AreEqual(actualCategory, expectedCategory);
        }
示例#15
0
        internal void EnterShareSkill()

        {//GlobalDefinitions.WaitForElement(driver, By.,20)
            GlobalDefinitions.wait(10);
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill");
            //clcik on Shareskill button
            ShareSkillButton.Click();
            //Click on Title text box
            Title.SendKeys(ExcelLib.ReadData(2, "Title"));
            //Enter Description in Title
            Description.SendKeys(ExcelLib.ReadData(2, "Description"));
            //CLick on dropdown
            CategoryDropDown.Click();
            //Thread.Sleep(5000);
            //Selecting option from Categorydropdown
            SelectElement oselect = new SelectElement(SelectSubDropdown);

            oselect.SelectByText(ExcelLib.ReadData(2, "Category"));

            //Click on SubCategory
            SubCategoryDropDown.Click();

            //Selecting option from SubCategorydropdown
            SelectElement subCategory = new SelectElement(SelectDropdown);

            subCategory.SelectByValue(ExcelLib.ReadData(2, "SubCategory"));

            //Enter Tags
            Tags.SendKeys(ExcelLib.ReadData(2, "Tags"));
            Tags.SendKeys(Keys.Enter);
            //Select Service Type(Radio buttons)
            switch (ExcelLib.ReadData(2, "ServiceType"))
            {
            case "One-off service":
                OneOffType.Click();
                break;

            case "Hourly basis service":
                HourlyType.Click();
                break;
            }
            //Select Location Type (Radio buttons)
            switch (ExcelLib.ReadData(2, "LocationType"))
            {
            case "On-site":
                OnSiteLocationTypeOption.Click();
                break;

            case "Online":
                OnlineLocationTypeOption.Click();
                break;
            }

            GlobalDefinitions.WaitForElement(driver, By.XPath("//div[3]/div[2]/input[1]"), 10);

            //Select Start Date
            StartDateDropDown.Click();
            Thread.Sleep(5000);
            StartDateDropDown.SendKeys(ExcelLib.ReadData(2, "Startdate"));

            GlobalDefinitions.WaitForElement(driver, By.Name("endDate"), 10);
            //Select End Date
            EndDateDropDown.Click();
            EndDateDropDown.SendKeys(ExcelLib.ReadData(2, "Enddate"));

            //DayAvailability
            switch (ExcelLib.ReadData(2, "Selectday"))
            {
            case "Sun":
                Sunday.Click();
                SundayTime.SendKeys(ExcelLib.ReadData(2, "Starttime"));
                SundayEndTime.SendKeys(ExcelLib.ReadData(2, "Endtime"));
                break;

            case "Mon":
                Monday.Click();
                MondayTime.SendKeys(ExcelLib.ReadData(2, "Starttime"));
                MondayEndTime.SendKeys(ExcelLib.ReadData(2, "Endtime"));
                break;

            case "Tue":
                Tuesday.Click();
                TuesdayTime.SendKeys(ExcelLib.ReadData(2, "Starttime"));
                TuesdayEndTime.SendKeys(ExcelLib.ReadData(2, "Endtime"));
                break;

            case "Wed":
                Wednesday.Click();
                WednesdayTime.SendKeys(ExcelLib.ReadData(2, "Starttime"));
                WednesdayEndTime.SendKeys(ExcelLib.ReadData(2, "Endtime"));
                break;

            case "Thu":
                Thursday.Click();
                ThursdayTime.SendKeys(ExcelLib.ReadData(2, "Starttime"));
                //MondayEndTime.SendKeys(ExcelLib.ReadData(2, "Endtime"));
                break;
            }
            //Select Skill Trade Radio buttons)
            switch (ExcelLib.ReadData(2, "SkillTrade"))
            {
            case "Skill-exchange":
                FirstSkillTradeOption.Click();
                break;

            case "Credit":
                SecondkillTradeOption.Click();
                break;
            }
            //Enter Skill-Exchange
            SkillExchange.SendKeys(ExcelLib.ReadData(2, "Skill-Exchange"));
            SkillExchange.SendKeys(Keys.Enter);
            //Enter WorkSample
            //FileUpload.SendKeys(@"C:\Users\minty\OneDrive\Pictures\FIle1.txt");
            GlobalDefinitions.WaitForElement(driver, By.XPath("//i[@Class = 'huge plus circle icon padding-25']"), 10);
            FileUpload.Click();
            AutoItX3 autoIt = new AutoItX3();

            autoIt.WinActivate("Open");
            Thread.Sleep(5000);
            autoIt.Send(@"C:\Users\minty\OneDrive\Pictures\Camera Roll\Garry.jpeg");
            Thread.Sleep(5000);
            autoIt.Send("{ENTER}");
            //Thread.Sleep(5000);
            ////WorkSample.Click();


            //Select ACtive/Hidden Options ( Radio Buttons)
            switch (ExcelLib.ReadData(2, "Active"))
            {
            case "Active":
                ActiveOption.Click();
                break;

            case "Hidden":
                HiddenOption.Click();
                break;
            }

            //Click on Save
            Save.Click();
            // Assert.IsTrue("Service Listing Saved Successfully".Exist, "OK");
        }
        //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"));
        }
示例#17
0
        internal void EnterShareSkill()
        {
            //Calling wait method
            GenericWait.ElementExists(GlobalDefinitions.driver, "Name", "title", 8);

            //Entering the "Title"
            Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title"));
            //Validating Title
            GlobalDefinitions.TextDataFieldValidation("Title", GlobalDefinitions.ExcelLib.ReadData(2, "Title"), Title.GetAttribute("value"));

            //Entering the "Description"
            Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description"));
            //Validating Description
            GlobalDefinitions.TextDataFieldValidation("Description", GlobalDefinitions.ExcelLib.ReadData(2, "Description"), Description.Text);

            //Selecting Category
            HelperCallingMethods.SelectingDropdown(CategoryDropDown, "SelectByText", GlobalDefinitions.ExcelLib.ReadData(2, "Category"));
            //Validating Category selection
            GlobalDefinitions.DropDownDataValidation("Category", CategoryDropDown, GlobalDefinitions.ExcelLib.ReadData(2, "Category"));

            //Selecting Sub-Category
            HelperCallingMethods.SelectingDropdown(SubCategoryDropDown, "SelectByText", GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory"));
            //Validating Sub-Category selection
            GlobalDefinitions.DropDownDataValidation("SubCategory", SubCategoryDropDown, GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory"));

            //Entering Tag
            Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags") + "\n");
            //GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//span[@class='ReactTags__tag']"), 5);
            GenericWait.ElementIsVisible(GlobalDefinitions.driver, "XPath", "//span[@class='ReactTags__tag']", 6);
            string EnteredTagTxt = TagReact.Text;

            //Validating entered Tag
            GlobalDefinitions.TextDataFieldValidation("Tags", GlobalDefinitions.ExcelLib.ReadData(2, "Tags"), EnteredTagTxt.Remove(EnteredTagTxt.Length - 1, 1));

            // Select the Service type radio button
            HelperCallingMethods.SelectingRadiobutton("//form/div[5]/div[@class='twelve wide column']/div/div[@class='field']", "serviceType", GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType"));
            //Validating Service Type Radiobutton selection
            GlobalDefinitions.RadiobuttonValidation("ServiceTypeRadioButtons", "//form/div[5]/div[@class='twelve wide column']/div/div[@class='field']", "serviceType", GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType"));

            // Select the Location type radio button
            HelperCallingMethods.SelectingRadiobutton("//form/div[6]/div[@class='twelve wide column']/div/div[@class = 'field']", "locationType", GlobalDefinitions.ExcelLib.ReadData(2, "LocationType"));
            //Validating Location Type Radiobutton selection
            GlobalDefinitions.RadiobuttonValidation("LocationTypeRadioButtons", "//form/div[6]/div[@class='twelve wide column']/div/div[@class = 'field']", "locationType", GlobalDefinitions.ExcelLib.ReadData(2, "LocationType"));

            //Selecting date and time
            HelperCallingMethods helperCallingMethods = new HelperCallingMethods();

            helperCallingMethods.SelectingDateAndTime();
            //Validating Start Date, End Date, Start Time,End Time
            GlobalDefinitions.TextDataFieldValidation("Start Date", DateTime.Today.ToString("dd/MM/yyyy"), DateTime.Parse(StartDateDropDown.GetAttribute("value")).ToString("dd/MM/yyyy"));
            GlobalDefinitions.TextDataFieldValidation("End Date", DateTime.Today.AddDays(14).ToString("dd/MM/yyyy"), DateTime.Parse(EndDateDropDown.GetAttribute("value")).ToString("dd/MM/yyyy"));
            GlobalDefinitions.TextDataFieldValidation("Start Time", GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"), DateTime.Parse(StartTime.GetAttribute("value")).ToString("hh:mmtt"));
            GlobalDefinitions.TextDataFieldValidation("End Time", GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"), DateTime.Parse(EndTime.GetAttribute("value")).ToString("hh:mmtt"));


            //Selecting SkillTrade or Credit radio button
            HelperCallingMethods.SelectingRadiobutton("//form/div[8]/div[@class='twelve wide column']/div/div[@class = 'field']", "skillTrades", GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade"));
            string SkillTradeValue = GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade");

            //Enter Skill-Exchange or Credit
            if (SkillTradeValue == "Skill-exchange")
            {
                SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange") + "\n");
                //Validating entered Skill exchange value
                GlobalDefinitions.TextDataFieldValidation("SkillExchange", GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange"), SkillExchangeTag.Text.Remove(SkillExchangeTag.Text.Length - 1, 1));
            }
            else if (SkillTradeValue == "Credit")
            {
                CreditAmount.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Credit"));
                //Validating entered Credit value
                GlobalDefinitions.TextDataFieldValidation("Credit", GlobalDefinitions.ExcelLib.ReadData(2, "Credit"), CreditAmount.GetAttribute("value"));
            }

            //Uploading file for Work Sample
            WorkSamples.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.Sleep(1000);
            //autoIt.Send(Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory()) + "\\FileUploadTest.txt"));
            autoIt.Send(Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "..\\..\\FileUploadTest.txt"));
            autoIt.Sleep(1000);
            autoIt.Send("{ENTER}");
            autoIt.Sleep(2000);
            string[] FileSplitText     = WorkSampleFileName.Text.Split('.');
            string   FileSplitTextName = FileSplitText[0];

            //Validating uploaded worksample
            GlobalDefinitions.TextDataFieldValidation("WorkSamples", FileSplitTextName.ToString(), GlobalDefinitions.ExcelLib.ReadData(2, "FileName").ToString());

            //selecting Active radio button
            HelperCallingMethods.SelectingRadiobutton("//form/div[10]/div[@class='twelve wide column']/div/div[@class = 'field']", "isActive", GlobalDefinitions.ExcelLib.ReadData(2, "Active"));
            //Validating Active radio button selection
            GlobalDefinitions.RadiobuttonValidation("Active", "//form/div[10]/div[@class='twelve wide column']/div/div[@class = 'field']", "isActive", GlobalDefinitions.ExcelLib.ReadData(2, "Active"));

            //Clicking Save button
            Save.Click();

            string img = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "Share skill added");
        }
示例#18
0
        internal void AddShareSkill()
        {
            //populate excel data

            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill");
            try
            {
                //Click on Share skill button
                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "LinkText", "Share Skill", 10000);
                ShareSkillButton.Click();

                //Enter the Title in textbox
                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "Name", "title", 10000);
                Title.Click();
                Title.Clear();
                Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title"));

                //Enter the Description in textbox
                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "Name", "description", 10000);
                Description.Click();
                Description.Clear();
                Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description"));

                //Select catagory from drop down
                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "Name", "categoryId", 10000);
                CategoryDropDown.Click();
                new SelectElement(CategoryDropDown).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Category"));

                //Select catagory from drop down
                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "Name", "subcategoryId", 10000);
                SubCategoryDropDown.Click();
                new SelectElement(SubCategoryDropDown).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory"));

                //Enter Tag names in textbox
                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//input[@value='']", 10000);
                Tags.Click();
                Tags.Clear();
                Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags"));
                Tags.SendKeys(Keys.Enter);

                //Select service type
                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//form/div[5]/div[@class='twelve wide column']/div/div[@class='field']", 10000);
                ServiceTypeOptions.Click();
                Servicetyp.Click();

                //Select the Location Type
                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//form/div[6]/div[@class='twelve wide column']/div/div[@class = 'field']", 10000);
                LocationTypeOption.Click();
                LocationSel.Click();

                //Add start date
                StartDateDropDown.Click();
                // StartDateDropDown.Clear();
                StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate"));

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


                //Select available day
                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//body/div/div/div[@id='service-listing-section']/div[@class='ui container']/div[@class='listing']/form[@class='ui form']/div[7]/div[2]/div[1]", 10000);
                Days.Click();
                Day.Click();

                //Select start time
                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[3]/div[2]/input", 10000);
                StartTime.Click();


                //enter start time
                StartTimeDropDown.Click();
                //StartTimeDropDown.Clear();
                StartTimeDropDown.SendKeys("08:00 AM");//(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"));

                //Select end time
                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[3]/div[3]/input", 10000);
                EndTime.Click();

                //Enter end time
                EndTimeDropDown.Click();
                //EndTimeDropDown.Clear();
                EndTimeDropDown.SendKeys("05:00 PM");// (GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"));

                //Click on Skill trade option
                SkillTradeOption.Click();

                //Add Skill exchange tag
                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[8]/div[4]/div/div/div/div/div/input", 10000);
                SkillExchange.Click();
                SkillExchange.Clear();
                SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange"));
                SkillExchange.SendKeys(Keys.Enter);

                //Select option Active or Hidden
                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//form/div[10]/div[@class='twelve wide column']/div/div[@class = 'field']", 10000);
                ActiveOption.Click();
                HiddenOpt.Click();

                //Click on save button
                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//input[@value='Save']", 10000);
                Save.Click();
            }

            catch (Exception ex)
            {
                Assert.Fail("Test failed to enter Skill details", ex.Message);
            }
        }
示例#19
0
        internal void EnterShareSkillData()
        {
            //Enter the Title
            Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title"));

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

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

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

            //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"));

            //Getting all the values in Selectday column in a list
            IList <string> DaysList = GlobalDefinitions.ExcelLib.ReadData(2, "Selectday").Split('/');

            //Getting count for all days
            //Check the checkbox for selectdays mentioned in excel and enter time for same
            int DaysRows = Days.FindElements(By.Name("Available")).Count;

            foreach (string AvailableDays in DaysList)
            {
                for (int i = 1; i <= DaysRows; i++)
                {
                    string DayValue = Days.FindElements(By.ClassName("fields"))[i].Text;
                    if (AvailableDays.ToLower() == DayValue.ToLower())
                    {
                        Days.FindElements(By.Name("Available"))[i - 1].Click();
                        string StartTime = DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")).ToString("hh:mmtt");
                        Days.FindElements(By.Name("StartTime"))[i - 1].SendKeys(StartTime);

                        string EndTime = DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")).ToString("hh:mmtt");
                        Days.FindElements(By.Name("EndTime"))[i - 1].SendKeys(EndTime);
                        break;
                    }
                }
            }

            //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.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Credit"));
            }

            //upload Work Samples
            WorkSamples.Click();
            AutoItX.WinWait("Open", "File Upload", 1);
            AutoItX.WinActivate("Open");
            AutoItX.ControlFocus("Open", "File Upload", "[CLASS:Edit; INSTANCE:1]");
            AutoItX.Send(Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "..\\..\\ExcelData\\empty.txt"));
            AutoItX.Send("{Enter}");

            //Select Active radio
            GlobalDefinitions.SelectRadioButton(ActiveOption, GlobalDefinitions.ExcelLib.ReadData(2, "Active"), By.Name("isActive"));
        }
        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);
        }
示例#21
0
        private void selectStartDateAndTime()
        {
            StartDateDropDown.setDate(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate"));

            GlobalDefinitions.wait(20);

            EndDateDropDown.setDate(GlobalDefinitions.ExcelLib.ReadData(2, "Enddate"));


            string weekDay = GlobalDefinitions.ExcelLib.ReadData(2, "Selectday");

            switch (weekDay)
            {   //MOnday is default value
            case "Sun":
                Days.FindElement(By.XPath("//div[2]/descendant::input[@index='0' and @name='Available']")).Click();
                Days.FindElement(By.XPath("//div[2]/descendant::input[@index='0' and @name='StartTime']")).
                setTime(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"));
                Days.FindElement(By.XPath("//div[2]/descendant::input[@index='0' and @name='EndTime']")).
                setTime(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"));
                break;

            case "Tue":
                Days.FindElement(By.XPath("//div[4]/descendant::input[@index='2' and @name='Available']")).Click();
                Days.FindElement(By.XPath("//div[4]/descendant::input[@index='2' and @name='StartTime']")).
                setTime(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"));
                Days.FindElement(By.XPath("//div[4]/descendant::input[@index='2' and @name='EndTime']")).
                setTime(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"));
                break;

            case "Wed":
                Days.FindElement(By.XPath("//div[5]/descendant::input[@index='3' and @name='Available']")).Click();
                Days.FindElement(By.XPath("//div[5]/descendant::input[@index='3' and @name='StartTime']")).
                setTime(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"));
                Days.FindElement(By.XPath("//div[5]/descendant::input[@index='3' and @name='EndTime']")).
                setTime(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"));
                break;

            case "Thu":
                Days.FindElement(By.XPath("//div[6]/descendant::input[@index='4' and @name='Available']")).Click();
                Days.FindElement(By.XPath("//div[6]/descendant::input[@index='4' and @name='StartTime']")).
                setTime(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"));
                Days.FindElement(By.XPath("//div[6]/descendant::input[@index='4' and @name='EndTime']")).
                setTime(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"));
                break;

            case "Fri":
                Days.FindElement(By.XPath("//div[7]/descendant::input[@index='5' and @name='Available']")).Click();
                Days.FindElement(By.XPath("//div[7]/descendant::input[@index='5' and @name='StartTime']")).
                setTime(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"));
                Days.FindElement(By.XPath("//div[7]/descendant::input[@index='5' and @name='EndTime']")).
                setTime(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"));
                break;

            case "Sat":
                Days.FindElement(By.XPath("//div[8]/descendant::input[@index='6' and @name='Available']")).Click();
                Days.FindElement(By.XPath("//div[8]/descendant::input[@index='6' and @name='StartTime']")).
                setTime(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"));
                Days.FindElement(By.XPath("//div[8]/descendant::input[@index='6' and @name='EndTime']")).
                setTime(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"));
                break;

            default:
                Days.FindElement(By.XPath("//div[3]/descendant::input[@index='1' and @name='Available']")).Click();
                Days.FindElement(By.XPath("//div[3]/descendant::input[@index='1' and @name='StartTime']")).
                setTime(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"));
                Days.FindElement(By.XPath("//div[3]/descendant::input[@index='1' and @name='EndTime']")).
                setTime(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"));
                break;
            }
        }
        //Add share skill details
        internal void EnterShareSkill()
        {
            //Populate the excel data

            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill");

            try
            {
                //Click on Share skill button
                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "LinkText", "Share Skill", 10000);
                ShareSkillButton.Click();

                //Enter the Title in textbox
                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "Name", "title", 10000);
                Title.Click();
                Title.Clear();
                Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title"));

                //Enter the Description in textbox
                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "Name", "description", 10000);
                Description.Click();
                Description.Clear();
                Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description"));

                //Select catagory from drop down
                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "Name", "categoryId", 10000);
                CategoryDropDown.Click();
                new SelectElement(CategoryDropDown).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Category"));

                //Select catagory from drop down
                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "Name", "subcategoryId", 10000);
                SubCategoryDropDown.Click();
                new SelectElement(SubCategoryDropDown).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory"));

                //Enter Tag names in textbox
                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//input[@value='']", 10000);
                Tags.Click();
                Tags.Clear();
                Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags"));
                Tags.SendKeys(Keys.Enter);

                //Select service type
                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//form/div[5]/div[@class='twelve wide column']/div/div[@class='field']", 10000);
                ServiceTypeOptions.Click();
                Servicetyp.Click();

                //Select the Location Type
                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//form/div[6]/div[@class='twelve wide column']/div/div[@class = 'field']", 10000);
                LocationTypeOption.Click();
                LocationSel.Click();

                //Add start date
                StartDateDropDown.Click();
                // StartDateDropDown.Clear();
                StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate"));

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


                //Select available day
                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//body/div/div/div[@id='service-listing-section']/div[@class='ui container']/div[@class='listing']/form[@class='ui form']/div[7]/div[2]/div[1]", 10000);
                Days.Click();

                Mon.Click();
                Tue.Click();
                Wed.Click();
                Thurs.Click();

                //Select start time and enter the time
                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[3]/div[2]/input", 10000);
                StartTimeM.Click();

                StartTimeDropDownM.Click();

                StartTimeM.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")).ToString("hh:mmtt"));

                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[4]/div[2]/input", 10000);
                StartTimeT.Click();

                StartTimeDropDownT.Click();

                StartTimeT.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")).ToString("hh:mmtt"));

                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[5]/div[2]/input", 10000);
                StartTimeW.Click();

                StartTimeDropDownW.Click();

                StartTimeW.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")).ToString("hh:mmtt"));

                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[6]/div[2]/input", 10000);
                StartTimeTh.Click();

                StartTimeDropDownTh.Click();

                StartTimeTh.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")).ToString("hh:mmtt"));



                //Select end time from box
                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[3]/div[3]/input", 10000);
                EndTimeM.Click();

                EndTimeDropDownM.Click();

                EndTimeM.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")).ToString("hh:mmtt"));

                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[4]/div[3]/input", 10000);
                EndTimeT.Click();

                EndTimeDropDownT.Click();

                EndTimeT.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")).ToString("hh:mmtt"));

                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[5]/div[3]/input", 10000);
                EndTimeW.Click();

                EndTimeDropDownW.Click();

                EndTimeW.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")).ToString("hh:mmtt"));

                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[6]/div[3]/input", 10000);
                EndTimeTh.Click();

                EndTimeDropDownTh.Click();

                EndTimeTh.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")).ToString("hh:mmtt"));
                Thread.Sleep(1000);

                //Click on Skill trade option
                SkillTradeOption.Click();

                //Add Skill exchange tag
                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[8]/div[4]/div/div/div/div/div/input", 10000);
                SkillExchange.Click();
                SkillExchange.Clear();
                SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange"));
                SkillExchange.SendKeys(Keys.Enter);

                //Upload File


                FileUpload.Click();

                AutoItX3 autoIt = new AutoItX3();
                AutoItX.WinWait("Open", "File Upload", 1);
                autoIt.WinActivate("Open");
                Thread.Sleep(2000);
                var SampleWorkPath = MarsResource.SampleWorkPath;
                autoIt.Send(Path.GetFullPath(SampleWorkPath));
                Thread.Sleep(2000);
                autoIt.Send("{Enter}");
                Thread.Sleep(2000);

                //Select option Active or Hidden
                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//form/div[10]/div[@class='twelve wide column']/div/div[@class = 'field']", 10000);
                ActiveOption.Click();
                HiddenOpt.Click();

                //Click on save button
                GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//input[@value='Save']", 10000);
                Save.Click();
            }

            catch (Exception ex)
            {
                Assert.Fail("Test failed to enter Skill details", ex.Message);
            }
        }
示例#23
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();
            }
        }
示例#24
0
        internal void EnterShareSkill1()
        {
            Global.GlobalDefinitions.wait(60000);
            ShareSkillButton.Click();


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


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

            //********************************************
            //Enter the Description

            Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description"));
            Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Info, "Description has been successfully entered");

            //******************************************
            //Select the Category option

            Actions action = new Actions(GlobalDefinitions.driver);

            action.MoveToElement(CategoryDropDown).Build().Perform();

            System.Collections.Generic.IList <IWebElement> ServiceCategory = CategoryDropDown.FindElements(By.TagName("option"));
            int count = ServiceCategory.Count;

            Console.WriteLine("Number of Category : " + count);
            for (int i = 0; i < count; i++)
            {
                if (ServiceCategory[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Category"))
                {
                    ServiceCategory[i].Click();
                    Base.test.Log(LogStatus.Info, "Category has been successfully selected");
                    break;
                }
            }

            //****************************************
            //Select the subcategory

            action.MoveToElement(SubCategoryDropDown).Build().Perform();

            IList <IWebElement> SubCategory = SubCategoryDropDown.FindElements(By.TagName("option"));
            int subcategorycount            = SubCategory.Count;

            Console.WriteLine("Number of Sub Category : " + subcategorycount);
            for (int i = 0; i < subcategorycount; i++)
            {
                if (SubCategory[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory"))
                {
                    SubCategory[i].Click();
                    Base.test.Log(LogStatus.Info, "Sub Category has been successfully selected");
                    break;
                }
            }

            //**************************************
            //Enter Tag name

            Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags"));
            Tags.SendKeys(Keys.Enter);
            Base.test.Log(LogStatus.Pass, "Tag name has been succesfully enetered");

            //************************************
            //Service Type Option

            action.MoveToElement(ServiceTypeOptions).Build().Perform();
            Thread.Sleep(3000);
            // Storing all the elements under category of 'Service Type' in the list of WebLements
            IList <IWebElement> ServiceType = ServiceTypeOptions.FindElements(By.XPath("//div/input[@name='serviceType']"));
            //Indicating the number of buttons present
            int servicetypecount = ServiceType.Count;

            Console.WriteLine("Number of Service type : " + servicetypecount);
            for (int i = 0; i < servicetypecount; i++)
            {
                //Storing the radio button to the string variable "Value", using the "value" attribute
                string Value = ServiceType.ElementAt(i).GetAttribute("value");
                int    j     = i + 1;
                var    Name  = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[5]/div[2]/div[1]/div[" + j + "]/div/label")).Text;
                //Checking if Name equals the "name" attribute - "ServiceType"
                if (Name.Equals(ExcelLib.ReadData(2, "ServiceType")) && Value.Equals("" + i))
                {
                    ServiceType.ElementAt(i).Click();
                    Base.test.Log(LogStatus.Pass, "Service Type has been succesfully selected");
                    break;
                }
            }

            //*****************************************
            //Location Type Option

            action.MoveToElement(LocationTypeOption).Build().Perform();
            Thread.Sleep(3000);
            // Storing all the elements under category of 'Location Type' in the list of WebLements
            IList <IWebElement> LocationType = LocationTypeOption.FindElements(By.XPath("//div/input[@name='locationType']"));
            //Indicating the number of buttons present
            int locationtypecount = LocationType.Count;

            Console.WriteLine("Number of Location type : " + locationtypecount);
            for (int i = 0; i < locationtypecount; i++)
            {
                //Storing the radio button to the string variable "Value", using the "value" attribute
                string Value = LocationType.ElementAt(i).GetAttribute("value");
                int    j     = i + 1;
                var    Name  = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[6]/div[2]/div[1]/div[" + j + "]/div/label")).Text;

                //Checking if Name equals the "name" attribute - "LocationType"
                if (Name.Equals(ExcelLib.ReadData(2, "LocationType")) && Value.Equals("" + i))
                {
                    LocationType.ElementAt(i).Click();
                    Base.test.Log(LogStatus.Pass, "Location Type has been succesfully selected");
                    break;
                }
            }

            //******************************************
            //Entering start date

            StartDateDropDown.SendKeys(Keys.Delete);

            Console.WriteLine("Start date read from excel is : " + GlobalDefinitions.ExcelLib.ReadData(2, "Startdate"));
            //1st Method using DateTime Class
            //====================================
            var dateTime = GlobalDefinitions.ExcelLib.ReadData(2, "Startdate");

            Console.WriteLine("Date is : " + dateTime);

            /*DateTime parsedDate = DateTime.Parse(dateTime);
             * Console.WriteLine("Parsed Date is : " + parsedDate);
             * //var dateTimeNow = DateTime.Now; /C:\Users\Vidhya\source\repos\MarsFramework\MarsFramework\packages\WebDriver.ChromeDriver.win32.2.41.0\content\chromedriver.exe/ Return 00/00/0000 00:00:00
             * //Console.WriteLine("Date Time Now : " + dateTimeNow);
             * //var dateOnlyString = dateTimeNow.ToShortDateString(); //Return 00/00/0000
             * //Console.WriteLine("Date only string is : " + dateOnlyString);
             * var dateOnlyString = parsedDate.ToShortDateString(); //To convert string to DateTime format Return 00/00/0000 00:00:00
             * Console.WriteLine("Date only string is : " + dateOnlyString);
             * StartDateDropDown.SendKeys(dateOnlyString);*/

            //2nd Method using string split
            //==============================
            string[] splitDate      = dateTime.Split(' ');
            int      countSplitDate = splitDate.Count();

            Console.WriteLine("The count of date string is : " + countSplitDate);
            Console.WriteLine($"String 1 is : {splitDate[0]} ");
            Console.WriteLine($"String 2 is : {splitDate[1]} ");
            Console.WriteLine($"String 3 is : {splitDate[2]} ");
            StartDateDropDown.SendKeys(splitDate[0]);


            StartDateDropDown.SendKeys(Keys.Tab);
            Base.test.Log(LogStatus.Pass, "Start Date has succesfully been edited");

            //******************************************
            //Entering End date

            //Console.Out.Write("End Date read from excel is : " + GlobalDefinitions.ExcelLib.ReadData(2, "Enddate"));
            Console.WriteLine("End Date read from excel is : " + GlobalDefinitions.ExcelLib.ReadData(2, "Enddate"));
            //var endDate = GlobalDefinitions.ExcelLib.ReadData(2, "Enddate");
            //DateTime parsedEndDate = DateTime.Parse(endDate);
            //var endDateonly = parsedEndDate.ToShortDateString();
            //EndDateDropDown.SendKeys(endDateonly);
            EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Enddate"));
            EndDateDropDown.SendKeys(Keys.Tab);
            Base.test.Log(LogStatus.Pass, "End Date has succesfully been edited");

            //***************************************
            //Selecting the day

            action.MoveToElement(Days).Build().Perform();

            IList <IWebElement> allDays = Days.FindElements(By.XPath("//div/div/div/input[@name = 'Available']"));
            int allDaysCount            = allDays.Count;

            Console.WriteLine("Number of Days : " + allDaysCount);
            for (int i = 0; i < allDaysCount; i++)
            {
                int j   = i + 2;
                var day = GlobalDefinitions.driver.FindElement(By.XPath("//div[" + j + "]/div[1]/div[1]/label")).Text;

                if (day.Equals(ExcelLib.ReadData(2, "Selectday")))
                {
                    allDays.ElementAt(i).Click();
                    Base.test.Log(LogStatus.Pass, "Day has been succesfully selected");
                    break;
                }
            }

            //*****************************************
            //Entering the starttime

            Console.WriteLine("Start time read from excel is : " + GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"));
            var      startTime       = GlobalDefinitions.ExcelLib.ReadData(2, "Starttime");
            DateTime parsedStartTime = DateTime.Parse(startTime);
            var      startTimeString = parsedStartTime.ToString("hh:mmtt");

            //var startTimeString = parsedStartTime.ToShortTimeString();
            Console.WriteLine("Start Time String is : " + startTimeString);

            StartTimeDropDown.SendKeys(startTimeString);
            StartTimeDropDown.SendKeys(Keys.Tab);
            //*****************************************
            //Entering the endtime

            GlobalDefinitions.wait(5);
            Console.WriteLine("End time read from excel is : " + GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"));
            var      endTime       = GlobalDefinitions.ExcelLib.ReadData(2, "Endtime");
            DateTime parsedEndTime = DateTime.Parse(endTime);
            var      endTimeString = parsedEndTime.ToString("hh:mmtt");

            Console.WriteLine("End Time String is : " + endTimeString);

            EndTimeDropDown.SendKeys(endTimeString);

            //******************************************
            //Skill Trade Option

            action.MoveToElement(SkillTradeOption).Build().Perform();


            // Storing all the elements under category of 'Skill Trade' in the list of WebLements
            IList <IWebElement> SkillTrade = SkillTradeOption.FindElements(By.XPath("//div/input[@name='skillTrades']"));

            //Indicating the number of buttons present
            int skilltradecount = SkillTrade.Count;

            Console.WriteLine("Number of Skill Trade : " + skilltradecount);

            for (int i = 0; i < skilltradecount; i++)
            {
                //Storing the radio button to the string variable "Value", using the "value" attribute
                string Value = SkillTrade.ElementAt(i).GetAttribute("value");
                int    j     = i + 1;
                var    Name  = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[8]/div[2]/div[1]/div[" + j + "]/div/label")).Text;

                //Checking if Name equals the "name" attribute - "LocationType"
                if (Name.Equals(ExcelLib.ReadData(2, "SkillTrade")) && Value.Equals("" + i))
                {
                    SkillTrade.ElementAt(i).Click();
                    Base.test.Log(LogStatus.Pass, "Skill Trade has been succesfully selected");
                    break;
                }
            }

            //****************************************
            //Enter Skill-Exchange Tag name

            SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange"));
            SkillExchange.SendKeys(Keys.Enter);
            Base.test.Log(LogStatus.Pass, "Skill-Exchange Tag name has been succesfully enetered");

            //**************************************
            //Active Option

            action.MoveToElement(ActiveOption).Build().Perform();
            Thread.Sleep(3000);

            // Storing all the elements under category of 'Active' in the list of WebLements
            IList <IWebElement> Active = ActiveOption.FindElements(By.XPath("//div/input[@name='isActive']"));

            //Indicating the number of buttons present
            int activecount = Active.Count;

            Console.WriteLine("Number of Active : " + activecount);

            for (int i = 0; i < activecount; i++)
            {
                //Storing the radio button to the string variable "Value", using the "value" attribute
                string Value = Active.ElementAt(i).GetAttribute("value");
                int    j     = i + 1;
                var    Name  = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[10]/div[2]/div[1]/div[" + j + "]/div/label")).Text;

                //Checking if Name equals the "name" attribute - "Active Option"
                if (Name.Equals(ExcelLib.ReadData(2, "Active")))// && Value.Equals("" + i))
                {
                    Active.ElementAt(i).Click();
                    Base.test.Log(LogStatus.Pass, "Services option has been succesfully selected");
                    break;
                }
            }
            //************************************

            //Save the page

            Save.Click();
        }
示例#25
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"));
        }
示例#26
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"));
        }
示例#27
0
        internal void ValidateShareSkillData()
        {
            //Validate Entered Title
            GlobalDefinitions.ValidateFieldData(GlobalDefinitions.ExcelLib.ReadData(2, "Title"), Title.GetAttribute("value"), "Title");

            //Validate Entered Description
            GlobalDefinitions.ValidateFieldData(GlobalDefinitions.ExcelLib.ReadData(2, "Description"), Description.Text, "Description");

            //Validate Selected Category
            GlobalDefinitions.ValidateDropDown(CategoryDropDown, GlobalDefinitions.ExcelLib.ReadData(2, "Category"), "Category");

            //Validate Selected SubCategory
            GlobalDefinitions.ValidateDropDown(SubCategoryDropDown, GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory"), "SubCategory");

            //Validate Entered Tags
            GlobalDefinitions.ValidateFieldData(GlobalDefinitions.ExcelLib.ReadData(2, "Tags"), EnteredTag.Text.Replace(EnteredTag.FindElement(By.XPath("./*")).Text, ""), "Tag");

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

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

            //Validate Start Date
            GlobalDefinitions.ValidateFieldData(Convert.ToDateTime(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate")).ToString("yyyy-MM-dd"), StartDateDropDown.GetAttribute("value"), "Start Date");

            //Validate End Date
            GlobalDefinitions.ValidateFieldData(Convert.ToDateTime(GlobalDefinitions.ExcelLib.ReadData(2, "Enddate")).ToString("yyyy-MM-dd"), EndDateDropDown.GetAttribute("value"), "End Date");

            //Validate Days and Time
            ValidateDaysAndTime();

            //Validate Skill Trade
            ValidateRadioButton(SkillTradeOption, By.Name("skillTrades"), GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade"), "SkillTrade");
            try
            {
                if (GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade").ToUpper() == "SKILL-EXCHANGE")
                {
                    //Validate Skill Exchange
                    GlobalDefinitions.ValidateFieldData(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange"), SkillExchangeTag.Text.Replace(EnteredTag.FindElement(By.XPath("./*")).Text, ""), "Skill-Exchange");
                }
                else if (GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade").ToUpper() == "CREDIT")
                {
                    GlobalDefinitions.ValidateFieldData(GlobalDefinitions.ExcelLib.ReadData(2, "Credit"), CreditAmount.GetAttribute("value"), "Credit");
                }
            }
            catch (Exception e)
            {
                Base.test.Log(LogStatus.Fail, "Caught Exception For Skill Exchange/Credit ", e.Message);
            }

            //Validate Selected Sample File
            // GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//label[@class='worksamples-file']//a"), 5);
            GlobalDefinitions.ValidateFieldData(WorkSamplesFile.Text, "empty.txt", "Work Sample File");

            //Validate Active
            GlobalDefinitions.ValidateRadioButton(ActiveOption, By.Name("isActive"), GlobalDefinitions.ExcelLib.ReadData(2, "Active"), "Active");
        }
示例#28
0
        internal void EditManageListings()
        {
            Thread.Sleep(500);
            //Clicking the manage listing button
            manageListingsLink.Click();
            Thread.Sleep(500);
            //Clicking edit button(edit is acting as adding option only)
            edit.Click();
            Thread.Sleep(500);
            //Populating with excel data
            GlobalDefinitions.ExcelLib.PopulateInCollection(@"MarsFramework\ExcelData\TestDataManageListings.xlsx", "ManageListings");
            //Enetering Title
            Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title"));
            //Entering Description
            Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description"));
            //Selecting Category
            SelectElement Category = new SelectElement(CategoryDropDown);

            Category.SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Category"));
            //Slecting Subcategory
            SelectElement SubCategory = new SelectElement(SubCategoryDropDown);

            SubCategory.SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory"));
            //Entering the Tag
            Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags") + "\n");
            //Clicking the Service type
            ServiceTypeOptions.Click();
            //Clicking the Type option
            LocationTypeOption.Click();

            //Handling the Date and time
            Thread.Sleep(500);
            StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate")); //Sending start date data
            Thread.Sleep(500);
            EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Enddate"));     //sending end date data
            Thread.Sleep(1500);
            //Looping for the targeted day, timings and corresponding check box
            for (int i = 0; i <= 9; i++)
            {
                var checkBox  = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[" + (2 + i) + "]/div[1]/div/input"));
                var dayName   = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[" + (2 + i) + "]/div[1]/div/label"));
                var startTime = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[" + (2 + i) + "]/div[2]/input"));
                var endTime   = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[" + (2 + i) + "]/div[3]/input"));

                if (GlobalDefinitions.ExcelLib.ReadData(2, "Selectday") == dayName.Text)
                {
                    Thread.Sleep(500);
                    //Clicking checkbox
                    checkBox.Click();
                    Thread.Sleep(500);
                    //Entering particular start timing in targeted day
                    startTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"));
                    Thread.Sleep(500);
                    //Entering particular End timings in targeted day
                    endTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"));
                    break;
                }
            }

            Thread.Sleep(500);
            //Clicking Skills Exchange
            SkillTradeOptionSkillExchange.Click();
            Thread.Sleep(500);
            //Enetering Skill Exchnge Tag
            SkillExchangeTags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "SkillExchange") + "\n");
            Thread.Sleep(500);
            //Clicking Credit
            SkillTradeOptionCredit.Click();
            Thread.Sleep(500);
            //Entering Credit
            CreditAmount.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Credit"));

            //Uploading File
            Thread.Sleep(500);
            workSamples.Click();
            AutoItX3 autoIt = new AutoItX3();

            autoIt.WinActivate("Open");
            Thread.Sleep(3000);
            autoIt.Send(Base.FileToUploadPath);
            Thread.Sleep(2000);
            autoIt.Send("{ENTER}");


            //Clicking Active option
            ActiveOption.Click();
            //Saving the new/ updated Manage skills
            Save.Click();


            //Asserts
            Thread.Sleep(3000);
            var DescriptionAssert = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[1]/td[4]")).Text;

            NUnit.Framework.Assert.That(DescriptionAssert, Is.EqualTo(GlobalDefinitions.ExcelLib.ReadData(2, "Description")));
        }
        internal void Listings()
        {
            //Enabling the Manage listing link
            manageListingsLink.Click();

            //Navigating to the Listing management page
            GlobalDefinitions.driver.Navigate().GoToUrl("http://localhost:5000/Home/ListingManagement");
            GlobalDefinitions.wait(10);

            //Enabling the Edit Icon
            editIcon.Click();

            //Navigating to the Service Listing page for updates
            GlobalDefinitions.driver.Navigate().GoToUrl("http://localhost:5000/Home/ServiceListing/?id=6098c9b920b935000188c7e5");

            //Populate the Excel Sheet for Manage Listings
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ManageListings");
            GlobalDefinitions.wait(10);


            //Clearing the existing title before inputting new Title
            Title.Clear();
            var expectedTitle = GlobalDefinitions.ExcelLib.ReadData(2, "Title");

            GlobalDefinitions.wait(10);

            //Clearing the existing title before inputting new Description
            Description.Clear();
            Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description"));
            GlobalDefinitions.wait(10);

            //Selecting the Category Dropdown
            //SelectElement categoryDropdown = new SelectElement(CategoryDropDown);

            //Initializing the Expected Category for Assertion/ Reading the Excel File-Category
            //var expectedCategory = GlobalDefinitions.ExcelLib.ReadData(2, "Category");
            //categoryDropdown.SelectByText(expectedCategory);
            //GlobalDefinitions.wait(5);



            //Selecting the Category Dropdown
            SelectElement Categorydropdown = new SelectElement(CategoryDropDown);

            //Reading the excel file - Category
            Categorydropdown.SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Category"));
            GlobalDefinitions.wait(5);


            //Selecting the Subcategory Dropdown
            SelectElement subCategorydropdown = new SelectElement(SubCategoryDropDown);

            //Reading the excel file - Subcategory
            subCategorydropdown.SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Select Subcategory"));
            GlobalDefinitions.wait(5);


            //Click the delete[x] from the tags and clearing the existing tags before inputting a new one
            deleteTags.Click();
            Tags.Clear();

            //Reading the Excelf file- Tags
            Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags"));
            //Enabling the ENTER mode to accept the new tags
            Tags.SendKeys(Environment.NewLine);


            //Populate the Excel Sheet from Time Sheet
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "Time");

            //Reading the excel file for StartDate
            StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Start Date"));

            //Reading the excel file for EndDate
            EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "End Date"));


            //Using a for loop for reading the excel file including the days[Checkboxes]
            for (var i = 2; i <= 8; i++)
            {
                //Reading the days checkbox element starting on the 2nd row [i-2]
                AvailableCheckBoxes[i - 2].Click();


                //Readtime = converting the string format to Date time format (see GlobalDefinitions changes)
                var excelStartTime = GlobalDefinitions.ExcelLib.ReadTime(i, "Start Time");

                //passing the value of excelStartTime as ex: (0700am) since the system is not accepting spaces
                var startTime = excelStartTime.ToString("hhmmtt");


                //Readtime = converting the string format to Date time format (see GlobalDefinitions changes)
                var excelEndTime = GlobalDefinitions.ExcelLib.ReadTime(i, "End Time");
                var endTime      = excelEndTime.ToString("hhmmtt");

                //Reading data from excel file starting on the 2nd row
                StartTimes[i - 2].SendKeys(startTime);
                EndTimes[i - 2].SendKeys(endTime);
            }

            //Saving the updated skills
            Save.Click();
            GlobalDefinitions.wait(20);

            //Assertion if the actual category is the same as the expected category
            //var actualCategory = GlobalDefinitions.driver.FindElement(By.XPath($"//td[normalize-space()='{expectedCategory}']")).Text;
            //Assert.AreEqual(actualCategory, expectedCategory);
            //GlobalDefinitions.wait(10);


            //Enabling the delete Icon in the Manage Listing feature
            deleteIcon.Click();

            //Enabling the Yes for confirmation
            clickActionsButton.Click();


            //assertion if the deleted skills is existing or not after the confirmation

            var isElementExist = true;

            try
            {
                GlobalDefinitions.driver.FindElement(By.XPath($"//td[normalize-space()='{expectedTitle}']"));
            }
            catch (NoSuchElementException)
            {
                isElementExist = false;
            }

            Assert.IsFalse(isElementExist);

            Thread.Sleep(1000);
        }
示例#30
0
        internal void EnterShareSkill()
        {
            //Explicit wait o find the shareskill button element
            GlobalDefinitions.WaitForElement(Global.GlobalDefinitions.driver, By.LinkText("Share Skill"), 5);

            //Thread.Sleep(1500);
            ShareSkillButton.Click();
            //Populating with excel data
            GlobalDefinitions.ExcelLib.PopulateInCollection(@"MarsFramework\ExcelData\TestDataShareSkill.xlsx", "ShareSkill");
            //Enter the Title in textbox 2
            Thread.Sleep(500);
            Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title"));
            if (Title.GetAttribute("value") == GlobalDefinitions.ExcelLib.ReadData(2, "Title"))
            {
                Base.test.Log(LogStatus.Pass, "Title is entered and displayed successfully");
            }
            else
            {
                Base.test.Log(LogStatus.Fail, "Title is not enetered and displayed successfully");
            }

            //Enter the Description in textbox 3
            Thread.Sleep(500);
            Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description"));
            //Selecting the category
            SelectElement Category = new SelectElement(CategoryDropDown);

            Category.SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Category"));
            //Selecting the sub category
            SelectElement SubCategory = new SelectElement(SubCategoryDropDown);

            SubCategory.SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory"));
            //Entering the tag
            Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags") + "\n");
            //Clicking the Service type option
            ServiceTypeOptions.Click();
            //Clicking the Location option
            LocationTypeOption.Click();


            //Handling the Date and time
            Thread.Sleep(500);
            StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate"));
            Thread.Sleep(500);
            EndDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Enddate"));
            Thread.Sleep(500);
            for (int i = 0; i <= 9; i++)
            {
                var checkBox  = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[" + (2 + i) + "]/div[1]/div/input"));
                var dayName   = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[" + (2 + i) + "]/div[1]/div/label"));
                var startTime = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[" + (2 + i) + "]/div[2]/input"));
                var endTime   = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[7]/div[2]/div/div[" + (2 + i) + "]/div[3]/input"));

                if (GlobalDefinitions.ExcelLib.ReadData(2, "Selectday") == dayName.Text)
                {
                    Thread.Sleep(500);
                    checkBox.Click();
                    Thread.Sleep(500);
                    startTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Starttime"));
                    Thread.Sleep(500);
                    endTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime"));
                    break;
                }
            }



            Thread.Sleep(500);
            //Clicking the Skills option
            SkillTradeOption.Click();
            Thread.Sleep(500);
            //sending the skill exchange
            SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "SkillExchange") + "\n");


            //Uploading File
            Thread.Sleep(500);
            workSamples.Click();
            AutoItX3 autoIt = new AutoItX3();

            autoIt.WinActivate("Open");
            Thread.Sleep(3000);
            //autoIt.Send(@"C:\Users\HP\Downloads\marsframework-master\FileToUpload.txt");
            autoIt.Send(Base.FileToUploadPath);
            Thread.Sleep(2000);
            autoIt.Send("{ENTER}");


            Thread.Sleep(3000);
            //clicking the Active button
            ActiveOption.Click();
            //Saving the skills
            Save.Click();

            //Asserts
            Thread.Sleep(3000);
            var DescriptionAssert = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[1]/td[4]")).Text;

            NUnit.Framework.Assert.That(DescriptionAssert, Is.EqualTo(GlobalDefinitions.ExcelLib.ReadData(2, "Description")));
        }