Ejemplo n.º 1
0
 private void selectSkillTrade(IWebElement element, string skillTrade)
 {
     if (skillTrade == "Skill-Exchange")
     {
         element.FindElement(By.XPath("//div[@class='ui radio checkbox']/input[@value = 'true' and @name='skillTrades']")).Click();
         if (SkillExchange.Displayed && SkillExchange.Enabled)
         {
             SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange"));
             SkillExchange.SendKeys(Keys.Enter);
         }
         else
         {
             Console.WriteLine("Skill Exchange textbox is not avaiable");
             return;
         }
     }
     else if (skillTrade == "Credit")
     {
         IWebElement credit = element.FindElement(By.XPath("//div[@class='ui radio checkbox']/input[@value = 'false' and @name = 'skillTrades']"));
         credit.Click();
         GlobalDefinitions.wait(5);
         if (CreditAmount.Displayed && CreditAmount.Enabled)
         {
             CreditAmount.SendKeys("1");
         }
         else
         {
             Console.WriteLine("Credit textbox is not avaiable");
             return;
         }
     }
 }
Ejemplo n.º 2
0
 private void chooseSkillTrade(IWebElement element, string trade, string skillExc, string credit)
 {
     if (trade == "Skill-Exchange")
     {
         element.FindElement(By.XPath("//div[@class='ui radio checkbox']/input[@value = 'true' and @name='skillTrades']")).Click();
         if (SkillExchange.Displayed && SkillExchange.Enabled)
         {
             SkillExchange.EnterText(skillExc);
             SkillExchange.EnterText(Keys.Enter);
         }
         else
         {
             Console.WriteLine("Skill Exchange textbox is not avaiable");
             return;
         }
     }
     else if (trade == "Credit")
     {
         IWebElement Credit = element.FindElement(By.XPath("//div[@class='ui radio checkbox']/input[@value = 'false' and @name = 'skillTrades']"));
         Credit.Click();
         GlobalDefinitions.wait(5);
         if (CreditAmount.Displayed && CreditAmount.Enabled)
         {
             CreditAmount.EnterText(credit);
         }
         else
         {
             Console.WriteLine("Credit textbox is not avaiable");
             return;
         }
     }
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 4
0
        internal void EditOptions(int DataRow)
        {
            //Check if the user is able to Click on the "Skill Exchange" option
            SkillTradeExchangeOption.Click();

            //Check if the user is able to create a tag for the "Skill Exchange" field
            SkillExchange.SendKeys(GlobalDefinitions.ReadData(DataRow, "SkillExchange") + Keys.Enter);
        }
Ejemplo n.º 5
0
        //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"));
        }
Ejemplo n.º 6
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);
 }
Ejemplo n.º 7
0
        public void AddShareSkillDetails(ShareSkillDetails skillObj)
        {
            //Enter Title data from Excel
            driver.WaitForElementIsVisible(TitleTextBox);
            TitleTextBox.SendKeys(skillObj.Title);

            //Enter Description data from Excel
            DescriptionTextBox.SendKeys(skillObj.Description);

            //Select Category based on Excel data
            driver.WaitForElementIsVisible(CategoryDropDown);
            SelectElement categorySelect = new SelectElement(CategoryDropDown);

            categorySelect.SelectByText(skillObj.Category);

            //Select Subcategory based on Excel data
            SelectElement subCategorySelect = new SelectElement(SubCategoryDropDown);

            subCategorySelect.SelectByText(skillObj.SubCategory);

            //Enter Text in Tag and perform keyboard action "Enter"
            TagTextBox.SendKeys(skillObj.Tags + Keys.Enter);

            //Select Service Type based on Excel data
            SelectRadioButton(ServiceType, ServiceTypeLabel, skillObj.ServiceType);

            //Select Location Type based on Excel data
            SelectRadioButton(LocationType, LocationTypeLabel, skillObj.LocationType);

            //Enter Startdate based on Excel data
            StartDate.SendKeys(skillObj.StartDate);

            //Enter Enddate based on Excel data
            EndDate.SendKeys(skillObj.EndDate);

            //Select days based on excel data and enter start and end time
            SelectAvailableDays(skillObj.SelectDay, skillObj.StartTime, skillObj.EndTime);

            //Select SkillTrade based on Excel data
            SelectRadioButton(SkillTrade, SkillTradeLabel, skillObj.SkillTrade);

            //Enter Text in Tag and perform keyboard action "Enter"
            SkillExchange.SendKeys(skillObj.SkillExchange + Keys.Enter);

            //Click WorkSample and upload the file through AutoIT
            driver.WaitForElementIsVisible(WorkSamples);
            WorkSamples.Click();
            UploadFileByAutoIT();

            //Select Active/Hidden based on Excel data
            SelectRadioButton(Active, ActiveLabel, skillObj.Active);

            //Save ShareSkill data
            SaveButton.Click();
        }
