public void TestChangeName(User admin, string[] names)
        {
            LoginPage loginPage = Application.Get().Login();
            UsersPage usersPage = loginPage.SuccessAdminLogin(admin);

            // Test steps
            // Go to EditProfile page and check if this page is really opened
            YourProfilePage yourProfilePage = usersPage.GotoEditProfile();

            Assert.IsNotNull(yourProfilePage.YourProfileLabel);

            yourProfilePage.ClickEditName();
            Assert.IsNotNull(yourProfilePage.GetNewNameField());

            // Set name with digits and try to change it. Check if appropriate message appears
            yourProfilePage.SetNewName(names[0]);
            yourProfilePage.ChangeName(admin);

            Assert.AreEqual(YourProfilePage.ErrorMessageForNameWithDigits, yourProfilePage.GetMessageText());

            // Set name with specific symbols and try to change it. Check if appropriate message appears
            yourProfilePage.SetNewName(names[1]);
            yourProfilePage.ChangeName(admin);

            Assert.AreEqual(YourProfilePage.ErrorMessageForNameWithSymbols, yourProfilePage.GetMessageText());

            // Set correct name try to change it. Check if name is really changed
            yourProfilePage.SetNewName(names[2]);
            yourProfilePage.ChangeName(admin);

            Assert.AreEqual(names[2], admin.GetName());

            // Return to previous state
            loginPage = yourProfilePage.GotoLogOut();
        }
Exemple #2
0
        public void CancelButtonTest(User admin, string newName, string newPassword)
        {
            // --- Precondition --- //

            admin.SetEmail("*****@*****.**");
            admin.SetPassword("blackstar");

            // Login
            LoginPage loginPage = Application.Get(ApplicationSourcesRepository.ChromeByIP()).Login();
            UsersPage usersPage = loginPage.SuccessAdminLogin(admin);

            // --- Test Steps --- //

            // 1. Go to 'Edit Profile' page
            YourProfilePage yourProfilePage = usersPage.GotoEditProfile();

            Assert.IsNotNull(yourProfilePage.YourProfileLabel);
            admin.SetName(yourProfilePage.GetNameValue());  // Get Current Name

            // 2. Go to 'Edit Name' form
            yourProfilePage.ClickEditName();
            Assert.IsNotNull(yourProfilePage.GetNewNameField());

            // 3. Set new name
            yourProfilePage.SetNewName(newName);

            // 4. Press 'Cancel' and check if information wasn't saved.
            yourProfilePage.ClickCancel();
            Assert.AreNotEqual(admin.GetName(), newName);

            // 5. Go to 'Edit Password' form
            yourProfilePage.ClickEditPassword();
            Assert.IsNotNull(yourProfilePage.YourProfileLabel);

            // 6. Set new password
            yourProfilePage.SetCurrentPassword(admin.GetPassword());
            yourProfilePage.SetNewPassword(newPassword);
            yourProfilePage.SetConfirmPassword(newPassword);

            // 7. Press 'Cancel' and check if information wasn't saved.
            yourProfilePage.ClickCancelPassword();
            Assert.AreNotEqual(admin.GetPassword(), newPassword);

            // --- Logout --- //
            loginPage = yourProfilePage.GotoLogOut();

            Console.WriteLine("Test Done!");
        }