Program public static void Main string args Console WriteLine Hello wo

 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
95
96
97
s Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello, world!");
}
}1. #region Imports
2.
3. using System;
4. using FluentAutomation.API.Enumerations;
5. using Microsoft.VisualStudio.TestTools.UnitTesting;
6.
7. #endregion
8.
9. namespace Web.UI.Tests
10. {
11. [TestClass]
12. public class UsersTest : FluentAutomation.SeleniumWebDriver.FluentTest
13. {
14. #region Fields
15.
16. private const string rootUrl = "http://CRM.domen.com";
17. private const string managerLogin = "manager@mail.com";
18. private const string managerPassword = "pasword";
19. private const int timesToRepeat = 20;
20.
21. #endregion
22.
23. public TestContext TestContext { get; set; }
24.
25. public override void Setup()
26. {
27. ProviderName = "Selenium";
28. base.Setup();
29. }
30.
31. [TestMethod]
32. public void UsersModuleTest()
33. {
34. // 1. Open CRM
35. // 2. Login under manager
36. // 3. Open Users module
37. // 4. Wait for first user details are loaded
38. // 5. Loop for first 20 users
39. // 5-1. Sleep for 10 seconds
40. // 5-2. Select next user
41. // 5-3. Wait for user details are loaded
42. // 5-4. Go to 5-1
43. // 6. Switch to Employees module
44. // 6-1. Repeat 5-1 - 5-4 for first 20 employees
45. // 7. Switch to Sales Agents module
46. // 7-1. Repeat 5-1 - 5-4 for first 20 agents
47. I.Use(BrowserType.Chrome);
48. I.Open(rootUrl);
49. var startTime = DateTime.Now;
50. TestContext.WriteLine("Test started\n", startTime);
51. I.Enter(managerLogin).In("input[name='Login']");
52. I.Enter(managerPassword).In("input[name='Password']");
53. I.Click("input[type='submit'][value='Login']");
54. TestContext.WriteLine("Logged in in {0}ms\n", (DateTime.Now - startTime));
55. I.Click("li[id='users-home-index'] a");
56. TestContext.WriteLine("Managers page loaded in {0}ms\n", (DateTime.Now - startTime));
57. I.Expect.Count(timesToRepeat).Of("#ManagersGrid table tr div.employee-details");
58. for (var i = 0; i < timesToRepeat; i++)
59. {
60. startTime = DateTime.Now;
61. I.Click("#ManagersGrid table tr div.employee-details:eq(" + i + ")");
62. TestContext.WriteLine("Manager #{0} details loaded in {1}ms\n", i +1, (DateTime.Now - startTime));
63. I.Wait(10);
64. }
65.
66. startTime = DateTime.Now;
67. I.Open(rootUrl + "/Users/Employees");
68. TestContext.WriteLine("Employees page loaded in {0}ms\n", (DateTime.Now - startTime));
69. I.Expect.Count(timesToRepeat).Of("#EmployeesGrid table tr div.employee-details");
70. for (var i = 0; i < timesToRepeat; i++)
71. {
72. startTime = DateTime.Now;
73. I.Click("#EmployeesGrid table tr div.employee-details:eq(" + i + ")");
74. TestContext.WriteLine("Employee #{0} details loaded in {1}ms\n", i + 1, (DateTime.Now - startTime));
75. I.Wait(10);
76. }
77.
78. startTime = DateTime.Now;
79. I.Open(rootUrl + "/Users/SalesAgents");
80. TestContext.WriteLine("SalesAgents page loaded in {0}ms\n", (DateTime.Now - startTime));
81. I.Expect.Count(timesToRepeat).Of("#SalesAgentsGrid table tr div.employee-details");
82. for (var i = 0; i < timesToRepeat; i++)
83. {
84. startTime = DateTime.Now;
85. I.Click("#SalesAgentsGrid table tr div.employee-details:eq(" + i + ")");
86. TestContext.WriteLine("Sales Agent #{0} details loaded in {1}ms\n", i + 1, (DateTime.Now - startTime));
87. I.Wait(10);
88. }
89. }
90. }
91. }