Skip to content

Commit

Permalink
test(update): update the e2e and finish the patient registry refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
DedrickEnc committed Aug 14, 2017
1 parent 964b441 commit 3b1711d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 20 deletions.
14 changes: 0 additions & 14 deletions client/src/modules/patients/registry/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,12 @@ function PatientRegistryController($state, Patients, Notify, AppCache,
Columns, Sorting, bhConstants, GridState, Languages, Export) {
var vm = this;

// var filter = new Filters();
// vm.filter = filter;

var cacheKey = 'PatientRegistry';
var cache = AppCache(cacheKey);
// var FILTER_BAR_HEIGHT = bhConstants.grid.FILTER_BAR_HEIGHT;
var state;

vm.search = search;
vm.patientCard = patientCard;
// vm.filterBarHeight = {};
vm.openColumnConfiguration = openColumnConfiguration;
vm.gridApi = {};
vm.onRemoveFilter = onRemoveFilter;
Expand Down Expand Up @@ -190,15 +185,6 @@ function PatientRegistryController($state, Patients, Notify, AppCache,

// startup function. Checks for cached filters and loads them. This behavior could be changed.
function startup() {

// if ($state.params.filters) {
// // Fix me, generate change dynamically
// var change = [{ key : $state.params.filters.key, value : $state.params.filters.value }];

// Patients.filters.replaceFilters(change);
// Patients.cacheFilters();
// }

load(Patients.filters.formatHTTP(true));
vm.latestViewFilters = Patients.filters.formatView();
}
Expand Down
2 changes: 1 addition & 1 deletion client/src/modules/patients/registry/search.modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</div>
</div>

<!-- patient reerence -->
<!-- patient reference -->
<div class="form-group" ng-class="{ 'has-error' : ModalForm.$submitted && ModalForm.reference.$invalid }">
<label class="control-label" translate> FORM.LABELS.REFERENCE </label>
<bh-clear on-clear="$ctrl.clear('reference')"></bh-clear>
Expand Down
19 changes: 15 additions & 4 deletions test/end-to-end/patient/registry.search.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function PatientRegistrySearch() {
let filters;

const parameters = {
patientGroup : 'Test Patient Group 2',
name: 'Mock',
name1: 'Patient',
dateRegistrationFrom: '01/01/2015',
Expand Down Expand Up @@ -56,7 +57,7 @@ function PatientRegistrySearch() {
// demonstrates that filtering works
it(`should find one patient with name "${parameters.name}"`, () => {
const NUM_MATCHING = 1;
FU.input('ModalCtrl.params.display_name', parameters.name);
FU.input('$ctrl.searchQueries.display_name', parameters.name);
FU.modal.submit();

expectNumberOfGridRows(NUM_MATCHING);
Expand All @@ -74,7 +75,7 @@ function PatientRegistrySearch() {
// demonstrates additive filters
it(`should find two "male" patients with name "${parameters.name1}"`, function () {
const NUM_MATCHING = 2;
FU.input('ModalCtrl.params.display_name', parameters.name1);
FU.input('$ctrl.searchQueries.display_name', parameters.name1);
element(by.id('male')).click();
FU.modal.submit();

Expand All @@ -84,14 +85,24 @@ function PatientRegistrySearch() {
// demonstrates that additive + time-delimited filtering works
it(`should find one patient with name "${parameters.name1}" registered in the last week`, function () {
const NUM_MATCHING = 0;
FU.input('ModalCtrl.params.display_name', parameters.name1);
FU.input('$ctrl.searchQueries.display_name', parameters.name1);
modal.switchToDefaultFilterTab();
modal.setPeriod('lastWeek');
FU.modal.submit();

expectNumberOfGridRows(NUM_MATCHING);
});

it(`should find two patient with patient group "${parameters.patientGroup}" registered in allTime`, function () {
const NUM_MATCHING = 2;
components.patientGroupSelect.set(parameters.patientGroup);
modal.switchToDefaultFilterTab();
modal.setPeriod('allTime');
FU.modal.submit();

expectNumberOfGridRows(NUM_MATCHING);
});

// demonstrates that sex + time-delimited filtering works
it('should find no female patients registered in the last year.', function () {
const NUM_MATCHING = 0;
Expand Down Expand Up @@ -129,7 +140,7 @@ function PatientRegistrySearch() {
it('should remember the cached filters', () => {
const NUM_MATCHING = 0;
element(by.id('male')).click();
FU.input('ModalCtrl.params.display_name', 'Some Non-Existant Patient');
FU.input('$ctrl.searchQueries.display_name', 'Some Non-Existant Patient');
modal.switchToDefaultFilterTab();
modal.setPeriod('year');
FU.modal.submit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('Check links', () => {
helpers.navigate('#!/patients/groups');

element.all(by.css('[class="fa fa-list"]')).get(2).click();
expectNumberOfGridRows(2);
expectNumberOfGridRows(4);
});

it('Check link betwen Debtor Groups -> Patient Registry', () => {
Expand Down

0 comments on commit 3b1711d

Please sign in to comment.