Skip to content

Commit

Permalink
fix(cash): ensure e2e tests use correct data
Browse files Browse the repository at this point in the history
This commit updates the cash e2e tests to run in the correct order and
use data that is pre-built from the data.sql file.
  • Loading branch information
Jonathan Niles committed Dec 3, 2016
1 parent 26c8fd0 commit f864ae4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
/* global element, by, browser */
'use strict';

const uuid = require('node-uuid');
const chai = require('chai');
const expect = chai.expect;

const FU = require('../shared/FormUtils');
const GU = require('../shared/GridUtils');
const helpers = require('../shared/helpers');
const components = require('../shared/components');

helpers.configure(chai);

/**
* Note: These tests depends on integration tests data
* so, the integration tests must be done before
*/
describe('Reports Cash Payment', () => {
function CashPaymentsRegistryTests() {

// navigate to the page
before(() => helpers.navigate('#/finance/reports/cash_payment'));
Expand All @@ -43,85 +33,79 @@ describe('Reports Cash Payment', () => {
FU.buttons.submit();
GU.expectRowCount('payment-registry', 0);

// clear filters
// clear filters
FU.buttons.clear();
});

it('find payment by reference', () => {

/** Existing reference */
FU.buttons.search();
FU.input('$ctrl.bundle.reference', 'TPA1')
FU.input('$ctrl.bundle.reference', 'TPA1');
FU.buttons.submit();
GU.expectRowCount('payment-registry', 1);

/** Not Existing reference */
FU.buttons.search();
FU.input('$ctrl.bundle.reference', 'NOT_A_REFERENCE')
FU.input('$ctrl.bundle.reference', 'NOT_A_REFERENCE');
FU.buttons.submit();
GU.expectRowCount('payment-registry', 0);

// clear filters
// clear filters
FU.buttons.clear();
});

it('find payment by client', () => {

/** Get all payment of Patient/2/Patient */
FU.buttons.search();
FU.uiSelect('$ctrl.bundle.debtor_uuid', 'Patient/2/Patient')
FU.uiSelect('$ctrl.bundle.debtor_uuid', 'Patient/2/Patient');
FU.buttons.submit();
GU.expectRowCount('payment-registry', PAYMENT_INSIDE_REGISTRY);

/** Get all payment of Mock Patient */
FU.buttons.search();
FU.uiSelect('$ctrl.bundle.debtor_uuid', 'Patient/Mock Patient First')
FU.buttons.submit();
GU.expectRowCount('payment-registry', 0);

// clear filters
// clear filters
FU.buttons.clear();
});

it('find payment by cashbox', () => {

/** Get all payment on Test Primary Cashbox A */
FU.buttons.search();
FU.uiSelect('$ctrl.bundle.cashbox_id', 'Test Primary Cashbox A')
FU.uiSelect('$ctrl.bundle.cashbox_id', 'Test Primary Cashbox A');
FU.buttons.submit();
GU.expectRowCount('payment-registry', 2);
GU.expectRowCount('payment-registry', 0);

/** Get all payment on Test Aux Cashbox A */
FU.buttons.search();
FU.uiSelect('$ctrl.bundle.cashbox_id', 'Test Aux Cashbox A')
FU.uiSelect('$ctrl.bundle.cashbox_id', 'Test Aux Cashbox A');
FU.buttons.submit();
GU.expectRowCount('payment-registry', 1);
GU.expectRowCount('payment-registry', PAYMENT_INSIDE_REGISTRY);

/** Get all payment on Test Aux Cashbox B */
FU.buttons.search();
FU.uiSelect('$ctrl.bundle.cashbox_id', 'Test Aux Cashbox B')
FU.uiSelect('$ctrl.bundle.cashbox_id', 'Test Aux Cashbox B');
FU.buttons.submit();
GU.expectRowCount('payment-registry', 0);

// clear filters
// clear filters
FU.buttons.clear();
});

it('find payment by user', () => {

/** Get all payment of new Utilisateur */
/** Get all payment of Regular User */
FU.buttons.search();
FU.uiSelect('$ctrl.bundle.user_id', 'New Utilisateur')
FU.uiSelect('$ctrl.bundle.user_id', 'Regular User');
FU.buttons.submit();
GU.expectRowCount('payment-registry', 0);

/** Get all payment of super user */
FU.buttons.search();
FU.uiSelect('$ctrl.bundle.user_id', 'Super User')
FU.uiSelect('$ctrl.bundle.user_id', 'Super User');
FU.buttons.submit();
GU.expectRowCount('payment-registry', PAYMENT_INSIDE_REGISTRY);

// clear filters
// clear filters
FU.buttons.clear();
});

Expand All @@ -131,4 +115,6 @@ describe('Reports Cash Payment', () => {
FU.modal.submit();
components.notification.hasSuccess();
});
});
}

module.exports = CashPaymentsRegistryTests;
2 changes: 2 additions & 0 deletions test/end-to-end/cash/cash.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ describe('Cash Payments', function () {
});

describe('Cash Transfer ', CashTransfer);

describe('Payments Registry', require('./cash.registry'));
});


Expand Down

0 comments on commit f864ae4

Please sign in to comment.