Skip to content

Commit

Permalink
Merge pull request #714 from compucorp/CPS-356-end-date-issue
Browse files Browse the repository at this point in the history
CPS-356: Fix issue with End/Start date not updating on Peoples tab
  • Loading branch information
deb1990 authored Mar 2, 2021
2 parents 3dfd549 + 1f434ec commit f812bbc
Show file tree
Hide file tree
Showing 38 changed files with 1,022 additions and 1,545 deletions.
122 changes: 94 additions & 28 deletions .github/workflows/backstop.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,46 @@
name: Backstop Tests

on:
pull_request:
types:
- labeled
workflow_dispatch:
inputs:
civicase_reference_branch:
description: CiviCase Reference Branch/Tag Name
default: master
required: true
civicase_test_branch:
description: CiviCase Test Branch/tag Name
required: true
civicrm_reference_version:
description: CiviCRM Reference Version
default: 5.28 # change this to the current civicrm version in use
required: true
civicrm_test_version:
description: CiviCRM Test Version
default: 5.28 # change this to the current civicrm version in use
required: true
reference_shoreditch_branch:
description: Shoreditch Reference Branch/Tag Name
default: master
required: true
test_shoreditch_branch:
description: Shoreditch Test Branch/Tag Name
default: master
required: true

jobs:
run-backstop-tests:
if: github.event.label.name == 'run backstop'
runs-on: ubuntu-latest
container:
image: compucorp/civicrm-buildkit:1.1.0-php7.2-chrome

env:
CIVICRM_EXTENSIONS_DIR: site/web/sites/all/modules/civicrm/tools/extensions
CIVICASE_BACKSTOP_DIR: site/web/sites/all/modules/civicrm/tools/extensions/uk.co.compucorp.civicase/tests/backstop_data
DRUPAL_THEME_DIR: site/web/sites/all/themes
REFERENCE_SITE_FOLDER: reference_site
REFERENCE_SITE_URL: http://localhost:7979
TEST_SITE_FOLDER: test_site
TEST_SITE_URL: http://localhost:7980
CIVICRM_EXTENSIONS_DIR: web/sites/all/modules/civicrm/tools/extensions
CIVICASE_BACKSTOP_DIR: uk.co.compucorp.civicase/tests/backstop_data
DRUPAL_THEME_DIR: web/sites/all/themes

