Esempio n. 1
0
        public void AddNewShareSkill()
        {
            #region Navigate to Share Skills Page

            // Click on Share Skills Page
            ShareSkills.Click();
            Thread.Sleep(1000);

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

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

            //Enter description
            Description.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Description"));
            Base.test.Log(LogStatus.Info, "Description has been successfully entered");

            //click on category dropdown menu
            Thread.Sleep(500);
            Category.Click();
            Thread.Sleep(1000);


            //Select the category
            ProgrammingandTech.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Category"));
            Thread.Sleep(1000);


            //Click on subcatogory drop down option
            Thread.Sleep(1000);
            SubCategory.Click();

            //Select the Sub-Category option
            SubCategory.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Subcategory"));
            SubCategory.SendKeys(Keys.Enter);
            Base.test.Log(LogStatus.Info, "SubCategory has been successfully entered");
            QA.Click();


            //Enter Tags
            Tags.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Tags"));
            Tags.SendKeys(Keys.Enter);
            Base.test.Log(LogStatus.Info, "TagName has been successfully entered");

            //Select service type
            //ServiceTypeHourly.Click();

            if (GlobalDefinitions.ExcelLib.ReadData(2, "Service Type") == "Hourly basis service")
            {
                ServiceTypeHourly.Click();
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "Service Type") == "One-off service")
            {
                ServiceTypeOneOff.Click();
            }

            //Select Location Type
            //LocationTypeOnline.Click();
            if (GlobalDefinitions.ExcelLib.ReadData(2, "Location Type") == "Online")
            {
                LocationTypeOnline.Click();
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "Location Type") == "On-site")
            {
                LocationTypeOnsite.Click();
            }



            //Click the start date
            StartDate.Click();
            Thread.Sleep(500);

            //Select the date
            Thread.Sleep(500);
            StartDate.SendKeys(Keys.Backspace);
            StartDate.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Start Date"));

            //Select the end Date
            Thread.Sleep(1000);
            EndDate.SendKeys(Keys.Backspace);
            EndDate.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "End Date"));

            //Select the Days available
            selectDays.Click();
            Thread.Sleep(500);

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

            //Select EndTime
            Thread.Sleep(1000);
            EndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "End Time"));

            //Select Skill Trade
            Credit.Click();
            Thread.Sleep(500);
            if (GlobalDefinitions.ExcelLib.ReadData(2, "Skill Trade") == "Skill-exchange")
            {
                RequiredSkills.Click();
                RequiredSkills.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill Trade"));
                RequiredSkills.SendKeys(Keys.Enter);
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "Skill Trade") == "Credit")
            {
                CreditAmount.Click();
                CreditAmount.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Credit Amount"));
                CreditAmount.SendKeys(Keys.Enter);

                //Enter credit amount
                // CreditAmount.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Credit Amount"));

                //Select the stats
                // StatusActive.Click();
                //Thread.Sleep(500);
                if (GlobalDefinitions.ExcelLib.ReadData(2, "Status") == "Active")
                {
                    StatusActive.Click();
                }
                else if (GlobalDefinitions.ExcelLib.ReadData(2, "Status") == "Hidden")
                {
                    StatusHidden.Click();
                }

                //Save the Share Skill
                Thread.Sleep(500);
                SaveShareSkills.Click();
                Thread.Sleep(500);


                //Verify if newShared skill is saved
                Thread.Sleep(3000);
                string ShareSkillSucess = Global.GlobalDefinitions.driver.FindElement(By.CssSelector("#listing-management-section > div:nth-child(3) > div:nth-child(2) > table > thead > tr > th:nth-child(1)")).Text;

                if (ShareSkillSucess == "Image")
                {
                    Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Saved Skill Successful");
                }
                else
                {
                    Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Saving Skill Unsuccessful");
                }
            }
        }
