42 lines
1.5 KiB
C#
42 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
using OpenQA.Selenium;
|
|
|
|
namespace Prevu
|
|
{
|
|
public class ActivateUserAccountPage : BasePage
|
|
{
|
|
By txtUsernameLocator = By.Id("username_id");
|
|
By btnActivate = By.ClassName("signup-btn");
|
|
By divValidationErrors = By.ClassName("validation-summary-errors");
|
|
By spanFieldValidationError = By.ClassName("field-validation-error");
|
|
|
|
WebDriver _driver;
|
|
|
|
public ActivateUserAccountPage(WebDriver driver)
|
|
{
|
|
_driver = driver;
|
|
}
|
|
|
|
public bool OpenActivateUserAccount(string userId)
|
|
{
|
|
_driver.OpenPage(string.Format("Account/Activate/?userId={0}", userId));
|
|
return _driver.GetElement(txtUsernameLocator).Text != null;
|
|
}
|
|
public bool ActivateUserAccount(string userId, string userName, string email, string password)
|
|
{
|
|
bool result = OpenActivateUserAccount(userId);
|
|
result = result && _driver.CheckElement(txtFormControl, "name", "UserName", userName);
|
|
result = result && _driver.CheckElement(txtFormControl, "name", "Email", email);
|
|
_driver.SendKeys(txtFormControl, "name", "Password", password);
|
|
_driver.SendKeys(txtFormControl, "name", "ConfirmationPassword", password);
|
|
_driver.ClickElement(btnActivate, "value", "Activate", "");
|
|
return result;
|
|
}
|
|
}
|
|
}
|