From 316f0068b906e0bdf25d6a16296840dab914cc57 Mon Sep 17 00:00:00 2001 From: antuarc Date: Fri, 20 Sep 2024 13:59:46 +1000 Subject: [PATCH 1/6] [QOLDEV-935] add scenario test for promoting and demoting sysadmins --- test/features/users.feature | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/features/users.feature b/test/features/users.feature index 0d561a2..a643f67 100644 --- a/test/features/users.feature +++ b/test/features/users.feature @@ -153,3 +153,22 @@ Feature: User APIs And I fill in "password2" with "password1234" And I press "Create Account" Then I should see "Password: Must contain at least one number, lowercase letter, capital letter, and symbol" + + Scenario: As a sysadmin, when I go to the sysadmin list, I can promote and demote other sysadmins + Given "SysAdmin" as the persona + When I log in + And I set "debug" to "True" + And I click the link to a url that contains "/ckan-admin/" + And I take a debugging screenshot + Then I should see an element with xpath "//table//a[string() = 'Administrator' and @href = '/user/admin']" + And I should not see "Test Admin" + + When I fill in "promote-username" with "test_org_admin" + And I press "Promote" + And I take a debugging screenshot + Then I should see "Promoted Test Admin to sysadmin" + And I should see an element with xpath "//table//a[string() = 'Test Admin' and @href = '/user/test_org_admin']" + + When I press the element with xpath "//tr/td/a[@href = '/user/test_org_admin']/../following-sibling::td//button[contains(@title, 'Revoke')]" + Then I should see "Revoked sysadmin permission from Test Admin" + And I should not see an element with xpath "//table//a[@href = '/user/test_org_admin']" From 574fdcf0e8689b08e17d368c89bf9b36401b1033 Mon Sep 17 00:00:00 2001 From: antuarc Date: Fri, 20 Sep 2024 14:01:25 +1000 Subject: [PATCH 2/6] [QOLDEV-935] update GitHub 'upload-artifact' action --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4918375..5a6a837 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -69,7 +69,7 @@ jobs: - name: Upload screenshots if: failure() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: CKAN ${{ matrix.ckan-version }} screenshots path: /tmp/artifacts/behave/screenshots From c52fe75b09ec8ae2e1b93d680231cb4ec0552a11 Mon Sep 17 00:00:00 2001 From: antuarc Date: Fri, 20 Sep 2024 14:04:24 +1000 Subject: [PATCH 3/6] [QOLDEV-935] disable debugging by default --- test/features/users.feature | 1 - 1 file changed, 1 deletion(-) diff --git a/test/features/users.feature b/test/features/users.feature index a643f67..9dd395e 100644 --- a/test/features/users.feature +++ b/test/features/users.feature @@ -157,7 +157,6 @@ Feature: User APIs Scenario: As a sysadmin, when I go to the sysadmin list, I can promote and demote other sysadmins Given "SysAdmin" as the persona When I log in - And I set "debug" to "True" And I click the link to a url that contains "/ckan-admin/" And I take a debugging screenshot Then I should see an element with xpath "//table//a[string() = 'Administrator' and @href = '/user/admin']" From 8f303e87db4eac9915de6c0e5b761d622e2c8780 Mon Sep 17 00:00:00 2001 From: antuarc Date: Fri, 20 Sep 2024 14:38:26 +1000 Subject: [PATCH 4/6] add activity stream tests --- bin/build.sh | 4 +++- test/features/datasets.feature | 19 +++++++++++++++++++ test/features/organisations.feature | 5 ++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/bin/build.sh b/bin/build.sh index e71f38f..aa1ea9d 100755 --- a/bin/build.sh +++ b/bin/build.sh @@ -21,8 +21,10 @@ CKAN_GIT_ORG=ckan if [ "$CKAN_VERSION" = "2.10" ]; then if [ "$CKAN_TYPE" = "custom" ]; then - CKAN_GIT_VERSION=ckan-2.10.3-qgov.3 + CKAN_GIT_VERSION=ckan-2.10.5-qgov.1 CKAN_GIT_ORG=qld-gov-au + else + CKAN_GIT_VERSION=ckan-2.10.5 fi PYTHON_VERSION=py3 diff --git a/test/features/datasets.feature b/test/features/datasets.feature index 93477e6..9871ef4 100644 --- a/test/features/datasets.feature +++ b/test/features/datasets.feature @@ -1,3 +1,4 @@ +@dataset Feature: Dataset APIs Scenario: Creative Commons BY-NC-SA 4.0 licence is an option for datasets @@ -6,3 +7,21 @@ Feature: Dataset APIs And I edit the "test-dataset" dataset Then I should see an element with xpath "//option[@value='cc-by-nc-sa-4']" + Scenario: As a publisher, I can view the change history of a dataset + Given "TestOrgEditor" as the persona + When I log in + And I create a dataset and resource with key-value parameters "notes=Testing activity stream" and "name=Test" + And I press the element with xpath "//a[contains(@href, '/dataset/activity/') and contains(string(), 'Activity Stream')]" + Then I should see "created the dataset" + When I press "View this version" + Then I should see "You're currently viewing an old version of this dataset." + + When I go back + And I press "Changes" + Then I should see "View changes from" + And I should see an element with xpath "//select[@name='old_id']" + And I should see an element with xpath "//select[@name='new_id']" + + When I go back + And I press the element with xpath "//li[contains(@class, 'new-package')]/preceding-sibling::li[1]//a[contains(string(), 'Changes')]" + Then I should see "Added resource" diff --git a/test/features/organisations.feature b/test/features/organisations.feature index 854efe3..4011e0a 100644 --- a/test/features/organisations.feature +++ b/test/features/organisations.feature @@ -1,4 +1,4 @@ -@users +@organisations Feature: Organization APIs Scenario Outline: Organisation membership is accessible to admins of the organisation @@ -37,6 +37,9 @@ Feature: Organization APIs Then I should see "Test Organisation" And I should not see an element with xpath "//a[contains(@href, '?action=read')]" And I should see an element with xpath "//a[contains(@href, '/organization/test-organisation')]" + When I press "Test Organisation" + And I press "Activity Stream" + Then I should see "created the org" When I view the "test-organisation" organisation API "not including" users Then I should see an element with xpath "//*[contains(string(), '"success": true') and contains(string(), '"name": "test-organisation"')]" From f9d9e8ff9241abe8e4569efec94621883586b6cd Mon Sep 17 00:00:00 2001 From: antuarc Date: Fri, 20 Sep 2024 14:40:11 +1000 Subject: [PATCH 5/6] [QOLDEV-933] don't show 'dataset not found' message when redirecting via PURL --- ckanext/qgov/common/plugin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ckanext/qgov/common/plugin.py b/ckanext/qgov/common/plugin.py index e0da4b9..2e9dc86 100644 --- a/ckanext/qgov/common/plugin.py +++ b/ckanext/qgov/common/plugin.py @@ -154,9 +154,11 @@ def make_middleware(self, app, config): if hasattr(app, 'errorhandler'): @app.errorhandler(404) def handle_not_found(e): - from flask import redirect, request + from flask import redirect, request, get_flashed_messages redirect_url = urlm.get_purl_response(request.base_url) if redirect_url: + # eat the 'page not found' message as it's obsolete + get_flashed_messages() return redirect(redirect_url, 301) else: # copy default error handling From 140f89f92c0d90d4ce57c868810b17a9159058f0 Mon Sep 17 00:00:00 2001 From: antuarc Date: Fri, 20 Sep 2024 14:47:06 +1000 Subject: [PATCH 6/6] [QOLDEV-935] drop CKAN 2.9 support - With the release of 2.11, 2.9 is no longer supported --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5a6a837..e76b9df 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,7 +25,7 @@ jobs: strategy: fail-fast: false matrix: - ckan-version: ["2.10", 2.9, 2.9-py2] + ckan-version: ["2.10"] ckan-type: ['vanilla', 'custom'] name: CKAN ${{ matrix.ckan-version }} ${{ matrix.ckan-type }}