forked from IMA-WorldHealth/bhima
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(billing services): implement e2e tests
This commit implements end-to-end tests for billing services. So far, only the create and update tests are supported. Deletion will be targetted next once we have a modal component to confirm deletes.
- Loading branch information
Showing
7 changed files
with
108 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* global browser, element, by, protractor */ | ||
|
||
var chai = require('chai'); | ||
var expect = chai.expect; | ||
|
||
// import testing utiliites | ||
var helpers = require('../shared/helpers'); | ||
helpers.configure(chai); | ||
|
||
var components = require('../shared/components'); | ||
var GU = require('../shared/gridTestUtils.spec.js'); | ||
var FU = require('../shared/FormUtils'); | ||
|
||
describe('Billing Services', function () { | ||
'use strict'; | ||
|
||
/** @const */ | ||
var path = '#/admin/billing_services'; | ||
|
||
/** @const */ | ||
var gridId = 'BillingServicesGrid'; | ||
|
||
before(function () { browser.get(path); }); | ||
|
||
it('can create a billing service', function () { | ||
|
||
// click on the create button | ||
FU.buttons.create(); | ||
|
||
// anticipate that the form should come up | ||
FU.exists(by.css('[name="BillingServicesForm"]'), true); | ||
|
||
var root = element(by.css('[data-component-find-account]')); | ||
|
||
// search for a particular account using the account input | ||
var accountInput = root.element(by.model('BillingServicesFormCtrl.model.account')); | ||
accountInput.sendKeys('410'); | ||
|
||
// click select the proper account | ||
var option = root.all(by.repeater('match in matches track by $index')).first(); | ||
option.click(); | ||
|
||
// fill in the rest of the fields | ||
FU.input('BillingServicesFormCtrl.model.label', 'Value Added Tax'); | ||
FU.input('BillingServicesFormCtrl.model.description', 'A tax added for people who want value!'); | ||
FU.input('BillingServicesFormCtrl.model.value', 25); | ||
|
||
FU.buttons.submit(); | ||
|
||
// make sure the "created" validation tag exists | ||
FU.exists(by.css('[data-validation="created"]'), true); | ||
|
||
// let's be sure we can find the record on the grid by returning there | ||
FU.buttons.back(); | ||
|
||
// check that the grid as exactly one record | ||
var grid = GU.getGrid(gridId); | ||
|
||
var rows = grid.element(by.css('.ui-grid-render-container-body')) | ||
.all(by.repeater('(rowRenderIndex, row) in rowContainer.renderedRows track by $index')); | ||
|
||
expect(rows.count()).to.eventually.equal(1); | ||
}); | ||
|
||
it('can update a billing service', function () { | ||
|
||
// get the cell with the update button and click it | ||
var cell = GU.dataCell(gridId, 0, 6); | ||
cell.element(by.css('[data-method="update"]')).click(); | ||
|
||
// expect to find the update form has loaded | ||
FU.exists(by.css('[name="BillingServicesForm"]'), true); | ||
|
||
// update the label | ||
FU.clear('BillingServicesFormCtrl.model.label'); | ||
FU.input('BillingServicesFormCtrl.model.label', 'Value Reduced Tax'); | ||
|
||
// submit the forn | ||
FU.buttons.submit(); | ||
|
||
// make sure the "created" validation tag exists | ||
FU.exists(by.css('[data-validation="updated"]'), true); | ||
|
||
// return to the main page | ||
FU.buttons.back(); | ||
}); | ||
|
||
/** @todo -- requires the modal described in #150 or similar */ | ||
it('can delete a billing service'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters