Ejemplo n.º 1
0
        /// <summary>
        /// Sets the Pokeball field to a given pokeball.
        /// </summary>
        /// <param name="pokeball">pokeball to use</param>
        /// <returns>current add form for chaining</returns>
        public AddPokemonForm WithPokeball(string pokeball)
        {
            ElementHelpers.ClickFirstElementById("SelectedPokeballId");

            ElementHelpers.ClickFirstElementByXPath(string.Format(Constants.OptionWithTextXPath, pokeball));

            return(this);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initiate logon to Gaiaonline by selecting header tab.
        /// </summary>
        /// <returns>login form for chaining</returns>
        public static LoginForm Logon()
        {
            ElementHelpers.ClickFirstElementByCssSelector(".header-login-tab-login");

            CurrentLoginForm = new LoginForm();

            return(CurrentLoginForm);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Sets the password field to a given password by css selector.
        /// </summary>
        /// <param name="password">password to enter</param>
        /// <returns>current login form for method chaining</returns>
        public LoginForm WithPassword(string password)
        {
            string selector = HeaderLoginInputSelector + nameof(password);

            ElementHelpers.SetFirstElementByCssSelector(selector, password);

            return(this);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Sets the sex field to a given sex.
        /// </summary>
        /// <param name="sex">sex to use</param>
        /// <returns>current add form for chaining</returns>
        public AddPokemonForm WithSex(string sex)
        {
            ElementHelpers.ClickFirstElementById("SelectedSexId");

            ElementHelpers.ClickFirstElementByXPath(string.Format(Constants.OptionWithTextXPath, sex));

            return(this);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Sets the username field to a given username by css selector.
        /// </summary>
        /// <param name="username">username to enter</param>
        /// <returns>current login form for method chaining</returns>
        public LoginForm WithUsername(string username)
        {
            string selector = HeaderLoginInputSelector + nameof(username);

            ElementHelpers.SetFirstElementByCssSelector(selector, username);

            return(this);
        }
Ejemplo n.º 6
0
        public void CheckWidgetTitleNotAllowed(string widgetTitle)
        {
            LoggerPage.LogStart(MethodBase.GetCurrentMethod().Name);

            Assert.IsTrue(
                ElementHelpers.GetCursorValue(By.XPath($"//div[contains(text(),'{widgetTitle}')]"))
                .Equals("not-allowed"));

            LoggerPage.LogEnd(MethodBase.GetCurrentMethod().Name);
        }
Ejemplo n.º 7
0
 void InitiateNextWave()
 {
     if (isGameOver)
     {
         return;
     }
     nextWaveElement = (Element)Random.Range(1, 6);
     GetComponent <DialogueController>().DisplayMessages(new string[] {
         "A wave of " + ElementHelpers.StringForElement(nextWaveElement) + " is incoming! Protect with " + ElementHelpers.StringForElement(ElementHelpers.ElementWeaknessForElement(nextWaveElement))
     });
     Invoke("SendWave", sendWaveDelay);
     if (sendWaveDelay > 2.5f)
     {
         sendWaveDelay -= 1.0f;
     }
 }
Ejemplo n.º 8
0
        public void SingleVtSelectionSearchResult()
        {
            LoggerPage.LogStart(MethodBase.GetCurrentMethod().Name);

            this.SingleVtButton.Click();
            ReadOnlyCollection <IWebElement> vtsBeforeSearch = this.elementHelpers.FindElements(ReportHeaderLocators.SingleVtListItem);

            this.elementHelpers.SendKeys(ReportHeaderLocators.SingleVtSearchInput, "mortgage");
            ElementHelpers.Clear(ReportHeaderLocators.SingleVtSearchInput);
            ReadOnlyCollection <IWebElement> vtsAfterSearch = this.elementHelpers.FindElements(ReportHeaderLocators.SingleVtListItem);

            this.SingleVtButton.Click();

            Assert.AreEqual(vtsBeforeSearch.Count, vtsAfterSearch.Count);

            LoggerPage.LogEnd(MethodBase.GetCurrentMethod().Name);
        }
Ejemplo n.º 9
0
        private static void VerifyExpectedErrorOccurred()
        {
            ElementHelpers elementHelpers = new ElementHelpers();

            var disclaimer        = elementHelpers.FindElement(By.CssSelector("mi-disclaimer"), false);
            var error             = elementHelpers.FindElement(By.XPath("//div[contains(text(),'An error occured while processing your request')]"), false);
            var reportsMenuButton = elementHelpers.FindElement(MiDashboardHeaderLocators.Reports).GetCssValue("cursor").Equals("default");
            var maintenanceInfo   = elementHelpers.FindElement(By.XPath("//div[contains(text(),'An error occurred. Please try again. If the problem continues, contact application administrator.')]"), false);
            var maintenanceUrl    = Actions.GetCurrentUrl().Contains("maintenance");

            if (disclaimer != null)
            {
                Helpers.Logger.Logger.Log("*******************************************");
                Helpers.Logger.Logger.Log("********** A disclaimer occured  **********");
                Helpers.Logger.Logger.Log("*******************************************");
            }

            if (error != null)
            {
                Helpers.Logger.Logger.Log("********************************************************************");
                Helpers.Logger.Logger.Log("********** An error occured while processing your request **********");
                Helpers.Logger.Logger.Log("********************************************************************");
            }

            if (reportsMenuButton)
            {
                Helpers.Logger.Logger.Log("********************************************");
                Helpers.Logger.Logger.Log("********** Reports are not loaded **********");
                Helpers.Logger.Logger.Log("********************************************");
            }

            if (maintenanceInfo != null)
            {
                Helpers.Logger.Logger.Log("***********************************************************************************************************************");
                Helpers.Logger.Logger.Log("********** An error occurred. Please try again. If the problem continues, contact application administrator. **********");
                Helpers.Logger.Logger.Log("***********************************************************************************************************************");
            }

            if (maintenanceUrl)
            {
                Helpers.Logger.Logger.Log("**********************************************");
                Helpers.Logger.Logger.Log("********** Maintenance Url appeared **********");
                Helpers.Logger.Logger.Log("**********************************************");
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Sets the level field to a given level.
        /// </summary>
        /// <param name="level">level to use</param>
        /// <returns>current add form for chaining</returns>
        public AddPokemonForm WithLevel(string level)
        {
            ElementHelpers.SetFirstElementById("Level", level);

            return(this);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Sets the location field to a given location.
        /// </summary>
        /// <param name="location">location to use</param>
        /// <returns>current add form for chaining</returns>
        public AddPokemonForm WithLocation(string location)
        {
            ElementHelpers.SetFirstElementById("Location", location);

            return(this);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Logout of Gaiaonline.
        /// </summary>
        public static void Logout()
        {
            ElementHelpers.HoverOverElementByCssSelector(".user-dropdown-arrow");

            ElementHelpers.ClickFirstElementByCssSelector(".user-dropdown-menu ul li:nth-child(3) a");
        }
Ejemplo n.º 13
0
 /// <summary>
 /// Click the submit button by xpath.
 /// </summary>
 protected override void OnSubmit()
 {
     ElementHelpers.ClickFirstElementByXPath(Constants.SubmitXPath);
 }
Ejemplo n.º 14
0
 public ReportsPage()
 {
     this.elementHelpers = new ElementHelpers();
     this.reportsActions = new ReportsActions();
     this.Verify         = new ReportsVerify();
 }
Ejemplo n.º 15
0
 public override string GetSortKey(Element element)
 {
     return(ElementHelpers.StructSortKey(element, sortKeyIndices));
 }
Ejemplo n.º 16
0
 public void Eliminated(Element e)
 {
     GetComponent <SpriteRenderer>().color = ElementHelpers.ColorFor(e);
     GetComponent <Animator>().Play("KillTile");
     Destroy(gameObject, 0.8f);
 }
Ejemplo n.º 17
0
 public MiDashboardPage()
 {
     this.elementHelpers        = new ElementHelpers();
     this.miDashboardHeaderPage = new MiDashboardHeaderPage();
 }
Ejemplo n.º 18
0
 public ReportsHeaderVerify()
 {
     this.elementHelpers = new ElementHelpers();
 }
Ejemplo n.º 19
0
        /// <summary>
        /// Sets the nickname field to a given nickname.
        /// </summary>
        /// <param name="nickName">nickname to use</param>
        /// <returns>current add form for chaining</returns>
        public AddPokemonForm WithNickname(string nickName)
        {
            ElementHelpers.SetFirstElementById("Nickname", nickName);

            return(this);
        }
Ejemplo n.º 20
0
 /// <summary>
 /// Release the current Pokemon.
 /// </summary>
 public static void ReleaseCurrentPokemon()
 {
     ElementHelpers.ClickFirstElementByXPath("//a[contains(@href, 'Delete')]");
 }
Ejemplo n.º 21
0
        /// <summary>
        /// Click the submit button by css selector.
        /// </summary>
        protected override void OnSubmit()
        {
            string selector = HeaderLoginInputSelector + "submit";

            ElementHelpers.ClickFirstElementByCssSelector(selector);
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Sets the capture date field to a given date.
        /// </summary>
        /// <param name="date">date to use</param>
        /// <returns>current add form for chaining</returns>
        public AddPokemonForm WithCaptureDate(string date)
        {
            ElementHelpers.SetFirstElementById("Date", date);

            return(this);
        }
Ejemplo n.º 23
0
 /// <summary>
 /// View the Pokemon from Pokedex by given nickname.
 /// </summary>
 /// <param name="nickName">nickname to view</param>
 public static void ViewPokemonByNickname(string nickName)
 {
     ElementHelpers.ClickFirstElementByXPath("//h4[text()='Nickname: " + nickName + "']");
 }
Ejemplo n.º 24
0
    public void WaveHitWithElement(int e)
    {
        if (isGameOver)
        {
            return;
        }
        GetComponent <AudioSource>().PlayOneShot(incomingWaveSound);
        if (NeighborCountAtSpot(50, 50) < 6)
        {
            SpiritDestroyed();
            return;
        }
        List <int[]> tilesToRemove = new List <int[]> {
        };
        Element element            = (Element)e;

        Debug.Log("attacking with element: " + element);
        foreach (int[] spot in ExposedSpots())
        {
            Element elementAtSpot = (Element)tileSpots[spot[0], spot[1]];
            if (element == ElementHelpers.ElementResistedForElement(elementAtSpot))
            {
                Debug.Log("safe because I'm: " + elementAtSpot);
            }
            else
            {
                // potentially unsafe, now check neighbors for protection
                bool isProtected = false;
                foreach (int[] neighborSpot in NeighborsAtSpot(spot[0], spot[1]))
                {
                    // protected next to resisting element
                    if (element == ElementHelpers.ElementResistedForElement((Element)tileSpots[neighborSpot[0], neighborSpot[1]]))
                    {
                        isProtected = true;
                        break;
                    }
                }
                if (!isProtected)
                {
                    // destroy the tile
                    if (TileAtSpot(spot[0], spot[1]) != null)
                    {
                        tileSpots[spot[0], spot[1]] = 0;
                        // placedTiles.Remove(spot);
                        tilesToRemove.Add(spot);
                        TileAtSpot(spot[0], spot[1]).Eliminated(element);
                    }
                }
            }
        }
        foreach (int[] t in tilesToRemove)
        {
            placedTiles.Remove(t);
        }
        // destroy any non-protected tiles that are weak to the element
        foreach (int[] spot in placedTiles)
        {
            Element elementAtSpot = (Element)tileSpots[spot[0], spot[1]];
            // check if weak to the coming element
            if (elementAtSpot == ElementHelpers.ElementResistedForElement(element))
            {
                bool isProtected = false;
                foreach (int[] neighborSpot in NeighborsAtSpot(spot[0], spot[1]))
                {
                    // protected next to resisting element
                    if (element == ElementHelpers.ElementResistedForElement((Element)tileSpots[neighborSpot[0], neighborSpot[1]]))
                    {
                        isProtected = true;
                        break;
                    }
                }
                if (!isProtected)
                {
                    // destroy the tile
                    if (TileAtSpot(spot[0], spot[1]) != null)
                    {
                        tileSpots[spot[0], spot[1]] = 0;
                        tilesToRemove.Add(spot);
                        TileAtSpot(spot[0], spot[1]).Eliminated(element);
                    }
                }
            }
        }
        foreach (int[] t in tilesToRemove)
        {
            placedTiles.Remove(t);
        }
        Invoke("EliminateLoners", 1.0f);
    }