forked from SeleniumHQ/selenium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestType.cs
34 lines (33 loc) · 1.35 KB
/
TestType.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
namespace Selenium.Tests
{
[TestFixture]
public class TestType : SeleniumTestCaseBase
{
[Test]
public void ShouldTestTyping()
{
selenium.Open("/html/test_type_page1.html");
Assert.AreEqual(string.Empty, selenium.GetValue("username"));
selenium.ShiftKeyDown();
selenium.Type("username", "x");
Assert.AreEqual("X", selenium.GetValue("username"));
selenium.ShiftKeyUp();
selenium.Type("username", "TestUserWithLongName");
Assert.AreEqual("TestUserWi", selenium.GetValue("username"));
selenium.Type("username", "TestUser");
Assert.AreEqual("TestUser", selenium.GetValue("username"));
Assert.AreEqual(string.Empty, selenium.GetValue("password"));
selenium.Type("password", "testUserPasswordIsVeryLong");
Assert.AreEqual("testUserPasswordIsVe", selenium.GetValue("password"));
selenium.Type("password", "testUserPassword");
Assert.AreEqual("testUserPassword", selenium.GetValue("password"));
selenium.Click("submitButton");
selenium.WaitForPageToLoad("30000");
Assert.IsTrue(selenium.IsTextPresent("Welcome, TestUser!"));
}
}
}