Пример #1
0
        public void FilterAsset()
        {
            //click on filter
            GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(36, "Locator"), ExcelLib.ReadData(36, "Value"));

            IList<IWebElement> dd_Room = GlobalDefinition.driver.FindElements(By.XPath(".//*[@id='assetDropdown_listbox']/li"));
            int RoomCount = dd_Room.Count;

            for (int i = 0; i < RoomCount; i++)
            {
                if (dd_Room[i].Text == "Sky")
                {
                    dd_Room[i].Click();
                }
            }
            //Check if asset created 
            string Xpath_start = ".//*[@id='AssetList']/tr[";
            string Xpath_end = "]/td[1]";

            int l = 1;
            while (GlobalDefinition.isElementPresent(Xpath_start + l + Xpath_end))
            {
                string Roomnamel = GlobalDefinition.driver.FindElement(By.XPath(".//*[@id='AssetList']/tr[" + l + "]/td[1]")).Text;

                if (Roomnamel == "Sky")
                {
                    Base.test.Log(LogStatus.Pass, "Room name matches the filter");
                }
                else
                {
                    Base.test.Log(LogStatus.Fail, "Room name does not match the filter");
                } l++;
            }
        }
Пример #2
0
        public void Addroom_Valid()
        {
            // Click on Add Room button
            GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(5, "Locator"), ExcelLib.ReadData(5, "Value"));
            //Enter Room name
            GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(6, "Locator"), ExcelLib.ReadData(6, "Value"), ExcelLib.ReadData(6, "Input"));
            //Click on Color picker
            GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(7, "Locator"), ExcelLib.ReadData(7, "Value"));

            //Select the color
            IWebElement color = GlobalDefinition.driver.FindElement(By.XPath("//div[@class='k-hsv-gradient']"));

            color.GetCssValue("#804040");
            Thread.Sleep(2000);
            color.Click();
            // Click on apply button
            GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(9, "Locator"), ExcelLib.ReadData(9, "Value"));
            Thread.Sleep(1000);

            //Click on save button
            GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(10, "Locator"), ExcelLib.ReadData(10, "Value"));
            Thread.Sleep(2000);

            // Handle validation alert if occurs
            //bool isElementDisplayed = GlobalDefinition.driver.FindElement(By.XPath(".//*[@id='beehive-alert']/p")).Displayed;

            //if (isElementDisplayed == true)
            //{
            //    string alert = GlobalDefinition.GetTextValue(GlobalDefinition.driver, ExcelLib.ReadData(16, "Locator"), ExcelLib.ReadData(16, "Value"));
            //    Base.test.Log(LogStatus.Error, "test failed " + alert);
            //}
            //    return;

            Thread.Sleep(1000);
            // last page on pagination
            GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(34, "Locator"), ExcelLib.ReadData(34, "Value"));
            Thread.Sleep(1000);

            string xpath_start = ".//*[@id='Room-List']/tr[";
            string xpath_end   = "]/td[2]";

            int i = 1;

            while (GlobalDefinition.isElementPresent(xpath_start + i + xpath_end))
            {
                // string Roomname = GlobalDefinition.GetTextValue(GlobalDefinition.driver,ExcelLib.ReadData(14,"Locator"),ExcelLib.ReadData(14,"Value"));
                string roomname = GlobalDefinition.driver.FindElement(By.XPath(".//*[@id='Room-List']/tr[" + i + "]/td[2]")).Text;
                if (roomname == ExcelLib.ReadData(6, "Input"))
                {
                    Base.test.Log(LogStatus.Pass, "Room added successfully");
                }
                else
                {
                    Base.test.Log(LogStatus.Fail, "Add new room unsuccessfull");
                }
                i++;
            }
        }
Пример #3
0
        public void AddNewAsset_Validdata()
        {
            //Click on Add new asset
            GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(20, "Locator"), ExcelLib.ReadData(20, "Value"));

            //select asset type
            GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(21, "Locator"), ExcelLib.ReadData(21, "Value"));
            GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(22, "Locator"), ExcelLib.ReadData(22, "Value"));

            //Enter asset name
            GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(23, "Locator"), ExcelLib.ReadData(23, "Value"), ExcelLib.ReadData(23, "Input"));
            // for (int i = 2; i < 5; i++)
            //{
            //enter data
            //  GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(23, "Locator"), ExcelLib.ReadData(23, "Value"), ExcelLib.ReadData(i, "V_Asset name"));

            //Select room
            GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(24, "Locator"), ExcelLib.ReadData(24, "Value"));
            GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(25, "Locator"), ExcelLib.ReadData(25, "Value"));
            string roomname = GlobalDefinition.GetTextValue(GlobalDefinition.driver, ExcelLib.ReadData(25, "Locator"), ExcelLib.ReadData(25, "Value"));

            //click on save btn
            GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(26, "Locator"), ExcelLib.ReadData(26, "Value"));
            //}
            //Click last page button on pagination
            GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(35, "Locator"), ExcelLib.ReadData(35, "Value"));

            //Check if asset created
            string Xpath_start = ".//*[@id='AssetList']/tr[";
            string Xpath_end   = "]/td[1]";

            int l = 1;

            while (GlobalDefinition.isElementPresent(Xpath_start + l + Xpath_end))
            {
                string Roomnamel = GlobalDefinition.driver.FindElement(By.XPath(".//*[@id='AssetList']/tr[" + l + "]/td[1]")).Text;

                if (Roomnamel == roomname)
                {
                    Base.test.Log(LogStatus.Info, "Room name matched");

                    string Assetnamel = GlobalDefinition.driver.FindElement(By.XPath(".//*[@id='AssetList']/tr[" + l + "]/td[2]")).Text;
                    if (Assetnamel == ExcelLib.ReadData(23, "Input"))
                    {
                        Base.test.Log(LogStatus.Pass, "Asset Created");
                    }
                }
                l++;
            }
        }
