示例#1
0
    public void LoginAsGuestAndRegister()
    {
        LoginPageObject   LoginPage   = new LoginPageObject();
        LobbyPageObject   LobbyPage   = new LobbyPageObject();
        ProfilePageObject ProfilePage = new ProfilePageObject();
        WebDriverWait     wait        = new WebDriverWait(PropertiesCollection.driver, TimeSpan.FromSeconds(10));

        wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("button.guest")));
        LoginPage.ButtonGuest.Click();
        Thread.Sleep(4000);
        Assert.AreEqual(@"http://172.16.45.50:9001/#/lobby", PropertiesCollection.driver.Url);
        Thread.Sleep(4000);
        PropertiesCollection.driver.SwitchTo().ActiveElement();
        LobbyPage.ButtonCollect.Click();
        Thread.Sleep(2000);
        LobbyPage.MyProfile.Click();
        Thread.Sleep(2000);
        ProfilePage.Register.Click();
        Thread.Sleep(2000);
        PropertiesCollection.driver.SwitchTo().ActiveElement();
        ProfilePage.Username.SendKeys("*****@*****.**");
        Thread.Sleep(2000);
        ProfilePage.Password.SendKeys("[email protected]");
        Thread.Sleep(2000);
        WaitClass.WaitForElementMethod(ProfilePage.RegisterButton);
        ProfilePage.RegisterButton.Click();
        Thread.Sleep(3000);
        WaitClass.WaitForElementMethod(LobbyPage.ButtonCollect);
        Thread.Sleep(3000);
        LobbyPage.ButtonCollect.Click();
        Thread.Sleep(3000);
        WaitClass.WaitForElementMethod(ProfilePage.ResendEmailButton);
        ProfilePage.ResendEmailButton.Click();
        Thread.Sleep(3000);
        PropertiesCollection.driver.SwitchTo().ActiveElement();
        string expectedMessage = "THANKS!";
        string message         = PropertiesCollection.driver.FindElement(By.CssSelector("div>mat-card-title")).Text;

        Assert.AreEqual(expectedMessage, message);
        ProfilePage.ButtonOKResendEmail.Click();
    }
示例#2
0
    public void LoginEditProfile()
    {
        LoginPageObject   page    = new LoginPageObject();
        ProfilePageObject profile = new ProfilePageObject();
        LobbyPageObject   lobby   = new LobbyPageObject();

        System.Threading.Thread.Sleep(2000);
        page.Username.SendKeys("*****@*****.**");
        page.Password.SendKeys("[email protected]");
        WebDriverWait wait = new WebDriverWait(PropertiesCollection.driver, TimeSpan.FromSeconds(10));

        wait.Until(ExpectedConditions.ElementToBeClickable(By.CssSelector("button.mt-sm-1")));
        if (page.ButtonLogin.Enabled)
        {
            page.ButtonLogin.Click();
            System.Threading.Thread.Sleep(5000);
            Assert.AreEqual(@"http://172.16.45.50:9001/#/lobby", PropertiesCollection.driver.Url);
        }
        else
        {
            throw new ArgumentException("Button is unavaliable");
        }
        System.Threading.Thread.Sleep(4000);
        lobby.MyProfile.Click();
        Thread.Sleep(2000);
        profile.ButtonEditProfile.Click();
        Thread.Sleep(2000);
        profile.NickNameField.Clear();
        profile.NickNameField.SendKeys("SomeNewNick");
        PropertiesCollection.driver.FindElement(By.CssSelector("#item-select>div>div.wrap.text-left.item-selected>div>i")).Click();
        Thread.Sleep(2000);
        PropertiesCollection.driver.FindElement(By.CssSelector("#item-select>div>div:nth-child(4)>span")).Click();
        Thread.Sleep(2000);
        WaitClass.WaitForElementMethod(profile.EditProfileSaveBtn);
        profile.EditProfileSaveBtn.Click();
        Thread.Sleep(4000);
    }
