diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000000..a9d9e9b47d8 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,13 @@ +language: java +matrix: + include: + - jdk: oraclejdk8 +script: travis_retry ./gradlew clean headless allTests coverage coveralls -i +before_install: + - "export DISPLAY=:99.0" + - "sh -e /etc/init.d/xvfb start" + +addons: + apt: + packages: + - oracle-java8-installer diff --git a/README.md b/README.md index b2700411181..40cad7f3d87 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,5 @@ Address Book sample application (Level 4) - [Gradle](docs/devops/gradle/Introduction to Gradle.md) - [Configuration](docs/addressbook/Configuration.md) -- [Logging](docs/addressbook/Logging.md) \ No newline at end of file +- [Logging](docs/addressbook/Logging.md) +- [Setting up Travis CI](docs/devops/integration/Configuring Travis CI.md) \ No newline at end of file diff --git a/docs/devops/integration/Configuring Travis CI.md b/docs/devops/integration/Configuring Travis CI.md index a87787efe73..9ff29e178d1 100644 --- a/docs/devops/integration/Configuring Travis CI.md +++ b/docs/devops/integration/Configuring Travis CI.md @@ -18,6 +18,15 @@ If you would like to customise your travis build, do read the [Travis CI Documen ![Signing into Travis CI](../../images/signing_in.png) 3. Head to the [Accounts](https://travis-ci.org/profile) page, and find the switch for the forked repository. + - If the organization is not shown, click `Review and add` as shown + ![Review and add](../../images/review_and_add.png) + This should bring you to a GitHub page that manages the access of third-party applications. + Depending on whether you are the owner of the repository, you can either grant access + ![Grant Access](../../images/grant_access.png) + or request access + ![Request Access](../../images/request_access.png) + to Travis CI so that it can access your commits and build your code. + - If repository cannot be found, click `Sync account` 4. Activate the switch. ![Activate the switch](../../images/flick_repository_switch.png) @@ -38,10 +47,10 @@ If you would like to customise your travis build, do read the [Travis CI Documen - oracle-java8-installer ``` 6. To see the CI in action, push a commit to the master branch! -Go to the repository and see the pushed commit. There should be an icon which will link you to the Travis build. + * Go to the repository and see the pushed commit. There should be an icon which will link you to the Travis build. ![Commit build](../../images/build_pending.png) -As the build is run on a provided remote machine, we can only examine the logs it produces: + * As the build is run on a provided remote machine, we can only examine the logs it produces: ![Travis build](../../images/travis_build.png) 7. If the build is successful, you should be able to check the coverage details of the tests at [Coveralls](http://coveralls.io/)! \ No newline at end of file diff --git a/src/main/java/seedu/address/controller/ResultDisplay.java b/src/main/java/seedu/address/controller/ResultDisplay.java index 472d7488bbd..570f4a92480 100644 --- a/src/main/java/seedu/address/controller/ResultDisplay.java +++ b/src/main/java/seedu/address/controller/ResultDisplay.java @@ -10,7 +10,7 @@ * A controller for the status bar that is displayed at the header of the application. */ public class ResultDisplay extends BaseUiPart { - public static final String HEADER_STATUS_BAR_ID = "resultDisplay"; + public static final String RESULT_DISPLAY_ID = "resultDisplay"; private static final String STATUS_BAR_STYLE_SHEET = "result-display"; private TextArea resultDisplayArea; @@ -29,7 +29,7 @@ public static ResultDisplay load(Stage primaryStage, AnchorPane placeHolder) { public void configure() { resultDisplayArea = new TextArea(); resultDisplayArea.setEditable(false); - resultDisplayArea.setId(HEADER_STATUS_BAR_ID); + resultDisplayArea.setId(RESULT_DISPLAY_ID); resultDisplayArea.getStyleClass().removeAll(); resultDisplayArea.getStyleClass().add(STATUS_BAR_STYLE_SHEET); resultDisplayArea.setText(""); diff --git a/src/test/java/guitests/GuiTestBase.java b/src/test/java/guitests/GuiTestBase.java index ffdcfbff0ef..e9f2be9e431 100644 --- a/src/test/java/guitests/GuiTestBase.java +++ b/src/test/java/guitests/GuiTestBase.java @@ -36,13 +36,14 @@ public class GuiTestBase { protected TypicalTestPersons td = new TypicalTestPersons(); - /* Handles to GUI elements present at the start up are created in advance + /* + * Handles to GUI elements present at the start up are created in advance * for easy access from child classes. */ protected MainGuiHandle mainGui; protected MainMenuHandle mainMenu; protected PersonListPanelHandle personListPanel; - protected HeaderStatusBarHandle headerStatusBar; + protected ResultDisplayHandle resultDisplay; private Stage stage; @BeforeClass @@ -61,13 +62,13 @@ public void setup() throws Exception { mainGui = new MainGuiHandle(new GuiRobot(), stage); mainMenu = mainGui.getMainMenu(); personListPanel = mainGui.getPersonListPanel(); - headerStatusBar = mainGui.getHeaderStatusBar(); + resultDisplay = mainGui.getResultDisplay(); this.stage = stage; }); EventManager.clearSubscribers(); testApp = (TestApp) FxToolkit.setupApplication(() -> new TestApp(this::getInitialData, getDataFileLocation())); FxToolkit.showStage(); - while(!stage.isShowing()); + while (!stage.isShowing()); mainGui.focusOnMainApp(); } @@ -104,15 +105,6 @@ public void sleep(long duration, TimeUnit timeunit) { mainGui.sleep(duration, timeunit); } - public void sleepForGracePeriod() { - mainGui.sleepForGracePeriod(); - } - - public void sleepUntilNextSync() { - //TODO: actively check for sync status rather than sleep for a fixed time - //sleep(getTestingConfig().getUpdateInterval(), TimeUnit.MILLISECONDS); - } - public void assertMatching(ReadOnlyPerson person, PersonCardHandle card) { assertTrue(TestUtil.compareCardAndPerson(card, person)); } diff --git a/src/test/java/guitests/PersonAddCommandTest.java b/src/test/java/guitests/PersonAddCommandTest.java index 3e0e3c48048..24c750fa47f 100644 --- a/src/test/java/guitests/PersonAddCommandTest.java +++ b/src/test/java/guitests/PersonAddCommandTest.java @@ -20,7 +20,7 @@ public void addPerson_singlePerson_successful() throws IllegalValueException { public void addPerson_duplicatePerson_showFeedback() throws IllegalValueException { personListPanel.enterCommandAndApply(td.hoon.getCommandString()); personListPanel.enterCommandAndApply(td.hoon.getCommandString()); - assertEquals(AddPersonCommand.MESSAGE_DUPLICATE_PERSON, headerStatusBar.getText()); + assertEquals(AddPersonCommand.MESSAGE_DUPLICATE_PERSON, resultDisplay.getText()); } @Test @@ -39,6 +39,6 @@ public void addPerson_multiplePerson_success() throws IllegalValueException { public void addPerson_invalidCommand_fail() { personListPanel.enterCommandAndApply("adds Johnny"); - assertEquals("Invalid command", headerStatusBar.getText()); + assertEquals("Invalid command", resultDisplay.getText()); } } diff --git a/src/test/java/guitests/PersonDeleteCommandTest.java b/src/test/java/guitests/PersonDeleteCommandTest.java index bf6fd4439ec..4c7dce5766f 100644 --- a/src/test/java/guitests/PersonDeleteCommandTest.java +++ b/src/test/java/guitests/PersonDeleteCommandTest.java @@ -61,18 +61,18 @@ public void deletePerson_middlePerson_successful() throws IllegalValueException @Test public void deletePerson_outOfBoundIndex_fail() { personListPanel.enterCommandAndApply("delete " + (personListPanel.getNumberOfPeople() + 1)); - assertEquals("The person index provided is invalid", headerStatusBar.getText()); + assertEquals("The person index provided is invalid", resultDisplay.getText()); } @Test public void deletePerson_zeroIndex_fail() { personListPanel.enterCommandAndApply("delete 0"); - assertEquals("The person index provided is invalid", headerStatusBar.getText()); + assertEquals("The person index provided is invalid", resultDisplay.getText()); } @Test public void deletePerson_negativeIndex_fail() { personListPanel.enterCommandAndApply("delete -1"); - assertEquals("The person index provided is invalid", headerStatusBar.getText()); + assertEquals("The person index provided is invalid", resultDisplay.getText()); } } diff --git a/src/test/java/guitests/PersonSearchCommandTest.java b/src/test/java/guitests/PersonSearchCommandTest.java index 182e5551585..272bb443dc3 100644 --- a/src/test/java/guitests/PersonSearchCommandTest.java +++ b/src/test/java/guitests/PersonSearchCommandTest.java @@ -1,12 +1,8 @@ package guitests; -import guitests.guihandles.PersonCardHandle; import org.junit.Test; -import seedu.address.commands.AddPersonCommand; import seedu.address.exceptions.IllegalValueException; -import java.util.concurrent.TimeUnit; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -16,14 +12,14 @@ public class PersonSearchCommandTest extends GuiTestBase { public void searchPerson_searchInvalidPerson_noResult() throws IllegalValueException { personListPanel.enterCommandAndApply("find Mark"); assertEquals(0, personListPanel.getNumberOfPeople()); - assertEquals("0 persons listed!", headerStatusBar.getText()); + assertEquals("0 persons listed!", resultDisplay.getText()); } @Test public void searchPerson_withSameLastName_foundMultiple() throws IllegalValueException { personListPanel.enterCommandAndApply("find Meier"); assertEquals(2, personListPanel.getNumberOfPeople()); - assertEquals("2 persons listed!", headerStatusBar.getText()); + assertEquals("2 persons listed!", resultDisplay.getText()); assertTrue(personListPanel.isListMatching(td.benson, td.daniel)); } @@ -31,7 +27,7 @@ public void searchPerson_withSameLastName_foundMultiple() throws IllegalValueExc public void searchPerson_withUniqueLastName_foundSingle() throws IllegalValueException { personListPanel.enterCommandAndApply("find Pauline"); assertEquals(1, personListPanel.getNumberOfPeople()); - assertEquals("1 persons listed!", headerStatusBar.getText()); + assertEquals("1 persons listed!", resultDisplay.getText()); assertTrue(personListPanel.isListMatching(td.alice)); } @@ -40,7 +36,7 @@ public void searchPerson_withUniqueLastName_foundSingle() throws IllegalValueExc public void searchPerson_withUniqueFirstName_foundSingle() throws IllegalValueException { personListPanel.enterCommandAndApply("find George"); assertEquals(1, personListPanel.getNumberOfPeople()); - assertEquals("1 persons listed!", headerStatusBar.getText()); + assertEquals("1 persons listed!", resultDisplay.getText()); assertTrue(personListPanel.isListMatching(td.george)); } @@ -48,7 +44,7 @@ public void searchPerson_withUniqueFirstName_foundSingle() throws IllegalValueEx public void searchPerson_withFullName_foundSingle() throws IllegalValueException { personListPanel.enterCommandAndApply("find Elle Meyer"); assertEquals(1, personListPanel.getNumberOfPeople()); - assertEquals("1 persons listed!", headerStatusBar.getText()); + assertEquals("1 persons listed!", resultDisplay.getText()); assertTrue(personListPanel.isListMatching(td.elle)); } @@ -58,7 +54,7 @@ public void searchPerson_withSameSubsetOfCharacters_foundMultiple() throws Illeg personListPanel.enterCommandAndApply("find on"); sleep(1, TimeUnit.SECONDS); assertEquals(2, personListPanel.getNumberOfPeople()); - assertEquals("2 persons listed!", headerStatusBar.getText()); + assertEquals("2 persons listed!", resultDisplay.getText()); assertTrue(personListPanel.isListMatching(td.benson, td.fiona)); */ } @@ -66,6 +62,6 @@ public void searchPerson_withSameSubsetOfCharacters_foundMultiple() throws Illeg @Test public void searchPerson_invalidCommand_fail() { personListPanel.enterCommandAndApply("findgeorge"); - assertEquals("Invalid command", headerStatusBar.getText()); + assertEquals("Invalid command", resultDisplay.getText()); } } diff --git a/src/test/java/guitests/guihandles/HeaderStatusBarHandle.java b/src/test/java/guitests/guihandles/HeaderStatusBarHandle.java deleted file mode 100644 index 59ad825a057..00000000000 --- a/src/test/java/guitests/guihandles/HeaderStatusBarHandle.java +++ /dev/null @@ -1,25 +0,0 @@ -package guitests.guihandles; - -import guitests.GuiRobot; -import javafx.stage.Stage; -import org.controlsfx.control.StatusBar; -import seedu.address.TestApp; -import seedu.address.controller.ResultDisplay; - -/** - * A handler for the HeaderStatusBar of the UI - */ -public class HeaderStatusBarHandle extends GuiHandle { - - public HeaderStatusBarHandle(GuiRobot guiRobot, Stage primaryStage) { - super(guiRobot, primaryStage, TestApp.APP_TITLE); - } - - public String getText() { - return getStatusBar().getText(); - } - - private StatusBar getStatusBar() { - return (StatusBar) getNode("#" + ResultDisplay.HEADER_STATUS_BAR_ID); - } -} diff --git a/src/test/java/guitests/guihandles/MainGuiHandle.java b/src/test/java/guitests/guihandles/MainGuiHandle.java index acb5e58a427..c9e79ce1f2b 100644 --- a/src/test/java/guitests/guihandles/MainGuiHandle.java +++ b/src/test/java/guitests/guihandles/MainGuiHandle.java @@ -22,8 +22,8 @@ public PersonListPanelHandle getPersonListPanel() { return new PersonListPanelHandle(guiRobot, primaryStage); } - public HeaderStatusBarHandle getHeaderStatusBar() { - return new HeaderStatusBarHandle(guiRobot, primaryStage); + public ResultDisplayHandle getResultDisplay() { + return new ResultDisplayHandle(guiRobot, primaryStage); } public MainMenuHandle getMainMenu() { diff --git a/src/test/java/guitests/guihandles/ResultDisplayHandle.java b/src/test/java/guitests/guihandles/ResultDisplayHandle.java new file mode 100644 index 00000000000..a2a01af2672 --- /dev/null +++ b/src/test/java/guitests/guihandles/ResultDisplayHandle.java @@ -0,0 +1,25 @@ +package guitests.guihandles; + +import guitests.GuiRobot; +import javafx.scene.control.TextArea; +import javafx.stage.Stage; +import seedu.address.TestApp; +import seedu.address.controller.ResultDisplay; + +/** + * A handler for the ResultDisplay of the UI + */ +public class ResultDisplayHandle extends GuiHandle { + + public ResultDisplayHandle(GuiRobot guiRobot, Stage primaryStage) { + super(guiRobot, primaryStage, TestApp.APP_TITLE); + } + + public String getText() { + return getResultDisplay().getText(); + } + + private TextArea getResultDisplay() { + return (TextArea) getNode("#" + ResultDisplay.RESULT_DISPLAY_ID); + } +}