Esempio n. 2
0
        public void AddNewSkill()
        {
            #region Navigate to Share Skills Page
            // Click on Share Skills Page
            ShareSkill.WaitForElementClickable(_driver, 60);
            ShareSkill.Click();
            //Populate the excel data
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkills");

            #endregion


            #region Enter Title
            Title.WaitForElementClickable(_driver, 60);
            //Enter the data in Title textbox
            Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "title"));

            #endregion

            #region Enter Description

            //Enter the data in Description textbox
            Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "EnterDescription"));


            #endregion

            #region Category Drop Down

            // Click on Category Dropdown
            Category.Click();


            // Select Category from Category Drop Down
            var SelectElement = new SelectElement(Category);
            SelectElement.SelectByText((GlobalDefinitions.ExcelLib.ReadData(2, "category")));

            // Click on Sub-Category Dropdown
            SubCategory.Click();

            //Select Sub-Category from the Drop Down
            var SelectElement1 = new SelectElement(SubCategory);
            SelectElement1.SelectByText((GlobalDefinitions.ExcelLib.ReadData(2, "subcategory")));
            #endregion

            #region Tags
            // Eneter Tag
            Tag.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "TagName"));
            Tag.SendKeys(Keys.Enter);

            #endregion

            #region Service Type Selection

            // Service Type Selection

            if (GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType") == "Hourly basis service")
            {
                ServiceTypeHourly.Click();
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType") == "One-off service")
            {
                ServiceTypeOnOff.Click();
            }
            #endregion

            #region Select Location Type
            // Location Type Selection

            if (GlobalDefinitions.ExcelLib.ReadData(2, "SelectLocationType") == "On-site")
            {
                LocationTypeOnsite.Click();
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "SelectLocationType") == "Online")
            {
                LocationTypeOnline.Click();
            }
            #endregion

            #region Select Available Dates from Calendar
            // Select Start Date
            StartDate.Click();
            // Select End Date
            EndDate.Click();
            #endregion


            #region Select Skill Trade
            // Select Skill Trade

            if (GlobalDefinitions.ExcelLib.ReadData(2, "SelectSkillTrade") == "Skill-exchange")
            {
                RequiredSkills.Click();
                RequiredSkills.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "ExchangeSkill"));
                RequiredSkills.SendKeys(Keys.Enter);
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "SelectSkillTrade") == "Credit")
            {
                CreditAmount.Click();
                CreditAmount.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "AmountInExchange"));
                CreditAmount.SendKeys(Keys.Enter);
            }
            #endregion

            #region Select User Status
            // Select User Status

            if (GlobalDefinitions.ExcelLib.ReadData(2, "UserStatus") == "Active")
            {
                StatusActive.Click();
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "UserStatus") == "Hidden")
            {
                StatusHidden.Click();
            }
            #endregion


            #region Add Work Sample

            //Work Sample upload button path
            IWebElement upload = _driver.FindElement(By.XPath("//*[@id='selectFile']"));

            // Uploading File path
            var    GetCurrentDirectory = Directory.GetCurrentDirectory();
            String path = GetCurrentDirectory + @"\MarsFramework\Upload Files\Samplework.txt";
            upload.SendKeys(path);



            #endregion

            #region Save / Cancel Skill
            // Save or Cancel New Skill

            if (Global.GlobalDefinitions.ExcelLib.ReadData(2, "SaveOrCancel") == "Save")
            {
                SaveShareSkills.Click();
            }
            else if (Global.GlobalDefinitions.ExcelLib.ReadData(2, "SaveOrCancel") == "Cancel")
            {
                CancelShareSkills.Click();
            }
            #endregion


            #region Check whether New  skill created sucessfully

            string ShareSkillSucess = _driver.FindElement(By.LinkText("Manage Listings")).Text;

            if (ShareSkillSucess == "Manage Listings")
            {
                Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Shared Skill Successful");
            }
            else
            {
                Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Share Skill Unsuccessful");
            }
            #endregion
        }