Skip to content

Commit 6970cea

Browse files
committed
updating travis for mac only tests to run excluding safari
updated readme with description on running safari tests
1 parent fa5dd1e commit 6970cea

File tree

4 files changed

+49
-4
lines changed

4 files changed

+49
-4
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ addons:
88

99
script:
1010
- ./mac_install_browsers.sh
11-
- mvn clean test
11+
- mvn clean test -Dgroups=mac
1212

1313
cache:
1414
directories:

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Join the chat at https://gitter.im/lazycoderio/sample-java-jenkins](https://badges.gitter.im/lazycoderio/sample-java-jenkins.svg)](https://gitter.im/lazycoderio/sample-java-jenkins?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Coverage Status](https://coveralls.io/repos/github/lazycoderio/sample-java-jenkins/badge.svg?branch=master)](https://coveralls.io/github/lazycoderio/sample-java-jenkins?branch=master) [![codecov](https://codecov.io/gh/lazycoderio/sample-java-jenkins/branch/master/graph/badge.svg)](https://codecov.io/gh/lazycoderio/sample-java-jenkins)[![Codacy Badge](https://api.codacy.com/project/badge/Grade/2da21d82c84640028d90abf2de796022)](https://www.codacy.com/app/andrew-m-krug/sample-java-jenkins?utm_source=github.com&utm_medium=referral&utm_content=lazycoderio/sample-java-jenkins&utm_campaign=Badge_Grade)[![Code Climate](https://codeclimate.com/github/lazycoderio/sample-java-jenkins/badges/gpa.svg)](https://codeclimate.com/github/lazycoderio/sample-java-jenkins)[![Dependency Status](https://www.versioneye.com/user/projects/583b58fd4ef164003ff45522/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/583b58fd4ef164003ff45522)[![Build Status](https://travis-ci.org/lazycoderio/sample-java-jenkins.svg?branch=master)](https://travis-ci.org/lazycoderio/sample-java-jenkins)
1+
[![Join the chat at https://gitter.im/lazycoderio/sample-java-jenkins](https://badges.gitter.im/lazycoderio/sample-java-jenkins.svg)](https://gitter.im/lazycoderio/sample-java-jenkins?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Coverage Status](https://coveralls.io/repos/github/lazycoderio/sample-java-jenkins/badge.svg?branch=master)](https://coveralls.io/github/lazycoderio/sample-java-jenkins?branch=master) [![codecov](https://codecov.io/gh/lazycoderio/sample-java-jenkins/branch/master/graph/badge.svg)](https://codecov.io/gh/lazycoderio/sample-java-jenkins) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/2da21d82c84640028d90abf2de796022)](https://www.codacy.com/app/andrew-m-krug/sample-java-jenkins?utm_source=github.com&utm_medium=referral&utm_content=lazycoderio/sample-java-jenkins&utm_campaign=Badge_Grade) [![Code Climate](https://codeclimate.com/github/lazycoderio/sample-java-jenkins/badges/gpa.svg)](https://codeclimate.com/github/lazycoderio/sample-java-jenkins) [![Dependency Status](https://www.versioneye.com/user/projects/583b58fd4ef164003ff45522/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/583b58fd4ef164003ff45522) [![Build Status](https://travis-ci.org/lazycoderio/sample-java-jenkins.svg?branch=master)](https://travis-ci.org/lazycoderio/sample-java-jenkins)
22
# Using this Project
33

44
This project is using the latest Selenium Bindings.
@@ -26,8 +26,22 @@ The following commands are instructions on how to run the tests
2626

2727
### From CLI
2828

29-
`mvn test`
29+
`mvn test -Dgroups=mac` on a mac
3030

3131
### Intellij Idea
3232

3333
There is a shared run configuration that has the maven target setup and another with a sample built in NUnit test runner option.
34+
35+
#### Safari Test
36+
37+
Safari requires the following steps to enable Selenium Webdriver tests to run:
38+
39+
1. Open Safari Prefrences
40+
2. Go to the Advanced Tab
41+
3. Check the box at the bottom "Show Develop menu in menu bar"
42+
4. Click on the Develop menu
43+
5. Click on "Allow Remote Execution"
44+
45+
Now Safari tests will work.
46+
47+
If running tests only locally you can remove delete `//` from the `@Test` line of the Safari class.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,38 @@
11
package LocalBrowsers;
22

3+
import org.openqa.selenium.WebDriver;
4+
import org.openqa.selenium.chrome.ChromeDriver;
5+
import org.openqa.selenium.chrome.ChromeOptions;
6+
import org.openqa.selenium.edge.EdgeDriver;
7+
import org.openqa.selenium.edge.EdgeOptions;
8+
import org.openqa.selenium.remote.DesiredCapabilities;
9+
import org.testng.Assert;
10+
import org.testng.annotations.AfterTest;
11+
import org.testng.annotations.BeforeTest;
12+
import org.testng.annotations.Test;
13+
314
/**
415
* Created by andrew on 12/3/16.
516
*/
617
public class Edge {
18+
WebDriver driver;
19+
20+
@BeforeTest
21+
public void edgeSetup(){
22+
DesiredCapabilities capabilities = DesiredCapabilities.edge();
23+
EdgeOptions options = new EdgeOptions();
24+
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
25+
driver = new EdgeDriver(capabilities);
26+
}
27+
28+
@Test(groups = {"windows"})
29+
public void test(){
30+
driver.get("http://lazycoder.io/about.html");
31+
Assert.assertEquals(driver.getTitle(), "About");
32+
}
33+
34+
@AfterTest
35+
public void testTeardown(){
36+
driver.quit();
37+
}
738
}

src/test/java/LocalBrowsers/Safari.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public void safariSetup(){
2323
driver = new SafariDriver(capabilities);
2424
}
2525

26-
@Test(groups = {"mac"})
26+
@Test//(groups = {"mac"})
2727
public void test(){
2828
driver.get("http://lazycoder.io/about.html");
2929
Assert.assertEquals(driver.getTitle(), "About");

0 commit comments

Comments
 (0)