Skip to content

Commit

Permalink
Merge pull request #254 from qld-gov-au/develop
Browse files Browse the repository at this point in the history
Develop to master
  • Loading branch information
ThrawnCA authored Jun 13, 2022
2 parents f48327f + 269a3fc commit 063e53d
Show file tree
Hide file tree
Showing 28 changed files with 113 additions and 99 deletions.
1 change: 1 addition & 0 deletions .ahoy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ commands:
usage: Build and start Docker containers.
cmd: |
echo "Preparing containers for $VARS_TYPE"
export CKAN_REPO
CKAN_VERSION=$(sh retrieve-ckan-version.sh)
if [ "$CKAN_VERSION" != "" ]; then
export CKAN_VERSION
Expand Down
2 changes: 1 addition & 1 deletion .docker/scripts/create-test-data-OpenData.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fi

# Create test dataset with our standard fields
curl -LsH "Authorization: ${API_KEY}" \
--data '{"name": "test-dataset", "owner_org": "'"${TEST_ORG_ID}"'",
--data '{"name": "test-dataset", "owner_org": "'"${TEST_ORG_ID}"'", "private": true,
"update_frequency": "monthly", "author_email": "admin@localhost", "version": "1.0",
"license_id": "other-open", "data_driven_application": "NO", "security_classification": "PUBLIC",
"notes": "test", "de_identified_data": "NO"}' \
Expand Down
2 changes: 1 addition & 1 deletion .docker/scripts/create-test-data-Publications.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ curl -LsH "Authorization: ${API_KEY}" \

# Create test dataset with our standard fields
curl -LsH "Authorization: ${API_KEY}" \
--data '{"name": "test-dataset", "owner_org": "'"${TEST_ORG_ID}"'"}' \
--data '{"name": "test-dataset", "owner_org": "'"${TEST_ORG_ID}"'", "private": true}' \
${CKAN_ACTION_URL}/package_create

if [ "$VENV_DIR" != "" ]; then
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
env:
VARS_TYPE: ${{ matrix.application }}
DEPLOY_ENV: ${{ matrix.target_environment }}
CKAN_REPO: qld-gov-au/ckan

steps:
- uses: actions/checkout@v2
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
env:
VARS_TYPE: ${{ matrix.application }}
DEPLOY_ENV: ${{ matrix.target_environment }}
CKAN_REPO: qld-gov-au/ckan

steps:
- uses: actions/checkout@v2
Expand Down
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ services:
SITE_URL: "http://${PROJECT}.docker.amazee.io"
VARS_TYPE:
DEPLOY_ENV:
CKAN_REPO:
CKAN_VERSION:
depends_on:
- postgres
Expand Down Expand Up @@ -92,6 +93,11 @@ services:
networks:
- amazeeio-network
- default
extra_hosts:
# point some unnecessary domains at localhost
- "www.googletagmanager.com:127.0.0.1"
- "fonts.gstatic.com:127.0.0.1"
- "gravatar.com:127.0.0.1"

volumes:
solr-data: {}
Expand Down
15 changes: 9 additions & 6 deletions test/features/comments.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@OpenData
Feature: Comments

@unauthenticated
Scenario: The Add Comment form should not display for a non-logged-in user - instead they see a 'Login to comment' button
Given "Unauthenticated" as the persona
When I go to dataset "warandpeace" comments
Expand Down Expand Up @@ -33,16 +34,15 @@ Feature: Comments
Then I submit a comment with subject "Test subject" and comment "This is a test comment"
Then I should see "This is a test comment" within 10 seconds

@comment-add @datarequest @comment-email
@comment-add @datarequest @email
Scenario: When a logged-in user submits a comment on a Data Request the email should contain title and comment
Given "CKANUser" as the persona
When I log in
And I go to data request "Test Request" comments
Then I should see an element with xpath "//h3[contains(string(), 'Add a comment')]"
Then I submit a comment with subject "Test Request" and comment "This is a test data request comment"
When I wait for 5 seconds
Then I should receive a base64 email at "test_org_admin@localhost" containing "Data request subject: Test Request"
And I should receive a base64 email at "test_org_admin@localhost" containing "Comment: This is a test data request comment"
Then I should receive a base64 email at "test_org_admin@localhost" containing both "Data request subject: Test Request" and "Comment: This is a test data request comment"

@comment-add @comment-profane
Scenario: When a logged-in user submits a comment containing whitelisted profanity on a Dataset the comment should display within 10 seconds
Expand All @@ -62,7 +62,7 @@ Feature: Comments
Then I submit a comment with subject "Test subject" and comment "He had sheep, and oxen, and he asses, and menservants, and maidservants, and she asses, and camels."
Then I should see "Comment blocked due to profanity" within 5 seconds

@comment-report
@comment-report @email
Scenario: When a logged-in user reports a comment on a Dataset the comment should be marked as reported and an email sent to the admins of the organisation
Given "TestOrgEditor" as the persona
When I log in
Expand All @@ -71,7 +71,7 @@ Feature: Comments
Then I should see "Reported" within 5 seconds
Then I should receive a base64 email at "test_org_admin@localhost" containing "This comment has been flagged as inappropriate by a user"

@comment-report @datarequest
@comment-report @datarequest @email
Scenario: When a logged-in user reports a comment on a Data Request the comment should be marked as reported and an email notification sent to the organisation admins
Given "CKANUser" as the persona
When I log in
Expand Down Expand Up @@ -113,6 +113,7 @@ Feature: Comments
And I should see "Comment deleted by Test Admin." within 2 seconds

@comment-tab
@unauthenticated
Scenario: Non-logged in users should not see comment form in dataset tab
Given "Unauthenticated" as the persona
When I go to dataset "warandpeace"
Expand All @@ -121,10 +122,12 @@ Feature: Comments
@comment-tab
Scenario: Logged in users should not see comment form in dataset tab
Given "CKANUser" as the persona
When I go to dataset "warandpeace"
When I log in
And I go to dataset "warandpeace"
Then I should not see an element with id "comment_form"

@comment-tab
@unauthenticated
Scenario: Users should see comment tab on dataset
Given "Unauthenticated" as the persona
Then I go to dataset "warandpeace"
Expand Down
11 changes: 11 additions & 0 deletions test/features/data_qld_theme.feature
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
Feature: Theme customisations

@unauthenticated
Scenario: Lato font is implemented on homepage
Given "Unauthenticated" as the persona
When I go to homepage
Then I should see an element with xpath "//link[contains(@href,'https://fonts.googleapis.com/css?family=Lato')]"

@unauthenticated
Scenario: Organisation is in fact spelled Organisation (as opposed to Organization)
Given "Unauthenticated" as the persona
When I go to organisation page
Then I should see "Organisation"
And I should not see "Organization"
Expand Down Expand Up @@ -35,11 +39,14 @@ Feature: Theme customisations
And I should see "Some description or other"
And I should see an element with xpath "//a[string() = 'read more' and contains(@href, '/organization/about/org-with-description')]"

@unauthenticated
Scenario: Explore button does not exist on dataset detail page
Given "Unauthenticated" as the persona
When I go to dataset page
And I click the link with text that contains "A Wonderful Story"
Then I should not see "Explore"

@unauthenticated
Scenario: Explore button does not exist on dataset detail page
When I go to organisation page
Then I should see "Organisations are Queensland Government departments, other agencies or legislative entities responsible for publishing open data on this portal."
Expand Down Expand Up @@ -108,15 +115,19 @@ Feature: Theme customisations
And I should see an element with xpath "//li[contains(@class, 'active')]/a[contains(string(), 'Gazettes') and @href='/gazettes-current']"
And I should see an element with xpath "//li[not(contains(@class, 'active'))]/a[contains(string(), 'Contact') and @href='https://www.qld.gov.au/contact-us']"

@unauthenticated
Scenario: When I encounter a 'resource not found' error page, it has a custom message
Given "Unauthenticated" as the persona
When I go to "/dataset/nonexistent/resource/nonexistent"
Then I should see "Sorry, the page you were looking for could not be found."

When I go to "/nonexistent"
Then I should see an element with xpath "//div[contains(string(), 'was not found') or contains(string(), 'could not be found')]"
And I should not see "Sorry, the page you were looking for could not be found."

@unauthenticated
Scenario: When I go to the header URL, I can see the list of necessary assets
Given "Unauthenticated" as the persona
When I go to "/header.html"
Then I should see an element with xpath "//a[@href='/user/login' and contains(string(), 'Log in')]"
And I should see an element with xpath "//a[@href='/user/register' and contains(string(), 'Register')]"
Expand Down
11 changes: 4 additions & 7 deletions test/features/data_request.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
@OpenData
Feature: Data Request

@unauthenticated
Scenario: Data Requests are accessible via the /datarequest URL
Given "Unauthenticated" as the persona
When I go to the data requests page
Then the browser's URL should contain "/datarequest"


@unauthenticated
Scenario: When visiting the datarequests page as a non-logged in user, the 'Add data request' button is not visible
Given "Unauthenticated" as the persona
When I go to the data requests page
Then I should not see an element with xpath "//a[contains(string(), 'Add data request', 'i')]"


Scenario: Data requests submitted without a description will produce an error message
Given "SysAdmin" as the persona
When I log in and go to the data requests page
Expand All @@ -23,7 +25,6 @@ Feature: Data Request
And I should see an element with the css selector "span.error-block" within 1 seconds
And I should see "Description cannot be empty" within 1 seconds


Scenario Outline: Data request creator and Sysadmin can see a 'Close' button on the data request detail page for opened data requests
Given "<User>" as the persona
When I log in and go to the data requests page
Expand All @@ -34,7 +35,6 @@ Feature: Data Request
| User |
| SysAdmin |


Scenario Outline: Non admin users cannot see a 'Close' button on the data request detail page for opened data requests
Given "<User>" as the persona
When I log in and go to the data requests page
Expand All @@ -49,14 +49,12 @@ Feature: Data Request
| TestOrgEditor |
| TestOrgMember |


Scenario: Creating a new data request will show the data request afterward
Given "TestOrgEditor" as the persona
When I log in and create a datarequest
Then I should see an element with xpath "//i[contains(@class, 'icon-unlock')]"
And I should see an element with xpath "//a[contains(string(), 'Close')]"


Scenario: Closing a data request will show the data request afterward
Given "DataRequestOrgAdmin" as the persona
When I log in and create a datarequest
Expand All @@ -66,7 +64,6 @@ Feature: Data Request
Then I should see an element with xpath "//i[contains(@class, 'icon-lock')]"
And I should not see an element with xpath "//a[contains(string(), 'Close')]"


Scenario: As an org admin I can re-open a closed data request
Given "DataRequestOrgAdmin" as the persona
When I log in and create a datarequest
Expand Down
1 change: 0 additions & 1 deletion test/features/data_validation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ Feature: Data Validation
| TestOrgAdmin |
| TestOrgEditor |


Scenario: As any user, I can view the 'Data Schema' link in the 'Additional Info' table of the resource read-view page
Given "SysAdmin" as the persona
When I log in
Expand Down
2 changes: 1 addition & 1 deletion test/features/dataset_deletion.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Feature: Dataset deletion
Then I fill in "name" with "res1"
Then I fill in "description" with "description"
Then I fill in "size" with "1024" if present
Then I fill in "resource_visibility" with "Resource NOT visible/Pending acknowledgement" if present
Then I fill in "resource_visibility" with "FALSE" if present
Then I press the element with xpath "//button[@value='go-metadata']"
And I wait for 10 seconds
Then I should see "Data and Resources"
Expand Down
3 changes: 1 addition & 2 deletions test/features/de_identified_data.feature
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ Feature: De-identified data
| TestOrgAdmin |
| TestOrgEditor |


Scenario Outline: An editor, admin or sysadmin user, when I go to the edit dataset page, the field field-de_identified_data should be visible with the correct values
Given "<User>" as the persona
When I log in
Expand Down Expand Up @@ -50,6 +49,7 @@ Feature: De-identified data
| TestOrgAdmin |
| TestOrgEditor |

@unauthenticated
Scenario: Unauthenticated user cannot view the de-identified data
Given "Unauthenticated" as the persona
When I go to "/dataset/warandpeace"
Expand All @@ -58,4 +58,3 @@ Feature: De-identified data

And I go to "/api/3/action/package_show?id=warandpeace"
Then I should not see an element with xpath "//body/*[contains(text(), '"de_identified_data":')]"

4 changes: 0 additions & 4 deletions test/features/engagement_reporting.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Feature: Engagement Reporting
| TestOrgAdmin |
| TestOrgEditor |


Scenario: As a data request organisation admin, when I view my engagement report, I can verify the number of data requests is correct and increments
Given "DataRequestOrgAdmin" as the persona
When I log in
Expand All @@ -38,7 +37,6 @@ Feature: Engagement Reporting
Then I should see an element with xpath "//tr[@id='datarequests-total']/td[contains(@class, 'metric-title') and string()='Data requests' and position()=1]"
Then I should see an element with xpath "//tr[@id='datarequests-total']/td[contains(@class, 'metric-data') and string()='4' and position()=2]"


Scenario: As an admin user of my organisation, when I view my engagement report, I can verify the number of dataset followers is correct and increments
Given "ReportingOrgAdmin" as the persona
When I log in
Expand All @@ -54,7 +52,6 @@ Feature: Engagement Reporting
Then I should see an element with xpath "//tr[@id='dataset-followers']/td[contains(@class, 'metric-title') and string()='Dataset followers' and position()=1]"
Then I should see an element with xpath "//tr[@id='dataset-followers']/td[contains(@class, 'metric-data') and string()='1' and position()=2]"


Scenario: As an admin user of my organisation, when I view my engagement report, I can verify the number of dataset comments is correct and increments
Given "ReportingOrgAdmin" as the persona
When I log in
Expand All @@ -70,7 +67,6 @@ Feature: Engagement Reporting
Then I should see an element with xpath "//tr[@id='dataset-comments']/td[contains(@class, 'metric-title') and string()='Dataset comments' and position()=1]"
Then I should see an element with xpath "//tr[@id='dataset-comments']/td[contains(@class, 'metric-data') and string()='1' and position()=2]"


Scenario: As an admin user of my organisation, when I view my engagement report, I can verify the number of data request comments is correct and increments
Given "ReportingOrgAdmin" as the persona
When I log in
Expand Down
Loading

0 comments on commit 063e53d

Please sign in to comment.