services:
mysql:
Expand All @@ -36,23 +61,28 @@ jobs:
echo "IncludeOptional $HOME/.amp/apache.d/*.conf" >> /etc/apache2/apache2.conf
/usr/sbin/apache2ctl restart
- name: Build Drupal site
- name: Build Reference Drupal site (CiviCRM - ${{ github.event.inputs.civicrm_reference_version }}, CiviCase - ${{ github.event.inputs.civicase_reference_branch }}, Shoreditch - ${{ github.event.inputs.reference_shoreditch_branch }})
run: |
civibuild create drupal-clean --civi-ver 5.28.3 --cms-ver 7.74 --web-root $GITHUB_WORKSPACE/site
chmod -R 777 $GITHUB_WORKSPACE/site
civibuild create drupal-clean --civi-ver ${{ github.event.inputs.civicrm_reference_version }} --cms-ver 7.74 --web-root $GITHUB_WORKSPACE/${{ env.REFERENCE_SITE_FOLDER }} --url ${{ env.REFERENCE_SITE_URL }}
chmod -R 777 $GITHUB_WORKSPACE/${{ env.REFERENCE_SITE_FOLDER }}
- name: Installing CiviCase and Shoreditch
working-directory: ${{ env.CIVICRM_EXTENSIONS_DIR }}
- name: Build Test Drupal site (CiviCRM - ${{ github.event.inputs.civicrm_test_version }}, CiviCase - ${{ github.event.inputs.civicase_test_branch }}, Shoreditch - ${{ github.event.inputs.test_shoreditch_branch }})
run: |
git clone https://github.com/compucorp/uk.co.compucorp.civicase.git --branch "${{ github.head_ref }}"
git clone --depth 1 https://github.com/civicrm/org.civicrm.shoreditch.git
civibuild create drupal-clean --civi-ver ${{ github.event.inputs.civicrm_test_version }} --cms-ver 7.74 --web-root $GITHUB_WORKSPACE/${{ env.TEST_SITE_FOLDER }} --url ${{ env.TEST_SITE_URL }}
chmod -R 777 $GITHUB_WORKSPACE/${{ env.TEST_SITE_FOLDER }}
- name: Installing CiviCase and Shoreditch in Reference Site
working-directory: ${{ env.REFERENCE_SITE_FOLDER }}/${{ env.CIVICRM_EXTENSIONS_DIR }}
run: |
git clone https://github.com/compucorp/uk.co.compucorp.civicase.git --branch ${{ github.event.inputs.civicase_reference_branch }}
git clone https://github.com/civicrm/org.civicrm.shoreditch.git --branch ${{ github.event.inputs.reference_shoreditch_branch }}
cv en shoreditch civicase
drush en civicrmtheme -y
drush en bootstrap -y
drush vset theme_default bootstrap
- name: Installing Shoreditch Companion Theme
working-directory: ${{ env.DRUPAL_THEME_DIR }}
- name: Installing Shoreditch Companion Theme in Reference Site
working-directory: ${{ env.REFERENCE_SITE_FOLDER }}/${{ env.DRUPAL_THEME_DIR }}
run: |
git clone https://github.com/compucorp/shoreditch-companion-d7-theme.git depth=1
drush en -y shoreditch_companion_d7_theme
Expand All @@ -64,32 +94,68 @@ jobs:
drush cc all && drush cc civicrm
- name: Setup data and site-config.json for Backstop tests
working-directory: ${{ env.CIVICASE_BACKSTOP_DIR }}
- name: Setup data and site-config.json for Backstop tests in Reference Site
working-directory: ${{ env.REFERENCE_SITE_FOLDER }}/${{ env.CIVICRM_EXTENSIONS_DIR }}/${{ env.CIVICASE_BACKSTOP_DIR }}
run: |
cp site-config.json.sample site-config.json
sed -i 's+<url>+http://localhost:7979+' site-config.json
sed -i 's+<path-to-site-root>+'"$GITHUB_WORKSPACE"'/site/web+' site-config.json
sed -i 's+<url>+${{ env.REFERENCE_SITE_URL }}+' site-config.json
sed -i 's+<path-to-site-root>+'"$GITHUB_WORKSPACE"'/${{ env.REFERENCE_SITE_FOLDER }}/web+' site-config.json
npm install
npx gulp backstopjs:setup-data
- name: Reference Screenshots in "master" Branch
- name: Reference Screenshots in (CiviCRM - ${{ github.event.inputs.civicrm_reference_version }}, CiviCase - ${{ github.event.inputs.civicase_reference_branch }}, Shoreditch - ${{ github.event.inputs.reference_shoreditch_branch }})
continue-on-error: true
working-directory: ${{ env.CIVICASE_BACKSTOP_DIR }}
working-directory: ${{ env.REFERENCE_SITE_FOLDER }}/${{ env.CIVICRM_EXTENSIONS_DIR }}/${{ env.CIVICASE_BACKSTOP_DIR }}
run: |
git checkout master
npx gulp backstopjs:reference
- name: Test Screenshots in "${{ github.head_ref }}" Branch
working-directory: ${{ env.CIVICASE_BACKSTOP_DIR }}
- name: Installing CiviCase and Shoreditch in Test Site
working-directory: ${{ env.TEST_SITE_FOLDER }}/${{ env.CIVICRM_EXTENSIONS_DIR }}
run: |
git clone https://github.com/compucorp/uk.co.compucorp.civicase.git --branch ${{ github.event.inputs.civicase_test_branch }}
git clone https://github.com/civicrm/org.civicrm.shoreditch.git --branch ${{ github.event.inputs.test_shoreditch_branch }}
cv en shoreditch civicase
drush en civicrmtheme -y
drush en bootstrap -y
drush vset theme_default bootstrap
- name: Installing Shoreditch Companion Theme in Test Site
working-directory: ${{ env.TEST_SITE_FOLDER }}/${{ env.DRUPAL_THEME_DIR }}
run: |
git clone https://github.com/compucorp/shoreditch-companion-d7-theme.git depth=1
drush en -y shoreditch_companion_d7_theme
drush vset civicrmtheme_theme_admin shoreditch_companion_d7_theme
drush sql-query "UPDATE block SET status = 0 WHERE theme='shoreditch_companion_d7_theme' AND module='civicrm' AND delta IN ('1', '2', '3', '4', '5');" -y
drush sql-query "UPDATE block SET status = 0 WHERE theme='shoreditch_companion_d7_theme' AND module='search' AND delta='form';" -y
drush sql-query "UPDATE block SET status = 0 WHERE theme='shoreditch_companion_d7_theme' AND module='system' AND delta IN ('navigation', 'powered-by');" -y
drush cc all && drush cc civicrm
- name: Setup data for Backstop tests in Test Site
working-directory: ${{ env.TEST_SITE_FOLDER }}/${{ env.CIVICRM_EXTENSIONS_DIR }}/${{ env.CIVICASE_BACKSTOP_DIR }}
run: |
cp site-config.json.sample site-config.json
sed -i 's+<url>+${{ env.TEST_SITE_URL }}+' site-config.json
sed -i 's+<path-to-site-root>+'"$GITHUB_WORKSPACE"'/${{ env.TEST_SITE_FOLDER }}/web+' site-config.json
npm install
npx gulp backstopjs:setup-data
- name: Update site-config.json for Reference Site to target Test Site
working-directory: ${{ env.REFERENCE_SITE_FOLDER }}/${{ env.CIVICRM_EXTENSIONS_DIR }}/${{ env.CIVICASE_BACKSTOP_DIR }}
run: |
sed -i 's+${{ env.REFERENCE_SITE_URL }}+${{ env.TEST_SITE_URL }}+' site-config.json
sed -i 's+${{ env.REFERENCE_SITE_FOLDER }}+${{ env.TEST_SITE_FOLDER }}+' site-config.json
- name: Test Screenshots in (CiviCRM - ${{ github.event.inputs.civicrm_test_version }}, CiviCase - ${{ github.event.inputs.civicase_test_branch }}, Shoreditch - ${{ github.event.inputs.test_shoreditch_branch }})
continue-on-error: true
working-directory: ${{ env.REFERENCE_SITE_FOLDER }}/${{ env.CIVICRM_EXTENSIONS_DIR }}/${{ env.CIVICASE_BACKSTOP_DIR }}
run: |
git checkout "${{ github.head_ref }}"
npx gulp backstopjs:test
- name: Prepare test report for download
if: ${{ always() }}
working-directory: ${{ env.CIVICASE_BACKSTOP_DIR }}
working-directory: ${{ env.REFERENCE_SITE_FOLDER }}/${{ env.CIVICRM_EXTENSIONS_DIR }}/${{ env.CIVICASE_BACKSTOP_DIR }}
run: |
mkdir backstop_report
cp -r html_report backstop_report
Expand All @@ -99,4 +165,4 @@ jobs:
if: ${{ always() }}
with:
name: backstop-report
path: ${{ env.CIVICASE_BACKSTOP_DIR }}/backstop_report
path: ${{ env.REFERENCE_SITE_FOLDER }}/${{ env.CIVICRM_EXTENSIONS_DIR }}/${{ env.CIVICASE_BACKSTOP_DIR }}/backstop_report
83 changes: 0 additions & 83 deletions ang/civicase-base/directives/send-to-api-on-change.directive.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,7 @@ <h3>{{ ts('%1 Contacts', {1: roles.getCountOfAssignedRoles()}) }}</h3>
class="form-control"
civicase-inline-datepicker
data-max-date="{{role.relationship.end_date}}"
civicase-send-to-api-on-change
data-api-data="roleDatesUpdater.getApiCallsForStartDate(role, item.id)"
data-on-api-data-sent="roleDatesUpdater.updatePreviousValue(role, 'start_date')"
ng-change="refresh(roleDatesUpdater.getApiCallsForStartDate(role, item.id))"
name="role_start_date"
ng-disabled="roleForm.role_start_date.isSaving"
ng-if="!!role.relationship"
Expand All @@ -175,9 +173,7 @@ <h3>{{ ts('%1 Contacts', {1: roles.getCountOfAssignedRoles()}) }}</h3>
class="form-control"
civicase-inline-datepicker
data-min-date="{{role.relationship.start_date}}"
civicase-send-to-api-on-change
data-api-data="roleDatesUpdater.getApiCallsForEndDate(role, item.id)"
data-on-api-data-sent="roleDatesUpdater.updatePreviousValue(role, 'end_date')"
ng-change="refresh(roleDatesUpdater.getApiCallsForEndDate(role, item.id))"
name="role_end_date"
ng-disabled="roleForm.role_end_date.isSaving"
ng-if="!!role.relationship"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

this.getApiCallsForEndDate = getApiCallsForEndDate;
this.getApiCallsForStartDate = getApiCallsForStartDate;
this.updatePreviousValue = updatePreviousValue;

/**
* @param {string} dateString A date in a year-month-day format.
Expand Down Expand Up @@ -130,17 +129,6 @@
.value();
}

/**
* Stores the current value of the role's relationship in the previous
* values object. Useful for storing the relationship date changes.
*
* @param {object} role A role object as provided by the roles service.
* @param {string} fieldName The name of the field to store.
*/
function updatePreviousValue (role, fieldName) {
role.previousValues[fieldName] = role.relationship[fieldName];
}

/**
* @typedef {object} RoleDateChangeParams
* @param {string} activityTypeId Name of the activity type that will
Expand Down

This file was deleted.

Loading

0 comments on commit f812bbc

Please sign in to comment.