Ejemplo n.º 1
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.º 2
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.º 3
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.º 4
0
        //Add share skill details
        internal void EnterShareSkill()
        {
            //Populate the excel data

            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill");

            try
            {
                ShareSkillButton.Click();

                //Click on Share skill button
                // GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//a[contains(text(),'Share Skill')]", 10000);
                // ShareSkillButton.Click();

                //Enter the Title in textbox
                //GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//input[@name='title']", 10000);
                Title.Click();
                Title.Clear();
                Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title"));

                //Enter the Description in textbox
                //GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//input[@name='description']", 10000);
                GlobalDefinitions.wait(1500);
                Description.Click();
                Description.Clear();
                Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description"));

                //Select catagory from drop down
                //GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//input[@name='categoryId']", 10000);
                CategoryDropDown.Click();
                new SelectElement(CategoryDropDown).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Category"));

                //Select catagory from drop down
                //GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//input[@name='subcategoryId']", 10000);
                SubCategoryDropDown.Click();
                new SelectElement(SubCategoryDropDown).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory"));

                //Enter Tag names in textbox
                //  GlobalDefinitions.WaitForElement(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.WaitForElement(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.WaitForElement(GlobalDefinitions.driver, "XPath", "(//input[@name='locationType'])[1]", 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"));
                EndDateDropDown.SendKeys(Keys.Enter);
                GlobalDefinitions.SelectDayTime(GlobalDefinitions.driver, (GlobalDefinitions.ExcelLib.ReadData(2, "Day")), Sun, Mon, Tue, Wed, Thu, Fri, Sat);

                /*
                 * //Select available day
                 * GlobalDefinitions.WaitForElement(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.WaitForElement(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((GlobalDefinitions.ExcelLib.ReadData(2, "Starttime")));
                 *
                 * //Select end time
                 * GlobalDefinitions.WaitForElement(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.WaitForElement(GlobalDefinitions.driver, "XPath", "//*[@id='service-listing-section']/div[2]/div/form/div[8]/div[4]/div/div/div/div/div/input", 10000);

                SkillExctxtbx.Clear();
                SkillExctxtbx.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange"));
                SkillExctxtbx.SendKeys(Keys.Enter);

                //Select option Active or Hidden
                // GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//form/div[10]/div[@class='twelve wide column']/div/div[@class = 'field']", 10000);
                //((GlobalDefinitions.ExcelLib.ReadData(2, "SkillActiveOptions"));
                //ActiveOption.Click();
                HiddenOption.Click();

                //Click on save button
                GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//input[@value='Save']", 10000);
                Save.Click();
            }

            catch (Exception ex)
            {
                Assert.Fail("Test failed to enter Skill details", ex.Message);
            }
        }