Beispiel #1
0
        internal void EditShareSkill()
        {
            //Populate the Excel sheet
            Global.GlobalDefinitions.ExcelLib.PopulateInCollection(Global.Base.ExcelPath, "ShareSkill");
            int excelRowToRead = 3;

            Title.Clear();
            Title.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "Title"));

            //Click on Description
            Description.Clear();
            Description.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "Description"));

            //Select A Category
            CategoryDropDown.Click();
            String categoryValue = Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "Category");
            IList <IWebElement> CategoriesDropDownList = CategoryDropDown.FindElements(By.XPath("//option"));
            int DpListCount = CategoriesDropDownList.Count;

            for (int i = 0; i < DpListCount; i++)
            {
                if (CategoriesDropDownList[i].Text == categoryValue)
                {
                    CategoriesDropDownList[i].Click();
                }
            }

            //Select Sub Category
            Thread.Sleep(1000);
            IWebElement SubCategorySelection = Global.GlobalDefinitions.driver.FindElement(By.Name("subcategoryId"));

            SubCategorySelection.Click();
            String SubCategoryValue = Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "SubCategory");
            IList <IWebElement> SubCategoriesDropDownList = SubCategorySelection.FindElements(By.XPath("//option"));
            int SbDpListCount = SubCategoriesDropDownList.Count;

            for (int i = 0; i < SbDpListCount; i++)
            {
                if (SubCategoriesDropDownList[i].Text == SubCategoryValue)
                {
                    SubCategoriesDropDownList[i].Click();
                }
            }

            //Clear and Add Tags
            IWebElement         tagsInputBox  = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[4]/div[2]/div"));
            IList <IWebElement> RemoveButtons = tagsInputBox.FindElements(By.ClassName("ReactTags__remove"));

            foreach (IWebElement element in RemoveButtons)
            {
                element.Click();
            }
            Tags.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "Tag"));
            Tags.SendKeys(Keys.Enter);

            //Select Service Type
            String ServiceType = Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "Service Type");

            if (ServiceType.Equals("Hourly basis Service"))
            {
                HourlyServiceType.Click();
            }

            else if (ServiceType.Equals("One-off Service"))
            {
                OneOffServiceType.Click();
            }

            //Select Location Type
            String LocatioType = Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "Location Type");

            if (LocatioType.Equals("On-site"))
            {
                OnSiteLocationType.Click();
            }

            else if (OnSiteLocationType.Equals("Online"))
            {
                OnlineLocationType.Click();
            }

            //Select Available Start Date
            IWebElement AvailableStartDateInput = AvailabilityForm.FindElement(By.Name("startDate"));

            AvailableStartDateInput.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "AvailableStartDate"));

            //Select Available End Date
            IWebElement AvailableEndDateInput = AvailabilityForm.FindElement(By.Name("endDate"));

            AvailableEndDateInput.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "AvailableEndDate"));

            String[] WeekDays = new String[] { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };

            //Cleared Selected Checkboxes
            IList <IWebElement> AvailableCheckBoxes = AvailabilityForm.FindElements(By.Name("Available"));

            foreach (IWebElement element in AvailableCheckBoxes)
            {
                if (element.Selected)
                {
                    element.Click();
                }
            }

            //Select Check boxes based on data
            String         AvailableDaysValue = Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "AvailableDays");
            IList <String> AvailableDays      = AvailableDaysValue.Split(',');

            for (int i = 0; i < WeekDays.Count(); i++)
            {
                if (AvailableDays.Contains(WeekDays[i]))
                {
                    AvailableCheckBoxes[i].Click();
                }
            }

            //Set Start times
            IList <IWebElement> AvailableStartTimeInputs = AvailabilityForm.FindElements(By.Name("StartTime"));
            String         AvailableStartTimesValue      = Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "AvailableStartTimes");
            IList <String> AvailableStartTimes           = AvailableStartTimesValue.Split(',');

            for (int i = 0; i < AvailableStartTimes.Count(); i++)
            {
                IList <String> startTimeInfo  = AvailableStartTimes[i].Split(':');
                String         startTimeDay   = startTimeInfo[0];
                String         startTimeValue = startTimeInfo[1];
                int            indexOfDay     = Array.IndexOf(WeekDays, startTimeDay);
                AvailableStartTimeInputs[indexOfDay].SendKeys(startTimeValue);
            }

            //Set End times
            IList <IWebElement> AvailableEndTimeInputs = AvailabilityForm.FindElements(By.Name("EndTime"));
            String         AvailableEndTimesValue      = Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "AvailableEndTimes");
            IList <String> AvailableEndTimes           = AvailableEndTimesValue.Split(',');

            for (int i = 0; i < AvailableEndTimes.Count(); i++)
            {
                IList <String> endTimeInfo  = AvailableEndTimes[i].Split(':');
                String         endTimeDay   = endTimeInfo[0];
                String         endTimeValue = endTimeInfo[1];
                int            indexOfDay   = Array.IndexOf(WeekDays, endTimeDay);
                AvailableEndTimeInputs[indexOfDay].SendKeys(endTimeValue);
            }

            //Select Skill Exchange Type
            String SkillTradeType = Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "SkillTradeType");

            if (SkillTradeType.Equals("Skill-exchange"))
            {
                SkillExchangeType.Click();

                //Clear and Add Tags
                IWebElement         SkillTagsInputBox = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[8]/div[4]/div/div"));
                IList <IWebElement> CrossButtons      = SkillTagsInputBox.FindElements(By.ClassName("ReactTags__remove"));
                foreach (IWebElement element in CrossButtons)
                {
                    element.Click();
                }
                SkillExchangeTag.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "SkillExchangeTab"));
                SkillExchangeTag.SendKeys(Keys.Enter);
            }

            else if (SkillTradeType.Equals("Credit"))
            {
                CreditsType.Click();
                CreditAmount.Clear();
                CreditAmount.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "CreditsAmount"));
            }

            //Select Active Status Button
            String ActiveType = Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "ActiveType");

            if (SkillTradeType.Equals("Active"))
            {
                ActiveButton.Click();
            }
            else if (SkillTradeType.Equals("Hidden"))
            {
                HiddenButton.Click();
            }

            //Click on Save Button
            SaveButton.Click();
            Thread.Sleep(3000);

            //Verify
            IWebElement         listingTable = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/table"));
            IList <IWebElement> tableRows    = listingTable.FindElements(By.TagName("tr"));

            Boolean isListingEdited = false;

            for (int i = 0; i <= tableRows.Count; i++)
            {
                IWebElement row = tableRows[i];
                if (row.Text.Contains(Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "Title")) && row.Text.Contains(Global.GlobalDefinitions.ExcelLib.ReadData(excelRowToRead, "Description")))
                {
                    isListingEdited = true;
                    break;
                }
            }
            if (isListingEdited == true)
            {
                Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Edit Skill test Successful");
            }
            else
            {
                Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Edit Skill test Failed");
            }
        }
