Added new tests, bug fixes for existing ones.

This commit is contained in:
Mohammad Rahman
2020-12-17 16:26:14 -05:00
parent eaf218cd1a
commit 26def287ee
7 changed files with 1712 additions and 748 deletions

View File

@@ -27,20 +27,29 @@ public class DashboardTest {
WebDriver driver;
static APIClient client;
static long runId;
// static String Url = System.getenv("CLOUD_SDK_URL");
// static String trUser = System.getenv("TR_USER");
// static String trPwd = System.getenv("TR_PWD");
// static String cloudsdkUser = "support@example.com";
// static String cloudsdkPwd="support";
@BeforeClass
public static void startTest() throws Exception
{
client = new APIClient("https://telecominfraproject.testrail.com");
client.setUser("syama.devi@connectus.ai");
client.setPassword("Connectus123$");
client.setPassword("Connect123$");
JSONArray c = (JSONArray) client.sendGet("get_runs/5");
runId = new Long(0);
Calendar cal = Calendar.getInstance();
//Months are indexed 0-11 so add 1 for current month
int month = cal.get(Calendar.MONTH) + 1;
String date = "UI Automation Run - " + cal.get(Calendar.DATE) + "/" + month + "/" + cal.get(Calendar.YEAR);
String day = Integer.toString(cal.get(Calendar.DATE));
if (day.length()<2) {
day = "0"+day;
}
String date = "UI Automation Run - " + day + "/" + month + "/" + cal.get(Calendar.YEAR);
for (int a = 0; a < c.size(); a++) {
if (((JSONObject) c.get(a)).get("name").equals(date)) {
runId = (Long) ((JSONObject) c.get(a)).get("id");
@@ -69,6 +78,14 @@ public class DashboardTest {
driver.findElement(By.xpath("//*[@id=\"login\"]/button/span")).click();
}
public void failure(int testId) throws MalformedURLException, IOException, APIException {
driver.close();
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
}
public void networkScreen() throws Exception {
driver.findElement(By.linkText("Network")).click();
}
@@ -84,10 +101,7 @@ public class DashboardTest {
Thread.sleep(2500);
}
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail("Number of AP's provisioned cannot be found");
}
@@ -108,10 +122,7 @@ public class DashboardTest {
}
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail("Number of AP's provisioned cannot be found");
}
return 0;
@@ -124,10 +135,7 @@ public class DashboardTest {
int displ = Integer.parseInt(displayed.substring(displayed.length()-2));
return displ;
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail("Number of total devices associated cannot be found");
}
@@ -139,10 +147,7 @@ public class DashboardTest {
try {
}catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail("Number of total devices associated cannot be found");
}
@@ -150,22 +155,18 @@ public class DashboardTest {
List<WebElement> lines = driver.findElements(By.cssSelector("[class^='highcharts-tracker-line']"));
if (lines.size()!= 5) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
Assert.assertEquals("Graphs not displayed", 5, lines.size());
}
public int countRows(int testId) throws MalformedURLException, IOException, APIException {
try {
}catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
WebElement tbl = driver.findElement(By.xpath("//table"));
List<WebElement> rows = tbl.findElements(By.tagName("tr"));
@@ -176,10 +177,8 @@ public class DashboardTest {
try {
}catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
WebElement tbl = driver.findElement(By.xpath("//table"));
List<WebElement> rows = tbl.findElements(By.tagName("tr"));
@@ -199,6 +198,30 @@ public class DashboardTest {
return count;
}
public void verifyClientDevicesGraphs(int testId) throws MalformedURLException, IOException, APIException, InterruptedException {
List<WebElement> points = driver.findElements(By.cssSelector("[class^='highcharts-point']"));
points.get(1).click();
points.get(2).click();
Thread.sleep(1000);
List<WebElement> lines = driver.findElements(By.cssSelector("[class^='highcharts-tracker-line']"));
if (!lines.get(1).getAttribute("visibility").equals("hidden")||!lines.get(2).getAttribute("visibility").equals("hidden")) {
failure(testId);
fail();
}
}
public void verifyTrafficGraphs(int testId) throws MalformedURLException, IOException, APIException, InterruptedException {
List<WebElement> points = driver.findElements(By.cssSelector("[class^='highcharts-point']"));
points.get(3).click();
points.get(4).click();
Thread.sleep(1000);
List<WebElement> lines = driver.findElements(By.cssSelector("[class^='highcharts-tracker-line']"));
if (!lines.get(3).getAttribute("visibility").equals("hidden")||!lines.get(4).getAttribute("visibility").equals("hidden")) {
failure(testId);
fail();
}
}
public void verifyDashboardScreenDetails(int testId) throws MalformedURLException, IOException, APIException {
Map data = new HashMap();
try {
@@ -307,6 +330,42 @@ public class DashboardTest {
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/5220", data);
}
//C5634
@Test
public void clientDevicesGraphsTest() throws Exception {
int testId = 5634;
Map data = new HashMap();
DashboardTest obj = new DashboardTest();
obj.launchBrowser();
obj.logIn();
Thread.sleep(5000);
obj.verifyClientDevicesGraphs(testId);
Thread.sleep(2000);
obj.closeBrowser();
data.put("status_id", new Integer(1));
data.put("comment", "This test worked fine!");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
}
//C5635
@Test
public void trafficGraphsTest() throws Exception {
int testId = 5635;
DashboardTest obj = new DashboardTest();
obj.launchBrowser();
obj.logIn();
Thread.sleep(5000);
obj.verifyTrafficGraphs(testId);
Thread.sleep(2000);
obj.closeBrowser();
Map data = new HashMap();
data.put("status_id", new Integer(1));
data.put("comment", "This test worked fine!");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
}
// @Test
// void devicesDetailsTest() throws Exception {

View File

@@ -35,21 +35,29 @@ public class LoginTest {
WebDriver driver, driver2;
static APIClient client;
static long runId;
// static String Url = System.getenv("CLOUD_SDK_URL");
// static String trUser = System.getenv("TR_USER");
// static String trPwd = System.getenv("TR_PWD");
// static String cloudsdkUser = "support@example.com";
// static String cloudsdkPwd="support";
@BeforeClass
public static void startTest() throws Exception
{
client = new APIClient("https://telecominfraproject.testrail.com");
client.setUser("syama.devi@connectus.ai");
client.setPassword("Connectus123$");
client.setPassword("Connect123$");
JSONArray c = (JSONArray) client.sendGet("get_runs/5");
runId = new Long(0);
Calendar cal = Calendar.getInstance();
//Months are indexed 0-11 so add 1 for current month
int month = cal.get(Calendar.MONTH) + 1;
String date = "UI Automation Run - " + cal.get(Calendar.DATE) + "/" + month + "/" + cal.get(Calendar.YEAR);
String day = Integer.toString(cal.get(Calendar.DATE));
if (day.length()<2) {
day = "0"+day;
}
String date = "UI Automation Run - " + day + "/" + month + "/" + cal.get(Calendar.YEAR);
for (int a = 0; a < c.size(); a++) {
if (((JSONObject) c.get(a)).get("name").equals(date)) {
runId = (Long) ((JSONObject) c.get(a)).get("id");
@@ -58,11 +66,10 @@ public class LoginTest {
}
public void launchBrowser() {
System.setProperty("webdriver.chrome.driver", "/Users/mohammadrahman/Downloads/chromedriver");
// System.setProperty("webdriver.chrome.driver", "/Users/mohammadrahman/Downloads/chromedriver");System.setProperty("webdriver.chrome.driver", "/home/netex/nightly_sanity/ui-scripts/chromedriver");
// System.setProperty("webdriver.chrome.driver", "/Users/mohammadrahman/Downloads/chromedriver");
System.setProperty("webdriver.chrome.driver", "/home/netex/nightly_sanity/ui-scripts/chromedriver");
ChromeOptions options = new ChromeOptions();
options.addArguments("--no-sandbox");
// options.addArguments("--disable-dev-shm-usage");
options.addArguments("--headless");
options.addArguments("--window-size=1920,1080");
driver = new ChromeDriver(options);
@@ -70,17 +77,12 @@ public class LoginTest {
}
public void launchPortal() {
driver2 = new ChromeDriver();
driver2.get("https://wlan-ui.qa.lab.wlan.tip.build/");
}
public void launchSecondWindow() throws Exception {
Actions action = new Actions(driver);
String URL = driver.getCurrentUrl();
action.sendKeys(Keys.chord(Keys.CONTROL, "n")).build().perform();
driver.get(URL);
Thread.sleep(2000);
public void failure(int testId) throws MalformedURLException, IOException, APIException {
driver.close();
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
}
public void login(String email, String password) {
@@ -89,6 +91,8 @@ public class LoginTest {
driver.findElement(By.xpath("//*[@id=\"login\"]/button/span")).click();
}
public void checkHover(String box, int testId) throws Exception {
try {
String colour, colour2;
@@ -132,10 +136,8 @@ public class LoginTest {
}
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
@@ -154,10 +156,8 @@ public class LoginTest {
}
Assert.assertEquals("Email field is not in focus", true, emailFocus);
} catch (Exception E){
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
@@ -204,10 +204,8 @@ public class LoginTest {
}
Assert.assertEquals("Login button is not in focus", true, confirmFocus);
}catch (Exception E){
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
}
@@ -237,10 +235,8 @@ public class LoginTest {
}
Assert.assertEquals("Password is still hidden", true, passwordTest2);
} catch (Exception E){
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
@@ -262,10 +258,8 @@ public class LoginTest {
//Assert.assertEquals(expected, actual);
} catch (Exception E){
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
}
@@ -304,10 +298,8 @@ public class LoginTest {
}
Assert.assertEquals("No error message displayed", true, found);
} catch (Exception E){
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
}
@@ -322,10 +314,8 @@ public class LoginTest {
}
Assert.assertEquals("Email field not found", true, driver.findElement(By.id("login_email")).isDisplayed());
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
@@ -341,10 +331,8 @@ public class LoginTest {
}
Assert.assertEquals("Password field not found", true, driver.findElement(By.id("login_password")).isDisplayed());
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
}
@@ -357,10 +345,8 @@ public class LoginTest {
}
Assert.assertEquals("Incorrect URL", URL, "https://wlan-ui.qa.lab.wlan.tip.build/dashboard");
}catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
}
@@ -373,10 +359,8 @@ public class LoginTest {
}
Assert.assertEquals("Incorrect URL", URL, "https://wlan-ui.qa.lab.wlan.tip.build/login");
}catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -37,20 +37,29 @@ public class ProfilesTest {
static APIClient client;
static long runId;
// static String Url = System.getenv("CLOUD_SDK_URL");
// static String trUser = System.getenv("TR_USER");
// static String trPwd = System.getenv("TR_PWD");
// static String cloudsdkUser = "support@example.com";
// static String cloudsdkPwd="support";
@BeforeClass
public static void startTest() throws Exception
{
client = new APIClient("https://telecominfraproject.testrail.com");
client.setUser("syama.devi@connectus.ai");
client.setPassword("Connectus123$");
client.setPassword("Connect123$");
JSONArray c = (JSONArray) client.sendGet("get_runs/5");
runId = new Long(0);
Calendar cal = Calendar.getInstance();
//Months are indexed 0-11 so add 1 for current month
int month = cal.get(Calendar.MONTH) + 1;
String date = "UI Automation Run - " + cal.get(Calendar.DATE) + "/" + month + "/" + cal.get(Calendar.YEAR);
String day = Integer.toString(cal.get(Calendar.DATE));
if (day.length()<2) {
day = "0"+day;
}
String date = "UI Automation Run - " + day + "/" + month + "/" + cal.get(Calendar.YEAR);
for (int a = 0; a < c.size(); a++) {
if (((JSONObject) c.get(a)).get("name").equals(date)) {
runId = (Long) ((JSONObject) c.get(a)).get("id");
@@ -80,6 +89,14 @@ public class ProfilesTest {
driver.findElement(By.xpath("//*[@id=\"login\"]/button/span")).click();
}
public void failure(int testId) throws MalformedURLException, IOException, APIException {
driver.close();
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
}
//Navigates to profiles tab
public void profileScreen() throws Exception {
driver.findElement(By.linkText("Profiles")).click();
@@ -89,13 +106,10 @@ public class ProfilesTest {
try {
while (driver.findElements(By.xpath("//*[@id=\"root\"]/section/main/div/div/div[3]/button/span")).size() != 0) {
driver.findElement(By.xpath("/html/body/div/section/main/div/div/div[3]/button/span")).click();
Thread.sleep(2000);
Thread.sleep(1400);
}
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
@@ -122,18 +136,15 @@ public class ProfilesTest {
}
}
if (expected != found && expected == true) {
failure(testId);
fail("Profile not found.");
} else if (expected != found && expected == false){
failure(testId);
fail("Profile unexpectedly found in the list.");
}
//Assert.assertEquals(expected, found);
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
@@ -162,17 +173,12 @@ public class ProfilesTest {
}
}
if (!found) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail("Profile not found.");
}
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
}
@@ -182,17 +188,11 @@ public class ProfilesTest {
//Correct profile
}
else {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail("Incorrect Profile selected");
}
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail("No title found for profile");
}
}
@@ -209,10 +209,8 @@ public class ProfilesTest {
fail("Popup displays incorrect text");
}
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
@@ -227,10 +225,8 @@ public class ProfilesTest {
driver.navigate().refresh();
Thread.sleep(3000);
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
}
@@ -244,10 +240,8 @@ public class ProfilesTest {
driver.navigate().refresh();
Thread.sleep(1500);
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
}
@@ -260,10 +254,7 @@ public class ProfilesTest {
String URL = driver.getCurrentUrl();
Assert.assertEquals("Incorrect URL", URL, "https://wlan-ui.qa.lab.wlan.tip.build/addprofile");
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
@@ -276,10 +267,7 @@ public class ProfilesTest {
driver.findElement(By.xpath("//*[@id=\"root\"]/section/main/div/div/div[1]/div/button")).click();
Thread.sleep(1000);
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
@@ -292,10 +280,7 @@ public class ProfilesTest {
//pass
}
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail("Notification not found");
}
@@ -307,10 +292,8 @@ public class ProfilesTest {
driver.findElement(By.xpath("//*[@id=\"name\"]")).sendKeys("AutomationTest Profile");
driver.findElement(By.xpath("//*[@id=\"ssid\"]")).sendKeys("Automation Test SSID");
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
}
@@ -319,10 +302,8 @@ public class ProfilesTest {
try {
driver.findElement(By.xpath("//*[@id=\"root\"]/section/main/div/div/div/div/button/span")).click();
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
}
@@ -334,10 +315,8 @@ public class ProfilesTest {
driver.findElement(By.cssSelector("body > div:nth-child(9) > div > div.ant-modal-wrap > div > div.ant-modal-content > "
+ "div.ant-modal-footer > div > button.ant-btn.index-module__Button___3SCd4.ant-btn-primary")).click();
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
}
@@ -354,10 +333,8 @@ public class ProfilesTest {
fail("No options for captive portal found");
}
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
}
@@ -373,14 +350,12 @@ public class ProfilesTest {
Thread.sleep(3000);
if (driver.findElements(By.className("ant-table-empty")).size()!=0) {
failure(testId);
fail("Table not displaying SSIDs");
}
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
@@ -388,28 +363,20 @@ public class ProfilesTest {
public void bandwidthDetails(int testId) throws Exception {
try {
Map data = new HashMap();
WebElement bandwidth = driver.findElement(By.xpath("//*[@id=\"bandwidthLimitDown\"]"));
//Actions action = new Actions(driver);
bandwidth.sendKeys(Keys.BACK_SPACE);
bandwidth.sendKeys("123");
Thread.sleep(500);
//Looks for field and error text is verified. If field is not found the exception is caught.
try {
if (driver.findElement(By.cssSelector("#root > section > main > div > div > form > div.index-module__ProfilePage___OaO8O > div:nth-child(1) > div.ant-card-body > div:nth-child(3) > div.ant-col.ant-col-12.ant-form-item-control > div > div > div > div.ant-row.ant-form-item.ant-form-item-with-help.ant-form-item-has-error > div > div.ant-form-item-explain > div"))
if (!driver.findElement(By.cssSelector("#root > section > main > div > div > form > div.index-module__ProfilePage___OaO8O > div:nth-child(1) > div.ant-card-body > div:nth-child(3) > div.ant-col.ant-col-12.ant-form-item-control > div > div > div > div.ant-row.ant-form-item.ant-form-item-with-help.ant-form-item-has-error > div > div.ant-form-item-explain > div"))
.getText().equals("Downstream bandwidth limit can be a number between 0 and 100.")){
//No further steps needed
} else {
System.out.print(driver.findElement(By.cssSelector("#root > section > main > div > div > form > div.index-module__ProfilePage___OaO8O > div:nth-child(1) > div.ant-card-body > div:nth-child(3) > div.ant-col.ant-col-12.ant-form-item-control > div > div > div > div.ant-row.ant-form-item.ant-form-item-with-help.ant-form-item-has-error > div > div.ant-form-item-explain > div"))
.getText());
failure(testId);
fail();
}
} catch (Exception E) {
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
@@ -420,22 +387,17 @@ public class ProfilesTest {
bandwidth.sendKeys("-10");
Thread.sleep(500);
//Looks for field and text is verified. If field is not found the exception is caught.
try {
if (driver.findElement(By.cssSelector("#root > section > main > div > div > form > div.index-module__ProfilePage___OaO8O > div:nth-child(1) > div.ant-card-body > div:nth-child(3) > div.ant-col.ant-col-12.ant-form-item-control > div > div > div > div.ant-row.ant-form-item.ant-form-item-with-help.ant-form-item-has-error > div > div.ant-form-item-explain > div"))
if (!driver.findElement(By.cssSelector("#root > section > main > div > div > form > div.index-module__ProfilePage___OaO8O > div:nth-child(1) > div.ant-card-body > div:nth-child(3) > div.ant-col.ant-col-12.ant-form-item-control > div > div > div > div.ant-row.ant-form-item.ant-form-item-with-help.ant-form-item-has-error > div > div.ant-form-item-explain > div"))
.getText().equals("Downstream bandwidth limit can be a number between 0 and 100.")){
//No further steps needed
} else {
System.out.print(driver.findElement(By.cssSelector("#root > section > main > div > div > form > div.index-module__ProfilePage___OaO8O > div:nth-child(1) > div.ant-card-body > div:nth-child(3) > div.ant-col.ant-col-12.ant-form-item-control > div > div > div > div.ant-row.ant-form-item.ant-form-item-with-help.ant-form-item-has-error > div > div.ant-form-item-explain > div"))
.getText());
failure(testId);
fail();
}
} catch (Exception E) {
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
fail("Bandwidths outside the desired range are accepted");
failure(testId);
fail();
}
bandwidth.sendKeys(Keys.BACK_SPACE);
@@ -445,17 +407,16 @@ public class ProfilesTest {
bandwidth.sendKeys("10");
Thread.sleep(500);
//Looks for field and text is verified. If field is not found the exception is caught.
if (driver.findElements(By.cssSelector("#root > section > main > div > div > form > div.index-module__ProfilePage___OaO8O > div:nth-child(1) > div.ant-card-body > div:nth-child(3) > div.ant-col.ant-col-12.ant-form-item-control > div > div > div > div.ant-row.ant-form-item.ant-form-item-with-help.ant-form-item-has-error > div > div.ant-form-item-explain > div"))
.size()!=0){
failure(testId);
fail();
fail("Field not found");
}
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
@@ -484,15 +445,14 @@ public class ProfilesTest {
found = false;
}
} catch (Exception E) {
failure(testId);
fail();
fail("Section not found");
}
Assert.assertEquals(true, found);
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
}
@@ -508,29 +468,24 @@ public class ProfilesTest {
cursor.sendKeys(Keys.ENTER).perform();
Thread.sleep(1500);
boolean found = true;
try {
if (!driver.findElement(By.cssSelector("#root > section > main > div > div > form > div.index-module__ProfilePage___OaO8O > div:nth-child(1) > div.ant-card-head > div > div")).getText().equals("LAN and Services")) {
found = false;
failure(testId);
fail();
} else if (!driver.findElement(By.cssSelector("#root > section > main > div > div > form > div.index-module__ProfilePage___OaO8O > div:nth-child(2) > div.ant-card-head > div > div")).getText().equals("Wireless Networks (SSIDs) Enabled on This Profile")) {
found = false;
failure(testId);
fail();
}
} catch (Exception E) {
found = false;
fail("Section not found");
failure(testId);
fail();
}
if (!found) {
fail("Section Not Found");
}
//Assert.assertEquals(true, found);
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
}
@@ -818,7 +773,6 @@ public class ProfilesTest {
obj.findProfile("ECW5410 Automation",4815);
Thread.sleep(5000);
obj.verifyProfile("ECW5410 Automation",4815);
//obj.addProfileButton();
obj.closeBrowser();
data.put("status_id", new Integer(1));
data.put("comment", "This test worked fine!");

View File

@@ -31,25 +31,33 @@ import org.openqa.selenium.interactions.Actions;
public class SystemTests {
WebDriver driver;
static APIClient client;
static long runId;
// static String Url = System.getenv("CLOUD_SDK_URL");
// static String trUser = System.getenv("TR_USER");
// static String trPwd = System.getenv("TR_PWD");
// static String cloudsdkUser = "support@example.com";
// static String cloudsdkPwd="support";
@BeforeClass
public static void startTest() throws Exception
{
// client.setUser(trUser);
// client.setPassword(trPwd);
client = new APIClient("https://telecominfraproject.testrail.com");
client.setUser("syama.devi@connectus.ai");
client.setPassword("Connectus123$");
client.setPassword("Connect123$");
JSONArray c = (JSONArray) client.sendGet("get_runs/5");
runId = new Long(0);
Calendar cal = Calendar.getInstance();
//Months are indexed 0-11 so add 1 for current month
int month = cal.get(Calendar.MONTH) + 1;
String date = "UI Automation Run - " + cal.get(Calendar.DATE) + "/" + month + "/" + cal.get(Calendar.YEAR);
String day = Integer.toString(cal.get(Calendar.DATE));
if (day.length()<2) {
day = "0"+day;
}
String date = "UI Automation Run - " + day + "/" + month + "/" + cal.get(Calendar.YEAR);
for (int a = 0; a < c.size(); a++) {
if (((JSONObject) c.get(a)).get("name").equals(date)) {
runId = (Long) ((JSONObject) c.get(a)).get("id");
@@ -59,9 +67,9 @@ public class SystemTests {
public void launchBrowser() {
System.setProperty("webdriver.chrome.driver", "/home/netex/nightly_sanity/ui-scripts/chromedriver");
// System.setProperty("webdriver.chrome.driver", "/Users/mohammadrahman/Downloads/chromedriver");
ChromeOptions options = new ChromeOptions();
options.addArguments("--no-sandbox");
//options.addArguments("--disable-dev-shm-usage");
options.addArguments("--headless");
options.addArguments("--window-size=1920,1080");
driver = new ChromeDriver(options);
@@ -72,6 +80,14 @@ public class SystemTests {
driver.close();
}
public void failure(int testId) throws MalformedURLException, IOException, APIException {
driver.close();
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
}
//Log into the CloudSDK portal
public void logIn() {
driver.findElement(By.id("login_email")).sendKeys("support@example.com");
@@ -84,10 +100,8 @@ public class SystemTests {
try {
driver.findElement(By.linkText("System")).click();
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
}
@@ -100,22 +114,90 @@ public class SystemTests {
cursor.sendKeys(Keys.ENTER).build().perform();
Thread.sleep(1000);
boolean found = false;
if (driver.findElement(By.cssSelector(".ant-notification-notice-description")).getText().equals("No matching manufacturer found for OUI")) {
found = true;
if (!driver.findElement(By.cssSelector(".ant-notification-notice-description")).getText().equals("No matching manufacturer found for OUI")) {
failure(testId);
fail();
}
if (!found) {
// test.log(LogStatus.FAIL, "Error message not displayed");
}
Assert.assertEquals("Error message not displayed", true, found);
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
}
public void ouiFormats(int testId) throws Exception {
Actions cursor = new Actions(driver);
WebElement oui = driver.findElement(By.xpath("//*[@id=\"oui\"]"));
cursor.sendKeys(oui, "88:12:4E").build().perform();
cursor.sendKeys(Keys.ENTER).build().perform();
Thread.sleep(1000);
boolean found = false;
if (driver.findElements(By.cssSelector(".ant-notification-notice-description")).size()>0) {
found = true;
}
if (found) {
failure(testId);
fail();
}
cursor.sendKeys(Keys.BACK_SPACE).perform();
cursor.sendKeys(Keys.BACK_SPACE).perform();
cursor.sendKeys(Keys.BACK_SPACE).perform();
cursor.sendKeys(Keys.BACK_SPACE).perform();
cursor.sendKeys(Keys.BACK_SPACE).perform();
cursor.sendKeys(Keys.BACK_SPACE).perform();
cursor.sendKeys(Keys.BACK_SPACE).perform();
cursor.sendKeys(Keys.BACK_SPACE).perform();
cursor.sendKeys(oui, "88124E").build().perform();
cursor.sendKeys(Keys.ENTER).build().perform();
Thread.sleep(1000);
if (driver.findElements(By.cssSelector(".ant-notification-notice-description")).size()>0) {
found = true;
}
if (found) {
failure(testId);
fail();
}
cursor.sendKeys(Keys.BACK_SPACE).perform();
cursor.sendKeys(Keys.BACK_SPACE).perform();
cursor.sendKeys(Keys.BACK_SPACE).perform();
cursor.sendKeys(Keys.BACK_SPACE).perform();
cursor.sendKeys(Keys.BACK_SPACE).perform();
cursor.sendKeys(Keys.BACK_SPACE).perform();
cursor.sendKeys(Keys.BACK_SPACE).perform();
cursor.sendKeys(Keys.BACK_SPACE).perform();
cursor.sendKeys(oui, "88-12-4E").build().perform();
cursor.sendKeys(Keys.ENTER).build().perform();
Thread.sleep(2000);
if (driver.findElements(By.cssSelector(".ant-notification-notice-description")).size()>0) {
failure(testId);
fail();
}
}
public void ouiLength(int testId) throws Exception {
try {
Actions cursor = new Actions(driver);
WebElement oui = driver.findElement(By.xpath("//*[@id=\"oui\"]"));
cursor.sendKeys(oui, "123456789").build().perform();
cursor.sendKeys(Keys.ENTER).build().perform();
Thread.sleep(3000);
if (oui.getAttribute("value").length()>8) {
failure(testId);
fail();
}
} catch (Exception E) {
failure(testId);
fail();
}
}
public void addVersion(int testId) throws Exception {
@@ -129,10 +211,8 @@ public class SystemTests {
driver.findElement(By.cssSelector(".ant-btn.index-module__Button___3SCd4.ant-btn-primary")).click();
Thread.sleep(1000);
}catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
}
@@ -151,18 +231,15 @@ public class SystemTests {
if (driver.findElement(By.cssSelector("body > div:nth-child(8) > div > div.ant-modal-wrap > div > div.ant-modal-content > div.ant-modal-body > form > div.ant-row.ant-form-item.ant-form-item-with-help.ant-form-item-has-error > div.ant-col.ant-col-15.ant-form-item-control > div.ant-form-item-explain > div")).getText().equals("Please input your Version Name")) {
//error message found
} else {
failure(testId);
fail("Incorrect error message displayed");
}
} catch (Exception E) {
failure(testId);
fail("Error message not displayed");
}
}catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
@@ -173,7 +250,7 @@ public class SystemTests {
try {
driver.findElement(By.xpath("//span[contains(.,'Add Client')]")).click();
} catch (Exception E) {
failure(testId);
fail("Add Client button not found");
}
@@ -185,10 +262,7 @@ public class SystemTests {
browser.sendKeys(Keys.TAB).perform();
browser.sendKeys(Keys.ENTER).perform();
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
@@ -205,17 +279,13 @@ public class SystemTests {
// driver.findElement(By.cssSelector("body > div:nth-child(8) > div > div.ant-modal-wrap > div > div.ant-modal-content > div.ant-modal-body > form > div > div.ant-col.ant-col-12.ant-form-item-control > div.ant-form-item-explain > div"))
// .click();
try {
if (driver.findElement(By.cssSelector("body > div:nth-child(8) > div > div.ant-modal-wrap > div > div.ant-modal-content > div.ant-modal-body > form > div > div.ant-col.ant-col-12.ant-form-item-control > div.ant-form-item-explain > div"))
if (!driver.findElement(By.cssSelector("body > div:nth-child(8) > div > div.ant-modal-wrap > div > div.ant-modal-content > div.ant-modal-body > form > div > div.ant-col.ant-col-12.ant-form-item-control > div.ant-form-item-explain > div"))
.getText().equals("Please enter a valid MAC Address.")){
//No further steps needed
} else {
// System.out.print(driver.findElement(By.cssSelector("#root > section > main > div > div > form > div.index-module__ProfilePage___OaO8O > div:nth-child(1) > div.ant-card-body > div:nth-child(3) > div.ant-col.ant-col-12.ant-form-item-control > div > div > div > div.ant-row.ant-form-item.ant-form-item-with-help.ant-form-item-has-error > div > div.ant-form-item-explain > div"))
// .getText());
failure(testId);
fail("Incorrect error message displayed");
}
} catch (Exception E) {
failure(testId);
fail("Error message not displayed");
}
@@ -223,10 +293,7 @@ public class SystemTests {
browser.sendKeys(Keys.TAB).perform();
browser.sendKeys(Keys.ENTER).perform();
}catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
@@ -249,10 +316,7 @@ public class SystemTests {
browser.sendKeys(Keys.TAB).perform();
browser.sendKeys(Keys.ENTER).perform();
}catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
@@ -288,10 +352,7 @@ public class SystemTests {
fail("Version unexpectedly found in the list.");
}
}catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
@@ -324,10 +385,7 @@ public class SystemTests {
fail("Version unexpectedly found in the list.");
}
}catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
@@ -359,10 +417,7 @@ public class SystemTests {
}
//Assert.assertEquals(expected, found);
}catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
@@ -393,10 +448,8 @@ public class SystemTests {
fail("Mac Address unexpectedly found in the list.");
}
}catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
}
@@ -420,10 +473,8 @@ public class SystemTests {
browse.sendKeys(Keys.TAB).perform();
browse.sendKeys(Keys.ENTER).perform();
}catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
@@ -434,10 +485,7 @@ public class SystemTests {
driver.findElement(By.cssSelector("[title^='edit-model-TEST']")).click();
Thread.sleep(2000);
}catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
@@ -457,10 +505,8 @@ public class SystemTests {
//driver.findElement(By.xpath("/html/body/div[4]/div/div[2]/div/div[2]/div[3]/div/button[2]")).click();
}catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
}
@@ -473,7 +519,7 @@ public class SystemTests {
if (!dropdown.getAttribute("title").equals("Toronto")){
//fail("Incorrect Locations displayed");
fail("Incorrect Locations displayed");
}
browser.sendKeys(dropdown, Keys.ARROW_DOWN).perform();
@@ -483,7 +529,7 @@ public class SystemTests {
if (!dropdown.getAttribute("title").equals("FirstFloor")){
//fail("Incorrect Locations displayed");
fail("Incorrect Locations displayed");
}
browser.sendKeys(Keys.ARROW_DOWN).perform();
@@ -493,7 +539,7 @@ public class SystemTests {
if (!dropdown.getAttribute("title").equals("TipBuilding")){
//fail("Incorrect Locations displayed");
fail("Incorrect Locations displayed");
}
browser.sendKeys(Keys.ARROW_DOWN).perform();
@@ -503,13 +549,10 @@ public class SystemTests {
if (!dropdown.getAttribute("title").equals("Ottawa")){
//fail("Incorrect Locations displayed");
fail("Incorrect Locations displayed");
}
}catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
@@ -525,20 +568,18 @@ public class SystemTests {
} else if (driver.findElement(By.xpath("//*[@id=\"rcDialogTitle2\"]")).getText().equals("Are you sure?")){
//Will have this Id when version edit button has been clicked prior
} else {
failure(testId);
fail("Confirmation not found");
}
} catch (Exception E) {
failure(testId);
fail("Confirmation not found");
}
}catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
}
@@ -555,11 +596,9 @@ public class SystemTests {
Thread.sleep(1000);
driver.navigate().refresh();
}catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
}
@@ -574,19 +613,16 @@ public class SystemTests {
} else if (driver.findElement(By.xpath("//*[@id=\"rcDialogTitle2\"]")).getText().equals("Are you sure?")){
//Will have this Id when version edit button has been clicked prior
} else {
failure(testId);
fail("Confirmation not found");
}
} catch (Exception E) {
failure(testId);
fail("Confirmation not found");
}
}catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
@@ -598,10 +634,7 @@ public class SystemTests {
driver.findElement(By.cssSelector("[title^='edit-firmware-TEST']")).click();
Thread.sleep(2000);
}catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
@@ -613,10 +646,7 @@ public class SystemTests {
driver.findElement(By.xpath("/html/body/div[4]/div/div[2]/div/div[2]/div[2]/form/div[2]/div[2]/div/div/input")).sendKeys("123");
driver.findElement(By.xpath("/html/body/div[4]/div/div[2]/div/div[2]/div[3]/div/button[2]")).click();
}catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
@@ -627,10 +657,7 @@ public class SystemTests {
driver.findElement(By.xpath("/html/body/div[4]/div/div[2]/div/div[2]/div[2]/form/div[2]/div[2]/div/div/input")).sendKeys("123");
driver.findElement(By.xpath("/html/body/div[4]/div/div[2]/div/div[2]/div[3]/div/button[1]")).click();
}catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
@@ -648,10 +675,7 @@ public class SystemTests {
Thread.sleep(1000);
driver.navigate().refresh();
}catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
@@ -668,10 +692,7 @@ public class SystemTests {
fail("Set manufacturer data section title incorrect");
}
}catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
//Assert.assertEquals(true, found);
@@ -681,26 +702,20 @@ public class SystemTests {
if (enabled) {
try {
if (!driver.findElement(By.cssSelector("#root > section > main > div:nth-child(2) > form > div.index-module__Content___2GmAx > div:nth-child(1) > div.ant-card-head > div > div")).getText().equals("Target Location")) {
failure(testId);
fail("Target Location title incorrect");
} else if (!driver.findElement(By.cssSelector("#root > section > main > div:nth-child(2) > form > div.index-module__Content___2GmAx > div:nth-child(2) > div.ant-card-head > div > div.ant-card-head-title")).getText().equals("Target Equipment Profiles")) {
fail("Target equipment profiles title incorrect");
}
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
} else {
if (driver.findElements(By.cssSelector("#root > section > main > div:nth-child(2) > form > div.index-module__Content___2GmAx > div:nth-child(1) > div.ant-card-head > div > div")).size()!=0) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
@@ -716,10 +731,8 @@ public class SystemTests {
try {
driver.findElement(By.xpath("//*[@id=\"rc-tabs-0-tab-firmware\"]")).click();
}catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
}
@@ -728,10 +741,8 @@ public class SystemTests {
try {
driver.findElement(By.xpath("//*[@id=\"rc-tabs-0-tab-autoprovision\"]")).click();
}catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
}
@@ -740,10 +751,8 @@ public class SystemTests {
try {
driver.findElement(By.xpath("//*[@id=\"rc-tabs-0-tab-blockedlist\"]")).click();
}catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
}
@@ -758,23 +767,16 @@ public class SystemTests {
} else if (driver.findElement(By.xpath("//*[@id=\"rcDialogTitle2\"]")).getText().equals("Are you sure?")){
//Will have this Id when version edit button has been clicked prior
} else {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
fail("Confirmation not found");
failure(testId);
fail();
}
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
}
@@ -791,12 +793,85 @@ public class SystemTests {
Thread.sleep(1000);
driver.navigate().refresh();
} catch (Exception E) {
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
failure(testId);
fail();
}
}
public void uniqueVersion(int testId) throws MalformedURLException, IOException, APIException {
try {
WebElement tbl = driver.findElement(By.cssSelector("#root > section > main > div:nth-child(2) > div:nth-child(2) > div > div > div > div > div > table"));
List<WebElement> rows = tbl.findElements(By.tagName("tr"));
List<String> ids = new ArrayList<String>();
boolean found = false;
//row iteration
for(int i=1; i<rows.size(); i++) {
List<WebElement> cols = rows.get(i).findElements(By.tagName("td"));
if (ids.contains(cols.get(0).getText())) {
failure(testId);
fail();
} else {
// System.out.print(cols.get(0).getText());
ids.add(cols.get(0).getText());
}
}
}catch (Exception E) {
failure(testId);
fail();
}
}
public List<String> listOfVersions(int table, int testId) throws MalformedURLException, IOException, APIException {
List<String> ids = new ArrayList<String>();
try {
WebElement tbl;
if (table == 1) {
tbl = driver.findElement(By.xpath("//table"));
} else {
tbl = driver.findElement(By.xpath("//*[@id=\"root\"]/section/main/div[2]/div[4]/div/div/div/div/div/table"));
}
List<WebElement> rows = tbl.findElements(By.tagName("tr"));
//List<String> ids = new ArrayList<String>();
boolean found = false;
//row iteration
for(int i=1; i<rows.size(); i++) {
List<WebElement> cols = rows.get(i).findElements(By.tagName("td"));
if (!ids.contains(cols.get(0).getText())) {
ids.add(cols.get(0).getText());
}
}
return ids;
}catch (Exception E) {
failure(testId);
fail();
}
return ids;
}
public int addModelAndClickDropdown(int testId) throws Exception {
driver.findElement(By.xpath("//span[contains(.,'Add Model Target Version')]")).click();
Thread.sleep(1000);
Actions browse = new Actions(driver);
Thread.sleep(1000);
browse.sendKeys(Keys.TAB).perform();
browse.sendKeys(Keys.TAB).perform();
browse.sendKeys(Keys.ENTER).perform();
List <WebElement> versions = driver.findElements(By.cssSelector(".ant-select-item.ant-select-item-option"));
browse.sendKeys(Keys.ESCAPE).perform();
System.out.print(versions.size());
return versions.size();
}
@@ -835,6 +910,38 @@ public class SystemTests {
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/5036", data);
}
//C5639
@Test
public void ouiLengthTest() throws Exception {
Map data = new HashMap();
SystemTests obj = new SystemTests();
obj.launchBrowser();
obj.logIn();
Thread.sleep(3000);
obj.systemScreen(5639);
Thread.sleep(2500);
obj.ouiLength(5639);
obj.closeBrowser();
data.put("status_id", new Integer(1));
data.put("comment", "This test worked fine!");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/5639", data);
}
//C5640
@Test
public void ouiFormatTest() throws Exception {
Map data = new HashMap();
SystemTests obj = new SystemTests();
obj.launchBrowser();
obj.logIn();
Thread.sleep(3000);
obj.systemScreen(5640);
Thread.sleep(2500);
obj.ouiFormats(5640);
obj.closeBrowser();
data.put("status_id", new Integer(1));
data.put("comment", "This test worked fine!");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/5640", data);
}
//C5040
@Test
public void createVersionTest() throws Exception {
@@ -947,7 +1054,7 @@ public class SystemTests {
Thread.sleep(1500);
obj.findVersion(true, "TEST123", 5056);
obj.deleteVersion(5056);
Thread.sleep(2000);
Thread.sleep(6000);
obj.closeBrowser();
data.put("status_id", new Integer(1));
data.put("comment", "This test worked fine!");
@@ -1226,5 +1333,53 @@ public class SystemTests {
data.put("comment", "This test worked fine!");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/5062", data);
}
//C5638
@Test
public void uniqueFieldsTest() throws Exception {
Map data = new HashMap();
SystemTests obj = new SystemTests();
obj.launchBrowser();
obj.logIn();
Thread.sleep(3000);
obj.systemScreen(5638);
Thread.sleep(4500);
obj.firmwareScreen(5638);
Thread.sleep(1000);
obj.uniqueVersion(5638);
Thread.sleep(2000);
obj.closeBrowser();
data.put("status_id", new Integer(1));
data.put("comment", "This test worked fine!");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/5638", data);
}
//C5637
@Test
public void versionsAvailableTest() throws Exception {
int testId = 5637;
Map data = new HashMap();
SystemTests obj = new SystemTests();
obj.launchBrowser();
obj.logIn();
Thread.sleep(3000);
obj.systemScreen(testId);
Thread.sleep(2500);
obj.firmwareScreen(testId);
Thread.sleep(1000);
List<String> ids = obj.listOfVersions(2, testId);
int dropdownOptions = obj.addModelAndClickDropdown(testId);
List<String> modTarg = obj.listOfVersions(1, testId);
int expected = ids.size() - modTarg.size();
if (dropdownOptions!= expected) {
fail();
}
Thread.sleep(2000);
obj.closeBrowser();
data.put("status_id", new Integer(1));
data.put("comment", "This test worked fine!");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
}
}

View File

@@ -0,0 +1,470 @@
package automationTests;
import static org.junit.jupiter.api.Assertions.*;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import org.junit.AfterClass;
import org.junit.Test;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.interactions.Actions;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.JSONValue;
import java.util.Map;
public class UsersTest{
WebDriver driver;
static APIClient client;
static long runId;
// static String Url = System.getenv("CLOUD_SDK_URL");
// static String trUser = System.getenv("TR_USER");
// static String trPwd = System.getenv("TR_PWD");
// static String cloudsdkUser = "support@example.com";
// static String cloudsdkPwd="support";
@BeforeClass
public static void startTest() throws Exception
{
client = new APIClient("https://telecominfraproject.testrail.com");
client.setUser("syama.devi@connectus.ai");
client.setPassword("Connect123$");
JSONArray c = (JSONArray) client.sendGet("get_runs/5");
runId = new Long(0);
Calendar cal = Calendar.getInstance();
//Months are indexed 0-11 so add 1 for current month
int month = cal.get(Calendar.MONTH) + 1;
String day = Integer.toString(cal.get(Calendar.DATE));
if (day.length()<2) {
day = "0"+day;
}
String date = "UI Automation Run - " + day + "/" + month + "/" + cal.get(Calendar.YEAR);
for (int a = 0; a < c.size(); a++) {
if (((JSONObject) c.get(a)).get("name").equals(date)) {
runId = (Long) ((JSONObject) c.get(a)).get("id");
}
}
}
public void launchBrowser() {
System.setProperty("webdriver.chrome.driver", "/home/netex/nightly_sanity/ui-scripts/chromedriver");
// System.setProperty("webdriver.chrome.driver", "/Users/mohammadrahman/Downloads/chromedriver");
ChromeOptions options = new ChromeOptions();
options.addArguments("--no-sandbox");
options.addArguments("--headless");
options.addArguments("--window-size=1920,1080");
driver = new ChromeDriver(options);
driver.get("https://wlan-ui.qa.lab.wlan.tip.build");
}
void closeBrowser() {
driver.close();
}
public void logIn() {
driver.findElement(By.id("login_email")).sendKeys("support@example.com");
driver.findElement(By.id("login_password")).sendKeys("support");
driver.findElement(By.xpath("//*[@id=\"login\"]/button/span")).click();
}
public void failure(int testId) throws MalformedURLException, IOException, APIException {
driver.close();
Map data = new HashMap();
data.put("status_id", new Integer(5));
data.put("comment", "Fail");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/"+testId, data);
}
public void accountsScreen(int testId) throws Exception {
try {
driver.findElement(By.linkText("Users")).click();
} catch (Exception E) {
failure(testId);
fail("Fail");
}
}
public void addAccountButton(int testId) throws MalformedURLException, IOException, APIException {
try {
Actions act = new Actions(driver);
act.moveToElement(driver.findElement(By.cssSelector("[title^='addaccount']"))).click().perform();
} catch (Exception E) {
failure(testId);
fail("Fail");
}
}
public void verifyAddAccountPopup(int testId) throws MalformedURLException, IOException, APIException {
Map data = new HashMap();
try {
if (driver.findElement(By.id("rcDialogTitle0")).getText().equals("Add User")) {
//pass
} else {
failure(testId);
fail();
}
} catch (Exception E) {
failure(testId);
fail("Fail");
}
}
public void addAccount(String account, String password, String confirmPassword, int testId) throws MalformedURLException, IOException, APIException {
try {
addAccountButton(testId);
Actions browser = new Actions(driver);
browser.sendKeys(Keys.TAB).perform();
browser.sendKeys(Keys.TAB).perform();
browser.sendKeys(account).perform();
browser.sendKeys(Keys.TAB).perform();
browser.sendKeys(Keys.TAB).perform();
browser.sendKeys(password).perform();
browser.sendKeys(Keys.TAB).perform();
browser.sendKeys(confirmPassword).perform();
browser.sendKeys(Keys.TAB).perform();
browser.sendKeys(Keys.TAB).perform();
browser.sendKeys(Keys.ENTER).perform();
} catch (Exception E) {
failure(testId);
fail("Fail");
}
}
public void blankEmailWarning(int testId) throws Exception {
try {
if (driver.findElement(By.cssSelector("[role^='alert']")).getText().equals("Please input your e-mail")) {
//pass
} else {
failure(testId);
fail("Incorrect warning displayed");
}
} catch (Exception E) {
failure(testId);
fail("No warning displayed");
}
}
public void invalidPasswordsWarning(int testId) throws Exception {
try {
if (driver.findElement(By.cssSelector("[role^='alert']")).getText().equals("The two passwords do not match")) {
//pass
} else {
failure(testId);
fail("Incorrect warning displayed");
}
} catch (Exception E) {
failure(testId);
fail("No warning displayed");
}
}
public void invalidEmailWarning(int testId) throws Exception {
try {
if (driver.findElement(By.cssSelector("[role^='alert']")).getText().equals("The input is not a valid e-mail")) {
//pass
} else {
failure(testId);
fail("Incorrect error displayed");
}
} catch (Exception E) {
failure(testId);
fail("No error displayed");
}
}
public void editAccount(String oldName, String newName, int testId) throws Exception {
try {
WebElement tbl = driver.findElement(By.xpath("//table"));
List<WebElement> rows = tbl.findElements(By.tagName("tr"));
boolean found = false;
//row iteration
breakP:
for(int i=0; i<rows.size(); i++) {
//check column each in row, identification with 'td' tag
List<WebElement> cols = rows.get(i).findElements(By.tagName("td"));
//column iteration
for(int j=0; j<cols.size()-1; j++) {
if (cols.get(j).getText().equals(oldName) && i!=1) {
cols.get(2).click();
found = true;
break breakP;
}
}
}
if (!found) {
failure(testId);
fail("Account not found");
}
Thread.sleep(1000);
Actions browser = new Actions(driver);
browser.sendKeys(Keys.TAB).perform();
browser.sendKeys(Keys.TAB).perform();
browser.sendKeys(newName).perform();
browser.sendKeys(Keys.TAB).perform();
browser.sendKeys(Keys.TAB).perform();
browser.sendKeys("Password1").perform();
browser.sendKeys(Keys.TAB).perform();
browser.sendKeys("Password1").perform();
browser.sendKeys(Keys.TAB).perform();
browser.sendKeys(Keys.TAB).perform();
browser.sendKeys(Keys.ENTER).perform();
} catch (Exception E) {
failure(testId);
fail("Fail");
}
}
public void deleteAccount(String profile, int testId) throws Exception {
try {
WebElement tbl = driver.findElement(By.xpath("//table"));
List<WebElement> rows = tbl.findElements(By.tagName("tr"));
boolean found = false;
//row iteration
breakP:
for(int i=0; i<rows.size(); i++) {
//check column each in row, identification with 'td' tag
List<WebElement> cols = rows.get(i).findElements(By.tagName("td"));
//column iteration
for(int j=0; j<cols.size()-1; j++) {
if (cols.get(j).getText().equals(profile) && i!=1) {
cols.get(3).click();
found = true;
break breakP;
}
}
}
if (!found) {
failure(testId);
fail("Account not found");
}
Thread.sleep(1000);
Actions browser = new Actions(driver);
browser.sendKeys(Keys.TAB).perform();
browser.sendKeys(Keys.TAB).perform();
browser.sendKeys(Keys.TAB).perform();
browser.sendKeys(Keys.ENTER).perform();
} catch (Exception E) {
failure(testId);
fail("Fail");
}
}
//Verifies whether profile exists
public void findAccount(boolean expected, String profile, int testId) throws MalformedURLException, IOException, APIException {
try {
WebElement tbl = driver.findElement(By.xpath("//table"));
List<WebElement> rows = tbl.findElements(By.tagName("tr"));
boolean found = false;
//row iteration
for(int i=0; i<rows.size(); i++) {
//check column each in row, identification with 'td' tag
List<WebElement> cols = rows.get(i).findElements(By.tagName("td"));
//column iteration
for(int j=0; j<cols.size()-1; j++) {
if (cols.get(j).getText().equals(profile) && i!=1) {
found = true;
}
}
}
if (expected != found && expected == true) {
failure(testId);
fail("Account not found.");
} else if (expected != found && expected == false){
failure(testId);
fail("Account unexpectedly found in the list.");
}
} catch (Exception E) {
failure(testId);
fail("Fail");
}
}
//C5116
@Test
public void addAccountPopupTest() throws Exception {
Map data = new HashMap();
UsersTest obj = new UsersTest();
obj.launchBrowser();
obj.logIn();
Thread.sleep(3000);
obj.accountsScreen(5116);
Thread.sleep(2000);
obj.addAccountButton(5116);
Thread.sleep(1000);
obj.verifyAddAccountPopup(5116);
obj.closeBrowser();
data.put("status_id", new Integer(1));
data.put("comment", "This test worked fine!");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/5116", data);
}
//C5113
@Test
public void addAccountTest() throws Exception {
Map data = new HashMap();
UsersTest obj = new UsersTest();
obj.launchBrowser();
obj.logIn();
Thread.sleep(3000);
obj.accountsScreen(5113);
Thread.sleep(2000);
obj.addAccount("automationtest@gmail.com","Password1","Password1", 5113);
Thread.sleep(3000);
obj.findAccount(true, "automationtest@gmail.com", 5113);
Thread.sleep(1000);
obj.deleteAccount("automationtest@gmail.com", 5113);
Thread.sleep(2000);
obj.closeBrowser();
data.put("status_id", new Integer(1));
data.put("comment", "This test worked fine!");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/5113", data);
}
//C5120
@Test
public void editAccountTest() throws Exception {
Map data = new HashMap();
UsersTest obj = new UsersTest();
obj.launchBrowser();
obj.logIn();
Thread.sleep(3000);
obj.accountsScreen(5120);
Thread.sleep(2000);
obj.addAccount("automationtest@gmail.com","Password1","Password1", 5120);
Thread.sleep(3000);
obj.editAccount("automationtest@gmail.com", "automationtestEdit@gmail.com", 5120);
Thread.sleep(1500);
obj.findAccount(true, "automationtestEdit@gmail.com", 5120);
obj.deleteAccount("automationtestEdit@gmail.com",5120);
Thread.sleep(2000);
obj.driver.navigate().refresh();
obj.closeBrowser();
data.put("status_id", new Integer(1));
data.put("comment", "This test worked fine!");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/5120", data);
}
//C5114
@Test
public void addAccountBlankDetailsTest() throws Exception {
Map data = new HashMap();
UsersTest obj = new UsersTest();
obj.launchBrowser();
obj.logIn();
Thread.sleep(3000);
obj.accountsScreen(5114);
Thread.sleep(2000);
obj.addAccount("","Password1","Password1", 5114);
Thread.sleep(1000);
obj.blankEmailWarning(5114);
Thread.sleep(1000);
obj.closeBrowser();
data.put("status_id", new Integer(1));
data.put("comment", "This test worked fine!");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/5114", data);
}
//C5117
@Test
public void addAccountInvalidPasswordTest() throws Exception {
Map data = new HashMap();
UsersTest obj = new UsersTest();
obj.launchBrowser();
obj.logIn();
Thread.sleep(3000);
obj.accountsScreen(5117);
Thread.sleep(2000);
obj.addAccount("automationtest@gmail.com","Password1","password1",5117);
Thread.sleep(1000);
obj.invalidPasswordsWarning(5117);
Thread.sleep(1000);
obj.closeBrowser();
data.put("status_id", new Integer(1));
data.put("comment", "This test worked fine!");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/5117", data);
}
//C5118
@Test
public void addAccountInvalidEmailTest() throws Exception {
Map data = new HashMap();
UsersTest obj = new UsersTest();
obj.launchBrowser();
obj.logIn();
Thread.sleep(3000);
obj.accountsScreen(5118);
Thread.sleep(2000);
obj.addAccount("abcd12234","Password1","Password1",5118);
Thread.sleep(3000);
obj.invalidEmailWarning(5118);
Thread.sleep(1000);
obj.closeBrowser();
data.put("status_id", new Integer(1));
data.put("comment", "This test worked fine!");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/5118", data);
}
//C5121
@Test
public void deleteAccountTest() throws Exception {
Map data = new HashMap();
UsersTest obj = new UsersTest();
obj.launchBrowser();
obj.logIn();
Thread.sleep(3000);
obj.accountsScreen(5121);
Thread.sleep(2000);
obj.addAccount("automationtest@gmail.com","Password1","Password1",5121);
Thread.sleep(3000);
obj.deleteAccount("automationtest@gmail.com",5121);
Thread.sleep(4000);
obj.driver.navigate().refresh();
Thread.sleep(3000);
obj.findAccount(false, "automationtest@gmail.com",5121);
obj.closeBrowser();
data.put("status_id", new Integer(1));
data.put("comment", "This test worked fine!");
JSONObject r = (JSONObject) client.sendPost("add_result_for_case/"+runId+"/5121", data);
}
}

View File

@@ -12,22 +12,21 @@ import org.junit.internal.TextListener;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
public class testSuite {
public class TestSuite {
static APIClient client;
public static void main(String args[]) throws Exception {
client = new APIClient("https://telecominfraproject.testrail.com");
client.setUser("syama.devi@connectus.ai");
client.setPassword("Connectus123$");
client.setPassword("Connect123$");
JUnitCore junit = new JUnitCore();
junit.addListener(new TextListener(System.out));
Result result = junit.run(SystemTests.class);
Result result1 = junit.run(ProfilesTest.class);
// Result result2 = junit.run(NetworkTest.class);
Result result2 = junit.run(NetworkTest.class);
Result result3 = junit.run(LoginTest.class);
Result result4 = junit.run(AccountTest.class);
Result result4 = junit.run(UsersTest.class);
Result result5 = junit.run(DashboardTest.class);
if (result3.getFailureCount() > 0) {
System.out.println("Tests failed.");