Пример #4
0
        public void AddCompany()
        {
            //Populate in collectiion
            //check git hub
            ExcelLib.PopulateInCollection(Global.Base.ExcelPath, "Companies");

            //click on admin tab
            GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(2, "Locator"), ExcelLib.ReadData(2, "Value"));

            //Click on Companies option
            WebDriverWait wait    = new WebDriverWait(GlobalDefinition.driver, TimeSpan.FromSeconds(10));
            var           Company = wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath(ExcelLib.ReadData(3, "Value"))));

            Company.Click();
            //GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "Value"));

            //Click add new button
            GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(4, "Locator"), ExcelLib.ReadData(4, "Value"));

            //enter text in company name
            GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(5, "Locator"), ExcelLib.ReadData(5, "Value"), ExcelLib.ReadData(5, "Input"));

            //enter email address
            GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(6, "Locator"), ExcelLib.ReadData(6, "Value"), ExcelLib.ReadData(6, "Input"));

            //enter street number
            GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(9, "Locator"), ExcelLib.ReadData(9, "Value"), ExcelLib.ReadData(9, "Input"));

            //enter street name
            GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(10, "Locator"), ExcelLib.ReadData(10, "Value"), ExcelLib.ReadData(10, "Input"));

            //Enter Suburb
            GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(11, "Locator"), ExcelLib.ReadData(11, "Value"), ExcelLib.ReadData(11, "Input"));

            //Enter City
            GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(12, "Locator"), ExcelLib.ReadData(12, "Value"), ExcelLib.ReadData(12, "Input"));

            //Enter Postcode
            GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(13, "Locator"), ExcelLib.ReadData(13, "Value"), ExcelLib.ReadData(13, "Input"));

            //eneter website
            GlobalDefinition.Textbox(GlobalDefinition.driver, ExcelLib.ReadData(14, "Locator"), ExcelLib.ReadData(14, "Value"), ExcelLib.ReadData(14, "Input"));

            //click to browse logo
            GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(15, "Locator"), ExcelLib.ReadData(15, "Value"));

            //upload logo
            AutoItX3 auto = new AutoItX3();

            auto.WinActivate("Open");
            auto.Send(@"C:\Users\sonia\Desktop\CRATE\experieco.png");
            auto.Send("{ENTER}");

            GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(16, "Locator"), ExcelLib.ReadData(16, "Value"));

            //Click on last page btn
            WebDriverWait wait1    = new WebDriverWait(GlobalDefinition.driver, TimeSpan.FromSeconds(10));
            var           lastpage = wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath(ExcelLib.ReadData(17, "Value"))));

            lastpage.Click();
            //GlobalDefinition.ActionButton(GlobalDefinition.driver, ExcelLib.ReadData(17, "Locator"), ExcelLib.ReadData(17, "Value"));
            var element = GlobalDefinition.driver.FindElement(By.XPath(ExcelLib.ReadData(17, "Value")));

            Actions actions1 = new Actions(GlobalDefinition.driver);

            actions1.MoveToElement(element).Click().Perform();

            //hi there just testing git hub



            //Check if company added

            string xpath_start = ".//*[@id='companies']/tr[";
            string xpath_end   = "]/td[1]";

            int i = 1;

            while (GlobalDefinition.isElementPresent(xpath_start + i + xpath_end))
            {
                string companyname = GlobalDefinition.driver.FindElement(By.XPath(".//*[@id='companies']/tr[" + i + "]/td[1]")).Text;

                if (companyname == ExcelLib.ReadData(5, "Input"))
                {
                    Base.test.Log(LogStatus.Info, "Company name found");
                    string emailid = GlobalDefinition.driver.FindElement(By.XPath(".//*[@id='companies']/tr[" + i + "]/td[2]")).Text;

                    if (emailid == ExcelLib.ReadData(6, "Input"))
                    {
                        Base.test.Log(LogStatus.Pass, "Company Created");
                    }
                }
                i++;
            }
        }