Skip to content

Commit

Permalink
Removing fixed port
Browse files Browse the repository at this point in the history
  • Loading branch information
chiara committed Mar 28, 2015
1 parent d853380 commit 8c7d158
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import weather.WeatherOracle;

import static org.junit.Assert.assertEquals;
import static weather.WeatherOracle.SUN_IS_SHINING;

public class LondonWeatherAcceptanceTest {

Expand All @@ -24,7 +25,6 @@ public class LondonWeatherAcceptanceTest {
public void setup() throws Exception {
SelendroidConfiguration config = new SelendroidConfiguration();
config.addSupportedApp("../londonWeather/build/outputs/apk/londonWeather-debug.apk");
config.setPort(4444);
SelendroidLauncher selendroidServer = new SelendroidLauncher(config);
selendroidServer.launchSelendroid();

Expand All @@ -34,12 +34,20 @@ public void setup() throws Exception {

@Test
public void userCanGetWeatherInLondon() {
WebElement weatherButton = findElementById("weather_button");
WebElement weatherButton = findWeatherButton();

weatherButton.click();

WebElement weatherText = findElementById("weather_text");
assertEquals(WeatherOracle.SUN_IS_SHINING, weatherText.getText());
WebElement weatherText = findWeatherText();
assertEquals(SUN_IS_SHINING, weatherText.getText());
}

private WebElement findWeatherText() {
return findElementById("weather_text");
}

private WebElement findWeatherButton() {
return findElementById("weather_button");
}

private WebElement findElementById(String id) {
Expand Down
12 changes: 10 additions & 2 deletions londonweatherlib/src/test/java/weather/WeatherOracleTest.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
package weather;

import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static weather.WeatherOracle.SUN_IS_SHINING;

/**
* Created by cchiappini on 21/03/2015.
*/
public class WeatherOracleTest {

private WeatherOracle weatherOracle;

@Before
public void setup(){
weatherOracle = new WeatherOracle();
}

@Test
public void testWeatherOracle(){
WeatherOracle weatherOracle = new WeatherOracle();
assertEquals(WeatherOracle.SUN_IS_SHINING, weatherOracle.getWeather());
assertEquals(SUN_IS_SHINING, weatherOracle.getWeather());
}
}
38 changes: 20 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,34 @@
"devDependencies": {
"bespoke": "^1.0.0",
"bespoke-backdrop": "^1.0.0",
"bespoke-bullets": "^1.0.0",
"bespoke-hash": "^1.0.0",
"bespoke-bullets": "^1.1.0",
"bespoke-hash": "^1.0.2",
"bespoke-keys": "^1.0.0",
"bespoke-progress": "^1.0.0",
"bespoke-scale": "^1.0.0",
"bespoke-theme-cube": "^2.0.0",
"bespoke-scale": "^1.0.1",
"bespoke-theme-cube": "^2.0.1",
"bespoke-touch": "^1.0.0",
"debowerify": "^0.7.1",
"debowerify": "^1.2.0",
"gh-pages": "^0.2.0",
"gulp": "^3.8.1",
"gulp-autoprefixer": "0.0.7",
"gulp-browserify": "^0.5.0",
"gulp-connect": "^2.0.5",
"gulp-csso": "^0.2.9",
"gulp-jade": "^0.6.0",
"gulp-plumber": "^0.6.3",
"gulp-autoprefixer": "^2.1.0",
"gulp-browserify": "^0.5.1",
"gulp-connect": "^2.2.0",
"gulp-csso": "^1.0.0",
"gulp-jade": "^1.0.0",
"gulp-plumber": "^1.0.0",
"gulp-rename": "^1.2.0",
"gulp-rimraf": "^0.1.0",
"gulp-stylus": "^1.0.2",
"gulp-uglify": "^0.3.1",
"gulp-util": "^2.2.17",
"gulp-rimraf": "^0.1.1",
"gulp-stylus": "^2.0.1",
"gulp-through": "^0.3.0",
"gulp-uglify": "^1.1.0",
"gulp-util": "^3.0.4",
"insert-css": "^0.2.0",
"opn": "^0.1.2",
"through": "^2.3.4"
"opn": "^1.0.1",
"prism": "0.0.1",
"through": "^2.3.6"
},
"engines": {
"node": ">=0.10.0"
}
}
}
39 changes: 18 additions & 21 deletions src/index.jade
Original file line number Diff line number Diff line change
Expand Up @@ -99,36 +99,33 @@ html
section
h2 Java module - test
pre.size-dimension
code
| public class WeatherOracleTest {
| @Test
| public void testWeatherOracle(){
| WeatherOracle weatherOracle = new WeatherOracle();
| assertEquals(WeatherOracle.SUN_IS_SHINING, weatherOracle.getWeather());
| }

code.language-javascript.
public class WeatherOracleTest {
@Test
public void testWeatherOracle(){
assertEquals(SUN_IS_SHINING, weatherOracle.getWeather());
}

section
h2 Java module - code
pre.size-dimension
code
| public class WeatherOracle {
| public static final String SUN_IS_SHINING = "Sun is shining";

| public String getWeather(){
| return SUN_IS_SHINING;
| }
code.language-javascript.
public class WeatherOracle {
public static final String SUN_IS_SHINING = "Sun is shining";<br>
public String getWeather(){
return SUN_IS_SHINING;
}

section
h2 Functional testing
pre.size-dimension
code
| @Test
| public void userCanGetWeatherInLondon() {
| WebElement weatherButton = driver.findElement(By.id("weather_button"));
| Assert.assertTrue(weatherButton.isDisplayed());
| weatherButton.click();
| WebElement weatherText = driver.findElement(By.id("weather_text"));
| Assert.assertEquals(WeatherOracle.SUN_IS_SHINING, weatherText.getText());
| public void userCanGetWeatherInLondon() {<br>
| WebElement weatherButton = findWeatherButton();<br>
| weatherButton.click();<br>
| WebElement weatherText = findWeatherText();
| assertEquals(SUN_IS_SHINING, weatherText.getText());

section
h2 Testing and CI
Expand Down
1 change: 1 addition & 0 deletions src/styles/main.styl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ h2 {
.size-dimension {
width: 640px;
text-align: left;
font-size: 0.8em;
}


0 comments on commit 8c7d158

Please sign in to comment.