This repository has been archived by the owner on Jan 9, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merging PR #198 - Imaging acceptance tests
- Loading branch information
Showing
5 changed files
with
123 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
import Ember from 'ember'; | ||
import { module, test } from 'qunit'; | ||
import startApp from 'hospitalrun/tests/helpers/start-app'; | ||
|
||
module('Acceptance | imaging', { | ||
beforeEach: function() { | ||
this.application = startApp(); | ||
}, | ||
|
||
afterEach: function() { | ||
Ember.run(this.application, 'destroy'); | ||
} | ||
}); | ||
|
||
test('visiting /imaging', function(assert) { | ||
loadPouchDump('default'); | ||
authenticateUser(); | ||
visit('/imaging'); | ||
|
||
andThen(() => { | ||
assert.equal(currentURL(), '/imaging'); | ||
assert.equal(find('li a:contains(Requests)').length, 1, 'Requests link is visible'); | ||
assert.equal(find('li a:contains(Completed)').length, 1, 'Completed link is visible'); | ||
let newImagingButton = find('button:contains(new imaging)'); | ||
assert.equal(newImagingButton.length, 1, 'New Imaging button is visible'); | ||
findWithAssert('p:contains(No items found. )'); | ||
findWithAssert('a:contains(Create a new record?)'); | ||
}); | ||
click('button:contains(new imaging)'); | ||
andThen(() => { | ||
assert.equal(currentURL(), '/imaging/edit/new'); | ||
}); | ||
destroyDatabases(); | ||
}); | ||
|
||
test('create a new imaging request', (assert) => { | ||
loadPouchDump('imaging'); | ||
authenticateUser(); | ||
visit('/imaging/edit/new'); | ||
|
||
andThen(() => { | ||
assert.equal(currentURL(), '/imaging/edit/new'); | ||
}); | ||
fillIn('.patient-input .tt-input', 'Lennex Zinyando - P00017'); | ||
triggerEvent('.patient-input .tt-input', 'input'); | ||
triggerEvent('.patient-input .tt-input', 'blur'); | ||
fillIn('.imaging-type-input .tt-input', 'Chest Scan'); | ||
fillIn('.radiologist-input .tt-input', 'Dr Test'); | ||
fillIn('.result-input input', 'Check is clear'); | ||
fillIn('textarea', 'Patient is healthy'); | ||
click('button:contains(Add)'); | ||
waitToAppear('.modal-dialog'); | ||
andThen(() => { | ||
assert.equal(find('.modal-title').text(), 'Imaging Request Saved', 'Imaging Request was saved successfully'); | ||
}); | ||
click('button:contains(Ok)'); | ||
andThen(() => { | ||
findWithAssert('button:contains(Update)'); | ||
findWithAssert('button:contains(Return)'); | ||
findWithAssert('button:contains(Complete)'); | ||
assert.equal(find('.test-patient-summary').length, 1, 'Patient summary is displayed'); | ||
}); | ||
destroyDatabases(); | ||
}); | ||
|
||
test('completed requests are displayed', (assert) => { | ||
loadPouchDump('imaging'); | ||
authenticateUser(); | ||
visit('/imaging/completed'); | ||
|
||
andThen(() => { | ||
assert.equal(currentURL(), '/imaging/completed'); | ||
assert.equal(find('.table').length, 1, 'Requests table is visible'); | ||
}); | ||
destroyDatabases(); | ||
}); | ||
|
||
test('mark an imaging request as completed', (assert) => { | ||
loadPouchDump('imaging'); | ||
authenticateUser(); | ||
visit('/imaging'); | ||
|
||
andThen(() => { | ||
assert.equal(currentURL(), '/imaging'); | ||
assert.equal(find('.table').length, 1, 'Requests table is visible'); | ||
assert.equal(find('tr').length, 3, 'Two imaging requests not completed'); | ||
}); | ||
click('button:contains(Edit)'); | ||
andThen(() => { | ||
assert.equal(currentURL(), '/imaging/edit/1AC1DD3D-E7E7-15B4-A698-8A8AE62749EB'); | ||
findWithAssert('button:contains(Update)'); | ||
findWithAssert('button:contains(Return)'); | ||
findWithAssert('button:contains(Complete)'); | ||
}); | ||
click('button:contains(Complete)'); | ||
waitToAppear('.modal-dialog'); | ||
andThen(() => { | ||
assert.equal(find('.modal-title').text(), 'Imaging Request Completed', 'Imaging Request was saved successfully'); | ||
}); | ||
click('button:contains(Ok)'); | ||
click('button:contains(Return)'); | ||
andThen(() => { | ||
assert.equal(currentURL(), '/imaging'); | ||
assert.equal(find('tr').length, 2, 'One request is left to complete'); | ||
}); | ||
destroyDatabases(); | ||
}); |
Large diffs are not rendered by default.
Oops, something went wrong.