Ejemplo n.º 8
0
        //ENTER SHARE SKILL
        public ManageListings AddShareSkills()
        {
            //Enter text in title
            EnterText(Title, ExcelLibHelper.ReadData(2, "Title"));

            //Enter text in description
            EnterText(Description, ExcelLibHelper.ReadData(2, "Description"));

            //impplicit wait
            Driver.TurnOnWait();

            //select Category
            SelectDropDown(CategoryDropDown, ExcelLibHelper.ReadData(2, "Category"));

            //select SubCategory
            SelectDropDown(SubCategoryDropDown, ExcelLibHelper.ReadData(2, "SubCategory"));

            //Select Tags and press enter
            Tags.SendKeys(ExcelLibHelper.ReadData(2, "Tags"));
            Tags.SendKeys(Keys.Enter);

            //explicit wait
            Driver.waitClickableElement("//form/div[5]/div[@class='twelve wide column']/div/div[@class='field'][2]");

            //click on Service Type
            selectServiceType();

            //Click on Location type
            Clickoperation(LocationTypeOption);
            Driver.TurnOnWait();

            //Enter details in dynamic table
            SelectDaytime();

            //Clcik on Skill exchange option
            Clickoperation(SkillTradeOption);

            //enter tag in skill exchange
            SkillExchange.SendKeys(ExcelLibHelper.ReadData(2, "Skill-Exchange"));
            SkillExchange.SendKeys(Keys.Enter);

            //implicit wait
            Driver.TurnOnWait();

            // Add Work Sample
            worksample();

            //click on active option button
            Clickoperation(ActiveOption);

            //Click on Save Button
            Clickoperation(Save);

            return(new ManageListings());
        }
Ejemplo n.º 9
0
        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();
        }
Ejemplo n.º 10
0
 internal void SelectSkillTrade()
 {
     if (GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade") == "Skill-Exchange")
     {
         optSkillExchange.Click();
         SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange"));
         SkillExchange.SendKeys(Keys.Enter);
     }
     else
     {
         optCredit.Click();
         CreditAmount.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Credit"));
     }
 }
Ejemplo n.º 11
0
        }//

        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();
        }
Ejemplo n.º 12
0
        internal void Avalible_Days_Time_Details(int dataRow)
        {
            DateTime myvalue = DateTime.Now;

            StartDate.SendKeys(myvalue.AddDays(3).ToLongDateString());

            //StartDate.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate"));


            // Fill End Date

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



            //Mon.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Select day"));
            Mon.Click();
            Console.WriteLine(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "StartTime")).ToString("hh:mmtt"));
            MonStartTime.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "StartTime")).ToString("hh:mmtt"));
            //MonStartTime.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "StartTime")).ToLongTimeString());
            //DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "Endtime")).ToString("HH:mm");

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


            //MonStartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "StartTime") + Keys.Enter);
            //MonEndTime.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(2, "EndTime")).ToLongTimeString());
            //MonEndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "EndTime") + Keys.Enter);


            Tue.Click();
            TueStartTime.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(3, "StartTime")).ToString("hh:mmtt"));

            //MonStartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "StartTime") + Keys.Enter);
            TueEndTime.SendKeys(DateTime.Parse(GlobalDefinitions.ExcelLib.ReadData(3, "EndTime")).ToString("hh:mmtt"));
            //MonEndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "EndTime") + Keys.Enter);

            //TueStartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "StartTime"));
            //TueEndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "EndTime"));



            SkillExchange.Click();
            SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange") + Keys.Enter);
        }
Ejemplo n.º 13
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();
        }
