Ejemplo n.º 1
0
 public void navigateToShareSkill()
 {
     //Click on the Share Skill button in the home page
     ShareSkill.Click();
 }
 public void ClickShareSkill()
 {
     Base.driver.WaitForElement(By.XPath("//div[@id='account-profile-section']/descendant::div[1]/section/descendant::a[6]"));
     ShareSkill.Click();
 }
Ejemplo n.º 3
0
        public void AddNewSkill()
        {
            #region Navigate to Share Skills Page
            // Click on Share Skills Page
            ShareSkill.WaitForElementClickable(Global.Base.driver, 60);
            ShareSkill.Click();
            //Populate the excel data
            GlobalDefinitions.ExcelLib.PopulateInCollection(MarsResources.ExcelPath, "ShareSkills");
            #endregion

            #region Enter Title
            Title.WaitForElementClickable(Global.Base.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
            Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "TagName"));
            Tags.SendKeys(Keys.Enter);
            Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "TagName"));
            Tags.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.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "StartDate"));
            // Select End Date
            EndDate.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "EndDate"));
            // select available days and start time and End time
            for (int i = 2; i < 9; i++)
            {
                for (int j = 2; j < 9; j++)
                {
                    for (int k = 2; k < 9; k++)
                    {
                        IWebElement SatrtTime     = driver.FindElement(By.XPath("//div[" + i + "]/div[2]/input"));
                        IWebElement EndTime       = driver.FindElement(By.XPath("//div[" + j + "]/div[3]/input"));
                        IWebElement AvailableDays = driver.FindElement(By.XPath("//div[7]/div[2]/div/div[" + k + "]/div[1]/div/input"));
                        if (i == 2 && j == 2 && k == 2)
                        {
                            AvailableDays.Click();
                            SatrtTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "StartTime"));
                            EndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "EndTime"));
                        }
                        if (i == 3 && j == 3 && k == 3)
                        {
                            AvailableDays.Click();
                            SatrtTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "StartTime"));
                            EndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "EndTime"));
                        }
                        if (i == 4 && j == 4 && k == 4)
                        {
                            AvailableDays.Click();
                            SatrtTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(4, "StartTime"));
                            EndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(4, "EndTime"));
                        }
                    }
                }
            }
            #endregion
            #region Select Skill Trade
            // Select Skill Trade
            if (GlobalDefinitions.ExcelLib.ReadData(2, "SelectSkillTrade") == "Skill-exchange")
            {
                SkillExchange.Click();
                RequiredSkills.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "ExchangeSkill"));
                RequiredSkills.SendKeys(Keys.Enter);
                RequiredSkills.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "ExchangeSkill"));
                RequiredSkills.SendKeys(Keys.Enter);
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "SelectSkillTrade") == "Credit")
            {
                CreditAmount.Click();
                CreditAmount.SendKeys(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
            //Click on Work sample
            WorkSample.Click();
            //AutoIT
            AutoItX3 AutoIt = new AutoItX3();
            AutoIt.WinActivate("Open");
            Thread.Sleep(3000);
            AutoIt.Send(@"A:\AdvanceTask\StandardTask\TW.docx");
            Thread.Sleep(2000);
            AutoIt.Send("{ENTER}");
            #endregion

            #region Save / Cancel Skill
            // Save or Cancel New Skill
            if (Global.GlobalDefinitions.ExcelLib.ReadData(2, "SaveOrCancel") == "Save")
            {
                Save.Click();
            }
            else if (Global.GlobalDefinitions.ExcelLib.ReadData(2, "SaveOrCancel") == "Cancel")
            {
                Cancel.Click();
            }
            #endregion
            Thread.Sleep(3000);
            #region Check whether New  skill created sucessfully

            //String expectedValue = GlobalDefinitions.ExcelLib.ReadData(2, "title");
            String actualTitle = driver.Title;
            //string ShareSkillSucess = driver.FindElement(By.TagName("h2")).Text;
            if (actualTitle == "ListingManagement")
            {
                Assert.IsTrue(true);
                Global.Base.test.Log(Status.Pass, "Shared Skill Successful");
                SaveScreenShotClass.SaveScreenshot(driver, "AddShareSkill");
            }
            else
            {
                Console.WriteLine("Test failed");
                SaveScreenShotClass.SaveScreenshot(driver, "FailedAddShareSkill");
                Global.Base.test.Log(Status.Fail, "Share Skill Unsuccessful");
            }
            #endregion
        }
Ejemplo n.º 4
0
        public void AddNewSkill()
        {
            #region Navigate to Share Skills Page
            // Click on Share Skills Page
            ShareSkill.WaitForElementClickable(Global.Base.driver, 60);
            ShareSkill.Click();
            //Populate the excel data
            GlobalDefinitions.ExcelLib.PopulateInCollection(MarsResources.ExcelPath, "ShareSkills");
            #endregion

            #region Enter Title
            Title.WaitForElementClickable(Global.Base.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
            Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "TagName"));
            Tags.SendKeys(Keys.Enter);
            Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "TagName"));
            Tags.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.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "StartDate"));
            // Select End Date

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

            // select available days and start time and End time

            // select available days and start time and End time
            Thread.Sleep(3000);
            IList <IWebElement> Sttim = driver.FindElements(By.Name("StartTime"));

            IList <IWebElement> Edtim = driver.FindElements(By.Name("EndTime"));
            //Driver.FindElements(By.Name("EndTime"));
            IList <IWebElement> Ckbx = driver.FindElements(By.XPath("(//input[@name='Available'])"));

            if (Ckbx.Count != 0)
            {
                //Selecting checkboxes for days from Monday to Friday
                for (int i = 1; i <= Ckbx.Count - 2; i++)
                {
                    //Verify whether checkbox is not selected
                    if (!Ckbx.ElementAt(i).Selected)
                    {
                        Ckbx.ElementAt(i).Click();
                    }
                    Console.WriteLine(driver);
                    //Validating the Count


                    Sttim.ElementAt(i).SendKeys(GlobalDefinitions.ExcelLib.ReadData(i + 1, "StartTime"));
                    // Sttim.ElementAt(i).SendKeys("10:00");


                    /*  var Svalue = Sttim.ElementAt(i).GetAttribute("value");
                     * Console.WriteLine(Svalue);
                     * Sttim.ElementAt(i).SendKeys(Svalue);*/

                    Thread.Sleep(2000);
                    // Sttim.ElementAt(i).Clear();
                    Edtim.ElementAt(i).SendKeys(GlobalDefinitions.ExcelLib.ReadData(i + 1, "EndTime"));
                    // Edtim.ElementAt(i).SendKeys("18:00");
                    Thread.Sleep(2000);
                }
            }



            #endregion
            #region Select Skill Trade
            // Select Skill Trade
            if (GlobalDefinitions.ExcelLib.ReadData(2, "SelectSkillTrade") == "Skill-exchange")
            {
                SkillExchange.Click();
                RequiredSkills.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "ExchangeSkill"));
                RequiredSkills.SendKeys(Keys.Enter);
                RequiredSkills.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "ExchangeSkill"));
                RequiredSkills.SendKeys(Keys.Enter);
            }
            else if (GlobalDefinitions.ExcelLib.ReadData(2, "SelectSkillTrade") == "Credit")
            {
                CreditAmount.Click();
                CreditAmount.SendKeys(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 Save / Cancel Skill
            // Save or Cancel New Skill
            if (Global.GlobalDefinitions.ExcelLib.ReadData(2, "SaveOrCancel") == "Save")
            {
                Save.Click();
            }
            else if (Global.GlobalDefinitions.ExcelLib.ReadData(2, "SaveOrCancel") == "Cancel")
            {
                Cancel.Click();
            }
            #endregion
            Thread.Sleep(3000);
            #region Check whether New  skill created sucessfully

            //String expectedValue = GlobalDefinitions.ExcelLib.ReadData(2, "title");
            String actualTitle = driver.Title;
            //string ShareSkillSucess = Driver.FindElement(By.TagName("h2")).Text;
            if (actualTitle == "ListingManagement")
            {
                Assert.IsTrue(true);
                Global.Base.test.Log(Status.Pass, "Shared Skill Successful");
                SaveScreenShotClass.SaveScreenshot(driver, "AddShareSkill");
            }
            else
            {
                Console.WriteLine("Test failed");
                SaveScreenShotClass.SaveScreenshot(driver, "FailedAddShareSkill");
                Global.Base.test.Log(Status.Fail, "Share Skill Unsuccessful");
            }
            #endregion
        }