From 9c3fd76ad59ef74f4a69eade9d174b3f77e77c2d Mon Sep 17 00:00:00 2001 From: Dan Feder Date: Fri, 14 Jul 2017 14:57:30 -0400 Subject: [PATCH 01/20] 1.13.5 Release notes. --- docs/releases/notes/1.13.5.md | 70 +++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 docs/releases/notes/1.13.5.md diff --git a/docs/releases/notes/1.13.5.md b/docs/releases/notes/1.13.5.md new file mode 100644 index 0000000000..0d164982d3 --- /dev/null +++ b/docs/releases/notes/1.13.5.md @@ -0,0 +1,70 @@ +# DKAN 1.13.4 + +This is a "patch" release of DKAN, containing bug fixes and minor +updates, but adding no new functionality. + +## Improvements in this release + +The 1.13.4 release of DKAN contains a very large number of minor fixes. +For a full list check the CHANGELOG. Noteable improvements include: + +- Some logic concerning when previews were rendered for resources has +been simplified. DKAN will now attempt to render a preview for any +resource that contains an *uploaded* or *remote* file. No *API or +Website URL* links in resources will be previewed other than with an +iframe to the URL. Note that in some cases, resources that +previously did have Recline previews may now simply display an +iframe to the remote resource. + +- Relatedly, various issues with previews for resources hosted on +external domains have been addressed. + +- Publishing options ("draft," "published" etc) were not available +when the Workflow module was enabled. This has been fixed. + +- A bug where data previews broke when a resource contained *only* +numeric data has been fixed. + +- A number of Workflow permissions issues have been resolved, allowing +users to access "stale drafts" and other data that had been hidden. + +- The groups page now lists groups alphabetically rather than by +create date. + +- Fixed the output for "language" in Project Open Data and DCAT to +be standards-compliant. + +- Fixed issues with how timestamps are applied to harvested datasets. +See below for details. + +- An existing hook_update function that upgraded from a previous version of the +Open Data Federal Extras module has been fixed to not fail when the fields are +not present. + +- The `drush dsu` command, to update a datastore from a local file, was broken +and has been restored. + +- Windows line endings are now supported on Datastore "fast imports" + +- Several issues causing the Harvester to break on large harvests have been +fixed. Remote files on servers (like Socrata) that will not supply a HEAD +request are briefly stored on disk instead of in memory to obtain metadata such +as filesize. Also, resource previews are no longer rendered for purposes of +indexing for Search API, which was causing indexing at the end of a large +harvest to fail. + +- Drupal core was updated to 7.56 and many contrib modules were updated to +their latest stable version. + +## Special Notes + +- Previous versions of DKAN provided a field "Modified Source Date" +(machine name `field_modified_source_date`) to store [Project Open +Data's "modified" property](https://project-open-data.cio.gov/v1.1/schema/#modified). +The way we capture sources' `modified` and `issued` properties has +since been revamped (see \#1802), and an update function was needed +to remove the old field. However, previous versions had put +hook\_update functions in the wrong order and some sites did not +recieve the change when updating. This release should clear up those +remaining issues on sites that still have the +`field_modified_source_date` field. From 791c90156ca582c9276ef8bfdfd13416bbfabcd1 Mon Sep 17 00:00:00 2001 From: Dan Feder Date: Fri, 14 Jul 2017 15:04:38 -0400 Subject: [PATCH 02/20] Clean up CHANGELOG --- CHANGELOG.txt | 18 +++++----- docs/releases/notes/1.13.5.md | 66 +++-------------------------------- 2 files changed, 12 insertions(+), 72 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index cfe97688df..f66a0024a4 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,16 +1,14 @@ 7.x-1.13.5 ---------- - - #2003 Fix dkan_bueditor_markdown_install() uses variable before it is initialized. - - #2003 Fix dkan_update_7016 assumes bueditor id is '5' (not always true). - - #2003 Fix dkan_topics_field_formatter_view() does not check if term exists causing drupal to throw. - - #2003 Fix dkan_default_content_disable() call to processRollback() on null. - - #2003 Fix harvest tests do not clean up. - - #1963 Allow dkanextension to handle custom fields + - #2003 Fix dkan_bueditor_markdown_install(), which was using variable before it was initialized. + - #2003 Fix to dkan_update_7016, which assumed the bueditor ID was always '5' and failed when it was not. + - #2003 Fix dkan_topics_field_formatter_view(), wich did not check if term exists causing drupal to throw. + - #2003 Make Harvest tests clean up after them selves more completely (resources, other nodes were not being cleared). + - #2003 Fix issues with registering/deregistering and rolling back default content migrations on install/uninstall. + - #2003 Fix dkan_migrate_base warning: wrong type supplied to foreach. + - #1963 Allow Behat dkanExtension to handle custom fields via devel generate - #1938 Allow skipping of features test via config - - #2003 Do not deregister default content migrations on disable. - - #2003 Deregister default content migrations on uninstall. - - #2003 Fix dkan_migrate_base warning wrong type supplied to foreach. - - #1970 DevOps: Automatically populate required fields when running behat tests. + - #1970 Automatically populate required fields when running behat tests. 7.x-1.13.4 ---------- diff --git a/docs/releases/notes/1.13.5.md b/docs/releases/notes/1.13.5.md index 0d164982d3..c388af2ee4 100644 --- a/docs/releases/notes/1.13.5.md +++ b/docs/releases/notes/1.13.5.md @@ -1,70 +1,12 @@ -# DKAN 1.13.4 +# DKAN 1.13.5 This is a "patch" release of DKAN, containing bug fixes and minor updates, but adding no new functionality. ## Improvements in this release -The 1.13.4 release of DKAN contains a very large number of minor fixes. -For a full list check the CHANGELOG. Noteable improvements include: +This is a small release adressing some minor issues in 1.13.4. The only significant change is the addition of the [devel module](https://www.drupal.org/project/devel) to DKAN core. The devel module is used by almost all Drupal developers to debug, test expiremental code, generate dummy content, and perform other developer tasks. DKAN developers are constantly adding the devel module after building DKAN, and a new set of Behat scenarios added to the test suite need to make use of the dummy content generation functions to pass. -- Some logic concerning when previews were rendered for resources has -been simplified. DKAN will now attempt to render a preview for any -resource that contains an *uploaded* or *remote* file. No *API or -Website URL* links in resources will be previewed other than with an -iframe to the URL. Note that in some cases, resources that -previously did have Recline previews may now simply display an -iframe to the remote resource. +The devel module and its submodules _will_ be disabled by default in DKAN however, and should only be enabled in development environments. Enabling devel in production should be considered a security risk. -- Relatedly, various issues with previews for resources hosted on -external domains have been addressed. - -- Publishing options ("draft," "published" etc) were not available -when the Workflow module was enabled. This has been fixed. - -- A bug where data previews broke when a resource contained *only* -numeric data has been fixed. - -- A number of Workflow permissions issues have been resolved, allowing -users to access "stale drafts" and other data that had been hidden. - -- The groups page now lists groups alphabetically rather than by -create date. - -- Fixed the output for "language" in Project Open Data and DCAT to -be standards-compliant. - -- Fixed issues with how timestamps are applied to harvested datasets. -See below for details. - -- An existing hook_update function that upgraded from a previous version of the -Open Data Federal Extras module has been fixed to not fail when the fields are -not present. - -- The `drush dsu` command, to update a datastore from a local file, was broken -and has been restored. - -- Windows line endings are now supported on Datastore "fast imports" - -- Several issues causing the Harvester to break on large harvests have been -fixed. Remote files on servers (like Socrata) that will not supply a HEAD -request are briefly stored on disk instead of in memory to obtain metadata such -as filesize. Also, resource previews are no longer rendered for purposes of -indexing for Search API, which was causing indexing at the end of a large -harvest to fail. - -- Drupal core was updated to 7.56 and many contrib modules were updated to -their latest stable version. - -## Special Notes - -- Previous versions of DKAN provided a field "Modified Source Date" -(machine name `field_modified_source_date`) to store [Project Open -Data's "modified" property](https://project-open-data.cio.gov/v1.1/schema/#modified). -The way we capture sources' `modified` and `issued` properties has -since been revamped (see \#1802), and an update function was needed -to remove the old field. However, previous versions had put -hook\_update functions in the wrong order and some sites did not -recieve the change when updating. This release should clear up those -remaining issues on sites that still have the -`field_modified_source_date` field. +All other improvements are minor issues related to installation and tests that arose during deployments of DKAN 1.13.4. From 820c357c620727af3a2201bb788c8d8a14ae6b60 Mon Sep 17 00:00:00 2001 From: David Kinzer Date: Thu, 20 Jul 2017 14:52:00 -0400 Subject: [PATCH 03/20] Multiple devops and test fixes - see description (#2018) * 1.13.5 release notes (#2009) * 1.13.5 Release notes. * Clean up CHANGELOG * Couple more changleog corrections/ * Last minute fixes * Add custom filelds and test tags. * Allow skipping of some tests. * Add custom fields. * Reconcile PR1943 with the 1.13.5 release * Remove changes on user.admin.feature * code review on .ht.router.php * Fix user.admin.feature * Add BeforeSuite file shiv. REF CIVIC-6610 When stage file proxy is enabled we need to make sure some required files are present in public:// By adding a BeforeSuite step that copies these files from a site to the local environment, we fix errors that arise from files not being present in the testing environment. * Docker Local Environment Updates (#1955) * Docker fix for mysql args * Changes from docker-machine to docker, fixed uli * Added 'ahoy docker hostfile' to add to /etc/hosts * Make backwards compatible with docker-machine. * Make backwards compatible with docker-machine. Missed this one. * Add dkan-uli.rb script. Will handle function for `ahoy dkan uli`. * Move uli command back to dkan.ahoy.yml * Update CHANGELOG. * Remove .ahoy.yml uli command. Backports #1955 into 1.13.5 * Remove CHANGELOG updates. * Remove CHANGELOG changes. * Revert "Remove CHANGELOG changes." This reverts commit 108d7c2d8075a325c0af7e681153b1ec127282f0. * Revert "Remove CHANGELOG updates." This reverts commit 3b02c2a0b18bc535d54c53f2e0ffbe0bdbdae137. * Release notes for 1.13.6 --- .ahoy/.scripts/.ht.router.php | 42 +++++++ .ahoy/.scripts/config.rb | 19 +++- .ahoy/.scripts/dkan-uli.rb | 16 +++ .ahoy/.scripts/drupal-rebuild.sh | 9 +- .ahoy/.scripts/server.sh | 12 ++ .ahoy/dkan.ahoy.yml | 33 +++--- .ahoy/docker-compose.yml | 19 +++- .ahoy/docker.ahoy.yml | 106 +++++++++++++++--- CHANGELOG.txt | 12 +- circle.yml | 2 +- docs/releases/notes/1.13.5.md | 2 +- docs/releases/notes/1.13.6.md | 5 + drupal-org.make | 2 +- .../dkan_dataset_groups.views_default.inc | 5 +- ...est_dashboard.features.user_permission.inc | 42 ------- .../dkan_migrate_base.module | 2 + test/README.md | 31 +++++ .../DKANExtension/Context/DatasetContext.php | 2 + .../DKANExtension/Context/PODContext.php | 9 +- .../DKANExtension/Context/RawDKANContext.php | 41 +++++++ .../DKANExtension/Context/ServicesContext.php | 2 + test/features/dataset.author.feature | 4 +- test/features/dataset_rest_api.feature | 10 +- test/features/datastore.feature | 2 +- test/features/group.all.feature | 5 +- test/features/pod.feature | 18 +-- test/features/user.admin.feature | 2 + test/features/user.all.feature | 18 +-- test/features/workflow.feature | 42 +++---- 29 files changed, 376 insertions(+), 138 deletions(-) create mode 100644 .ahoy/.scripts/.ht.router.php create mode 100644 .ahoy/.scripts/dkan-uli.rb create mode 100644 .ahoy/.scripts/server.sh create mode 100644 docs/releases/notes/1.13.6.md delete mode 100644 modules/dkan/dkan_harvest/modules/dkan_harvest_dashboard/dkan_harvest_dashboard.features.user_permission.inc diff --git a/.ahoy/.scripts/.ht.router.php b/.ahoy/.scripts/.ht.router.php new file mode 100644 index 0000000000..9fa2cfcd88 --- /dev/null +++ b/.ahoy/.scripts/.ht.router.php @@ -0,0 +1,42 @@ += 3.0 +# TODO: replace defaults with custom deep_merge + begin CONFIG = YAML.load_file("config/config.yml") rescue Exception => msg puts "Loading of Configuration errored out with: #{msg}." puts "Using default CONFIG instead." - CONFIG = {"circle" => {"skip_features" => []}} + CONFIG = {} +end + +if not CONFIG.has_key? "circle" + CONFIG["circle"] = {} end +if not CONFIG["circle"].has_key? "skip_features" + CONFIG["circle"]["skip_features"] = [] +end +if not CONFIG.has_key? "default" + CONFIG["default"] = {} +end + +if not CONFIG["default"].has_key? "https_everywhere" + CONFIG["default"]["https_everywhere"] = false +end diff --git a/.ahoy/.scripts/dkan-uli.rb b/.ahoy/.scripts/dkan-uli.rb new file mode 100644 index 0000000000..0ab500957e --- /dev/null +++ b/.ahoy/.scripts/dkan-uli.rb @@ -0,0 +1,16 @@ +require "./dkan/.ahoy/.scripts/config.rb" + +if CONFIG["default"]["https_everywhere"] + url="surl" +else + url="url" +end + +url=`ahoy drush --uri="$(ahoy docker #{url})" uli` +os =`uname` + +if os =~ /Darwin/ + `open #{url}` +else + puts url +end diff --git a/.ahoy/.scripts/drupal-rebuild.sh b/.ahoy/.scripts/drupal-rebuild.sh index 0c2271249c..51fdcf4d0a 100644 --- a/.ahoy/.scripts/drupal-rebuild.sh +++ b/.ahoy/.scripts/drupal-rebuild.sh @@ -12,8 +12,13 @@ fi drush --root=docroot make --concurrency=$concurrency --prepare-install dkan/drupal-org-core.make docroot --yes -drush --root=docroot -y --verbose $root si minimal --sites-subdir=default --account-pass='admin' --db-url=$1 install_configure_form.update_status_module='array(false,false)' && +drush --root=docroot -y --verbose si minimal --sites-subdir=default --account-pass='admin' --db-url=$1 install_configure_form.update_status_module='array(false,false)' && ln -s ../../dkan docroot/profiles/dkan chmod +w docroot/sites/default/settings.php -printf "// DKAN Datastore Fast Import options.\n\$databases['default']['default']['pdo'] = array(\n PDO::MYSQL_ATTR_LOCAL_INFILE => 1,\n PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => 1,\n);" >> docroot/sites/default/settings.php + +if [ "$AHOY_CMD_PROXY" = "DOCKER" ]; then + printf "// Docker Database Settings\n\$databases['default']['default'] = array(\n 'database' => 'drupal',\n 'username' => 'drupal',\n 'password' => '123',\n 'host' => 'db',\n 'port' => '',\n 'driver' => 'mysql',\n 'prefix' => '',\n);\n" >> docroot/sites/default/settings.php +fi +printf "// DKAN Datastore Fast Import options.\n\$databases['default']['default']['pdo'] = array(\n PDO::MYSQL_ATTR_LOCAL_INFILE => 1,\n PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => 1,\n);\n" >> docroot/sites/default/settings.php + chmod -w docroot/sites/default/settings.php diff --git a/.ahoy/.scripts/server.sh b/.ahoy/.scripts/server.sh new file mode 100644 index 0000000000..7cab895b8d --- /dev/null +++ b/.ahoy/.scripts/server.sh @@ -0,0 +1,12 @@ + +if [ "$HOSTNAME" = "cli" ]; then + HOST=cli +else + HOST=localhost +fi + +cp ./dkan/.ahoy/.scripts/.ht.router.php ./docroot/ +cd ./docroot + +echo $HOST +php -S $HOST:8888 .ht.router.php \ No newline at end of file diff --git a/.ahoy/dkan.ahoy.yml b/.ahoy/dkan.ahoy.yml index 73a22ae0c8..b274405668 100644 --- a/.ahoy/dkan.ahoy.yml +++ b/.ahoy/dkan.ahoy.yml @@ -4,11 +4,14 @@ commands: drupal-rebuild: usage: 'Builds a drupal site in ./docroot. Requires database url.' cmd: | - if [ "$AHOY_CMD_PROXY" != "DOCKER" ]; then - ARGS="{{args}}" - else + if [ "$AHOY_CMD_PROXY" = "DOCKER" ]; then ARGS=`ahoy docker mysql-url` fi + + # If no mysql URL from docker, use passed in args. + if [ "$ARGS" = "" ];then + ARGS="{{args}}" + fi if [[ "$ARGS" != mysql* ]]; then echo "You need to specify the drupal db url to use in the form mysql://root:root@localhost/db as an argument." exit 1 @@ -44,9 +47,11 @@ commands: mkdir backups fi if [ -f backups/last_install.sql ] && ahoy confirm "An existing installation backup exists at backups/last_install.sql, do you want to use that instead of reinstalling from scratch?"; then - ahoy drush sql-drop -y - ahoy drush cc all - ahoy drush sql-cli < backups/last_install.sql + + ahoy drush sql-drop -y && \ + echo "... Removed tables, restoring DB" + ahoy dkan sqlc < backups/last_install.sql + echo "Installed dkan from backup" else if [ "$AHOY_CMD_PROXY" == "DOCKER" ]; then @@ -193,15 +198,13 @@ commands: import: dkan/.ahoy/theme.ahoy.yml hide: true + # Moved to .ahoy.yml uli: - usage: log into the + usage: Log in via drush cmd: | - uli=$(ahoy drush uli {{args}} | sed 's/^http.*\/default\/\(.*$\)/\1/g') - url="$(ahoy docker url)/$uli" - os=$(uname) + ruby dkan/.ahoy/.scripts/dkan-uli.rb {{args}} - if [ "$os" = "Darwin" ]; then - open $url - else - echo $url - fi + server: + usage: Provided as an easy way to setup the php server during testing. + cmd: + ahoy cmd-proxy bash dkan/.ahoy/.scripts/server.sh diff --git a/.ahoy/docker-compose.yml b/.ahoy/docker-compose.yml index aa5fbc77fc..cde5b8155e 100644 --- a/.ahoy/docker-compose.yml +++ b/.ahoy/docker-compose.yml @@ -5,12 +5,17 @@ web: hostname: web image: nuams/drupal-apache-php:1.0-5.6 + # Fix for docker for mac container not starting selenium + # https://forums.docker.com/t/space-in-new-no-proxy-env-var-breaking-old-containers/14075 + environment: - VIRTUAL_HOST=dkan.docker + - no_proxy=localhost #- VIRTUAL_PROTO=https ports: - "80" - "443" + - "8888" volumes: # PHP configuration overrides - "./.docker/etc/php5/php.ini:/etc/php5/fpm/conf.d/z_php.ini" @@ -49,6 +54,7 @@ cli: environment: - XDEBUG_CONFIG=idekey=cli - PHP_IDE_CONFIG=serverName=dkan.docker + - VIRTUAL_HOST=dkan.docker volumes: # PHP configuration overrides - "./.docker/etc/php5/php-cli.ini:/etc/php5/cli/conf.d/z_php.ini" @@ -64,6 +70,8 @@ cli: - browser - memcached - solr + ports: + - "8888" # Memcached node # Uncomment the service definition section below and the link in the web service above to start using memcached. @@ -96,16 +104,21 @@ browser: - /dev/shm:/dev/shm # Project root folder mapping - *project_root + links: - web ports: - # - "4444:4444" - "5900" + # Fix for docker for mac container not starting selenium + # https://forums.docker.com/t/space-in-new-no-proxy-env-var-breaking-old-containers/14075 + environment: + - no_proxy=localhost + solr: hostname: solr image: devinci/drupal-solr:3.x - #ports: - # - "8983:8983" + ports: + - "8983" volumes: - "./.docker/etc/solr/3.x:/var/lib/solr/conf" diff --git a/.ahoy/docker.ahoy.yml b/.ahoy/docker.ahoy.yml index bb29fcc9c1..5bf0eeaadc 100644 --- a/.ahoy/docker.ahoy.yml +++ b/.ahoy/docker.ahoy.yml @@ -5,39 +5,98 @@ commands: cmd: | cat << EOF # To initialize your environment to use docker. - # Run: eval \$(ahoy docker env) + # Run: eval "\$(ahoy docker env)" # OR # Add the following to your ~/.bashrc which docker || (echo "you don't seem to have docker installed. Exiting."; exit 1) - which docker-machine || (echo "you don't seem to have docker-machine installed. Exiting."; exit 1) which docker-compose || (echo "you don't seem to have docker-compose installed. Exiting."; exit 1) echo "Setting up docker environment" export AHOY_CMD_PROXY=DOCKER - docker-machine start default - $(docker-machine env default) + which docker-machine || (echo "you don't seem to have docker-machine installed. Exiting."; exit 1) + if [ ! -z "$DOCKER_MACHINE_NAME" ]; then + docker-machine start default + $(docker-machine env default) + fi + ahoy docker up EOF usage: Outputs the commands needed to setup a docker environment. + hostfile: + cmd: | + ip_address="127.0.0.1" + host_name="dkan.docker" + # find existing instances in the host file and save the line numbers + matches_in_hosts="$(grep -n $host_name /etc/hosts | cut -f1 -d:)" + host_entry="${ip_address} ${host_name}" + + if [ -z "$matches_in_hosts" ];then + echo "Adding new hosts entry." + echo "$host_entry" | sudo tee -a /etc/hosts > /dev/null + fi up: - cmd: "ahoy docker compose up -d {{args}}" + cmd: | + if [ -z $AHOY_CMD_PROXY ]; then + echo "AHOY_CMD_PROXY is not set. Run 'ahoy docker env' and follow instructions." + exit 0 + fi + ahoy docker compose up -d {{args}} + ahoy docker proxy-up + ahoy docker hostfile usage: Start the docker-compose containers. proxy-up: - cmd: "docker run -d -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock:ro jwilder/nginx-proxy" + cmd: | + proxy_image=jwilder/nginx-proxy + # Check if the proxy container is running. + if [ ! "$(docker ps -f name=dkan_proxy -f ancestor=$proxy_image -q)" ];then + # Check if the proxy container stopped. + if [ "$(docker ps -f name=dkan_proxy -f ancestor=$proxy_image -qa)" ];then + echo "Restarting dkan_proxy container" + docker start dkan_proxy + else + echo "Starting dkan_proxy container" + docker run -d --privileged \ + -p 80:80 -p 443:443 -p 5959:5900 \ + -v /var/run/docker.sock:/tmp/docker.sock:ro \ + --name=dkan_proxy jwilder/nginx-proxy + fi + fi usage: Run the nginx-proxy container stop: - cmd: "ahoy docker compose stop" + cmd: | + ahoy docker compose stop + proxy_image=jwilder/nginx-proxy + if [ ! -z "$(docker ps -f name=dkan_proxy -f ancestor=$proxy_image -q)" ];then + echo "Stopping dkan_proxy container" + docker stop dkan_proxy + fi usage: Stop the docker-compose containers (non-destructive). ps: cmd: "ahoy docker compose ps" usage: List the running docker-compose containers. + + # Alias for web-ip. ip: - cmd: "docker-machine ip default" - usage: Show the ip address f the default docker machine VM + cmd: | + if [ -z "$DOCKER_MACHINE_NAME" ]; then + ahoy docker web-ip + else + docker-machine ip default + fi + + usage: Show the ip address of the web container reset: - cmd: "ahoy docker compose stop && ahoy docker compose rm && ahoy docker compose up -d" + cmd: | + ahoy docker destroy + ahoy docker up usage: Destroy and then restart the docker compose containers. destroy: - cmd: "ahoy docker compose stop && ahoy docker compose rm" + cmd: | + ahoy docker stop + ahoy docker compose rm + proxy_image=jwilder/nginx-proxy + if [ ! -z "$(docker ps -f name=dkan_proxy -f ancestor=$proxy_image -all -q)" ];then + docker rm dkan_proxy + fi usage: Destroy all the docker compose containers. (use before deleting folder) exec: cmd: | @@ -82,18 +141,37 @@ commands: compose: cmd: docker-compose -f dkan/.ahoy/docker-compose.yml -p "${PWD##*/}" {{args}} usage: Abstraction for docker-compose + web-host: + cmd: | + echo `ahoy docker exec web printenv VIRTUAL_HOST | tr -d '\r'` + web-ip: + usage: Prints the web container IP address + cmd: | + echo `docker inspect --format '{{ .NetworkSettings.IPAddress }}' $(ahoy docker compose ps -q web)` url: usage: Prints the project URL cmd: | - echo "http://`docker-machine ip default`:`ahoy docker compose port web 80|cut -d ':' -f2`" + if [ -z "$DOCKER_MACHINE_NAME" ]; then + echo "http://`ahoy docker web-host`" + else + echo "http://`docker-machine ip default`:`ahoy docker compose port web 80|cut -d ':' -f2`" + fi surl: usage: Prints a secure project URL cmd: | - echo "https://`docker-machine ip default`:`ahoy docker compose port web 443|cut -d ':' -f2`" + if [ -z "$DOCKER_MACHINE_NAME" ]; then + echo "https://`ahoy docker web-host`:`ahoy docker compose port web 443|cut -d ':' -f2`" + else + echo "https://`docker-machine ip default`:`ahoy docker compose port web 443|cut -d ':' -f2`" + fi vnc: usage: Prints the project VNC URL cmd: | - echo "`docker-machine ip default`:`ahoy docker compose port browser 5900|cut -d ':' -f2`" + if [ -z "$DOCKER_MACHINE_NAME" ]; then + echo "https://`ahoy docker web-host`:`ahoy docker compose port browser 5900|cut -d ':' -f2`" + else + echo "`docker-machine ip default`:`ahoy docker compose port browser 5900|cut -d ':' -f2`" + fi cleanup: usage: Clean ups docker unused images and volumes. See http://blog.yohanliyanage.com/2015/05/docker-clean-up-after-yourself/. diff --git a/CHANGELOG.txt b/CHANGELOG.txt index f66a0024a4..1cb7e078ec 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,14 +1,18 @@ +7.x-1.13.6 +---------- + - #2018 Additional test/devops improvements needed for deployment. See #2012, #2014, #2015 and #2016 for specifics. + 7.x-1.13.5 ---------- - - #2003 Fix dkan_bueditor_markdown_install(), which was using variable before it was initialized. + - #2003 Fix dkan_bueditor_markdown_install(), which was using a variable before it was initialized. - #2003 Fix to dkan_update_7016, which assumed the bueditor ID was always '5' and failed when it was not. - - #2003 Fix dkan_topics_field_formatter_view(), wich did not check if term exists causing drupal to throw. - - #2003 Make Harvest tests clean up after them selves more completely (resources, other nodes were not being cleared). + - #2003 Fix dkan_topics_field_formatter_view(), which does not check if a term exists before calling it by tid. + - #2003 Make Harvest tests clean up after themselves more completely (resources, other nodes were not being cleared). - #2003 Fix issues with registering/deregistering and rolling back default content migrations on install/uninstall. - #2003 Fix dkan_migrate_base warning: wrong type supplied to foreach. - #1963 Allow Behat dkanExtension to handle custom fields via devel generate - #1938 Allow skipping of features test via config - - #1970 Automatically populate required fields when running behat tests. + - #1970 DevOps: Automatically populate required fields when running behat tests. 7.x-1.13.4 ---------- diff --git a/circle.yml b/circle.yml index 169f9000e3..adf47e9d90 100644 --- a/circle.yml +++ b/circle.yml @@ -60,7 +60,7 @@ dependencies: - 'PATH=/home/ubuntu/.config/composer/vendor/bin:$PATH ahoy drush --yes en dkan_harvest dkan_harvest_datajson dkan_harvest_dashboard' - 'PATH=/home/ubuntu/.config/composer/vendor/bin:$PATH ahoy drush cc all' # Run a webserver using drush. - - 'PATH=/home/ubuntu/.config/composer/vendor/bin:$PATH ahoy drush --yes runserver :8888': + - 'PATH=/home/ubuntu/.config/composer/vendor/bin:$PATH ahoy dkan server': background: true # Setup display for selenium diff --git a/docs/releases/notes/1.13.5.md b/docs/releases/notes/1.13.5.md index c388af2ee4..d88a7d58d0 100644 --- a/docs/releases/notes/1.13.5.md +++ b/docs/releases/notes/1.13.5.md @@ -9,4 +9,4 @@ This is a small release adressing some minor issues in 1.13.4. The only signific The devel module and its submodules _will_ be disabled by default in DKAN however, and should only be enabled in development environments. Enabling devel in production should be considered a security risk. -All other improvements are minor issues related to installation and tests that arose during deployments of DKAN 1.13.4. +All other improvements are minor issues related to installation and tests that arose during deployments of DKAN 1.13.4. Check the CHANGELOG and [Pull Request #2003](https://github.com/NuCivic/dkan/pull/2003) where most of these changes are captured. diff --git a/docs/releases/notes/1.13.6.md b/docs/releases/notes/1.13.6.md new file mode 100644 index 0000000000..175be198ee --- /dev/null +++ b/docs/releases/notes/1.13.6.md @@ -0,0 +1,5 @@ +# DKAN 1.13.6 + +This is a "patch" release of DKAN, containing bug fixes and minor updates, but adding no new functionality. + +All changes aside from minor module updates are for test and devops issues. diff --git a/drupal-org.make b/drupal-org.make index 01ad4fb79b..01b1d4f05f 100644 --- a/drupal-org.make +++ b/drupal-org.make @@ -407,4 +407,4 @@ libraries: directory_name: spyc defaults: projects: - subdir: contrib + subdir: contrib \ No newline at end of file diff --git a/modules/dkan/dkan_dataset/modules/dkan_dataset_groups/dkan_dataset_groups.views_default.inc b/modules/dkan/dkan_dataset/modules/dkan_dataset_groups/dkan_dataset_groups.views_default.inc index 99cb37341d..f7571c0153 100644 --- a/modules/dkan/dkan_dataset/modules/dkan_dataset_groups/dkan_dataset_groups.views_default.inc +++ b/modules/dkan/dkan_dataset/modules/dkan_dataset_groups/dkan_dataset_groups.views_default.inc @@ -300,7 +300,10 @@ function dkan_dataset_groups_views_default_views() { $handler = $view->new_display('default', 'Master', 'default'); $handler->display->display_options['title'] = 'DKAN OG Extras group members (User)'; $handler->display->display_options['use_more_always'] = FALSE; - $handler->display->display_options['access']['type'] = 'perm'; + $handler->display->display_options['access']['type'] = 'role'; + $handler->display->display_options['access']['role'] = array( + 2 => '2', + ); $handler->display->display_options['cache']['type'] = 'none'; $handler->display->display_options['query']['type'] = 'views_query'; $handler->display->display_options['exposed_form']['type'] = 'basic'; diff --git a/modules/dkan/dkan_harvest/modules/dkan_harvest_dashboard/dkan_harvest_dashboard.features.user_permission.inc b/modules/dkan/dkan_harvest/modules/dkan_harvest_dashboard/dkan_harvest_dashboard.features.user_permission.inc deleted file mode 100644 index 9d706b856b..0000000000 --- a/modules/dkan/dkan_harvest/modules/dkan_harvest_dashboard/dkan_harvest_dashboard.features.user_permission.inc +++ /dev/null @@ -1,42 +0,0 @@ - 'use Rules component rules_dkan_harvest_source_cache', - 'roles' => array( - 'administrator' => 'administrator', - ), - 'module' => 'rules', - ); - - // Exported permission: 'use Rules component rules_dkan_harvest_source_cache_and_migrate'. - $permissions['use Rules component rules_dkan_harvest_source_cache_and_migrate'] = array( - 'name' => 'use Rules component rules_dkan_harvest_source_cache_and_migrate', - 'roles' => array( - 'administrator' => 'administrator', - ), - 'module' => 'rules', - ); - - // Exported permission: 'use Rules component rules_dkan_harvest_source_migrate'. - $permissions['use Rules component rules_dkan_harvest_source_migrate'] = array( - 'name' => 'use Rules component rules_dkan_harvest_source_migrate', - 'roles' => array( - 'administrator' => 'administrator', - ), - 'module' => 'rules', - ); - - return $permissions; -} diff --git a/modules/dkan/dkan_migrate_base/dkan_migrate_base.module b/modules/dkan/dkan_migrate_base/dkan_migrate_base.module index 86e4b0aa68..d1a2f67037 100644 --- a/modules/dkan/dkan_migrate_base/dkan_migrate_base.module +++ b/modules/dkan/dkan_migrate_base/dkan_migrate_base.module @@ -5,6 +5,8 @@ * Required module file. */ +include_once 'dkan_migrate_base.migrate.inc'; + /** * We should pull out this from here to another more generic module. * diff --git a/test/README.md b/test/README.md index 1b943f46d6..19dadf165a 100644 --- a/test/README.md +++ b/test/README.md @@ -16,6 +16,37 @@ Assuming you have a working DKAN installation you wish to test on: Your tests should run from the VM and use your host machine as a Selenium server, meaning any Selenium tests will run in an instance of Chrome on your machine. + +### Behat Tags + - **@add_ODFE** Enables ODFE + - **@ahoyRunMe** label only + - **@api** Enables the Drupal API Driver + - **@customizable** Exclude scenario on client sites when testing customizable functionality + - **@datastore** Drops the table after testing + - **@deleteTempUsers** Delete any tempusers that were created outside of 'Given users' + - **@disablecaptcha** Disables captcha config if it is enabled, then restores config after the test + - **@dkanBug** label only + - **@enableFastImport** Enables fast import + - **@enableDKAN_Workflow** Enables dkan_workflow + - **@fixme** label only + - **@globalUser** Populates the global user with the current user + - **@javascript** switches the current Mink session to Selenium2 + - **@mail** Setup the testing mail system, then restore original mail system + - **@no-main-menu** used to skip tests that requires a link in the main menu + - **@noworkflow** label only + - **@ok** label only + - **@pod_json_valid** label only + - **@pod_json_odfe** label only + - **@remove_ODFE** Disables ODFE + - **@testBug** label only + - **@timezone** Sets the timezone for tests and restores the timezone afterwards. + - **@Topics** label only + + **Unique tag per scenario pattern** + + To allow customized sites to skip specific tests we are adding a unique tag to every scenario. The pattern is the feature name followed by a two digit numerical value. So the pod.feature scenarios are tagged like this: @pod_01, @pod_02, @pod_03, etc. + + ## PHPUnit tests Starting from 1.13 PHPUnit tests were added into DKAN core. All tests can be found inside the `/phpunit` directory separated in different test suites, one per DKAN module. diff --git a/test/dkanextension/src/Drupal/DKANExtension/Context/DatasetContext.php b/test/dkanextension/src/Drupal/DKANExtension/Context/DatasetContext.php index 52c94dcae0..76f672c087 100644 --- a/test/dkanextension/src/Drupal/DKANExtension/Context/DatasetContext.php +++ b/test/dkanextension/src/Drupal/DKANExtension/Context/DatasetContext.php @@ -36,6 +36,8 @@ public function __construct() { 'attest quality' => 'field_hhs_attestation_quality', 'bureau code' => 'field_odfe_bureau_code', 'license' => 'field_license', + 'doi' => 'field_doi', + 'citation' => 'field_citation', ), array( 'moderation', diff --git a/test/dkanextension/src/Drupal/DKANExtension/Context/PODContext.php b/test/dkanextension/src/Drupal/DKANExtension/Context/PODContext.php index 486e9ec13d..fbfa87a009 100644 --- a/test/dkanextension/src/Drupal/DKANExtension/Context/PODContext.php +++ b/test/dkanextension/src/Drupal/DKANExtension/Context/PODContext.php @@ -34,19 +34,12 @@ public function gatherContexts(BeforeScenarioScope $scope){ */ public function iSeeAValidDataJson($should) { - // Change /data.json path to /json during tests. The '.' on the filename breaks tests on CircleCI's server. $data_json = open_data_schema_map_api_load('data_json_1_1'); - if ($data_json->endpoint !== 'json') { - $data_json->endpoint = 'json'; - drupal_write_record('open_data_schema_map', $data_json, 'id'); - drupal_static_reset('open_data_schema_map_api_load_all'); - menu_rebuild(); - } // Get base URL. $url = $this->getMinkParameter('base_url') ? $this->getMinkParameter('base_url') : "http://127.0.0.1::8888"; // Validate POD. - $results = open_data_schema_pod_process_validate($url . '/json', TRUE); + $results = open_data_schema_pod_process_validate($url . '/data.json', TRUE); if ($results['errors'] && $should === 'should') { throw new \Exception(sprintf('Data.json is not valid.')); } diff --git a/test/dkanextension/src/Drupal/DKANExtension/Context/RawDKANContext.php b/test/dkanextension/src/Drupal/DKANExtension/Context/RawDKANContext.php index 1d1d30faf5..5372491d7f 100644 --- a/test/dkanextension/src/Drupal/DKANExtension/Context/RawDKANContext.php +++ b/test/dkanextension/src/Drupal/DKANExtension/Context/RawDKANContext.php @@ -67,6 +67,43 @@ public static function disableAdminMenuCache(BeforeSuiteScope $scope) { variable_set('admin_menu_cache_client', FALSE); } + /** + * @BeforeSuite + */ + public static function moveStageFileProxyFiles(BeforeSuiteScope $scope) { + // Only need to run this once. + if (variable_get('stage_file_proxy_setup', FALSE)) { + return; + } + + global $conf; + if (!isset($conf['default']['stage_file_proxy_origin']) || $conf['default']['stage_file_proxy_origin'] == 'changeme') { + return; + } + + // Fix missing font files. + $font_files = array('eot', 'svg', 'ttf', 'woff'); + + // Add the file usage. + foreach ($font_files as $ext) { + $filename = 'dkan-topics'; + $theme_path = drupal_get_path('theme', 'nuboot_radix'); + $source = $theme_path . '/assets/fonts/' . $filename . '.' . $ext; + $destination = 'public://' . $filename . '.' . $ext; + copy($source, $destination); + } + + if (isset($conf['default']['stage_file_proxy_files'])) { + $proxy_files = (array) $conf['default']['stage_file_proxy_files']; + foreach ($proxy_files as $file) { + $source = $conf['default']['stage_file_proxy_origin'] . '/' . $file; + $destination = 'public://' . $file; + $copy($source, $destination); + } + } + variable_set('stage_file_proxy_setup', TRUE); + } + /** * @AfterSuite */ @@ -89,6 +126,8 @@ public function beforeCaptcha() module_load_include('inc', 'captcha', 'captcha'); variable_set('disable_captcha', TRUE); captcha_set_form_id_setting('user_login', 'none'); + captcha_set_form_id_setting('user_pass', 'none'); + captcha_set_form_id_setting('user_register_form', 'none'); captcha_set_form_id_setting('feedback_node_form', 'none'); captcha_set_form_id_setting('comment_node_feedback_form', 'none'); } @@ -131,6 +170,8 @@ public function afterCaptcha() module_load_include('inc', 'captcha', 'captcha'); variable_set('disable_captcha', FALSE); captcha_set_form_id_setting('user_login', 'default'); + captcha_set_form_id_setting('user_pass', 'none'); + captcha_set_form_id_setting('user_register_form', 'none'); captcha_set_form_id_setting('feedback_node_form', 'default'); captcha_set_form_id_setting('comment_node_feedback_form', 'default'); } diff --git a/test/dkanextension/src/Drupal/DKANExtension/Context/ServicesContext.php b/test/dkanextension/src/Drupal/DKANExtension/Context/ServicesContext.php index 4aed627bfc..a22720bc85 100644 --- a/test/dkanextension/src/Drupal/DKANExtension/Context/ServicesContext.php +++ b/test/dkanextension/src/Drupal/DKANExtension/Context/ServicesContext.php @@ -43,6 +43,8 @@ class ServicesContext extends RawDKANContext { 'attest quality' => 'field_hhs_attestation_quality[und]', 'bureau code' => 'field_odfe_bureau_code[und]', 'license' => 'field_license[und][select]', + 'doi' => 'field_doi[und][0][value]', + 'citation' => 'field_citation[und][0][value]', ), ); diff --git a/test/features/dataset.author.feature b/test/features/dataset.author.feature index 0153edcb91..e62ab22a77 100644 --- a/test/features/dataset.author.feature +++ b/test/features/dataset.author.feature @@ -64,7 +64,7 @@ Feature: Dataset Features | Resource 05 | | Katie | Yes | Dataset 08 | | | Resource 06 | Group 02 | Katie | Yes | Dataset 09 | | - @noworkflow + @noworkflow @dataset_author_1 Scenario: Create dataset as content creator Given I am logged in as "Katie" And I am on "Add Dataset" page @@ -76,7 +76,7 @@ Feature: Dataset Features And I press "Next: Add data" Then I should see "Test Dataset has been created" - @noworkflow + @noworkflow @dataset_author_2 Scenario: Save using Additional Info Given I am logged in as a user with the "content creator" role And I am on "Add Dataset" page diff --git a/test/features/dataset_rest_api.feature b/test/features/dataset_rest_api.feature index 25becbcf42..4b246462b9 100644 --- a/test/features/dataset_rest_api.feature +++ b/test/features/dataset_rest_api.feature @@ -20,6 +20,7 @@ Feature: DKAN Dataset REST API | title | published | | Group 01 | Yes | + @dataset_rest_api_01 Scenario: Create a Resource using the 'Dataset REST API' endpoint Given I am on "Search Resources" page Then I should not see "Resource 02" @@ -30,7 +31,7 @@ Feature: DKAN Dataset REST API When I am on "Search Resources" page Then I should see "Resource 02" - @api + @dataset_rest_api_02 @api Scenario: Attach files to Resources using the 'Dataset REST API' endpoint Given I am on "Resource 01" page Then I should not see "Polling_Places_Madison" @@ -48,6 +49,7 @@ Feature: DKAN Dataset REST API And I click "Manage Datastore" Then I should not see "No imported items" + @dataset_rest_api_03 Scenario: Update a Resource using the 'Dataset REST API' endpoint Given I am on "Resource 01" page Then I should not see "The description was modified" @@ -58,6 +60,7 @@ Feature: DKAN Dataset REST API When I am on "Resource 01" page Then I should see "The description was modified" + @dataset_rest_api_04 Scenario: Delete a Resource using the 'Dataset REST API' endpoint Given I am on "Search Resources" page Then I should see "Resource 01" @@ -66,6 +69,7 @@ Feature: DKAN Dataset REST API When I am on "Search Resources" page Then I should not see "Resource 01" + @dataset_rest_api_05 Scenario: Create a Dataset using the 'Dataset REST API' endpoint Given I am on "Search Datasets" page Then I should not see "Dataset 02" @@ -78,6 +82,7 @@ Feature: DKAN Dataset REST API And I am on "/dataset/dataset-02" Then I should see "Resource 01" + @dataset_rest_api_06 Scenario: Update a Dataset using the 'Dataset REST API' endpoint Given I am on "Dataset 01" page Then I should not see "The description was modified" @@ -88,6 +93,7 @@ Feature: DKAN Dataset REST API When I am on "Dataset 01" page Then I should see "The description was modified" + @dataset_rest_api_07 Scenario: Delete a Dataset using the 'Dataset REST API' endpoint Given I am on "Search Datasets" page Then I should see "Dataset 01" @@ -95,5 +101,3 @@ Feature: DKAN Dataset REST API And I use the "dataset rest api" endpoint to delete the node "Dataset 01" When I am on "Search Datasets" page Then I should not see "Dataset 01" - - diff --git a/test/features/datastore.feature b/test/features/datastore.feature index 0c850d5951..d73f746fc6 100644 --- a/test/features/datastore.feature +++ b/test/features/datastore.feature @@ -53,7 +53,7 @@ Feature: Datastore Then I wait for "DKAN Datastore Link Importer: Status" When I press "Import" And I wait for "2 imported items total." - When I click "Data API" + When I click "Data API" in the "primary tabs" region Then I wait for "Example Query" When I click "Manage Datastore" Then I wait for "DKAN Datastore Link Importer: Status" diff --git a/test/features/group.all.feature b/test/features/group.all.feature index 56d41983f3..a8891ba2dd 100644 --- a/test/features/group.all.feature +++ b/test/features/group.all.feature @@ -75,6 +75,7 @@ Feature: Site Manager administer groups When I follow "Groups" And I should not see "Group 03" + @customizable Scenario: View the details of a published group Given I am on "Groups" page When I follow "Group 01" @@ -85,6 +86,7 @@ Feature: Site Manager administer groups Given I am on "Group 01" page Then I should see "2 datasets" in the "content" region + @customizable Scenario: View the correct count of datasets Given I am on "Groups" page Then I should see "11 datasets" @@ -92,7 +94,8 @@ Feature: Site Manager administer groups Then I should see "Displaying 1 - 10 of 11 datasets" Scenario: View the list of group members - Given I am on "Group 01" page + Given I am logged in as "Gabriel" + And I am on "Group 01" page When I click "Members" in the "group block" region Then I should see "Gabriel" in the "group members" region And I should see "Katie" in the "group members" region diff --git a/test/features/pod.feature b/test/features/pod.feature index 59646bf92b..2ff1d5c43c 100644 --- a/test/features/pod.feature +++ b/test/features/pod.feature @@ -5,23 +5,23 @@ Feature: Project Open Data + Open Data Federal Extras As a dataset creator I want to create datasets with POD fields and publish them with data.json - @pod_json_valid @api @noworkflow + @pod_01 @pod_json_valid @api @noworkflow Scenario: Data.json should be valid Given I am on the homepage Then I "should" see a valid data.json - @pod_json_odfe @api @noworkflow @add_ODFE @remove_ODFE + @pod_02 @pod_json_odfe @api @noworkflow @add_ODFE @remove_ODFE Scenario: Data.json validation should fail if ODFE enabled Given I am on the homepage Then I "should not" see a valid data.json - @api @noworkflow @add_ODFE @remove_ODFE + @pod_03 @api @noworkflow @add_ODFE @remove_ODFE Scenario: See Federal Extras fields on the Dataset form Given I am logged in as a user with the "editor" role When I visit "node/add/dataset" Then I should see all of the Federal Extras fields - @api @noworkflow @add_ODFE @remove_ODFE + @pod_04 @api @noworkflow @add_ODFE @remove_ODFE Scenario: See all POD required fields marked as required # Enable POD validation + Groups validation Given I "enable" the "Strict POD validation" on DKAN Dataset Forms @@ -40,7 +40,7 @@ Feature: Project Open Data + Open Data Federal Extras Then I "disable" the "Strict POD validation" on DKAN Dataset Forms Then I "disable" the "Groups validation" on DKAN Dataset Forms - @api @noworkflow @add_ODFE @remove_ODFE + @pod_05 @api @noworkflow @add_ODFE @remove_ODFE Scenario: See all POD required fields marked as required except for Groups # Enable POD validation only. Given I "enable" the "Strict POD validation" on DKAN Dataset Forms @@ -57,13 +57,13 @@ Feature: Project Open Data + Open Data Federal Extras # Cleanup configuration. Then I "disable" the "Strict POD validation" on DKAN Dataset Forms - @api @noworkflow @add_ODFE @remove_ODFE + @pod_06 @api @noworkflow @add_ODFE @remove_ODFE Scenario: See all license values if POD validation is not enabled Given I am logged in as a user with the "content creator" role When I visit "node/add/dataset" Then I should see "all" license values - @api @noworkflow @add_ODFE @remove_ODFE + @pod_07 @api @noworkflow @add_ODFE @remove_ODFE Scenario: See only POD valid licenses if POD validation is enabled # Enable POD validation only. Given I "enable" the "Strict POD validation" on DKAN Dataset Forms @@ -74,8 +74,8 @@ Feature: Project Open Data + Open Data Federal Extras #Cleanup configuration Given I "disable" the "Strict POD validation" on DKAN Dataset Forms - @api - Scenario: DEBUG Site Manager role should have access to the validation page + @pod_08 @api + Scenario: Site Manager role should have access to the validation page Given pages: | name | url | | POD Validation | /admin/config/services/odsm/validate/pod | diff --git a/test/features/user.admin.feature b/test/features/user.admin.feature index 8fae3df6ae..73e9ec0648 100644 --- a/test/features/user.admin.feature +++ b/test/features/user.admin.feature @@ -71,6 +71,7 @@ Feature: User And I press "Create new account" Then I should see "Created a new user account for tempuser." When I am on "Users" page + And I wait for "tempuser" Then I should see "editor" in the "tempuser" row Scenario: Block user @@ -87,6 +88,7 @@ Feature: User Scenario: Disable user Given I am logged in as "John" And I am on "Users" page + And I wait for "edit" When I click "edit" in the "Katie" row And I press "Cancel account" And I select the radio button "Disable the account and keep its content." diff --git a/test/features/user.all.feature b/test/features/user.all.feature index e94fb564bf..ba0e953fe6 100644 --- a/test/features/user.all.feature +++ b/test/features/user.all.feature @@ -38,7 +38,7 @@ Feature: User | Dataset 01 | Group 01 | Katie | Yes | world | Test | | Dataset 02 | Group 01 | Katie | Yes | world | Test | - @login + @user_all_01 @login Scenario: Login Given I am on the homepage When I follow "Log in" @@ -47,14 +47,14 @@ Feature: User And I press "Log in" Then I should see the "John" user page - @login + @user_all_02 @login Scenario: Logout Given I am logged in as "John" And I am on the homepage When I follow "Log out" Then I should see "Log in" - @javascript @deleteTempUsers @customizable + @user_all_03 @javascript @deleteTempUsers @customizable Scenario: Register Given I am on the homepage When I follow "Register" @@ -67,7 +67,7 @@ Feature: User Then I should see "Thank you for applying for an account." And I should see "Your account is currently pending approval by the site administrator." - @mail @login + @user_all_04 @mail @login Scenario: Request new password Given I am on the homepage When I follow "Log in" @@ -77,16 +77,17 @@ Feature: User Then user "John" should receive an email #TODO: Follow reset password link on email? + @user_all_05 Scenario: View user profile - Given I am on "Group 01" page - And I follow "Members" - When I click "Katie" - Then I should see the "Katie" user page + Given I am on the "Katie" page + Then I should see "Katie's content" + @user_all_06 Scenario: View list of published datasets created by user on user profile Given I am on "Katie" page Then I should see "2" items in the "user content" region + @user_all_07 Scenario: Search datasets created by user on user profile Given I am on "Katie" page When I fill in "Test" for "Search" in the "content search" region @@ -94,6 +95,7 @@ Feature: User Then I should see "2 results" in the "user content" region And I should see "2" items in the "user content" region + @user_all_08 Scenario: See list of user memberships on user profile Given I am logged in as "Katie" And I am on "Katie" page diff --git a/test/features/workflow.feature b/test/features/workflow.feature index 6b877d2334..50cad8f693 100644 --- a/test/features/workflow.feature +++ b/test/features/workflow.feature @@ -35,7 +35,7 @@ Feature: #Non workbench roles can see the menu item My Workflow. However #they can't access to the page. - @globalUser + @workflow_01 @globalUser Scenario Outline: As a user without a Workbench role, I should not be able to access My Workbench or the My Workbench tabs Given I am logged in as a user with the "" role Then I should not see the link "My Workbench" @@ -54,7 +54,7 @@ Feature: | editor | | site manager | - @ok @globalUser + @workflow_02 @ok @globalUser Scenario Outline: As a user with any Workflow role, I should be able to access My Workbench. Given I am logged in as a user with the "" role When I am on "My Workbench" page @@ -69,7 +69,7 @@ Feature: | Workflow Moderator | | Workflow Supervisor | - @api @javascript @globalUser + @workflow_03 @api @javascript @globalUser Scenario Outline: As a user with any Workflow role, I should be able to upgrade my own draft content to needs review. Given I am logged in as "" And datasets: @@ -121,7 +121,7 @@ Feature: # | Workflow Moderator, editor | # | Workflow Supervisor, site manager | - @ok @javascript @globalUser + @workflow_04 @ok @javascript @globalUser Scenario: As a user with the Workflow Supervisor role, I should be able to publish stale 'Needs Review' content. Given I am logged in as "Contributor" And datasets: @@ -147,7 +147,7 @@ Feature: When I press "Publish" Then I wait for "Performed Publish on 3 items" - @ok @globalUser + @workflow_05 @ok @globalUser Scenario Outline: As a user with Workflow Roles, I should not be able to see draft contents I did not author in 'My Drafts' Given I am logged in as a user with the "" role Given users: @@ -169,7 +169,7 @@ Feature: | Workflow Moderator, editor | | Workflow Supervisor, site manager | - @ok @globalUser + @workflow_06 @ok @globalUser Scenario Outline: As a user with Workflow Roles, I should be able to see draft content I authored in 'My Drafts' Given I am logged in as "" And datasets: @@ -187,7 +187,7 @@ Feature: | Moderator | | Supervisor | - @ok @globalUser + @workflow_07 @ok @globalUser Scenario Outline: As a user with Workflow Roles, I should not be able to see Published content I authored in workbench pages Given I am logged in as "Contributor" And datasets: @@ -213,7 +213,7 @@ Feature: | My Drafts | Workflow Supervisor, site manager | | Needs Review | Workflow Supervisor, site manager | - @ok @globalUser + @workflow_08 @ok @globalUser Scenario Outline: As a user with Workflow Roles, I should not be able to see Needs Review resources I authored in 'My Drafts' Given I am logged in as a user with the "" role And datasets: @@ -233,7 +233,7 @@ Feature: | Workflow Moderator, editor | | Workflow Supervisor, site manager | - @ok @globalUser + @workflow_09 @ok @globalUser Scenario: As a user with the Workflow Contributor, I should be able to see Needs Review contents I authored in 'Needs Review' Given I am logged in as "Contributor" And datasets: @@ -248,7 +248,7 @@ Feature: And I should see "My Resource" And I should see "My Dataset" - @ok @globalUser + @workflow_10 @ok @globalUser Scenario: As a user with the Workflow Contributor, I should not be able to see Needs Review contents I did not author in 'Needs Review' Given I am logged in as a user with the "Workflow Contributor" role Given users: @@ -267,7 +267,7 @@ Feature: Then I should not see "Not My Resource" Then I should not see "Not My Dataset" - @ok @globalUser + @workflow_11 @ok @globalUser Scenario: As a Workflow Moderator, I should be able to see Needs Review datasets I did not author, but which belongs to my Group, in 'Needs Review' Given users: | name | roles | @@ -283,7 +283,7 @@ Feature: And I am on "Needs Review" page Then I should see the text "Not My Dataset" - @ok @globalUser + @workflow_21 @ok @globalUser Scenario: As a Workflow Moderator, I should be able to see Stale Needs Review datasets I did not author, but which belongs to my Group, in 'Needs Review' Given users: | name | roles | @@ -299,7 +299,7 @@ Feature: And I am on "Stale Reviews" page Then I should see the text "Not My Dataset" - @ok @globalUser + @workflow_12 @ok @globalUser Scenario: As a Workflow Moderator, I should not be able to see Needs Review datasets I did not author, and which do not belong to my Group, in 'Needs Review' Given users: | name | roles | @@ -317,7 +317,7 @@ Feature: And I am on "Needs Review" page Then I should not see the text "Not My Dataset" - @ok @globalUser + @workflow_13 @ok @globalUser Scenario: As a Workflow Supervisor, I should be able to see Needs Review content I did not author, regardless whether it belongs to my group or not, in 'Needs Review' Given users: | name | roles | @@ -338,7 +338,7 @@ Feature: Then I should see the text "Still Not My Dataset" Then I should see the text "Not My Dataset" - @ok @globalUser + @workflow_14 @ok @globalUser Scenario: As a Workflow Supervisor I should be able to see content in the 'Needs Review' state I did not author, regardless whether it belongs to my group or not, but which were submitted greater than 72 hours before now, in the 'Stale Reviews' Given users: | name | roles | @@ -359,7 +359,7 @@ Feature: Then I should see the text "Still Not My Dataset" Then I should see the text "Not My Dataset" - @ok @globalUser + @workflow_15 @ok @globalUser Scenario: As a Workflow Supervisor I should be able to see content in the 'Draft' state I did not author, regardless whether it belongs to my group or not, but which were submitted greater than 72 hours before now, in the 'Stale Drafts' Given users: | name | roles | @@ -380,7 +380,7 @@ Feature: Then I should see the text "Still Not My Dataset" Then I should see the text "Not My Dataset" - @api @ahoyRunMe @javascript @globalUser + @workflow_16 @api @ahoyRunMe @javascript @globalUser Scenario: When administering users, role pairings with core roles should be enforced Given I am logged in as a user with the "administrator" role And I visit the "Create User" page @@ -400,7 +400,7 @@ Feature: And I click "Edit" Then the checkbox "content creator" should be checked - @api @globalUser + @workflow_17 @api @globalUser Scenario: Modify user workflow roles as site manager Given users: | name | roles | mail | @@ -420,7 +420,7 @@ Feature: When I am on "Users" page Then I should see "Workflow Contributor" in the "content-creator" row - @api @ahoyRunMe @javascript @globalUser + @workflow_18 @api @ahoyRunMe @javascript @globalUser Scenario: Role pairings should also work for site managers. Given users: | name | roles | @@ -444,7 +444,7 @@ Feature: And I click "Edit" Then the checkbox "editor" should be checked - @api @javascript @harvest + @workflow_20 @api @javascript @harvest Scenario: Check harvested datasets are published by default even when dkan_workflow is enabled. Given users: | name | mail | status | roles | @@ -452,7 +452,7 @@ Feature: And The "source_one" source is harvested And the content "Gold Prices in London 1950-2008 (Monthly) Harvest" should be "published" - @ok + @workflow_19 @ok # https://jira.govdelivery.com/browse/CIVIC-5348 Scenario: "View draft" should display the draft dataset and not the published revision. Given users: From 74c35b9203831200b6a6002afca577a54f5f4dfa Mon Sep 17 00:00:00 2001 From: Dan Feder Date: Thu, 20 Jul 2017 20:01:01 -0400 Subject: [PATCH 04/20] 1.13.6 module updates (#2020) * Module updates: File Entity, Media, Panpopoly, Search API * Update test for new version of Panopoly Widgets * Revert "Update test for new version of Panopoly Widgets" This reverts commit 606f5c7f4c19da2a8ae7dc4aac7cba8ad3279706. * Remove panopoly updates --- drupal-org.make | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drupal-org.make b/drupal-org.make index 01b1d4f05f..fc8ebd23bc 100644 --- a/drupal-org.make +++ b/drupal-org.make @@ -135,7 +135,7 @@ projects: 2826182: https://www.drupal.org/files/issues/fieldable_panels_panes-title-shown-when-set-to-hidden-2826182-3.patch 2826205: https://www.drupal.org/files/issues/fieldable_panels_panes-n2826205-32.patch file_entity: - version: 2.2 + version: 2.3 file_resup: download: type: git @@ -202,7 +202,7 @@ projects: patch: 2045225: http://drupal.org/files/remove-dsm-from-hook-install-2045225-1.patch media: - version: 2.8 + version: 2.9 patch: 2272567: https://www.drupal.org/files/issues/media_dialog_appears_2272567-32.patch media_youtube: @@ -310,7 +310,7 @@ projects: version: '1.2' revision: 08b02458694d186f8ab3bd0b24fbc738f9271108 search_api: - version: '1.21' + version: '1.22' search_api_db: version: '1.6' select_or_other: From 94e2db15ec29707dc58cde877ce572031161ef0a Mon Sep 17 00:00:00 2001 From: Janette Day Date: Fri, 21 Jul 2017 08:34:44 -0500 Subject: [PATCH 05/20] Add unique tags to remaining test scenarios (#2021) * Add unique tags to test scenarios * Remove update not in the release patch --- test/features/dataset.admin.feature | 10 +++--- test/features/dataset.author.feature | 42 ++++++++++++------------- test/features/workflow.feature | 47 ++++++++++++++-------------- 3 files changed, 49 insertions(+), 50 deletions(-) diff --git a/test/features/dataset.admin.feature b/test/features/dataset.admin.feature index 5b60a535e4..2c2d0553c6 100644 --- a/test/features/dataset.admin.feature +++ b/test/features/dataset.admin.feature @@ -42,7 +42,7 @@ Feature: Dataset Features | Resource 01 | Group 01 | csv | Katie | Yes | Dataset 01 | Test R1 | | Resource 02 | Group 01 | html | Katie | Yes | Dataset 01 | Test R2 | - @noworkflow + @dataset_admin_01 @noworkflow Scenario: Edit any dataset Given I am logged in as "John" And I am on "Dataset 03" page @@ -51,7 +51,7 @@ Feature: Dataset Features And I press "Finish" Then I should see "Dataset Dataset 03 edited has been updated" - @noworkflow + @dataset_admin_02 @noworkflow Scenario: Delete any dataset Given I am logged in as "John" And I am on "Dataset 03" page @@ -60,7 +60,7 @@ Feature: Dataset Features And I press "Delete" Then I should see "Dataset Dataset 03 has been deleted" - @noworkflow + @dataset_admin_03 @noworkflow Scenario: Publish any dataset Given I am logged in as "John" And I am on "Dataset 05" page @@ -71,7 +71,7 @@ Feature: Dataset Features And I press "Finish" Then I should see "Dataset Dataset 05 has been updated" - @javascript + @dataset_admin_04 @javascript Scenario: See all dataset fields Given I am logged in as "Gabriel" And I am on "Dataset 01" page @@ -81,7 +81,7 @@ Feature: Dataset Features Then I select "Restricted" from "edit-field-public-access-level-und" And I should see "Rights on Project Open Data" - @javascript + @dataset_admin_05 @javascript Scenario: Should not see Rights field if public access level = none Given I am logged in as "Gabriel" And I am on "Dataset 01" page diff --git a/test/features/dataset.author.feature b/test/features/dataset.author.feature index e62ab22a77..aa1ab9ed73 100644 --- a/test/features/dataset.author.feature +++ b/test/features/dataset.author.feature @@ -64,7 +64,7 @@ Feature: Dataset Features | Resource 05 | | Katie | Yes | Dataset 08 | | | Resource 06 | Group 02 | Katie | Yes | Dataset 09 | | - @noworkflow @dataset_author_1 + @dataset_author_1 @noworkflow Scenario: Create dataset as content creator Given I am logged in as "Katie" And I am on "Add Dataset" page @@ -76,7 +76,7 @@ Feature: Dataset Features And I press "Next: Add data" Then I should see "Test Dataset has been created" - @noworkflow @dataset_author_2 + @dataset_author_2 @noworkflow Scenario: Save using Additional Info Given I am logged in as a user with the "content creator" role And I am on "Add Dataset" page @@ -89,7 +89,7 @@ Feature: Dataset Features Then I should see "Test Dataset" And I should see "Test description" - @noworkflow + @dataset_author_3 @noworkflow Scenario: Edit own dataset as a content creator Given I am logged in as "Katie" And I am on "Dataset 03" page @@ -100,7 +100,7 @@ Feature: Dataset Features When I am on "My Content" page Then I should see "Dataset 03 edited" - @noworkflow + @dataset_author_4 @noworkflow Scenario: Seeing the License Given I am logged in as "Katie" And I am on "Dataset 03" page @@ -112,12 +112,12 @@ Feature: Dataset Features And I click "Creative Commons Attribution" Then I should see "The Creative Commons Attribution license allows re-distribution and re-use of a licensed work" - @fixme @noworkflow - # TODO: Needs definition. How can a data contributor unpublish content? + @dataset_author_5 @fixme @noworkflow + # TODO: Needs definition. How can a data contributor unpublish content? Scenario: Unpublish own dataset as a content creator Given I am on the homepage - @noworkflow + @dataset_author_6 @noworkflow Scenario: Delete own dataset as content creator Given I am logged in as "Katie" And I am on "Dataset 03" page @@ -126,7 +126,7 @@ Feature: Dataset Features And I press "Delete" Then I should see "Dataset 03 has been deleted" - @noworkflow + @dataset_author_7 @noworkflow Scenario: Add a dataset to group that I am a member of Given I am logged in as "Katie" And I am on "Dataset 03" page @@ -137,7 +137,7 @@ Feature: Dataset Features When I am on "Group 01" page Then I should see "Dataset 03" in the "content" region - @noworkflow @javascript + @dataset_author_8 @noworkflow @javascript Scenario: Add a resource with no dataset to a dataset with no resource Given I am logged in as "Katie" And I am on "Dataset 06" page @@ -153,7 +153,7 @@ Feature: Dataset Features # NOTE: Datasets and resources associated through the 'Background' steps cannot be used here # because the URL of the resources change based on the datasets where they are added # so going back to a resource page after the dataset association is modified throws an error. - @noworkflow @javascript + @dataset_author_9 @noworkflow @javascript Scenario: Remove a resource with only one dataset from the dataset Given I am logged in as "Katie" And I am on "Dataset 06" page @@ -171,7 +171,7 @@ Feature: Dataset Features When I am on "Resource 04" page Then I should not see the link "Back to dataset" - @noworkflow @javascript + @dataset_author_10 @noworkflow @javascript Scenario: Add a resource with no group to a dataset with group Given I am logged in as "Katie" And I am on "Dataset 07" page @@ -184,7 +184,7 @@ Feature: Dataset Features # NOTE: Datasets and resources associated through the 'Background' steps cannot be used here # because the URL of the resources change based on the datasets where they are added # so going back to a resource page after the dataset association is modified throws an error. - @noworkflow @javascript + @dataset_author_11 @noworkflow @javascript Scenario: Remove a resource from a dataset with group Given I am logged in as "Katie" And I am on "Dataset 07" page @@ -200,7 +200,7 @@ Feature: Dataset Features Then I should see "Dataset 07 has been updated" And I should see "Groups were updated on 1 resource(s)" - @noworkflow + @dataset_author_12 @noworkflow Scenario: Add group to a dataset with resources Given I am logged in as "Katie" And I am on "Dataset 08" page @@ -210,7 +210,7 @@ Feature: Dataset Features Then I should see "Dataset 08 has been updated" And I should see "Groups were updated on 1 resource(s)" - @noworkflow + @dataset_author_13 @noworkflow Scenario: Remove group from dataset with resources Given I am logged in as "Katie" And I am on "Dataset 09" page @@ -220,7 +220,7 @@ Feature: Dataset Features Then I should see "Dataset 09 has been updated" And I should see "Groups were updated on 1 resource(s)" - @noworkflow @javascript + @dataset_author_14 @noworkflow @javascript Scenario: Add group and resource to a dataset on the same edition Given I am logged in as "Katie" And I am on "Dataset 08" page @@ -232,35 +232,35 @@ Feature: Dataset Features And I should see "Groups were updated on 1 resource(s)" And I should see "Resource 04" in the "dataset resource list" region - @noworkflow + @dataset_author_15 @noworkflow Scenario: Site Managers should see groups they are not member of Given I am logged in as "John" When I visit "node/add/dataset" Then I should see the "Group 01" groups option And I should see the "Group 02" groups option - @noworkflow + @dataset_author_16 @noworkflow Scenario: Content Creators should only see the groups they are member of Given I am logged in as "Katie" When I visit "node/add/dataset" Then I should see the "Group 02" groups option And I should not see the "Group 04" groups option - @noworkflow + @dataset_author_17 @noworkflow Scenario: Editors should only see the groups they are member of Given I am logged in as "Daniel" When I visit "node/add/dataset" Then I should see the "Group 02" groups option And I should not see the "Group 04" groups option - @noworkflow + @dataset_author_18 @noworkflow Scenario: Site Managers should see authoring information and publishing options Given I am logged in as "John" When I visit "node/add/dataset" Then I should see "Authoring information" And I should see "Publishing options" - @noworkflow + @dataset_author_19 @noworkflow Scenario: Content Creators not part of a group should see publishing options Given I am logged in as "Keith" When I visit "node/add/dataset" @@ -270,7 +270,7 @@ Feature: Dataset Features Then I should not see "Authoring information" Then I should see "Publishing options" - @noworkflow + @dataset_author_20 @noworkflow Scenario: Content Creators who are part of a group should not see authoring information Given I am logged in as "Katie" When I visit "node/add/dataset" diff --git a/test/features/workflow.feature b/test/features/workflow.feature index 50cad8f693..8c2a6ab958 100644 --- a/test/features/workflow.feature +++ b/test/features/workflow.feature @@ -283,22 +283,6 @@ Feature: And I am on "Needs Review" page Then I should see the text "Not My Dataset" - @workflow_21 @ok @globalUser - Scenario: As a Workflow Moderator, I should be able to see Stale Needs Review datasets I did not author, but which belongs to my Group, in 'Needs Review' - Given users: - | name | roles | - | some-other-user | Workflow Contributor, content creator | - And group memberships: - | user | group | role on group | membership status | - | some-other-user | Group 01 | administrator member | Active | - And datasets: - | title | author | published | publisher | - | Not My Dataset | some-other-user | No | Group 01 | - And "some-other-user" updates the moderation state of "Not My Dataset" to "Needs Review" on date "30 days ago" - Given I am logged in as "Moderator" - And I am on "Stale Reviews" page - Then I should see the text "Not My Dataset" - @workflow_12 @ok @globalUser Scenario: As a Workflow Moderator, I should not be able to see Needs Review datasets I did not author, and which do not belong to my Group, in 'Needs Review' Given users: @@ -444,14 +428,6 @@ Feature: And I click "Edit" Then the checkbox "editor" should be checked - @workflow_20 @api @javascript @harvest - Scenario: Check harvested datasets are published by default even when dkan_workflow is enabled. - Given users: - | name | mail | status | roles | - | Administrator | admin@fakeemail.com | 1 | administrator | - And The "source_one" source is harvested - And the content "Gold Prices in London 1950-2008 (Monthly) Harvest" should be "published" - @workflow_19 @ok # https://jira.govdelivery.com/browse/CIVIC-5348 Scenario: "View draft" should display the draft dataset and not the published revision. @@ -471,3 +447,26 @@ Feature: And I click "View draft" Then I should see "Dataset draft title" + @workflow_20 @api @javascript @harvest + Scenario: Check harvested datasets are published by default even when dkan_workflow is enabled. + Given users: + | name | mail | status | roles | + | Administrator | admin@fakeemail.com | 1 | administrator | + And The "source_one" source is harvested + And the content "Gold Prices in London 1950-2008 (Monthly) Harvest" should be "published" + + @workflow_21 @ok @globalUser + Scenario: As a Workflow Moderator, I should be able to see Stale Needs Review datasets I did not author, but which belongs to my Group, in 'Needs Review' + Given users: + | name | roles | + | some-other-user | Workflow Contributor, content creator | + And group memberships: + | user | group | role on group | membership status | + | some-other-user | Group 01 | administrator member | Active | + And datasets: + | title | author | published | publisher | + | Not My Dataset | some-other-user | No | Group 01 | + And "some-other-user" updates the moderation state of "Not My Dataset" to "Needs Review" on date "30 days ago" + Given I am logged in as "Moderator" + And I am on "Stale Reviews" page + Then I should see the text "Not My Dataset" From 79f68f87ba5d54018b635430a7d0c1f49b129284 Mon Sep 17 00:00:00 2001 From: Dan Feder Date: Wed, 26 Jul 2017 12:39:24 -0400 Subject: [PATCH 06/20] Update CHANGELOG.txt --- CHANGELOG.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 1cb7e078ec..1bfaf2ecaa 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -67,9 +67,6 @@ - #1852 Allow the use of multi-polygonal data for Dataset Spatial field. - #1857 Fixed publishing options not accessible when dkan_workflow is enabled. -7.x-1.13.3-RC1 --------------- - - #1810 Stop throwing exception on tables with only numeric columns, to prevent preview breaking. 7.x-1.13.3 2017-04-18 --------------------- - #1863 Update restws module to v2.7 From f11b104a2f97dab1e0ea434693e99486ba783f32 Mon Sep 17 00:00:00 2001 From: msolv Date: Wed, 26 Jul 2017 18:37:50 -0300 Subject: [PATCH 07/20] Include language selectors on 'chosen_jquery_selector' config (#2034) * Added upgrade hook * Update CHANGELOG.txt * Updated chosen_jquery_selector config on dkan_dataset_content_types * Update CHANGELOG.txt --- CHANGELOG.txt | 1 + dkan.install | 9 +++++++++ .../dkan_dataset_content_types.strongarm.inc | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 1bfaf2ecaa..8bbca98f61 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,6 @@ 7.x-1.13.6 ---------- + - #2034 Added language selectors on 'chosen_jquery_selector' configuration. - #2018 Additional test/devops improvements needed for deployment. See #2012, #2014, #2015 and #2016 for specifics. 7.x-1.13.5 diff --git a/dkan.install b/dkan.install index f91f8a8e35..3da7a176f9 100644 --- a/dkan.install +++ b/dkan.install @@ -378,3 +378,12 @@ function dkan_update_7021() { ->condition('eid', $eid) ->execute(); } + +/** + * Update chosen_jquery_selector to include language selectors. + */ +function dkan_update_7022() { + // REF #1936, #1890. + variable_set('chosen_jquery_selector', + '.page-node select:not([class*="delta-order"], [name*="workbench_moderation"], [class*="filter-list"], [id*="delimiter"],[name*="sort_by"],[name*="sort_order"], [id*="lines-terminated-by"], [id*="lang-dropdown-select-language"])'); +} diff --git a/modules/dkan/dkan_dataset/modules/dkan_dataset_content_types/dkan_dataset_content_types.strongarm.inc b/modules/dkan/dkan_dataset/modules/dkan_dataset_content_types/dkan_dataset_content_types.strongarm.inc index fce31d54b3..417b6db762 100644 --- a/modules/dkan/dkan_dataset/modules/dkan_dataset_content_types/dkan_dataset_content_types.strongarm.inc +++ b/modules/dkan/dkan_dataset/modules/dkan_dataset_content_types/dkan_dataset_content_types.strongarm.inc @@ -15,7 +15,7 @@ function dkan_dataset_content_types_strongarm() { $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ $strongarm->api_version = 1; $strongarm->name = 'chosen_jquery_selector'; - $strongarm->value = '.page-node select:not([class*="delta-order"], [name*="workbench_moderation"], [class*="filter-list"], [id*="delimiter"],[name*="sort_by"],[name*="sort_order"], [id*="lines-terminated-by"])'; + $strongarm->value = '.page-node select:not([class*="delta-order"], [name*="workbench_moderation"], [class*="filter-list"], [id*="delimiter"],[name*="sort_by"],[name*="sort_order"], [id*="lines-terminated-by"], [id*="lang-dropdown-select-language"])'; $export['chosen_jquery_selector'] = $strongarm; $strongarm = new stdClass(); From c53453563096a2fe0e291c7fc47396f01f785006 Mon Sep 17 00:00:00 2001 From: David Kinzer Date: Thu, 27 Jul 2017 12:06:40 -0300 Subject: [PATCH 08/20] Add configurable arguments via Behat Contexts. (#2025) * Add configurable arguments via Behat Contexts. REF CIVIC-6614 By passing Context Attributes via configuration we have the option of overriding them for custom settings and test environments. * Fix Ruby YAML does not like unquoted % token. * Update tests. * Add fields to ServiceContext. Fix typo in dataset key * Fix behat.yml services params. * Load Dataset context froom ServicesContext via Factory. * Fix datasetContext not available form ServicesContext. * Reformat behat.yml and fix PODContext URL. --- .ahoy/tests/behat-parse-params.rb | 2 +- test/behat.yml | 301 +++++++++++------- .../DKANExtension/Context/DatasetContext.php | 57 +--- .../DKANExtension/Context/PODContext.php | 2 +- .../DKANExtension/Context/RawDKANContext.php | 2 +- .../Context/RawDKANEntityContext.php | 9 +- .../DKANExtension/Context/ServicesContext.php | 37 +-- 7 files changed, 208 insertions(+), 202 deletions(-) diff --git a/.ahoy/tests/behat-parse-params.rb b/.ahoy/tests/behat-parse-params.rb index 73d36fabf4..74400a8573 100644 --- a/.ahoy/tests/behat-parse-params.rb +++ b/.ahoy/tests/behat-parse-params.rb @@ -1,5 +1,5 @@ require "minitest/autorun" -require "./.scripts/behat-parse-params.rb" +require "./dkan/.ahoy/.scripts/behat-parse-params.rb" class TestBehatParseParams < MiniTest::Unit::TestCase diff --git a/test/behat.yml b/test/behat.yml index 6e3dd607b5..52bc35eb17 100644 --- a/test/behat.yml +++ b/test/behat.yml @@ -1,122 +1,195 @@ -default: - suites: - dkan: - contexts: - - FeatureContext #Temporary overrides only! - - Drupal\DrupalExtension\Context\MinkContext - - Drupal\DrupalExtension\Context\DrupalContext - - Drupal\DrupalExtension\Context\MessageContext - - Drupal\DrupalExtension\Context\MarkupContext - - Drupal\DrupalExtension\Context\BatchContext - - Drupal\DKANExtension\Context\DKANContext - - Drupal\DKANExtension\Context\MailContext - - Drupal\DKANExtension\Context\PageContext - - Drupal\DKANExtension\Context\GroupContext - - Drupal\DKANExtension\Context\HarvestSourceContext - - Drupal\DKANExtension\Context\WorkflowContext - - Drupal\DKANExtension\Context\DatasetContext - - Drupal\DKANExtension\Context\DataDashboardContext - - Drupal\DKANExtension\Context\PODContext - - Drupal\DKANExtension\Context\FastImportContext - - Drupal\DKANExtension\Context\SearchAPIContext: - search_forms: - default: - form_css: '#dkan-sitewide-dataset-search-form' - form_field: 'edit-search' - form_button: 'edit-submit' - results_css: '.view-dkan-datasets' - result_item_css: '.views-row' - harvest_source: - results_css: '.view-dkan-harvest-source-search' - result_item_css: '.views-row' - - Drupal\DKANExtension\Context\ResourceContext - - Drupal\DKANExtension\Context\ServicesContext - - Drupal\DKANExtension\Context\PODContext - - Drupal\DKANExtension\Context\DatastoreContext - - Drupal\DKANExtension\Context\TimezoneContext - - Drupal\DrupalExtension\Context\DrushContext - - Devinci\DevinciExtension\Context\DebugContext: - asset_dump_path: %paths.base%/assets - - Devinci\DevinciExtension\Context\JavascriptContext: - maximum_wait: 30 - formatters: - pretty: - output_styles: - comment: [default, default , [conceal]] - gherkin: - filters: +--- +default: + suites: + dkan: + contexts: + - FeatureContext + - Drupal\DrupalExtension\Context\MinkContext + - Drupal\DrupalExtension\Context\DrupalContext + - Drupal\DrupalExtension\Context\MessageContext + - Drupal\DrupalExtension\Context\MarkupContext + - Drupal\DrupalExtension\Context\BatchContext + - Drupal\DKANExtension\Context\DKANContext + - Drupal\DKANExtension\Context\MailContext + - Drupal\DKANExtension\Context\PageContext + - Drupal\DKANExtension\Context\GroupContext + - Drupal\DKANExtension\Context\HarvestSourceContext + - Drupal\DKANExtension\Context\WorkflowContext + - Drupal\DKANExtension\Context\DatasetContext: + - fields: + title: title + description: body + published: status + resource: field_resources + access level: field_public_access_level + contact name: field_contact_name + contact email: field_contact_email + attest name: field_hhs_attestation_name + attest date: field_hhs_attestation_date + verification status: field_hhs_attestation_negative + attest privacy: field_hhs_attestation_privacy + attest quality: field_hhs_attestation_quality + bureau code: field_odfe_bureau_code + license: field_license + doi: field_doi + citation: field_citation + - labels: + title: Title + body: Description + field_tags: Tags + field_topics: Topics + field_license: License + field_author: Author + field_spatial_geographical_cover: Spatial / Geographical Coverage Location + field_frequency: Frequency + field_granularity: Granularity + field_data_dictionary_type: Data Dictionary Type + field_data_dictionary: Data Dictionary + field_contact_name: Contact Name + field_contact_email: Contact Email + field_public_access_level: Public Access Level + field_additional_info: Additional Info + field_resources: Resources + field_related_content: Related Content + field_landing_page: Homepage URL + field_conforms_to: Data Standard + field_language: Language + og_group_ref: Groups + - sets: + field_spatial: Spatial / Geographical Coverage Area + field_temporal_coverage: Temporal Coverage + - defaults: + field_public_access_level: public + field_hhs_attestation_negative: 1 + field_license: odc-by + - Drupal\DKANExtension\Context\DataDashboardContext + - Drupal\DKANExtension\Context\PODContext + - Drupal\DKANExtension\Context\FastImportContext + - Drupal\DKANExtension\Context\SearchAPIContext: + search_forms: + default: + form_css: "#dkan-sitewide-dataset-search-form" + form_field: edit-search + form_button: edit-submit + results_css: .view-dkan-datasets + result_item_css: .views-row + harvest_source: + results_css: .view-dkan-harvest-source-search + result_item_css: .views-row + - Drupal\DKANExtension\Context\ResourceContext + - Drupal\DKANExtension\Context\ServicesContext: + - request_fields_map: + resource: + type: type + title: title + body: body[und][0][value] + status: status + dataset: + type: type + title: title + status: status + published: status + body: body[und][0][value] + resource: field_resources[und][0][target_id] + access level: field_public_access_level[und] + contact name: field_contact_name[und][0][value] + contact email: field_contact_email[und][0][value] + attest name: field_hhs_attestation_name[und][0][value] + attest date: field_hhs_attestation_date[und][0][value][date] + verification status: field_hhs_attestation_negative[und] + attest privacy: field_hhs_attestation_privacy[und] + attest quality: field_hhs_attestation_quality[und] + bureau code: field_odfe_bureau_code[und] + license: field_license[und][select] + doi: field_doi[und][0][value] + citation: field_citation[und][0][value] + - Drupal\DKANExtension\Context\PODContext + - Drupal\DKANExtension\Context\DatastoreContext + - Drupal\DKANExtension\Context\TimezoneContext + - Drupal\DrupalExtension\Context\DrushContext + - Devinci\DevinciExtension\Context\DebugContext: + asset_dump_path: "%paths.base%/assets" + - Devinci\DevinciExtension\Context\JavascriptContext: + maximum_wait: 30 + formatters: + pretty: + output_styles: + comment: + - default + - default + - [conceal] + gherkin: + filters: tags: ~@fixme - extensions: - Behat\MinkExtension: - goutte: ~ - selenium2: ~ - default_session: 'goutte' - javascript_session: 'selenium2' + extensions: + Behat\MinkExtension: + goutte: [] + + selenium2: [] + + default_session: goutte + javascript_session: selenium2 browser_name: chrome - files_path: %paths.base%/files - Drupal\DrupalExtension: - blackbox: ~ - drupal: - #TODO Abstract this out. - drupal_root: %paths.base%/../../docroot - api_driver: 'drupal' - # @todo fixup these regions for use with new theme. Updated navigation only - region_map: - content: ".region-content" - toolbar: ".tabs--primary" + files_path: "%paths.base%/files" + Drupal\DrupalExtension: + blackbox: + drupal: + drupal_root: "%paths.base%/../../docroot" + api_driver: drupal + region_map: + admin menu: "#admin-menu" + breadcrumb: .breadcrumb + comment: .comment-main + content search: .form-item-query + content: .region-content + dashboards: .view-data-dashboards table tbody + dataset body: .field-name-body + dataset edit body: "#edit-body" + dataset resource list: "#data-and-resources" + dataset spatial: "#edit-field-spatial" + dataset title: .pane-node .pane-title + datasets: .view-dkan-datasets + dropdown_links: .comment-main .links.inline.dropdown-menu + facet container: .radix-layouts-sidebar + filter by author: .facetapi-facet-author + filter by date changed: .facetapi-facet-changed + filter by resource format: .facetapi-facet-field-resourcesfield-format + filter by tag: .facetapi-facet-field-tags + filter by topics: .facetapi-facet-field-topic footer: "#footer" + group block: .pane-views-group-block-block + group members: .view-id-dkan_og_extras_group_members + group subscribe: .group-subscribe-message + groups: .view-content + harvest datasets: .view-dkan-harvest-datasets header: "#header" - modal: "#modalContent" left header: "#header-left" + left_sidebar: .panel-col-first + modal: "#modalContent" + navigation: .navigation-wrapper + other access: .pane-dkan-sitewide-dkan-sitewide-other-access + primary tabs: .tabs--primary + resource groups: "#edit-groups" + resource title: .pane-node .pane-title + results: .view-header right header: "#header-right" right sidebar: "#column-right" - dashboards: ".view-data-dashboards table tbody" - navigation: '.navigation-wrapper' - breadcrumb: '.breadcrumb' - left_sidebar: '.panel-col-first' - dataset title: '.pane-node .pane-title' - dataset resource list: '#data-and-resources' - dataset body: '.field-name-body' - dataset edit body: '#edit-body' - dataset spatial: '#edit-field-spatial' - resource title: '.pane-node .pane-title' - resource groups: '#edit-groups' - search_area: '.panel-col-last' - dropdown_links: '.comment-main .links.inline.dropdown-menu' - comment: '.comment-main' - navigation: '.navigation-wrapper' - primary tabs: '.tabs--primary' - group subscribe: '.group-subscribe-message' - group block: '.pane-views-group-block-block' - group members: '.view-id-dkan_og_extras_group_members' - facet container: '.radix-layouts-sidebar' - filter by resource format: '.facetapi-facet-field-resourcesfield-format' - filter by author: '.facetapi-facet-author' - filter by topics: '.facetapi-facet-field-topic' - filter by tag: '.facetapi-facet-field-tags' - filter by date changed: '.facetapi-facet-changed' - social: '.pane-dkan-sitewide-dkan-sitewide-social' - other access: '.pane-dkan-sitewide-dkan-sitewide-other-access' - datasets: '.view-dkan-datasets' - user profile: '.pane-dkan-sitewide-panels-dkan-user-summary' - results: '.view-header' - user page: '.main' - user command center: '.pane-dkan-sitewide-profile-page-dkan-user-summary' - tabs: '.field-group-htabs-wrapper' - content: '.view-content' - groups: '.view-content' - search content results: '.content' - user content: '.view-user-profile-search' - content search: '.form-item-query' - user block: '.pane-views-user-profile-fields-block' - admin menu: '#admin-menu' - harvest datasets: '.view-dkan-harvest-datasets' - text: - log_out: "Log out" - log_in: "Log in" - selectors: - message_selector: '.alert' - error_message_selector: '.alert.alert-error' - success_message_selector: '.alert.alert-success' - Drupal\DKANExtension: + search content results: .content + search_area: .panel-col-last + social: .pane-dkan-sitewide-dkan-sitewide-social + tabs: .field-group-htabs-wrapper + toolbar: .tabs--primary + user block: .pane-views-user-profile-fields-block + user command center: .pane-dkan-sitewide-profile-page-dkan-user-summary + user content: .view-user-profile-search + user page: .main + user profile: .pane-dkan-sitewide-panels-dkan-user-summary + text: + log_out: Log out + log_in: Log in + selectors: + message_selector: .alert + error_message_selector: .alert.alert-error + success_message_selector: .alert.alert-success + Drupal\DKANExtension: some_param: test diff --git a/test/dkanextension/src/Drupal/DKANExtension/Context/DatasetContext.php b/test/dkanextension/src/Drupal/DKANExtension/Context/DatasetContext.php index 76f672c087..cb7bede93c 100644 --- a/test/dkanextension/src/Drupal/DKANExtension/Context/DatasetContext.php +++ b/test/dkanextension/src/Drupal/DKANExtension/Context/DatasetContext.php @@ -16,29 +16,15 @@ class DatasetContext extends RawDKANEntityContext { /** * */ - public function __construct() { + public function __construct($fields, $labels = array(), $sets = array(), $defaults = array()) { + $this->datasetFieldLabels = $labels['labels']; + $this->datasetFieldSets = $sets['sets']; + $this->datasetFieldDefaults = $defaults['defaults']; + parent::__construct( 'node', 'dataset', - // ToDo: load this from custom context.https://github.com/NuCivic/dkan_starter/issues/332. - array( - 'title' => 'title', - 'description' => 'body', - 'published' => 'status', - 'resource' => 'field_resources', - 'access level' => 'field_public_access_level', - 'contact name' => 'field_contact_name', - 'contact email' => 'field_contact_email', - 'attest name' => 'field_hhs_attestation_name', - 'attest date' => 'field_hhs_attestation_date', - 'verification status' => 'field_hhs_attestation_negative', - 'attest privacy' => 'field_hhs_attestation_privacy', - 'attest quality' => 'field_hhs_attestation_quality', - 'bureau code' => 'field_odfe_bureau_code', - 'license' => 'field_license', - 'doi' => 'field_doi', - 'citation' => 'field_citation', - ), + $fields['fields'], array( 'moderation', 'moderation_date', @@ -278,35 +264,8 @@ public function iShouldSeeAllTheDatasetFieldsInTheForm() { // We could use field_info_instances() to get the list of fields for the 'dataset' content // type but that would not cover the case where a field is removed accidentally. - $dataset_fields = array( - 'title' => 'Title', - 'body' => 'Description', - 'field_tags' => 'Tags', - 'field_topics' => 'Topics', - 'field_license' => 'License', - 'field_author' => 'Author', - 'field_spatial_geographical_cover' => 'Spatial / Geographical Coverage Location', - 'field_frequency' => 'Frequency', - 'field_granularity' => 'Granularity', - 'field_data_dictionary_type' => 'Data Dictionary Type', - 'field_data_dictionary' => 'Data Dictionary', - 'field_contact_name' => 'Contact Name', - 'field_contact_email' => 'Contact Email', - 'field_public_access_level' => 'Public Access Level', - 'field_additional_info' => 'Additional Info', - 'field_resources' => 'Resources', - 'field_related_content' => 'Related Content', - 'field_landing_page' => 'Homepage URL', - 'field_conforms_to' => 'Data Standard', - 'field_language' => 'Language', - 'og_group_ref' => 'Groups', - ); - - $dataset_fieldsets = array( - 'field_spatial' => 'Spatial / Geographical Coverage Area', - 'field_temporal_coverage' => 'Temporal Coverage', - ); - + $dataset_fields = $this->datasetFieldLabels; + $dataset_fieldsets = $this->datasetFieldSets; // Get all available form fields. // Searching by the Label as a text on the page is not enough since a text like 'Resources' // could appear because other reasons. diff --git a/test/dkanextension/src/Drupal/DKANExtension/Context/PODContext.php b/test/dkanextension/src/Drupal/DKANExtension/Context/PODContext.php index fbfa87a009..7e80da65e1 100644 --- a/test/dkanextension/src/Drupal/DKANExtension/Context/PODContext.php +++ b/test/dkanextension/src/Drupal/DKANExtension/Context/PODContext.php @@ -36,7 +36,7 @@ public function iSeeAValidDataJson($should) { $data_json = open_data_schema_map_api_load('data_json_1_1'); // Get base URL. - $url = $this->getMinkParameter('base_url') ? $this->getMinkParameter('base_url') : "http://127.0.0.1::8888"; + $url = $this->getMinkParameter('base_url') ? $this->getMinkParameter('base_url') : "http://127.0.0.1:8888"; // Validate POD. $results = open_data_schema_pod_process_validate($url . '/data.json', TRUE); diff --git a/test/dkanextension/src/Drupal/DKANExtension/Context/RawDKANContext.php b/test/dkanextension/src/Drupal/DKANExtension/Context/RawDKANContext.php index 5372491d7f..0a324a9294 100644 --- a/test/dkanextension/src/Drupal/DKANExtension/Context/RawDKANContext.php +++ b/test/dkanextension/src/Drupal/DKANExtension/Context/RawDKANContext.php @@ -98,7 +98,7 @@ public static function moveStageFileProxyFiles(BeforeSuiteScope $scope) { foreach ($proxy_files as $file) { $source = $conf['default']['stage_file_proxy_origin'] . '/' . $file; $destination = 'public://' . $file; - $copy($source, $destination); + copy($source, $destination); } } variable_set('stage_file_proxy_setup', TRUE); diff --git a/test/dkanextension/src/Drupal/DKANExtension/Context/RawDKANEntityContext.php b/test/dkanextension/src/Drupal/DKANExtension/Context/RawDKANEntityContext.php index 478ff5cd26..4179f3523d 100644 --- a/test/dkanextension/src/Drupal/DKANExtension/Context/RawDKANEntityContext.php +++ b/test/dkanextension/src/Drupal/DKANExtension/Context/RawDKANEntityContext.php @@ -458,16 +458,13 @@ public function applyMissingRequiredFields(array &$data) { continue; } + $defaults = $this->datasetFieldDefaults; + if (isset($field['required']) && $field['required']) { $k = array_search($key, $this->field_map); if (!isset($data[$k])) { $data[$k] = $devel_generate_wrapper->$key->value(); - // TODO: use param passed in from behat config for defaults. - $defaults = array( - 'field_public_access_level' => 'public', - 'field_hhs_attestation_negative' => 1, - 'field_license' => 'odc-by', - ); + $defaults = $this->datasetFieldDefaults; foreach ($defaults as $default => $value) { if ($key == $default) { $data[$k] = $value; diff --git a/test/dkanextension/src/Drupal/DKANExtension/Context/ServicesContext.php b/test/dkanextension/src/Drupal/DKANExtension/Context/ServicesContext.php index a22720bc85..9d22ec6b49 100644 --- a/test/dkanextension/src/Drupal/DKANExtension/Context/ServicesContext.php +++ b/test/dkanextension/src/Drupal/DKANExtension/Context/ServicesContext.php @@ -19,34 +19,11 @@ class ServicesContext extends RawDKANContext { /** * TODO: Move to configuration passed in to constructor. */ - private $request_fields_map = array( - 'resource' => array( - 'type' => 'type', - 'title' => 'title', - 'body' => 'body[und][0][value]', - 'status' => 'status', - ), - 'dataset' => array( - 'type' => 'type', - 'title' => 'title', - 'status' => 'status', - 'published' => 'status', - 'body' => 'body[und][0][value]', - 'resource' => 'field_resources[und][0][target_id]', - 'access level' => 'field_public_access_level[und]', - 'contact name' => 'field_contact_name[und][0][value]', - 'contact email' => 'field_contact_email[und][0][value]', - 'attest name' => 'field_hhs_attestation_name[und][0][value]', - 'attest date' => 'field_hhs_attestation_date[und][0][value][date]', - 'verification status' => 'field_hhs_attestation_negative[und]', - 'attest privacy' => 'field_hhs_attestation_privacy[und]', - 'attest quality' => 'field_hhs_attestation_quality[und]', - 'bureau code' => 'field_odfe_bureau_code[und]', - 'license' => 'field_license[und][select]', - 'doi' => 'field_doi[und][0][value]', - 'citation' => 'field_citation[und][0][value]', - ), - ); + private $request_fields_map; + + public function __construct($request_fields_map = array()) { + $this->request_fields_map = $request_fields_map['request_fields_map']; + } /** * @BeforeScenario @@ -55,6 +32,7 @@ public function gatherContexts(BeforeScenarioScope $scope) { parent::gatherContexts($scope); $environment = $scope->getEnvironment(); $this->dkanContext = $environment->getContext('Drupal\DKANExtension\Context\DKANContext'); + $this->datasetContext = $environment->getContext('Drupal\DKANExtension\Context\DatasetContext'); } /** @@ -403,8 +381,7 @@ private function build_node_data($data, $node = NULL) { $rest_api_fields = $this->request_fields_map[$node_type]; if ($node_type == "dataset") { - $rawDkanEntityContext = new DatasetContext(); - $rawDkanEntityContext->applyMissingRequiredFields($data); + $this->datasetContext->applyMissingRequiredFields($data); } foreach ($data as $field => $field_value) { From ce7530f4243ded5dfe3244a80749c2262d783420 Mon Sep 17 00:00:00 2001 From: msolv Date: Thu, 27 Jul 2017 16:31:45 -0300 Subject: [PATCH 09/20] Change 'Datasets' field on Resources form to use autocomplete (#2035) * Changed dataset field on resource form to be autocomplete * Fixed code style errors * Fixed automatic reference to datasets * Update CHANGELOG.txt * Update dkan_dataset.forms.inc * Refactored step used to fill in autocomplete fields * Fixed tests * Removed unused step * Added javascript tagas * Fixed tests --- CHANGELOG.txt | 1 + .../dkan/dkan_dataset/dkan_dataset.forms.inc | 16 +--- ..._content_types.features.field_instance.inc | 7 +- .../DKANExtension/Context/DKANContext.php | 80 ++++++++----------- .../DKANExtension/Context/DatasetContext.php | 35 -------- test/features/dataset.author.feature | 10 +-- test/features/resource.author.feature | 42 +++++----- 7 files changed, 70 insertions(+), 121 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 8bbca98f61..c50b44f295 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,6 @@ 7.x-1.13.6 ---------- + - #2035 Change 'Datasets' field on Resources form to use autocomplete. - #2034 Added language selectors on 'chosen_jquery_selector' configuration. - #2018 Additional test/devops improvements needed for deployment. See #2012, #2014, #2015 and #2016 for specifics. diff --git a/modules/dkan/dkan_dataset/dkan_dataset.forms.inc b/modules/dkan/dkan_dataset/dkan_dataset.forms.inc index 548e8dd92f..0b77edb5a8 100644 --- a/modules/dkan/dkan_dataset/dkan_dataset.forms.inc +++ b/modules/dkan/dkan_dataset/dkan_dataset.forms.inc @@ -299,6 +299,7 @@ function dkan_dataset_form_alter(&$form, &$form_state, $form_id) { $form['#validate'][] = 'dkan_dataset_dataset_node_form_validate'; } + if ($form_id == 'resource_node_form') { drupal_add_library('system', 'jquery.bbq'); $form['#attached']['css'][] = drupal_get_path('module', 'dkan_dataset') . '/css/dkan_dataset.css'; @@ -313,11 +314,6 @@ function dkan_dataset_form_alter(&$form, &$form_state, $form_id) { // Get langcode for field_dataset_ref. $field_dataset_ref_langcode = dkan_dataset_form_field_language($form, 'field_dataset_ref'); $form['field_dataset_ref'][$field_dataset_ref_langcode]['#description'] = t('Dataset that this resource is attached to.'); - $dataset_options = $form['field_dataset_ref'][$field_dataset_ref_langcode]['#options']; - $fix_apostrophes = function ($value) { - return html_entity_decode($value, ENT_QUOTES, "UTF-8"); - }; - $form['field_dataset_ref'][$field_dataset_ref_langcode]['#options'] = array_map($fix_apostrophes, $dataset_options); // Get langcode for field_upload. $field_upload_langcode = dkan_dataset_form_field_language($form, 'field_upload'); @@ -352,18 +348,13 @@ function dkan_dataset_form_alter(&$form, &$form_state, $form_id) { if ($query = drupal_get_query_parameters()) { if (isset($query['dataset'])) { - $form['field_dataset_ref'][$field_dataset_ref_langcode]['#default_value'] = $query['dataset']; + $selected_dataset = node_load($query['dataset']); + $form['field_dataset_ref'][$field_dataset_ref_langcode][0]['target_id']['#default_value'] = $selected_dataset->title . ' (' . $query['dataset'] . ')'; $form['prefix']['#type'] = 'item'; $form['prefix']['#weight'] = '-20'; $form['prefix']['#markup'] = dkan_form_create_stages('resource-create', $query['dataset']); } } - elseif (isset($form['#node']->field_dataset_ref['nid'])) { - $form['field_dataset_ref'][$field_dataset_ref_langcode]['#default_value'] = $form['#node']->field_dataset_ref['nid']; - $form['prefix']['#type'] = 'item'; - $form['prefix']['#weight'] = '-20'; - $form['prefix']['#markup'] = dkan_form_create_stages('resource-create', $form['#node']->field_dataset_ref['nid']); - } $form['#validate'][] = 'dkan_dataset_resource_node_form_validate'; // This saves us on the ajax reloading. if (isset($query['dataset'])) { @@ -628,7 +619,6 @@ function dkan_dataset_resource_node_form_validate($form, &$form_state) { // Check for geojson. if ($type == 'json' && isset($file)) { $response = drupal_http_request($file->uri, array('timeout' => 5)); - // dpm($response); if ($response->code == '200') { $data = $response->data; $decoded = drupal_json_decode($data); diff --git a/modules/dkan/dkan_dataset/modules/dkan_dataset_content_types/dkan_dataset_content_types.features.field_instance.inc b/modules/dkan/dkan_dataset/modules/dkan_dataset_content_types/dkan_dataset_content_types.features.field_instance.inc index 26a3378ef1..f886065c39 100644 --- a/modules/dkan/dkan_dataset/modules/dkan_dataset_content_types/dkan_dataset_content_types.features.field_instance.inc +++ b/modules/dkan/dkan_dataset/modules/dkan_dataset_content_types/dkan_dataset_content_types.features.field_instance.inc @@ -1519,11 +1519,14 @@ uk-ogl|UK Open Government Licence (OGL)', ), 'widget' => array( 'active' => 1, - 'module' => 'options', + 'module' => 'entityreference', 'settings' => array( 'apply_chosen' => 0, + 'match_operator' => 'CONTAINS', + 'path' => '', + 'size' => 60, ), - 'type' => 'options_select', + 'type' => 'entityreference_autocomplete', 'weight' => 8, ), ); diff --git a/test/dkanextension/src/Drupal/DKANExtension/Context/DKANContext.php b/test/dkanextension/src/Drupal/DKANExtension/Context/DKANContext.php index d1dea7d1f2..5275b874c5 100644 --- a/test/dkanextension/src/Drupal/DKANExtension/Context/DKANContext.php +++ b/test/dkanextension/src/Drupal/DKANExtension/Context/DKANContext.php @@ -407,23 +407,6 @@ public function iWaitForSeconds($milliseconds) { } - - - /** - * Selects option in select field with specified by node title. - * - * @When /^(?:|I )select node named "(?P