Ejemplo n.º 14
0
        public void AddShareSkill(IWebDriver Driver)
        {
            //Click Share Skill button
            ShareSkillBtn.Click();
            Thread.Sleep(5000);

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

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

            //Select Category
            var selectElement1 = new SelectElement(Category);

            selectElement1.SelectByValue("6");
            Console.WriteLine("Category selcted");

            //Select Sub-Catergory

            var selectElement2 = new SelectElement(Subcategory);

            selectElement2.SelectByText("QA");
            Console.WriteLine("Sub-Category selcted");

            //Select Tags
            Tag1.SendKeys(Helpers.ExcelLib.ReadData(2, "Tag1"));
            Tag1.SendKeys(Keys.Enter);

            Console.WriteLine("Enter clicked");

            //Select Service Type
            Servicetype.Click();

            //Select Location Type
            Locationtype.Click();

            //Select End date
            Enddate.SendKeys("29-07-2019");

            //Input for the whole week
            //Monday time
            MonCheck.Click();
            MonStart.SendKeys(Helpers.ExcelLib.ReadData(2, "MonStart"));
            MonEnd.SendKeys(Helpers.ExcelLib.ReadData(2, "MonEnd"));

            //Tuesday time
            TuesCheck.Click();
            TuesStart.SendKeys(Helpers.ExcelLib.ReadData(2, "TuesStart"));
            TuesEnd.SendKeys(Helpers.ExcelLib.ReadData(2, "TuesEnd"));

            //Wednesday time
            WedCheck.Click();
            WedStart.SendKeys(Helpers.ExcelLib.ReadData(2, "WedStart"));
            WedEnd.SendKeys(Helpers.ExcelLib.ReadData(2, "WedEnd"));

            //Thursday time
            ThursCheck.Click();
            ThursStart.SendKeys(Helpers.ExcelLib.ReadData(2, "ThursStart"));
            ThursEnd.SendKeys(Helpers.ExcelLib.ReadData(2, "ThursEnd"));

            //Friday time
            FriCheck.Click();
            FriStart.SendKeys(Helpers.ExcelLib.ReadData(2, "FriStart"));
            FriEnd.SendKeys(Helpers.ExcelLib.ReadData(2, "FriEnd"));

            //Select Skill trade
            SkillTrade.Click();

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

            //Upload Work Sample Upload click
            IJavaScriptExecutor js1 = (IJavaScriptExecutor)Driver;

            js1.ExecuteScript("arguments[0].click();", Upload);
            Thread.Sleep(5000);

            AutoItX3 autoIt = new AutoItX3();

            autoIt.WinActivate("Open");
            autoIt.Send(@"C:\Users\Bhushan\Desktop\Updated - Mars(QA)-CompetitionTask.pdf");
            Thread.Sleep(4000);
            autoIt.Send("{ENTER}");

            //Select Active
            SkillActive.Click();

            //Click Save
            Savebtn.Click();
            Thread.Sleep(5000);

            //Verification

            //CommonDriver.Driver.FindElement(By.XPath("//a[contains(text(),'Manage Listings')]")).Click();
            //string ExpectedResult1 = "Software Tester 7";
            //string ActualResult1 = CommonDriver.Driver.FindElement(By.XPath("//td[contains(text(),'q')]")).Text;

            //if (ActualResult1 == ExpectedResult1)
            //{
            //    Console.WriteLine("Test Pass: Skill Added");
            //}
            //else
            //{
            //    Console.WriteLine("Test Fail: Skill Not Added");
            //}

            try
            {
                Assert.IsTrue(Driver.FindElement(By.XPath("//tr[1]//td[3]")).Displayed);
                Console.WriteLine("Test Pass: Skill listing Added");
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 15
0
        internal void Share_Skill()
        {
            Console.WriteLine("Start of shareSkill Method");

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

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

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

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

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

            //Click on Category
            Category.Click();

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

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

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

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

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

            //Click on tags
            Tags.Click();

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

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

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

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

            Thread.Sleep(1000);

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

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

            Thread.Sleep(1000);

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

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

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

            Thread.Sleep(2000);

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

            Thread.Sleep(3000);

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

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

            //Click on Save
            Save.Click();
        }
Ejemplo n.º 16
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();
            }
        }
