internal void EnterShareSkill()
        {
            Commondriver.Excellib.PopulateInCollection(Base.Excelpath, "Shareskills");
            Title.SendKeys(Commondriver.Excellib.ReadData(2, "Title"));
            Description.SendKeys(Commondriver.Excellib.ReadData(2, "Description"));
            Commondriver.Wait(10);
            SelectElement catobj = new SelectElement(Category);

            catobj.SelectByText(Commondriver.Excellib.ReadData(2, "Category"));
            Commondriver.Wait(10);
            SelectElement Subcatobj = new SelectElement(Subcategory);

            Subcatobj.SelectByText(Commondriver.Excellib.ReadData(2, "Subcategory"));
            Tagname.SendKeys(Commondriver.Excellib.ReadData(2, "Tagname"));
            Tagname.SendKeys(Keys.Return);
            Servicetype.Click();
            Locationtype.Click();
            Startdate.SendKeys(Commondriver.Excellib.ReadData(2, "Start date"));
            Enddate.SendKeys(Commondriver.Excellib.ReadData(2, "End date"));
            Availabledays.Click();
            Starttime.SendKeys(Commondriver.Excellib.ReadData(2, "Starttime"));
            Endtime.SendKeys(Commondriver.Excellib.ReadData(2, "End time"));
            Skilltrade.Click();
            Credit.SendKeys(Commondriver.Excellib.ReadData(2, "Credit"));
            System.Threading.Thread.Sleep(3000);
            AutoItX3 autoit = new AutoItX3();

            autoit.WinActivate("Open");
            autoit.Send(@"D:\\Mars\\MarsPageF\\file.txt");
            System.Threading.Thread.Sleep(3000);
            autoit.Send("{ENTER}");
            Active.Click();
            Save.Click();
        }
Esempio n. 2
0
        internal void AddNewSkill(string title, string description, string category, string subcategory, string tags, string credit)
        {
            // Click on the Share Skill button on Home page
            Shareskill.Click();
            Thread.Sleep(1000);

            // Wait for fields to load
            Thread.Sleep(1000);

            // Input information into the Title field
            Title.SendKeys(title);

            // Input information into the Description field
            Description.SendKeys(description);

            // Choose Category
            Category.SendKeys(category);

            // Choose Subcategory
            Subcategory.SendKeys(subcategory);

            // Input information into the Tags field and press Enter key
            Tags.SendKeys(tags);
            Tags.SendKeys(Keys.Enter);

            // Tick One-off service option of Service Type
            ServiceType.Click();

            // Tick On-site option of Location Type
            LocationType.Click();

            // Set Start date and End date of Available days
            Startdate.SendKeys("01-06-2019");
            Enddate.SendKeys("30-06-2019");

            // Tick all weekdays, set Start time as 9:00 and End time as 17:00

            for (int i = 1; i <= 5; i++)
            {
                GlobalDefinitions.driver.FindElement(By.XPath("//div[@class='fields']//input[@name='Available'][@index='" + i + "']")).Click();
                GlobalDefinitions.driver.FindElement(By.XPath("//input[@name='StartTime'][@index='" + i + "']")).SendKeys("0900");
                GlobalDefinitions.driver.FindElement(By.XPath("//input[@name='EndTime'][@index='" + i + "']")).SendKeys("1700");
            }

            // Tick Credit option of Skill Trade
            SkillTrade.Click();

            // Input number into price field
            Credit.SendKeys(credit);

            // Tick Hidden option of Active
            Active.Click();

            // Click on the Save button
            Save.Click();
            Thread.Sleep(500);
        }
