Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

add acceptance test for patients.admitted #785

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 24 additions & 18 deletions tests/acceptance/patients-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,6 @@ module('Acceptance | patients', {
}
});

test('visiting /patients route', function(assert) {
runWithPouchDump('default', function() {
authenticateUser();
visit('/patients');
andThen(function() {
assert.equal(currentURL(), '/patients');
let noPatientsFound = find('[data-test-selector="no-patients-found"]');
assert.equal(noPatientsFound.text().trim(), 'No patients found. Create a new patient record?', 'no records found');
let newPatientButton = find('button:contains(+ new patient)');
assert.equal(newPatientButton.length, 1, 'Add new patient button is visible');
});
click('button:contains(+ new patient)');
andThen(function() {
assert.equal(currentURL(), '/patients/edit/new');
});
});
});

test('View reports tab', function(assert) {
runWithPouchDump('default', function() {
authenticateUser();
Expand All @@ -52,6 +34,9 @@ testSimpleReportForm('Discharges Detail');
testSimpleReportForm('Discharges Summary');
testSimpleReportForm('Procedures Detail');

testPatientList('/patients');
testPatientList('/patients/admitted');

test('View reports tab | Patient Status', function(assert) {
runWithPouchDump('default', function() {
authenticateUser();
Expand Down Expand Up @@ -116,3 +101,24 @@ function testSimpleReportForm(reportName) {
});
});
}

function testPatientList(url) {
test(`List patients | app${url}`, function(assert) {
runWithPouchDump('default', function() {
authenticateUser();
visit(url);

andThen(function() {
assert.equal(currentURL(), url);
let noPatientsFound = find('[data-test-selector="no-patients-found"]');
assert.equal(noPatientsFound.text().trim(), 'No patients found. Create a new patient record?', 'No records found');
let newPatientButton = find('button:contains(+ new patient)');
assert.equal(newPatientButton.length, 1, 'Add new patient button is visible');
});
click('button:contains(+ new patient)');
andThen(function() {
assert.equal(currentURL(), '/patients/edit/new');
});
});
});
}