Ejemplo n.º 17
0
        internal void EditShareSkill(IWebDriver driver)
        {
            CommomDriver.Wait(2000);

            //Click on ShareSkill Button
            ShareSkillBtn.Click();

            //Wait untill driver find title text Field
            CommomDriver.WaitForVisibility(driver, "Name", "title", 2);

            //populate login page data collection
            ExcelLibHelpers.PopulateInCollection(MarsResource.ExcelPath, "EditShareSkill");

            //Give a Title
            Title.SendKeys(ExcelLibHelpers.ReadData(2, "Title"));

            //Give a Description
            Description.SendKeys(ExcelLibHelpers.ReadData(2, "Description"));

            //select one of the option from Category
            Category.SendKeys(ExcelLibHelpers.ReadData(2, "Category"));

            ////Select SubCategory Option
            SubCategory.SendKeys(ExcelLibHelpers.ReadData(2, "Sub Category"));

            //give input in Tag TextField
            Tag.SendKeys(ExcelLibHelpers.ReadData(2, "Tag") + Keys.Enter);
            Tag.SendKeys(ExcelLibHelpers.ReadData(3, "Tag") + Keys.Enter);

            //choose Radio button option
            ServiceType.Click();

            //Choose Location
            Location.Click();

            //Give StartDate
            StartDate.SendKeys(ExcelLibHelpers.ReadData(2, "Start Date"));

            //Give EndDate
            EndDate.SendKeys(ExcelLibHelpers.ReadData(2, "End Date"));

            for (int i = 2; i < 9; i++)
            {
                for (int j = 2; j < 9; j++)
                {
                    IWebElement SatrtTime = driver.FindElement(By.XPath("//div[" + i + "]/div[2]/input"));
                    IWebElement EndTime   = driver.FindElement(By.XPath("//div[" + j + "]/div[3]/input"));
                    if (i == 2 && j == 2)
                    {
                        SatrtTime.SendKeys(ExcelLibHelpers.ReadData(2, "Start Time"));
                        EndTime.SendKeys(ExcelLibHelpers.ReadData(2, "End Time"));
                    }
                    if (i == 3 && j == 3)
                    {
                        SatrtTime.SendKeys(ExcelLibHelpers.ReadData(3, "Start Time"));
                        EndTime.SendKeys(ExcelLibHelpers.ReadData(3, "End Time"));
                    }
                    if (i == 4 && j == 4)
                    {
                        SatrtTime.SendKeys(ExcelLibHelpers.ReadData(4, "Start Time"));
                        EndTime.SendKeys(ExcelLibHelpers.ReadData(4, "End Time"));
                    }
                    if (i == 5 && j == 5)
                    {
                        SatrtTime.SendKeys(ExcelLibHelpers.ReadData(5, "Start Time"));
                        EndTime.SendKeys(ExcelLibHelpers.ReadData(5, "End Time"));
                    }
                    if (i == 6 && j == 6)
                    {
                        SatrtTime.SendKeys(ExcelLibHelpers.ReadData(6, "Start Time"));
                        EndTime.SendKeys(ExcelLibHelpers.ReadData(6, "End Time"));
                    }
                    if (i == 7 && j == 7)
                    {
                        SatrtTime.SendKeys(ExcelLibHelpers.ReadData(7, "Start Time"));
                        EndTime.SendKeys(ExcelLibHelpers.ReadData(7, "End Time"));
                    }
                    if (i == 8 && j == 8)
                    {
                        SatrtTime.SendKeys(ExcelLibHelpers.ReadData(8, "Start Time"));
                        EndTime.SendKeys(ExcelLibHelpers.ReadData(8, "End Time"));
                    }
                    else
                    {
                        continue;
                    }
                }
            }

            //Click on Share Trade Radio Button
            SkillTrade.Click();

            //give inpute Skill Exchange
            SkillExchange.SendKeys(ExcelLibHelpers.ReadData(2, "Skill Exchange") + Keys.Enter + ExcelLibHelpers.ReadData(3, "Skill Exchange") + Keys.Enter);

            //Click on Work Sample
            WorkSample.Click();

            //Handle the window that not belongs to Browser -AutoIt - see blog for more info
            //below line execute the AutoIT script
            //Create an object for AutoIt
            AutoItX3 autoIt = new AutoItX3();

            //This statement Active the window and perform set of auctions
            autoIt.WinActivate("Open");
            Thread.Sleep(1000);
            //set the path to open the file on browser
            autoIt.Send(@"D:\scrummeeting.png");
            Thread.Sleep(1000);
            //It will click on "Open" button
            autoIt.Send("{ENTER}");

            //click on active radio button
            Active.Click();

            //click on save button
            savebtn.Click();

            CommomDriver.Wait(2);
            //For Assertion- Go to manage list
            ManageList.Click();
            //Get the text from manage list of Title and Category
            String ManageTitle        = TitleofManage.Text;
            String ManageListCategory = CategoryofManage.Text;

            try
            {
                //For Assertion - After Save Skills For varification,
                //Goto manage list page and match Title and Cetegory with Excel Enter Skill
                Assert.AreEqual(ManageTitle, ExcelLibHelpers.ReadData(2, "Title"));
                Assert.AreEqual(ManageListCategory, ExcelLibHelpers.ReadData(2, "Category"));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Ejemplo n.º 18
0
        internal void EnterShareSkill(IWebDriver driver)
        {
            // Populate data saved in excel to collection
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ShareSkillPath, "ShareSkill");

            // Click ShareSkill Button
            GlobalDefinitions.WaitForElementClickable(driver, "LinkText", "Share Skill", 5);
            ShareSkillBtn.Click();

            // Wait Elements on new page
            GlobalDefinitions.WaitForTextPresentInElement(driver, Title, "", 10);

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

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

            // Select Category from Excel
            GlobalDefinitions.WaitForElement(driver, "Name", "categoryId", 10);

            new SelectElement(CategoryDropdown).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Category"));
            new SelectElement(SubCategoryDropdown).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory"));

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

            // Choose Service Type radio button from excel
            IWebElement ServiceTypeRadioBtn = driver.FindElement(By.XPath("//input[@name='serviceType' " +
                                                                          "and @value='" + GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType") + "'] "));

            ServiceTypeRadioBtn.Click();

            // Choose Location Type radio button from excel
            IWebElement LocationTypeRadioBtn = driver.FindElement(By.XPath("//input[@name='locationType' " +
                                                                           "and @value='" + GlobalDefinitions.ExcelLib.ReadData(2, "LocationType") + "']"));

            LocationTypeRadioBtn.Click();

            // Enter Available days from excel
            // *** Enter start date and end date ***
            StartDateInputArea.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "StartDate"));
            EndDateInputArea.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "EndDate"));

            // *** Set loop for days checkbox ***
            for (int rows = 2; rows < 9; rows++)
            {
                var sr = GlobalDefinitions.ExcelLib.ReadData(rows, "SelectDay").ToString();
                if (sr != null && sr != "")
                {
                    // Select checkbox
                    IWebElement DaysCheckbox = driver.FindElement(By.XPath("//input[@name='Available' " +
                                                                           "and @index='" + GlobalDefinitions.ExcelLib.ReadData(rows, "SelectDay") + "']"));
                    DaysCheckbox.Click();

                    // Enter start time
                    IWebElement StartTimeInputArea = driver.FindElement(By.XPath("//input[@name='StartTime' " +
                                                                                 "and @index='" + GlobalDefinitions.ExcelLib.ReadData(rows, "SelectDay") + "']"));
                    StartTimeInputArea.SendKeys(GlobalDefinitions.ExcelLib.ReadData(rows, "StartTime"));

                    // Enter end time
                    IWebElement EndTimeInputArea = driver.FindElement(By.XPath("//input[@name='EndTime' " +
                                                                               "and @index='" + GlobalDefinitions.ExcelLib.ReadData(rows, "SelectDay") + "']"));
                    EndTimeInputArea.SendKeys(GlobalDefinitions.ExcelLib.ReadData(rows, "EndTime"));
                }
                else
                {
                    break;
                }
            }


            // Choose Skill Trade radio button
            try
            {
                string      SkillTradeTypeExcel = GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade").ToString();
                IWebElement SkillTradeRadioBtn  = driver.FindElement(By.XPath("//input[@name='skillTrades' " +
                                                                              "and @value='" + SkillTradeTypeExcel + "']"));
                SkillTradeRadioBtn.Click();

                // Condition1: Enter Skill-Exchange from excel-------Condition2: Enter Credit
                if (SkillTradeTypeExcel == "true")
                {
                    SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange Tag"));
                    SkillExchange.SendKeys(Keys.Enter);
                }
                if (SkillTradeTypeExcel == "false")
                {
                    try
                    {
                        var CreditExcel = Convert.ToDecimal(GlobalDefinitions.ExcelLib.ReadData(2, "Credit"));

                        if (0 <= CreditExcel && CreditExcel <= 10)
                        {
                            CreditAmount.SendKeys(CreditExcel.ToString());
                        }
                        else
                        {
                            Assert.Fail("Please enter a number between 0-10.");
                        }
                    } catch (Exception e)
                    {
                        Assert.Fail("Credit input is illegal, please check format!", e.Message);
                    }
                }
            } catch (Exception ex)
            {
                Assert.Fail("Test failed at choosing skill trade type", ex.Message);
            }



            //Upload document from the path saved in excel, if it's input type, then can send path directly
            // Option 1: SendKeys
            //try
            //{
            //    IWebElement upload = driver.FindElement(By.XPath("//input[@id='selectFile']"));
            //    // Uploading File path
            //    var SampleWorkPath = MarsResource.SampleWorkPath;
            //    string fullPath = System.IO.Path.GetFullPath(SampleWorkPath);
            //    upload.SendKeys(fullPath);
            //}
            //catch (Exception e)
            //{
            //    Assert.Fail("Failed to upload work sample", e.Message);
            //}

            // Option 2: AutoIt
            //driver.FindElement(By.ClassName("huge plus circle icon padding-25")).Click(); //Class Name Shouldn't have space inside, or use xpath or css.
            driver.FindElement(By.CssSelector("i[class='huge plus circle icon padding-25']")).Click();

            AutoItX3 AutoIt = new AutoItX3();

            AutoIt.WinActivate("Open");
            // Must wait input text ready to input or will lose part of the url
            AutoIt.WinWaitActive("Open", "Edit", 3);

            var SampleWorkPath = MarsResource.SampleWorkPath;

            AutoIt.Send(Path.GetFullPath(SampleWorkPath));
            Thread.Sleep(1500);
            AutoIt.Send("{ENTER}");


            // Choose Active radio button
            GlobalDefinitions.WaitForElement(driver, "XPath", "//i[@class='remove sign icon floatRight']", 10);
            IWebElement IsActiveRadioBtn = driver.FindElement(By.XPath("//input[@name='isActive' and" +
                                                                       " @value='" + GlobalDefinitions.ExcelLib.ReadData(2, "Active") + "']"));

            IsActiveRadioBtn.Click();

            // Click Save Button to save all data
            Save.Click();
        }