Esempio n. 3
0
        internal void Addingdate()
        {
            Actions actions = new Actions(Global.GlobalDefinitions.driver);



            //Populate the Excel sheet
            Global.GlobalDefinitions.ExcelLib.PopulateInCollection(Global.Base.ExcelPath, "Share_Skill");

            //click on share skill
            SSbutton.Click();
            Thread.Sleep(2000);

            //Click on title
            Title.Click();
            Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title"));

            //clic on description
            Description.Click();
            Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description"));

            //Click on Category
            actions.MoveToElement(Category).Build().Perform();
            Thread.Sleep(1000);
            IList <IWebElement> Select_Cat = Category.FindElements(By.TagName("option"));

            Console.WriteLine("List of category" + Select_Cat);
            int categorycount = Select_Cat.Count;

            for (int i = 0; i < categorycount; i++)
            {
                if (Select_Cat[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Category"))
                {
                    Select_Cat[i].Click();
                    Console.WriteLine("Category is" + Select_Cat[i].Text);
                    Base.test.Log(LogStatus.Info, "Selected Category");
                }
            }

            //Click on Sub Category
            actions.MoveToElement(SubCategory).Build().Perform();
            Thread.Sleep(1000);
            IList <IWebElement> Select_SubCat = SubCategory.FindElements(By.TagName("option"));

            Console.WriteLine("List of category" + Select_SubCat);
            int Scategorycount = Select_SubCat.Count;

            for (int i = 0; i < Scategorycount; i++)
            {
                if (Select_SubCat[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Sub-Category"))
                {
                    Select_SubCat[i].Click();
                    Console.WriteLine("Category is" + Select_SubCat[i].Text);
                    Base.test.Log(LogStatus.Info, "Selected Category");
                }
            }

            //Add tags
            actions.MoveToElement(Tags).Build().Perform();
            string tag1 = GlobalDefinitions.ExcelLib.ReadData(2, "Tags");
            string tag2 = GlobalDefinitions.ExcelLib.ReadData(3, "Tags");
            string tag3 = GlobalDefinitions.ExcelLib.ReadData(4, "Tags");

            Tags.SendKeys(tag1);
            Tags.SendKeys(Keys.Enter);

            Thread.Sleep(2000);
            Tags2.Click();
            // actions.MoveToElement(Tags2).Build().Perform();
            Tags2.SendKeys(tag2);

            Thread.Sleep(1000);
            //actions.MoveToElement(Tags).Build().Perform();
            //Tags.SendKeys(tag3);



            //Select service type
            actions.MoveToElement(ServiceType).Build().Perform();
            IList <IWebElement> ST = ServiceType.FindElements(By.XPath("//div/input[@name='serviceType']/following-sibling :: label"));

            for (int i = 0; i < ST.Count; i++)
            {
                Console.WriteLine("service from web" + ST[i].Text);
                if (ST[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType"))
                {
                    HourlyService.Click();
                }
                else
                {
                    One_off_service.Click();
                }
                break;
            }

            //Select Location type
            actions.MoveToElement(LocationType).Build().Perform();
            IList <IWebElement> LT = ServiceType.FindElements(By.XPath("//div/input[@name='locationType']/following-sibling :: label"));

            for (int i = 0; i < LT.Count; i++)
            {
                Console.WriteLine("service from web" + LT[i].Text);
                if (LT[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "LocationType"))
                {
                    Onsite.Click();
                }
                else
                {
                    Online.Click();
                }
                break;
            }


            //Click on start date
            Startdate.Click();

            Thread.Sleep(1000);
            //Enter start date
            string s1 = Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartDate");

            string[] s = s1.Split(' ');
            Console.WriteLine("1st part of string:" + s[0]);
            Console.WriteLine("2nd part of string:" + s[1]);
            string SD = s[0];

            Startdate.SendKeys(SD);

            //click on enddate
            Enddate.Click();
            //Enter End date
            string E1 = Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndDate");

            string[] E = E1.Split(' ');
            Console.WriteLine("Enddate 1st part is:" + E[0]);
            Console.WriteLine("End date second part is:" + E[1]);
            string ED = E[0];

            Enddate.SendKeys(ED);

            Thread.Sleep(1000);
            //Enter day
            actions.MoveToElement(Days).Build().Perform();
            IList <IWebElement> Day_Name = Days.FindElements(By.XPath("//div[@class='ui checkbox']/input/following-sibling :: label"));

            Console.WriteLine("Days are" + Day_Name);
            IList <IWebElement> Day_check = Days.FindElements(By.XPath("//input[@tabindex='0' and @type='checkbox']"));

            Console.WriteLine("Day checkbox" + Day_check);
            Thread.Sleep(1000);
            int Day_Count      = Day_Name.Count;
            int DayCheck_Count = Day_check.Count;

            for (int i = 0; i < Day_Count; i++)
            {
                if (Day_Name[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Day"))
                {
                    int j = i;
                    Day_check[j].Click();
                    Console.WriteLine("selected day is" + Day_Name[i]);
                }
            }

            //Enter starttime
            Start_Time.Click();
            string t1 = Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartTime");

            Console.WriteLine("Starttime is:" + t1);
            Start_Time.SendKeys(t1);

            //Enter Endtime
            End_Time.Click();
            string ET = Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndTime");

            Console.WriteLine("Endtime is:" + ET);
            End_Time.SendKeys(ET);

            //Select SkillExchange
            actions.MoveToElement(Skill_trade).Build().Perform();
            IList <IWebElement> Skill_E = Skill_trade.FindElements(By.XPath("//div/input[@name='skillTrades']/following-sibling :: label"));
            int SkillCount = Skill_E.Count;

            Console.WriteLine("count of radio buttons:" + SkillCount);
            for (int i = 0; i < SkillCount; i++)
            {
                if (Skill_E[i].Text == GlobalDefinitions.ExcelLib.ReadData(3, "SkillTrade"))
                {
                    Console.WriteLine("Skil is" + Skill_E[i].Text);
                    Skill_Exchange.Click();
                    actions.MoveToElement(Add_tags).Build().Perform();
                    string Tag = GlobalDefinitions.ExcelLib.ReadData(2, "SkillExchange");
                    Add_tags.SendKeys(Tag);
                    Base.test.Log(LogStatus.Info, "Selected skill");
                }

                else
                {
                    Credit.Click();
                    actions.MoveToElement(Add_credit).Build().Perform();
                    string Cr = GlobalDefinitions.ExcelLib.ReadData(2, "Credit");
                    Add_credit.SendKeys(Cr);
                }
                break;
            }


            //Click on Worksample
            PlusIcon.Click();

            //Performing the upload file operation using AutoIT

            AutoItX3 autoIT = new AutoItX3();

            autoIT.WinActivate("Open");
            Thread.Sleep(3000);
            string sample1 = GlobalDefinitions.ExcelLib.ReadData(2, "WorkSample");

            Console.WriteLine("file path is" + sample1);
            Thread.Sleep(2000);
            autoIT.Send(@sample1);
            Thread.Sleep(3000);
            autoIT.Send("{Enter}");
            Thread.Sleep(2000);

            //Downloading the file
            Download.Click();

            //Deleting a file
            Delete.Click();
            Thread.Sleep(500);

            actions.MoveToElement(Active).Build().Perform();
            IList <IWebElement> Active_Name = Active.FindElements(By.XPath("//div[@class='ui radio checkbox']/input[@name='isActive']/following-sibling :: label"));

            Console.WriteLine("Days are" + Active_Name);
            IList <IWebElement> Active_radio = Active.FindElements(By.XPath("//input[@name='isActive' and @type='radio']"));

            Console.WriteLine("Day checkbox" + Active_radio);
            Thread.Sleep(1000);
            int Active_Count = Active_Name.Count;

            for (int i = 0; i < Active_Count; i++)
            {
                if (Active_Name[i].Text == GlobalDefinitions.ExcelLib.ReadData(2, "Active"))
                {
                    int j = i;
                    Active_radio[j].Click();
                }
            }

            //click on save
            actions.MoveToElement(Buttons).Build().Perform();
            IList <IWebElement> BT = ServiceType.FindElements(By.XPath("//input[@type='button']"));

            for (int i = 0; i < BT.Count; i++)
            {
                Console.WriteLine("Button from web" + BT.Count);
                if (GlobalDefinitions.ExcelLib.ReadData(2, "Buttons") == "Save")
                {
                    Save.Click();
                }
                else
                {
                    Cancel.Click();
                }
                break;
            }


            string text = Global.GlobalDefinitions.driver.Title;

            if (text == "ServiceListing")
            {
                Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Share skill page");
            }
            else
            {
                Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Not valid page");
            }
        }
Esempio n. 4
0
        public void AddShareSkill(IWebDriver Driver)
        {
            //Click Share Skill button
            ShareSkillBtn.Click();
            Thread.Sleep(5000);

            //Title Input
            Title.SendKeys(Helpers.ExcelLib.ReadData(2, "Title"));

            //Description Input
            Description.SendKeys(Helpers.ExcelLib.ReadData(2, "Description"));

            //Select Category
            var selectElement1 = new SelectElement(Category);

            selectElement1.SelectByValue("6");
            Console.WriteLine("Category selcted");

            //Select Sub-Catergory

            var selectElement2 = new SelectElement(Subcategory);

            selectElement2.SelectByText("QA");
            Console.WriteLine("Sub-Category selcted");

            //Select Tags
            Tag1.SendKeys(Helpers.ExcelLib.ReadData(2, "Tag1"));
            Tag1.SendKeys(Keys.Enter);

            Console.WriteLine("Enter clicked");

            //Select Service Type
            Servicetype.Click();

            //Select Location Type
            Locationtype.Click();

            //Select End date
            Enddate.SendKeys("29-07-2019");

            //Input for the whole week
            //Monday time
            MonCheck.Click();
            MonStart.SendKeys(Helpers.ExcelLib.ReadData(2, "MonStart"));
            MonEnd.SendKeys(Helpers.ExcelLib.ReadData(2, "MonEnd"));

            //Tuesday time
            TuesCheck.Click();
            TuesStart.SendKeys(Helpers.ExcelLib.ReadData(2, "TuesStart"));
            TuesEnd.SendKeys(Helpers.ExcelLib.ReadData(2, "TuesEnd"));

            //Wednesday time
            WedCheck.Click();
            WedStart.SendKeys(Helpers.ExcelLib.ReadData(2, "WedStart"));
            WedEnd.SendKeys(Helpers.ExcelLib.ReadData(2, "WedEnd"));

            //Thursday time
            ThursCheck.Click();
            ThursStart.SendKeys(Helpers.ExcelLib.ReadData(2, "ThursStart"));
            ThursEnd.SendKeys(Helpers.ExcelLib.ReadData(2, "ThursEnd"));

            //Friday time
            FriCheck.Click();
            FriStart.SendKeys(Helpers.ExcelLib.ReadData(2, "FriStart"));
            FriEnd.SendKeys(Helpers.ExcelLib.ReadData(2, "FriEnd"));

            //Select Skill trade
            SkillTrade.Click();

            //Select Skill Exchange
            SkillExchange.SendKeys(Helpers.ExcelLib.ReadData(2, "SkillExchange"));
            SkillExchange.SendKeys(Keys.Enter);

            //Upload Work Sample Upload click
            IJavaScriptExecutor js1 = (IJavaScriptExecutor)Driver;

            js1.ExecuteScript("arguments[0].click();", Upload);
            Thread.Sleep(5000);

            AutoItX3 autoIt = new AutoItX3();

            autoIt.WinActivate("Open");
            autoIt.Send(@"C:\Users\Bhushan\Desktop\Updated - Mars(QA)-CompetitionTask.pdf");
            Thread.Sleep(4000);
            autoIt.Send("{ENTER}");

            //Select Active
            SkillActive.Click();

            //Click Save
            Savebtn.Click();
            Thread.Sleep(5000);

            //Verification

            //CommonDriver.Driver.FindElement(By.XPath("//a[contains(text(),'Manage Listings')]")).Click();
            //string ExpectedResult1 = "Software Tester 7";
            //string ActualResult1 = CommonDriver.Driver.FindElement(By.XPath("//td[contains(text(),'q')]")).Text;

            //if (ActualResult1 == ExpectedResult1)
            //{
            //    Console.WriteLine("Test Pass: Skill Added");
            //}
            //else
            //{
            //    Console.WriteLine("Test Fail: Skill Not Added");
            //}

            try
            {
                Assert.IsTrue(Driver.FindElement(By.XPath("//tr[1]//td[3]")).Displayed);
                Console.WriteLine("Test Pass: Skill listing Added");
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Esempio n. 5
0
        internal void AddShareSkill(IWebDriver Driver)
        {
            //Populate the Excel sheet
            Global.GlobalDefinitions.ExcelLib.PopulateInCollection(Global.Base.ExcelPath, "ShareSkillTestData");
            Thread.Sleep(1000);

            //Click Share Skill button
            ShareSkillBtn.Click();
            Thread.Sleep(5000);

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

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

            //Select Category
            var selectElement1 = new SelectElement(Category);

            selectElement1.SelectByValue("6");
            Console.WriteLine("Category selcted");

            //Select Sub-Catergory

            var selectElement2 = new SelectElement(Subcategory);

            selectElement2.SelectByText("QA");
            Console.WriteLine("Sub-Category selcted");

            //Select Tags
            Tag1.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Tag1"));
            Tag1.SendKeys(Keys.Enter);

            Console.WriteLine("Enter clicked");

            //Select Service Type
            Servicetype.Click();

            //Select Location Type
            Locationtype.Click();

            //Select End date
            Enddate.SendKeys("29-07-2019");

            //Input for the whole week
            //Monday time
            MonCheck.Click();
            MonStart.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "MonStart"));
            MonEnd.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "MonEnd"));

            //Tuesday time
            TuesCheck.Click();

            TuesStart.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "TuesStart"));
            TuesEnd.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "TuesEnd"));

            //Wednesday time
            WedCheck.Click();
            WedStart.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "WedStart"));
            WedEnd.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "WedEnd"));

            //Thursday time
            ThursCheck.Click();
            ThursStart.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "ThursStart"));
            ThursEnd.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "ThursEnd"));

            //Friday time
            FriCheck.Click();
            FriStart.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "FriStart"));
            FriEnd.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "FriEnd"));

            //Select Skill trade
            SkillTrade.Click();

            //Select Skill Exchange
            SkillExchange.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "SkillExchange"));
            SkillExchange.SendKeys(Keys.Enter);

            ////Upload Work Sample Upload click
            IJavaScriptExecutor js1 = (IJavaScriptExecutor)Driver;

            js1.ExecuteScript("arguments[0].click();", Upload);
            Thread.Sleep(5000);

            AutoItX3 autoIt = new AutoItX3();

            Thread.Sleep(5000);
            autoIt.WinActivate("Open");
            autoIt.Send(@"C:\Users\Bhushan\Desktop\Updated - Mars(QA)-CompetitionTask.pdf");
            Thread.Sleep(4000);
            autoIt.Send("{ENTER}");

            //Select Active
            SkillActive.Click();

            //Click Save
            Savebtn.Click();
            Thread.Sleep(5000);

            Base.test.Log(LogStatus.Info, "Skill added successfully");

            //Verification
            Thread.Sleep(4000);
            string ExpectedResult1 = Global.GlobalDefinitions.ExcelLib.ReadData(2, "Title");
            string ActualResult1   = ActualValue1.Text;

            if (ActualResult1 == ExpectedResult1)
            {
                Console.WriteLine("Test Pass: Skill Added");
                // Screenshot
                String img = Global.GlobalDefinitions.SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.Driver, "Report"); //AddScreenCapture(@"E:\Dropbox\VisualStudio\Projects\Beehive\TestReports\ScreenShots\");
                Base.test.Log(LogStatus.Info, "Image example: " + img);
                // end test. (Reports)
                Base.extent.EndTest(Base.test);
                // calling Flush writes everything to the log file (Reports)
                Base.extent.Flush();
                // Close the driver :)
                //GlobalDefinitions.driver.Close();
            }
            else
            {
                Console.WriteLine("Test Fail: Skill Not Added");
            }

            //try
            //{

            //    Assert.IsTrue(Driver.FindElement(By.XPath("//tr[1]//td[3]")).Displayed);
            //    Console.WriteLine("Test Pass: Skill listing Added");
            //}
            //catch (Exception e)
            //{
            //    Console.WriteLine("Test Fail: Skill listing not present");
            //}
        }