-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUnitTests.cs
94 lines (79 loc) · 2.97 KB
/
UnitTests.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
using Gallio.Framework;
using MbUnit.Framework;
namespace ProtoTest.Nightshade.Tests.Diagnostics
{
/// <summary>
/// Some basic tests for the frameowrk. Requires a device to be ready.
/// </summary>
public class UnitTests : EggplantTestBase
{
//[Test]
public void TestDriver()
{
EggplantElement StartButton = new EggplantElement(By.Image("MC65/System/StartMenu/StartButton"));
EggplantElement ContactsButton = new EggplantElement(By.Text("Contacts"));
EggplantElement CloseButton = new EggplantElement(By.Image("MC65/System/StartMenu/ExitButton"));
if(!ContactsButton.IsPresent())
StartButton.Click();
ContactsButton.Click();
CloseButton.Click();
StartButton.Click();
CloseButton.Click();
}
//[Test]
public void TestScreenRectangle()
{
ConnectToHost1();
var rect = Driver.GetScreenRectangle();
DiagnosticLog.WriteLine("The rect is : " + rect.width + " x " + rect.height);
}
//[Test]
public void TestGetOptions()
{
ConnectToHost1();
DiagnosticLog.WriteLine(Driver.GetOptions());
DiagnosticLog.WriteLine(Driver.GetOption("ImageSearchTime"));
}
//[Test]
public void TestConnectionInfo()
{
ConnectToHost1();
var info = Driver.GetConnectionInfo();
DiagnosticLog.WriteLine(info);
}
//[Test]
public void TestElementSearchRectangle()
{
ConnectToHost1();
EggplantElement Home = new EggplantElement(By.Text("Home").InRectangle(SearchRectangle.TopQuarter));
EggplantElement element = new EggplantElement(By.Image("MC65/System/StartMenu/ExitButton").InRectangle(SearchRectangle.BottomQuarter));
Home.Click();
element.Click();
}
//[Test]
public void TestElementByPath()
{
EggplantElement element = new EggplantElement(By.Image("MC65/System/StartMenu/ExitButton"));
element.Click();
}
//[Test]
public void TestElementByText()
{
EggplantElement element = new EggplantElement(By.Image("(Text:\"Text Of Element\")"));
element.Click();
}
//[Test]
public void TestTwoHosts()
{
Driver.Disconnect();
ConnectToHost2();
}
//[Test]
public void TestByLocators()
{
Driver.Connect(Config.Host1Ip);
var Element = new EggplantElement(By.Text("Run"));
Element.Click();
}
}
}