Ejemplo n.º 19
0
        public void AddService()
        {
            Global.GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ServiceListing");

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

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

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

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

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

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

            GlobalDefinitions.wait(2000);

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

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

            //Click Service Type

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

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

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

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

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

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

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

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

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

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

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

                default: break;
                }
            }


            //Click SkillTrade

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

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

            //Approach 2: Using AutoIT

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

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

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

            //click save
            Save.Click();
            Base.test.Log(LogStatus.Info, "Saved Service successfully");
        }
        public void EditSkills()
        {
            //Populate the Excel Sheet
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ManageListings");
            Thread.Sleep(4000);

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

            while (true)

            {
                var j = 1;

                while (j <= 10)

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

                        //Selecting Skill Trade

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

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

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

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

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

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

            Assert.AreEqual("Test Analyst", Title1);
            Console.WriteLine(" Skills Edited Successfully");
        }
Ejemplo n.º 21
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);
        }
Ejemplo n.º 22
0
        internal bool ShareSkill()
        {
            try
            {
                //Populate From Excel
                GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill");
                Thread.Sleep(2000);

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

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

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

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

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

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

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

                StartDate.SendKeys(SDateForm[0]);

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

                EndDate.SendKeys(EDateForm[0]);

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

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

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


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


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

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

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

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


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

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

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

                Thread.Sleep(2000);

                Save.Click();

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

            catch (Exception e)
            {
                Base.test.Log(LogStatus.Fail, "Error in adding service" + e.Message);
                return(false);
            }
        }
Ejemplo n.º 23
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"));
        }
