Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C# by Max ( 12 years ago )
public class LogOnTests : TestsBase
{
    [TestMethod]
    public void LogOnWithEmptyLogin()
    {
        #region TestData

        const string login = null;
        const string password = "password";
        const string error = "Empty login!";

        #endregion

        Browser.Open(...);
        LogOnPage.LogOn(login, password);

        Assert.AreEqual(error, LogOnPage.Error,
            "Error expected.");
    }
}

public static class LogOnPage
{
    private static readonly WebElement LoginEdit = new WebElement().ById("Login");
    private static readonly WebElement PasswordEdit = new WebElement().ById("Password");
     private static readonly WebElement Log WebElement().ById("LogOn");
     private static readonly WebElement Log WebElement().ById("LogOnValidation");

    public static void LogOn(string login, string password)
    {
        LoginEdit.Text = login;
        PasswordEdit.Text = password;
        LogOnButton.Click();
    }

    public static string Error
    {
        get { return LogOnValidationError.Text; }
    }
}

 

Revise this Paste

Your Name: Code Language: