-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSeleniumTests.cs
More file actions
148 lines (109 loc) · 6.84 KB
/
SeleniumTests.cs
File metadata and controls
148 lines (109 loc) · 6.84 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using System;
using Vansah;
namespace VansahSeleniumCSharpDemo
{
public class Tests
{
//******************************************* Required ********************************************************************//
public IWebDriver driver;
private VansahNode testExecute;
private static string testCase;
private string issueKey;
//******************************************* Test Properties - Optional **************************************************//
private string sprintName;
private string releaseName;
private string environment;
[SetUp]
public void Setup()
{
//******************************* Create Instance for VansahNode *******************************************************//
testExecute = new VansahNode();
}
[Test]
//***************************** Adding Quick Test for a TestCase From an Issue *********************************************//
public void VAN_C15()
{
//********************************* Assigning Values to Variables ********************************************************//
testCase = "VAN-C15";
issueKey = "VAN-5";
environment = "UAT";
//*********************************** Setting Asset & Test Properties **************************************************//
testExecute.SetJira_Issue_Key(issueKey);
testExecute.SetEnvironment_Name(environment);
//********************************** Function For Add Quick Test From Jira Issue **************************************//
testExecute.AddQuickTestFromJiraIssue(testCase, "failed");
}
[Test]
//***************************** Adding Quick Test for a TestCase From an Issue and Remove Test run ***********************//
public void VAN_C17()
{
//********************************* Assigning Values to Variables *****************************************************//
testCase = "VAN-C17";
issueKey = "VAN-5";
environment = "UAT";
//*********************************** Setting Asset & Test Properties ************************************************//
testExecute.SetJira_Issue_Key(issueKey);
testExecute.SetEnvironment_Name(environment);
//********************************** Function To Add Quick Test From Jira Issue **************************************//
testExecute.AddQuickTestFromJiraIssue(testCase, "passed");
//********************************** Function To Remove Current Test Run *********************************************//
testExecute.RemoveTestRun();
}
[Test]
//***************************** Sample TestCase - Validating Selenium Vansah Webpage *************************************//
//***************************** Adding TestRun, Adding TestLog, Update TestLog *******************************************//
public void VAN_C23()
{
//*************************** Creating Instance for ChromeDriver ******************************************************//
driver = new ChromeDriver(System.IO.Directory.GetCurrentDirectory());
//********************************* Assigning Values to Variables ******************************************************//
testCase = "VAN-C23";
issueKey = "VAN-5";
environment = "UAT";
//*********************************** Setting Asset & Test Properties *************************************************//
testExecute.SetJira_Issue_Key(issueKey);
testExecute.SetEnvironment_Name(environment);
//**************************Function For Adding Test run from Jira Issue *********************************************//
testExecute.AddTestRunFromJiraIssue(testCase);
//************************* Test Case Started, Validating Selenium Vansah Webpage ***********************************//
driver.Url = "https://selenium.vansah.io/";
driver.Manage().Window.Maximize();
//*********************Test step #1, Check whether User able to open the vansah.com ********************************//
//************************************ Function to Add Test Log ***************************************************//
if (driver.Url.Equals("https://selenium.vansah.io/"))
{
//ResultName - n/a, failed, passed, untested
//Add logs for each step function(ResultName, AcutalResultComment, TestStepID, screenshotTrueorFalse, chromedriver/OtherBroswerdriver);
testExecute.AddTestLog("passed", "As expected, Url is opened", 1, true, driver);
}
else
{
//ResultName - n/a, failed, passed, untested
//Add logs for each step function(ResultName, AcutalResultComment, TestStepID, screenshotTrueorFalse, chromedriver/OtherBroswerdriver);
testExecute.AddTestLog("failed", "URL not Found", 1, true, driver);
}
//**************************** Clicking on TRY NOW button ***************************************************************//
IWebElement element = driver.FindElement(By.XPath("//*[text()='Try Now']"));
element.Click();
//************************* Test step #2 , Validating URL of MarketPlace ***********************************************//
if (driver.Url.Equals("https://marketplace.atlassian.com/apps/1224250/vansah-test-management-for-jira?tab=overview&hosting=cloud"))
{
//ResultName - n/a, failed, passed, untested
//Add logs for each step function(ResultName, AcutalResultComment, TestStepID, screenshotTrueorFalse, chromedriver/OtherBroswerdriver);
testExecute.AddTestLog("passed", "As expected, url is matched", 2, true, driver);
}
else
{
//ResultName - n/a, failed, passed, untested
//Add logs for each step function(ResultName, AcutalResultComment, TestStepID, screenshotTrueorFalse, chromedriver/OtherBroswerdriver);
testExecute.AddTestLog("failed", "Url is not matched", 2, true, driver);
}
//************************** Function to Update Current/Last Test Log ************************************************//
testExecute.UpdateTestLog("N/A", "Step Not in Scope", false, driver);
//**************************** Terminating the driver instance ********************************************************//
driver.Quit();
}
}
}