Ejemplo n.º 24
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"));
        }
Ejemplo n.º 25
0
        //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"));
        }
Ejemplo n.º 26
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");
        }
Ejemplo n.º 27
0
        public void ShareProfile(string Decission)
        {
            //Populate the Excel Sheet
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill");
            Thread.Sleep(1000);


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

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

            //Select the category
            IList <IWebElement> CategoryOptions = Category.FindElements(By.TagName("option"));

            for (int i = 0; i < CategoryOptions.Count; i++)
            {
                if (CategoryOptions[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Category"))
                {
                    CategoryOptions[i].Click();
                    Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Category selected");
                }
            }
            //-------------------------------------------------------------------------------------

            //Select Subcategory
            IList <IWebElement> SubcategoryOptions = SubCategory.FindElements(By.TagName("option"));

            for (int i = 0; i < SubcategoryOptions.Count; i++)
            {
                if (SubcategoryOptions[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Subcategory"))
                {
                    SubcategoryOptions[i].Click();
                    Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Subcategory Selected");
                }
            }
            //-------------------------------------------------------------------------------------------

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

            //Define Lists of radio button options in Skill Share page
            IList <IWebElement> ServiceTypeOptions = GlobalDefinitions.driver.FindElements(By.XPath("//div[@class='field']/div"));
            IList <IWebElement> Radiobtn           = GlobalDefinitions.driver.FindElements(By.XPath("//div[@class='field']/div/input"));

            Thread.Sleep(1000);

            //---------------------------------------------------------------------------------------------

            //Select Service Type
            for (int i = 0; i < ServiceTypeOptions.Count; i++)
            {
                if (ServiceTypeOptions[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Service Type"))
                {
                    Radiobtn[i].Click();
                    Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Service Type Selected");
                }
            }
            //------------------------------------------------------------------------------------------
            //Select Location Type
            for (int i = 0; i < ServiceTypeOptions.Count; i++)
            {
                if (ServiceTypeOptions[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Location Type"))
                {
                    Radiobtn[i].Click();
                    Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Location Type Selected");
                }
            }

            //-----------------------------------------------------------------------------------------------
            //Enter start date
            StartDate.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Start Date"));
            Console.WriteLine(GlobalDefinitions.ExcelLib.ReadData(2, "Start Date"));
            //StartDate.SendKeys("06/16/2019");
            Thread.Sleep(1000);

            //Enter end date
            //EndDate.Clear();
            EndDate.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "End Date"));
            // ---------------------------------------------------------------------------------

            //Select Available Date and Time
            List <int> AvailableDays = new List <int> {
                0, 1, 0, 1, 0, 0, 0
            };
            IList <IWebElement> Dayspath  = Global.GlobalDefinitions.driver.FindElements(By.XPath("//input[@name='Available']"));
            IList <IWebElement> StartTime = Global.GlobalDefinitions.driver.FindElements(By.XPath("//input[@name='StartTime']"));
            IList <IWebElement> EndTime   = Global.GlobalDefinitions.driver.FindElements(By.XPath("//input[@name='EndTime']"));

            if (AvailableDays[0] == 1)
            {
                Dayspath[0].Click();

                StartTime[1].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "StartTime"));
                EndTime[0].SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "EndTime"));
            }

            if (AvailableDays[1] == 1)
            {
                Dayspath[1].Click();

                StartTime[1].SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "StartTime"));
                StartTime[1].SendKeys(Keys.ArrowDown);
                StartTime[1].SendKeys(Keys.ArrowDown);
                Console.WriteLine(GlobalDefinitions.ExcelLib.ReadData(3, "StartTime"));
                EndTime[1].SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "EndTime"));
                EndTime[1].SendKeys(Keys.ArrowDown);
            }

            if (AvailableDays[2] == 1)
            {
                Dayspath[2].Click();
                StartTime[2].SendKeys(GlobalDefinitions.ExcelLib.ReadData(4, "StartTime"));
                EndTime[2].SendKeys(GlobalDefinitions.ExcelLib.ReadData(4, "EndTime"));
            }

            if (AvailableDays[3] == 1)
            {
                Dayspath[3].Click();
                StartTime[3].SendKeys(GlobalDefinitions.ExcelLib.ReadData(5, "StartTime"));
                StartTime[3].SendKeys(Keys.ArrowDown);
                StartTime[3].SendKeys(Keys.ArrowDown);
                EndTime[3].SendKeys(GlobalDefinitions.ExcelLib.ReadData(5, "EndTime"));
                EndTime[3].SendKeys(Keys.ArrowDown);
            }

            if (AvailableDays[4] == 1)
            {
                Dayspath[4].Click();
                StartTime[4].SendKeys(GlobalDefinitions.ExcelLib.ReadData(6, "StartTime"));
                EndTime[4].SendKeys(GlobalDefinitions.ExcelLib.ReadData(6, "EndTime"));
            }

            if (AvailableDays[5] == 1)
            {
                Dayspath[5].Click();
                StartTime[5].SendKeys(GlobalDefinitions.ExcelLib.ReadData(7, "StartTime"));
                EndTime[5].SendKeys(GlobalDefinitions.ExcelLib.ReadData(7, "EndTime"));
            }

            if (AvailableDays[6] == 1)
            {
                Dayspath[6].Click();
                StartTime[6].SendKeys(GlobalDefinitions.ExcelLib.ReadData(8, "StartTime"));
                EndTime[6].SendKeys(GlobalDefinitions.ExcelLib.ReadData(8, "EndTime"));
            }


            Thread.Sleep(1000);
            //--------------------------------------------------------------------------------
            //Select Skill trade
            for (int i = 0; i < ServiceTypeOptions.Count; i++)
            {
                Console.WriteLine(ServiceTypeOptions[i].Text);
                if (ServiceTypeOptions[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Skill Trade"))
                {
                    Radiobtn[i].Click();
                    Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Skill Trade Selected");
                }
            }
            //----------------------------------------------------------------------------------------

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

            //----------------------------------------------------------------------------------------
            //Work Samples File Upload
            Thread.Sleep(2000);
            workSamplesUpload.Click();
            AutoItX3 autoit = new AutoItX3();

            autoit.WinActivate("Open"); //Activate the window
            autoit.Send(@"C:\Users\dell\Desktop\DESKTOP_AKILA\MVP studio\Mars Competition1\MarsFramework\MarsFramework\download.jpg");
            Thread.Sleep(2000);
            autoit.Send("{ENTER}");

            //--------------------------------------------------------------------------------------------
            //Select Active
            for (int i = 0; i < ServiceTypeOptions.Count; i++)
            {
                Console.WriteLine(ServiceTypeOptions[i].Text);
                if (ServiceTypeOptions[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Active"))
                {
                    Radiobtn[i].Click();
                    Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Active Selected");
                }
            }

            if (Decission == "Save")
            {
                SaveBtn.Click();
            }
            else
            {
                CancelBtn.Click();
            }
        }
Ejemplo n.º 28
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");
        }
Ejemplo n.º 29
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);
            }
        }
