示例#1
0
        internal void ValidateShareSkillData()
        {
            //Validate Entered Title
            GlobalDefinitions.ValidateFieldData(GlobalDefinitions.ExcelLib.ReadData(2, "Title"), Title.GetAttribute("value"), "Title");

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

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

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

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

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

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

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

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

            //Validate Days and Time
            ValidateDaysAndTime();

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

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

            //Validate Active
            GlobalDefinitions.ValidateRadioButton(ActiveOption, By.Name("isActive"), GlobalDefinitions.ExcelLib.ReadData(2, "Active"), "Active");
        }
示例#2
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");
        }