Skip to content

Use latest Gosu release #1156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ cache:
matrix:
include:
- jdk: openjdk7
script: mvn -q install -P examples
script: mvn -q install
- jdk: oraclejdk7
script: mvn -q install
after_success: mvn -q deploy --settings .travis-settings.xml -Dno.gem.deploy=true -DskipTests=true -Dmaven.javadoc.skip=true
- jdk: oraclejdk8
script: mvn -q install -P java8
after_success: mvn -q deploy -P java8 -pl java8 --settings .travis-settings.xml -DskipTests=true -Dmaven.javadoc.skip=true
after_success: mvn -q deploy -P java8 -pl java8,gosu --settings .travis-settings.xml -DskipTests=true -Dmaven.javadoc.skip=true

env:
global:
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ Now release everything (replace X.Y.Z below with the next release number):

```
mvn release:clean
mvn --batch-mode -P release-sign-artifacts release:prepare -DautoVersionSubmodules=true -DdevelopmentVersion=X.Y.Z-SNAPSHOT
mvn -P release-sign-artifacts release:perform
mvn --batch-mode release:prepare -DautoVersionSubmodules=true -DdevelopmentVersion=X.Y.Z-SNAPSHOT
mvn release:perform
```

Post release the API docs must be generated for each module and manually copied over to a working copy of the [cucumber.github.com](https://github.com/cucumber/cucumber.github.com) which must be a sibling of `cucumber-jvm` (this repo):
Expand Down
1 change: 0 additions & 1 deletion examples/android/cukeulator-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<parent>
<groupId>io.cucumber.android-examples</groupId>
<artifactId>android-examples</artifactId>
<relativePath>../pom.xml</relativePath>
<version>2.0.0-SNAPSHOT</version>
</parent>

Expand Down
3 changes: 1 addition & 2 deletions examples/android/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

<parent>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../../pom.xml</relativePath>
<artifactId>cucumber-examples</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>

Expand Down
3 changes: 1 addition & 2 deletions examples/clojure_cukes/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

<parent>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../../pom.xml</relativePath>
<artifactId>cucumber-examples</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>

Expand Down
3 changes: 1 addition & 2 deletions examples/groovy-calculator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

<parent>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../../pom.xml</relativePath>
<artifactId>cucumber-examples</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>

Expand Down
3 changes: 1 addition & 2 deletions examples/java-calculator-testng/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

<parent>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../../pom.xml</relativePath>
<artifactId>cucumber-examples</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>

Expand Down
3 changes: 1 addition & 2 deletions examples/java-calculator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

<parent>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../../pom.xml</relativePath>
<artifactId>cucumber-examples</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>

Expand Down
2 changes: 2 additions & 0 deletions examples/java-webbit-websockets-selenium/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
selenium_standalone/
selenium_standalone_zips/
89 changes: 78 additions & 11 deletions examples/java-webbit-websockets-selenium/pom.xml
Original file line number Diff line number Diff line change
@@ -1,42 +1,104 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../../pom.xml</relativePath>
<artifactId>cucumber-examples</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>

<artifactId>java-webbit-websockets-selenium</artifactId>
<packaging>jar</packaging>
<name>Examples: Webbit WebSockets tested with Selenium</name>

<!-- skipTests -->
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.selenium</groupId>
<artifactId>driver-binary-downloader-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>selenium</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- we don't want to run these tests on travis TRAVIS will be set to true in the travis CI
They WILL be compiled -->
<!-- TODO: there's PhantomJS, and xvfb, so we could maybe re-enable these -->
<skipTests>${env.TRAVIS}</skipTests>
<systemPropertyVariables>
<!--
Run phantomjs by default. It probably works every where.

Check the develop profile to configure which web driver to use
when developing.
-->
<webdriver>phantomjs</webdriver>
<!--Provided by the driver-binary-downloader-maven-plugin-->
<!--suppress MavenModelInspection -->
<webdriver.gecko.driver>${webdriver.gecko.driver}</webdriver.gecko.driver>
<!--suppress MavenModelInspection -->
<webdriver.chrome.driver>${webdriver.chrome.driver}
</webdriver.chrome.driver>
<!--suppress MavenModelInspection -->
<webdriver.opera.driver>${webdriver.opera.driver}</webdriver.opera.driver>
<!--suppress MavenModelInspection -->
<phantomjs.binary.path>${phantomjs.binary.path}</phantomjs.binary.path>
<!--suppress MavenModelInspection -->
<webdriver.ie.driver>${webdriver.ie.driver}</webdriver.ie.driver>
<!--suppress MavenModelInspection -->
<webdriver.edge.driver>${webdriver.ie.driver}</webdriver.edge.driver>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<!--
Change this to select the browser to use. E.g: firefox, chrome, edge, ect.
-->
<webdriver>firefox</webdriver>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>develop</id>
<activation>
<property>
<name>!env.TRAVIS</name>
</property>
</activation>
</profile>
</profiles>

<dependencies>
<dependency>
<groupId>org.webbitserver</groupId>
<artifactId>webbit</artifactId>
</dependency>

<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm-deps</artifactId>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java8</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -56,7 +118,12 @@
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<artifactId>selenium-java</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@ private double roundOneDecimal(double n) {
return (double) Math.round(n * 10) / 10;
}

public void start() throws IOException, ExecutionException, InterruptedException {
public TemperatureServer start() throws IOException, ExecutionException, InterruptedException {
webServer.start().get();
return this;
}

public void stop() throws IOException, ExecutionException, InterruptedException {
public TemperatureServer stop() throws IOException, ExecutionException, InterruptedException {
webServer.stop().get();
return this;
}

public static void main(String[] args) throws IOException, ExecutionException, InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
package cucumber.examples.java.websockets;

import cucumber.api.java.en.Given;
import cucumber.api.java8.En;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

public class NavigationStepdefs {
private final WebDriver webDriver;
public class NavigationStepdefs implements En {

public NavigationStepdefs(SharedDriver webDriver) {
this.webDriver = webDriver;
}

@Given("^I am on the front page$")
public void i_am_on_the_front_page() throws InterruptedException {
webDriver.get("http://localhost:" + ServerHooks.PORT);
Given("^I am on the front page$", () -> {
webDriver.get("http://localhost:" + ServerHooks.PORT);

// The input fields won't be enabled until the WebSocket has established
// a connection. Wait for this to happen.
WebDriverWait wait = new WebDriverWait(webDriver, 1);
wait.until(ExpectedConditions.elementToBeClickable(By.id("celcius")));
// The input fields won't be enabled until the WebSocket has established
// a connection. Wait for this to happen.
WebDriverWait wait = new WebDriverWait(webDriver, 1);
wait.until(ExpectedConditions.elementToBeClickable(By.id("celcius")));
});
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
package cucumber.examples.java.websockets;

import cucumber.api.java.After;
import cucumber.api.java.Before;
import cucumber.api.java8.En;

import java.io.IOException;
import java.util.concurrent.ExecutionException;

public class ServerHooks {
public static final int PORT = 8887;
public class ServerHooks implements En {
static final int PORT = 8887;

private TemperatureServer temperatureServer;

@Before
public void startServer() throws IOException, ExecutionException, InterruptedException {
temperatureServer = new TemperatureServer(PORT);
temperatureServer.start();
}

@After
public void stopServer() throws IOException, ExecutionException, InterruptedException {
temperatureServer.stop();
public ServerHooks(){
Before(() -> temperatureServer = new TemperatureServer(PORT).start());
After(() -> temperatureServer.stop());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
* </p>
*/
public class SharedDriver extends EventFiringWebDriver {
private static final WebDriver REAL_DRIVER = new FirefoxDriver();
private static final WebDriver REAL_DRIVER = WebDriverFactory.create();

private static final Thread CLOSE_THREAD = new Thread() {
@Override
public void run() {
Expand All @@ -47,11 +48,11 @@ public SharedDriver() {
}

@Override
public void close() {
public void quit() {
if (Thread.currentThread() != CLOSE_THREAD) {
throw new UnsupportedOperationException("You shouldn't close this WebDriver. It's shared and will close when the JVM exits.");
throw new UnsupportedOperationException("You shouldn't quit this WebDriver. It's shared and will quit when the JVM exits.");
}
super.close();
super.quit();
}

@Before
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
package cucumber.examples.java.websockets;

import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

import static org.junit.Assert.assertEquals;

public class TemperatureStepdefs {
private final WebDriver webDriver;
import cucumber.api.java8.En;
import org.openqa.selenium.By;

public class TemperatureStepdefs implements En {

public TemperatureStepdefs(SharedDriver webDriver) {
this.webDriver = webDriver;
}

@When("^I enter (.+) (celcius|fahrenheit)$")
public void i_enter_temperature(double value, String unit) {
webDriver.findElement(By.id(unit)).sendKeys(String.valueOf(value));
}
When("^I enter (.+) (celcius|fahrenheit)$", (Double value, String unit) ->
webDriver.findElement(By.id(unit)).sendKeys(String.valueOf(value)));

@Then("^I should see (.+) (celcius|fahrenheit)$")
public void i_should_see_temperature(double value, String unit) {
assertEquals(String.valueOf(value), webDriver.findElement(By.id(unit)).getAttribute("value"));
Then("^I should see (.+) (celcius|fahrenheit)$", (Double value, String unit) ->
assertEquals(String.valueOf(value), webDriver.findElement(By.id(unit)).getAttribute("value")));
}
}
Loading