Ejemplo n.º 30
0
        internal void EnterShareSkill()
        {
            //Thread.Sleep(3000);

            GlobalDefinitions.WaitForElement(_driver, By.LinkText("Share Skill"), 3000);
            //GlobalDefinitions.Wait(3000);

            //click share skill button
            ShareSkillBtn.Click();

            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "EnterShareSkill");
            //Thread.Sleep(3000);
            //GlobalDefinitions.Wait(3000);
            GlobalDefinitions.WaitForElement(_driver, By.Name("title"), 3000);


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

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

            //Category
            Category.Click();

            Category.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[3]/div[2]/div/div[1]/select/option[7]")).Click();
            GlobalDefinitions.Wait(1000);


            //Sub-Category
            SubCategory.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[3]/div[2]/div/div[2]/div[1]/select/option[5]")).Click();
            GlobalDefinitions.Wait(1000);

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

            //Service
            Service.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[5]/div[2]/div[1]/div[1]/div/input")).Click();     // [Hourly basis service]
            GlobalDefinitions.Wait(3000);
            // Thread.Sleep(1000);


            //Service.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[5]/div[2]/div[1]/div[2]/div/input")).Click();      [One-off Service]


            //Location
            // Location.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[6]/div[2]/div/div[1]/div/input")).Click();       [On-site]
            Location.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[6]/div[2]/div/div[2]/div/input")).Click();       // [Online]
            GlobalDefinitions.Wait(5000);

            //Available Days
            GlobalDefinitions.WaitForElement(_driver, By.Name("startDate"), 2000);

            //Start Date
            StartDate.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "StartDate"));
            GlobalDefinitions.WaitForElement(_driver, By.Name("endDate"), 2000);

            // End Date
            EndDate.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "EndDate"));
            GlobalDefinitions.Wait(2000);

            //Skill Trade
            SkillTrade.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[8]/div[2]/div/div[1]/div/input")).Click();     // [Skill-exchange]

            //Skill Exchange
            SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "SkillExchange"));
            SkillExchange.SendKeys(Keys.Enter);
            //Thread.Sleep(1000);
            GlobalDefinitions.Wait(1000);


            //Active
            Active.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[10]/div[2]/div/div[1]/div/input")).Click();        // [Active]
            //Thread.Sleep(1000);
            GlobalDefinitions.Wait(1000);


            //Save
            Save.Click();
            //Thread.Sleep(1000);
            GlobalDefinitions.Wait(1000);
        }