Skip to content

Commit

Permalink
Merge pull request #132 from AtlasOfLivingAustralia/1.1.4
Browse files Browse the repository at this point in the history
1.1.4
  • Loading branch information
chrisala committed Jun 19, 2015
2 parents 4d30390 + 774daa5 commit 21927a2
Show file tree
Hide file tree
Showing 65 changed files with 1,906 additions and 693 deletions.
30 changes: 26 additions & 4 deletions fieldcapture-hub/grails-app/conf/BuildConfig.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,31 @@ grails.project.fork = [
console: false// [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256]
]


def inlinePluginAvailable = new File('../fieldcapture-hubs-plugin/application.properties').exists()
def inlineTestPluginAvailable = false

// settings for the inline fieldcapture-plugin
if (Environment.current == Environment.DEVELOPMENT && inlinePluginAvailable) {
grails.plugin.location.'fieldcapture-plugin' = '../fieldcapture-hubs-plugin'
println('Using inline fieldcapture-plugin...')
if (Environment.current == Environment.DEVELOPMENT) {

if (inlinePluginAvailable) {
grails.plugin.location.'fieldcapture-plugin' = '../fieldcapture-hubs-plugin'
println('Using inline fieldcapture-plugin...')
}

def props = new Properties()
File propertiesFile = new File('/data/fieldcapture-hub/config/fieldcapture-hub-config.properties')
if (propertiesFile.exists()) {
propertiesFile.withInputStream {
stream -> props.load(stream)
}
}
def testPluginLocation = props.getProperty("fieldcapture-test-plugin.location") ?: '../fieldcapture-test-plugin'
if (new File("${testPluginLocation}/application.properties").exists()) {
inlineTestPluginAvailable = true
println "Using inline test plugin"
grails.plugin.location.'fieldcapture-test-plugin' = testPluginLocation
}
}
grails.project.dependency.resolver = "maven"
grails.project.dependency.resolution = {
Expand Down Expand Up @@ -69,7 +88,10 @@ grails.project.dependency.resolution = {
runtime ":ala-bootstrap2:2.2"

if (Environment.current != Environment.DEVELOPMENT || !inlinePluginAvailable) {
compile ":fieldcapture-plugin:1.1.3-SNAPSHOT"
compile ":fieldcapture-plugin:1.1.4-SNAPSHOT"
}
if (Environment.current != Environment.DEVELOPMENT || !inlineTestPluginAvailable) {
test ":fieldcapture-test:0.1-SNAPSHOT"
}

build ":release:3.0.1"
Expand Down
5 changes: 5 additions & 0 deletions fieldcapture-hub/grails-app/i18n/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ label.imcra4_pbFacet=<abbr title="Marine Region">Marine Regions</abbr>
label.otherFacet=<abbr title="Other areas">Other Regions</abbr>
label.gerSubRegionFacet=<abbr title="Partnership Regions">Partnership Regions</abbr>
label.GER\ Border\ Ranges=Border Ranges Alliance
label.electFacet = <abbr title="Project status">Federal Electorates</abbr>
label.cmzFacet = <abbr title="Conservation Management Zones">CMZ</abbr>
label.meriPlanAssetFacet=<abbr title="Assets addressed in the MERI plan">Assets Addressed</abbr>
label.partnerOrganisationTypeFacet=<abbr title="Organisation type of partner organisations">Partner Organisations</abbr>


label.T=<i class=\"icon-ok\"></i>
label.F=<i class=\"icon-remove\"></i>
Expand Down
13 changes: 13 additions & 0 deletions fieldcapture-hub/scripts/exportFunctionalTestData.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
if [ -z "$1" ]
then
echo "No data set name argument supplied"
exit 1
fi

export DATABASE_NAME=ecodata-test
export DATA_PATH=test/functional/resources/$1

# Configure the ecodata-test database to be how the functional tests expect it.
mongoexport --db $DATABASE_NAME --collection organisation --out $DATA_PATH/organisation.json
mongoexport --db $DATABASE_NAME --collection userPermission --out $DATA_PATH/userPermission.json
mongoexport --db $DATABASE_NAME --collection project --out $DATA_PATH/project.json
19 changes: 19 additions & 0 deletions fieldcapture-hub/scripts/loadFunctionalTestData.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
echo "This script should be run from the project root directory"
if [ -z "$1" ]
then
echo "No data set name argument supplied"
exit 1
fi

export DATABASE_NAME=ecodata-test
export DATA_PATH=$1

# Configure the ecodata-test database to be how the functional tests expect it.
mongo $DATABASE_NAME --eval "db.dropDatabase()"

# Configure the ecodata-test database to be how the functional tests expect it.
mongoimport --db $DATABASE_NAME --collection organisation --file $DATA_PATH/organisation.json
mongoimport --db $DATABASE_NAME --collection project --file $DATA_PATH/project.json
mongoimport --db $DATABASE_NAME --collection userPermission --file $DATA_PATH/userPermission.json
mongoimport --db $DATABASE_NAME --collection setting --file $DATA_PATH/setting.json
12 changes: 12 additions & 0 deletions fieldcapture-hub/scripts/startEcodataForFunctionalTests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export ECODATA_DIR=target/ecodata
export ECODATA_BRANCH=master

rm -rf $ECODATA_DIR
git clone https://github.com/AtlasOfLivingAustralia/ecodata.git $ECODATA_DIR
cd $ECODATA_DIR
git checkout $ECODATA_BRANCH


grails test run-app -Dgrails.server.port.http=8080&


Original file line number Diff line number Diff line change
@@ -1,33 +1,134 @@
package au.org.ala.fieldcapture

import pages.ProjectDetails
import pages.CreateOrganisation
import pages.CreateProject
import pages.ProjectIndex
import pages.EntryPage

import spock.lang.Stepwise

@Stepwise
class CreateProjectSpec extends FieldcaptureFunctionalTest {

def setup() {
useDataSet("data-set-1")
}

def "The user must be logged in to create a project"() {

logout(browser)

when: "attempt to create a project"
via ProjectDetails
via CreateProject

then: "redirected to the home page with an error"
at EntryPage
}

def "The user can create a citizen science project"() {
def "If the user is not a member of an organisation then they must select one via a search"() {
logout(browser)
login(browser, "[email protected]", "testing!")

given: "navigate to the create project page"
to CreateProject, citizenScience:true

expect:
at CreateProject
organisation.organisationName == ''

when: "search for an organisation"
organisation.organisationName = "Test"

then: "The available organisations have been narrowed"


when: "an organisation is selected"
organisation.selectOrganisation("Test organisation 1")

then: "The search field is disabled and updated to match the organisation name"

organisation.organisationName == "Test organisation 1"
organisation.organisationName.@disabled == 'true'

}

def "If the user is a member of exactly one organisation it should be preselected"() {
logout(browser)
login(browser, "[email protected]", "testing!")

given: "navigate to the create project page"
to CreateProject, citizenScience:true

expect: "the user's organisation is selected"
at CreateProject

organisation.organisationName == "Test organisation 3"
organisation.organisationName.@disabled == 'true'
}

def "The user can register an organisation during project creation"() {
logout(browser)
login(browser, "[email protected]", "testing!")

when: "navigate to the create project page"
to ProjectDetails
given: "navigate to the create project page"
to CreateProject, citizenScience:true

expect: "the user's organisation is selected"
at CreateProject

organisation.notOnList.displayed == true

when: "the user indicates their organisation is not on the list"
organisation.notOnList = 'organisationNotOnList' // check the checkbox

then: "the user is given the option to register a new organsation"
organisation.registerButton.displayed == true

when: "the user selects to register a new organisation"
organisation.registerButton.click()

then: "the user is sent to the create organisation page"
at CreateOrganisation

when: "enter the details of the new organisation"
name = "Test organisation 4"
description = "Test organisation 4 description"
type = "Government"
create()

then: "the user should be returned to the create project page without loss of data and with the new organisation pre-selected"
waitFor {at CreateProject}



}


def "The user can register an external citizen science project"() {

logout(browser)
login(browser, "[email protected]", "testing!")

given: "navigate to the create project page"
to CreateProject, citizenScience:true

expect:
at CreateProject
projectType == 'citizenScience' // The field should be pre-selected and disabled - note the selector returns the value, not the text.

when: "enter project details"
recordUsingALA = 'No'
name = 'External project'
description = 'External project description'
setDate(plannedStartDate, '01/01/2015')
site.extentType = 'point'

save()

then: "at the newly created project page"

waitFor { at ProjectIndex }


then: "blank"
at ProjectDetails
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package au.org.ala.fieldcapture

import pages.EditProject
import pages.CreateOrganisation
import spock.lang.Stepwise

/**
* Specification for the edit project use case.
*/
@Stepwise
class EditProjectSpec extends FieldcaptureFunctionalTest {

def setup() {
useDataSet("data-set-1")
}

def "When editing a project, the project data should be pre-populated"() {

setup:
logout(browser)
login(browser, "[email protected]", "testing!")
def projectId = '9c99e298-1af3-4d46-aef2-470f9ec0277a' // From data-set-1

when: "navigate to the edit project page"
to EditProject, id:projectId

then: "the project data is pre-populated on the form"
projectTypeSelectedText == 'Citizen Science Project'
recordUsingALASelectedText == 'No'
organisation.organisationName == 'Test organisation 3'
organisation.notOnList.displayed == false
organisation.registerButton.displayed == false
name == "External project 1"
description == "External project 1 description"
plannedStartDate == '01-01-2015'

}

def "The user can register an organisation while editing a project"() {
logout(browser)
login(browser, "[email protected]", "testing!")
def projectId = '9c99e298-1af3-4d46-aef2-470f9ec0277a' // From data-set-1

given: "navigate to the edit project page"
to EditProject, id:projectId

expect: "the project's organisation is selected"
organisation.organisationName == 'Test organisation 3'
organisation.notOnList.displayed == false

when: "the user clears the organisation selection"
organisation.clearButton.click()

then: "the user can now search for an organisation"
organisation.results.size() > 0

when: "the user indicates their organisation is not on the list"
organisation.organisationName = 'not in list'
organisation.notOnList = 'organisationNotOnList' // check the checkbox

then: "the user is given the option to register a new organisation"
organisation.registerButton.displayed == true

when: "the user selects to register a new organisation"
organisation.registerButton.click()

then: "the user is sent to the create organisation page"
at CreateOrganisation

when: "enter the details of the new organisation"
name = "Test organisation 4"
description = "Test organisation 4 description"
type = "Government"
create()

then: "the user should be returned to the edit project page without loss of data and with the new organisation pre-selected"
waitFor {at EditProject}
organisation.organisationName == 'Test organisation 4'


}
}

This file was deleted.

13 changes: 0 additions & 13 deletions fieldcapture-hub/test/functional/pages/EntryPage.groovy

This file was deleted.

Loading

0 comments on commit 21927a2

Please sign in to comment.