示例#3
0
    public void VerifyMainMenuButtons()
    {
        LoginPageObject LoginPage = new LoginPageObject();
        WebDriverWait   wait      = new WebDriverWait(PropertiesCollection.driver, TimeSpan.FromSeconds(10));

        WaitClass.WaitForElementMethod(LoginPage.ButtonGuest);
        LoginPage.ClickGuestLoginButton();
        Assert.AreEqual(@"http://172.16.45.50:9001/#/lobby", PropertiesCollection.driver.Url);
        Thread.Sleep(2000);
        LobbyPageObject LobbyPage = new LobbyPageObject();

        PropertiesCollection.driver.SwitchTo().ActiveElement();
        Thread.Sleep(4000);
        LobbyPage.ButtonCollect.Click();
        Thread.Sleep(4000);
        LobbyPage.ButtonWorld.Click();
        Thread.Sleep(3000);
        Assert.AreEqual(@"http://172.16.45.50:9001/#/world", PropertiesCollection.driver.Url);
        wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("li:nth-child(1)>div>div>div.info-block>p.title")));
        wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("div.back.ng-star-inserted")));
        LobbyPage.BackButton.Click();
        Thread.Sleep(3000);
        LobbyPage.ButtonSkillGames.Click();
        Thread.Sleep(3000);
        Assert.AreEqual(@"http://172.16.45.50:9001/#/skillgames", PropertiesCollection.driver.Url);
        var skillheader = PropertiesCollection.driver.FindElement(By.CssSelector("div>h2")).Text;

        Assert.AreEqual("SKILL GAMES", skillheader);
        LobbyPage.BackButton.Click();
        Thread.Sleep(3000);
        LobbyPage.MyProfile.Click();
        Thread.Sleep(3000);
        Assert.AreEqual(@"http://172.16.45.50:9001/#/profile", PropertiesCollection.driver.Url);
        var profileheader = PropertiesCollection.driver.FindElement(By.CssSelector("div>h2")).Text;

        Assert.AreEqual("PROFILE", profileheader);
        LobbyPage.BackButton.Click();
        Thread.Sleep(3000);
        LobbyPage.Promotions.Click();
        Thread.Sleep(3000);
        Assert.AreEqual(@"http://172.16.45.50:9001/#/promotions", PropertiesCollection.driver.Url);
        var promotionheader = PropertiesCollection.driver.FindElement(By.CssSelector("div>h2")).Text;

        Assert.AreEqual("PROMOTIONS", promotionheader);
        LobbyPage.BackButton.Click();
        Thread.Sleep(3000);
        LobbyPage.LeaderBoard.Click();
        Thread.Sleep(3000);
        Assert.AreEqual(@"http://172.16.45.50:9001/#/leaderboard", PropertiesCollection.driver.Url);
        var leaderheader = PropertiesCollection.driver.FindElement(By.CssSelector("div>h2")).Text;

        Assert.AreEqual("LEADERBOARD", leaderheader);
        LobbyPage.BackButton.Click();
        Thread.Sleep(3000);
        LobbyPage.Tournaments.Click();
        Thread.Sleep(3000);
        Assert.AreEqual(@"http://172.16.45.50:9001/#/tournaments", PropertiesCollection.driver.Url);
        var tournamentsheader = PropertiesCollection.driver.FindElement(By.CssSelector("div>h2")).Text;

        Assert.AreEqual("TOURNAMENTS", tournamentsheader);
        LobbyPage.BackButton.Click();
        Thread.Sleep(3000);
        LobbyPage.Challenges.Click();
        Thread.Sleep(3000);
        Assert.AreEqual(@"http://172.16.45.50:9001/#/challenges", PropertiesCollection.driver.Url);
        var challengesheader = PropertiesCollection.driver.FindElement(By.CssSelector("div>h2")).Text;

        Assert.AreEqual("CHALLENGES", challengesheader);
        Thread.Sleep(4000);
        LobbyPage.SettingsButton.Click();
        PropertiesCollection.driver.SwitchTo().ActiveElement();
        LobbyPage.LogoutButton.Click();
        Thread.Sleep(3000);
        wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("button.guest")));
        Assert.AreEqual(@"http://172.16.45.50:9001/#/login", PropertiesCollection.driver.Url);
        Thread.Sleep(4000);
    }