-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #132 from AtlasOfLivingAustralia/1.1.4
1.1.4
- Loading branch information
Showing
65 changed files
with
1,906 additions
and
693 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
12
fieldcapture-hub/scripts/startEcodataForFunctionalTests.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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& | ||
|
||
|
115 changes: 108 additions & 7 deletions
115
fieldcapture-hub/test/functional/au/org/ala/fieldcapture/CreateProjectSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
82 changes: 82 additions & 0 deletions
82
fieldcapture-hub/test/functional/au/org/ala/fieldcapture/EditProjectSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
|
||
|
||
} | ||
} |
30 changes: 0 additions & 30 deletions
30
fieldcapture-hub/test/functional/au/org/ala/fieldcapture/FieldcaptureFunctionalTest.groovy
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.