Repository navigation
Expand file tree
/
Copy pathJenkinsDemo.java
More file actions
58 lines (52 loc) · 1.56 KB
/
Copy pathJenkinsDemo.java
File metadata and controls
58 lines (52 loc) · 1.56 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
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
/**
* Created by burakergoren
* Sample junit test code to integrate by
*/
public class JenkinsDemo
{
private static String Base_Url = "https://www.facebook.com";
private WebDriver driver;
@Before
public void setUp()
{
ChromeOptions chromeOptions= new ChromeOptions();
chromeOptions.setBinary("/bin/chromedriver");
chromeOptions.addArguments("--no-sandbox");
chromeOptions.addArguments("--headless");
chromeOptions.addArguments("--disable-dev-shm-usage");
chromeOptions.setExperimentalOption("useAutomationExtension", false);
System.setProperty("webdriver.chrome.driver","/bin/chromedriver");
driver = new ChromeDriver(chromeOptions);
driver.get(Base_Url);
}
@After
public void after()
{
driver.quit();
}
@Test
public void testCasePassed()
{
Assert.assertTrue(driver.findElement(By.xpath("//form[@id='login_form']")).isDisplayed());
}
@Test
public void testCaseFailed()
{
Assert.assertTrue(driver.findElement(By.xpath("//form[@id='failed case']")).isDisplayed());
}
@Ignore
@Test
public void testCaseIgnored()
{
Assert.assertTrue(driver.findElement(By.xpath("//form[@id='ignored case']")).isDisplayed());
}
}