Beispiel #2
0
        internal void editShareskill()
        {
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "Service Data");



            GlobalDefinitions.wait(1000);

            //Enter Title

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

            //Enter Description

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

            //Select Category
            SelectElement catg = new SelectElement(CategoryDropDown);

            GlobalDefinitions.wait(1000);
            catg.SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Category"));

            //Select Subcategory

            OpenQA.Selenium.Support.UI.SelectElement subcatg = new SelectElement(SubCategoryDropDown);
            GlobalDefinitions.wait(1000);
            subcatg.SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Sub Category"));

            //Tags
            GlobalDefinitions.wait(1000);
            Tags.Click();
            GlobalDefinitions.wait(1000);
            Tags.SendKeys("FirstTag" + "\n");

            //Select Service Type from radio buttons

            OneOffServiceType.Click();


            //Select Location Type radio button

            onlineLocationType.Click();

            //Select Available days and Time
            //select startdate
            StartDate.Click();
            GlobalDefinitions.wait(1000);
            StartDate.SendKeys("25062020");

            //Select end date
            EndDate.Click();
            GlobalDefinitions.wait(1000);
            EndDate.SendKeys("25072020");

            //Select Monday
            MondayCheckbox.Click();

            //Select start time for Monday
            MondayStartTime.Click();
            GlobalDefinitions.wait(1000);
            MondayStartTime.SendKeys("0930am");
            GlobalDefinitions.wait(1000);

            //Select end time for Monday
            MondayendTime.Click();
            GlobalDefinitions.wait(1000);
            MondayendTime.SendKeys("0530pm");
            GlobalDefinitions.wait(1000);

            //Select Skill Trade radio button



            Creditradiobutton.Click();

            GlobalDefinitions.wait(1000);


            GlobalDefinitions.wait(1000);
            SkillExchangeTags.Click();
            GlobalDefinitions.wait(1000);
            SkillExchangeTags.SendKeys("FirstSTag" + "\n");

            //Select Active radio button

            ActiveRadiobutton.Click();

            //Save the data
            GlobalDefinitions.wait(1000);

            Savebutton.Click();
            GlobalDefinitions.wait(1000);
        }