Пример #1
0
        public bool Coment(RemoteWebDriver driver)
        {
            var interactionDone = false;

            basePage = new WallLocators(driver, wait);
            try
            {
                basePage.searchBox.SendKeys("Covalol");
                basePage.searchBox.Click();
                Thread.Sleep(5000);
                return(true);
            }
            catch (Exception e)
            {
                TestContext.Error.WriteLine("AddFriends test failed " + e.ToString());
                return(false);
            }
        }
Пример #2
0
        public bool Like(RemoteWebDriver driver)
        {
            likeLocator = new WallLocators(driver, wait);

            try
            {
                //lee si el elemento es el icono antiguo de facebook, de serlo entra al if, si no entra al else
                if (driver.FindElement(likeLocator.FacebookIconOld).Displayed)
                {
                    likeLocator.SearchBoxO.Click();
                    likeLocator.SearchBoxO.SendKeys("Cova LoL");
                    Thread.Sleep(5000);
                    likeLocator.SearchIcon.Click();
                    Thread.Sleep(5000);
                    likeLocator.CanalButtonO.Click();
                    Thread.Sleep(5000);
                    likeLocator.LikebuttonO.Click();
                    Thread.Sleep(5000);
                }

                // De entrar al else es el icono nuevo, por lo tanto ejecuta la prueba oara la version nueva
                else
                {
                    likeLocator.SearchBoxN.Click();
                    likeLocator.SearchBoxN.SendKeys("Cova LoL");
                    likeLocator.SearchBoxN.SendKeys(Keys.Enter);
                    Thread.Sleep(5000);
                    likeLocator.LikebuttonN.Click();
                    Thread.Sleep(5000);
                }
                return(true);
            }
            catch (Exception e)
            {
                TestContext.Error.WriteLine("Like page test failed" + e.ToString());

                return(false);
            }
        }
Пример #3
0
        public bool SentTheMessage(RemoteWebDriver driver)
        {
            var isMessageSend = false;

            try
            {
                wallPage = new WallLocators(driver, wait);

                IWebElement element = null; //Crea un elemento IWebEleent inicializado en null

                //CLIC PARA ABRIR LA LISTA DE CHAT
                var FBChatListO = driver.FindElement(wallPage.FBChatListOld);
                var FBChatListN = driver.FindElement(wallPage.FBChatListNew);

                if (TryFindElement(By.XPath("//div[@id='fbDockChatBuddylistNub']/a[@class='fbNubButton']"), out element))
                {/*Verify if it is the old version*/
                    bool visible = IsElementVisible(element);
                    if (visible)
                    {
                        FBChatListO.Click();
                    }
                }
                else if (TryFindElement(By.XPath("//div[@aria-label='Nuevo mensaje']"), out element))
                {/*Verify if it is the new version*/
                    bool visible = IsElementVisible(element);
                    if (visible)
                    {
                        FBChatListN.Click();
                    }
                }

                //ENVIAR TEXTO A LA BUSQUEDA
                var FBClSearchContactO = driver.FindElement(wallPage.FBClSearchContactOld);
                var FBClSearchContactN = driver.FindElement(wallPage.FBClSearchContactNew);

                if (TryFindElement(By.XPath("//div[@id='fbDockChatBuddylistNub']/a[@class='fbNubButton']"), out element))
                {/*Verify if it is the old version*/
                    bool visible = IsElementVisible(element);
                    if (visible)
                    {
                        FBClSearchContactO.SendKeys("Cova LoL");
                    }
                }
                else if (TryFindElement(By.XPath("//div[@aria-label='Nuevo mensaje']"), out element))
                {/*Verify if it is the new version*/
                    bool visible = IsElementVisible(element);
                    if (visible)
                    {
                        FBClSearchContactN.SendKeys("Cova LoL");
                    }
                }

                //SELECCIONA AL CONTACTO QUE RECIVIRA EL MSJ
                var FBClSelectContactO = driver.FindElement(wallPage.FBClSelectContactOld);
                var FBClSelectContactN = driver.FindElement(wallPage.FBClSelectContactNew);

                if (TryFindElement(By.XPath("//div[@id='fbDockChatBuddylistNub']/a[@class='fbNubButton']"), out element))
                {/*Verify if it is the old version*/
                    bool visible = IsElementVisible(element);
                    if (visible)
                    {
                        FBClSelectContactO.Click();
                    }
                }
                else if (TryFindElement(By.XPath("//div[@aria-label='Nuevo mensaje']"), out element))
                {/*Verify if it is the new version*/
                    bool visible = IsElementVisible(element);
                    if (visible)
                    {
                        FBClSelectContactN.Click();
                    }
                }

                //REDACTAR TEXTO DEL MSJ
                var FBChatTextBoxO = driver.FindElement(wallPage.FBChatTextBoxOld);
                var FBChatTextBoxN = driver.FindElement(wallPage.FBChatTextBoxNew);

                if (TryFindElement(By.XPath("//div[@id='fbDockChatBuddylistNub']/a[@class='fbNubButton']"), out element))
                {/*Verify if it is the old version*/
                    bool visible = IsElementVisible(element);
                    if (visible)
                    {
                        FBChatTextBoxO.SendKeys("Ejercicio de practica del curso de automation con selenium");
                    }
                }
                else if (TryFindElement(By.XPath("//div[@aria-label='Nuevo mensaje']"), out element))
                {/*Verify if it is the new version*/
                    bool visible = IsElementVisible(element);
                    if (visible)
                    {
                        FBChatTextBoxN.SendKeys("Ejercicio de practica del curso de automation con selenium");
                    }
                }

                //ENVIAR EL MSJ
                var FBSentMsgButtonO = driver.FindElement(wallPage.FBSentMsgButtonOld);
                var FBSentMsgButtonN = driver.FindElement(wallPage.FBSentMsgButtonNew);

                if (TryFindElement(By.XPath("//div[@id='fbDockChatBuddylistNub']/a[@class='fbNubButton']"), out element))
                {/*Verify if it is the old version*/
                    bool visible = IsElementVisible(element);
                    if (visible)
                    {
                        FBSentMsgButtonO.Click();
                    }
                }
                else if (TryFindElement(By.XPath("//div[@aria-label='Nuevo mensaje']"), out element))
                {/*Verify if it is the new version*/
                    bool visible = IsElementVisible(element);
                    if (visible)
                    {
                        FBSentMsgButtonN.Click();
                    }
                }

                isMessageSend = true;
                //Assert.IsTrue(wallPage.FBMsgText.Displayed);
                return(isMessageSend);
            }
            catch (Exception e)
            {
                TestContext.Error.WriteLine("LoginUser test failed " + e.ToString());
                return(false);
            }
        }