Skip to content

Commit

Permalink
Fix test hierarchy in xml test reports
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcameron committed Dec 12, 2023
1 parent 9b18ab9 commit 2c97c63
Show file tree
Hide file tree
Showing 162 changed files with 771 additions and 751 deletions.
6 changes: 6 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ module.exports = (config) => {
outputFile : process.env.KARMA_FILENAME || 'test.xml',
suite : 'BHIMA-Tests',
useBrowserName : false,
nameFormatter : (browser, result) => {
return result.description;
},
classNameFormatter : (browser, result) => {
return result.suite[0];
},
},

// web server port
Expand Down
2 changes: 1 addition & 1 deletion playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = defineConfig({
// testIgnore : process.env.E2E_DIR ? '' : /\/stock\/|\/account\//,

/* Maximum time one test can run for. */
timeout : 40 * 1000, // Need longer value for CI
timeout : 50 * 1000, // Need longer value for CI

expect : {
/**
Expand Down
3 changes: 3 additions & 0 deletions sh/test-e2e-account.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ echo "[test] Running end-to-end account tests using playwright."
cd ..
E2E_DIR=account npx playwright test 2>&1 | tee ./results/end-to-end-account-report

# Adjust formatting for Jenkins
sed -i 's/.spec.js//g' "./results/end-to-end-account-results.xml"

# FYI: Use --workers=1 to limit number of workers

# Clean up any left-over zombie node processes (if not CI)
Expand Down
3 changes: 3 additions & 0 deletions sh/test-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ cd ..

npx playwright test $TESTS 2>&1 | tee "./results/end-to-end-report-$TEST_NUM"

# Adjust formatting for Jenkins
sed -i 's/.spec.js//g' "./results/end-to-end-$TEST_NUM-results.xml"

# FYI: Use PWTEST_SKIP_TEST_OUTPUT=1 to skip interactive web debug at the end
# FYI: Use --workers=1 to limit number of workers

Expand Down
1 change: 1 addition & 0 deletions test/client-unit/components/bhCardList.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint no-unused-expressions:off */
/* global inject expect */
describe('test/client-unit/components/bhCardList', () => {

let $compile;
let $rootScope;
let $templateCache;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint no-unused-expressions:"off" */
/* global inject, expect, chai */

describe.skip('bhFindPatient Controller Tests', ControllerTests);
describe.skip('test/client-unit/components/bhFindPatient Controller Tests', ControllerTests);

/**
* @todo - finish the DOM tests to compliment this controller test suite.
Expand Down
2 changes: 1 addition & 1 deletion test/client-unit/components/bhFindPatient/dom.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* global inject, expect, chai */

describe.skip('bhFindPatient DOM bindings', DomTests);
describe.skip('test/client-unit/components/bhFindPatient DOM bindings', DomTests);

/**
* @todo(@jniles) - finish this test suite. At the moment, it is incomplete and
Expand Down
2 changes: 1 addition & 1 deletion test/client-unit/directives/bhBlur.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint no-unused-expressions:off, no-continue: off */
/* global inject, expect, chai */

describe('test/client-unit/directives/(directive) bhBlur', () => {
describe('test/client-unit/directives/bhBlur directive', () => {
let $compile;
let $scope;
let element;
Expand Down
2 changes: 1 addition & 1 deletion test/client-unit/directives/bhInteger.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* global inject, expect */
describe('test/client-unit/directives/(directive) bhInteger', () => {
describe('test/client-unit/directives/bhInteger directive', () => {
let $scope;
let form;

Expand Down
2 changes: 1 addition & 1 deletion test/client-unit/directives/bhMaxInteger.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* global inject, expect */
describe('test/client-unit/directives/(directive) bhMaxInteger', () => {
describe('test/client-unit/directives/bhMaxInteger directive', () => {
let $scope;
let form;

Expand Down
24 changes: 12 additions & 12 deletions test/client-unit/directives/bhSubmit.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* global inject, expect, chai */
describe('test/client-unit/directives/(directive) bhSubmit', () => {
describe('test/client-unit/directives/bhSubmit directive', () => {
let $scope;
let element;
let deferred;
Expand All @@ -15,7 +15,7 @@ describe('test/client-unit/directives/(directive) bhSubmit', () => {
};
}));

describe('when the directive is added to a form', () => {
context('when the directive is added to a form', () => {
beforeEach(inject(($compile) => {
element = angular.element(`
<form name="form" bh-submit="models.submit(form)" novalidate>
Expand All @@ -27,49 +27,49 @@ describe('test/client-unit/directives/(directive) bhSubmit', () => {
$scope.$digest();
}));

it('sets $loading to false on the FormControl', () => {
it('when the directive is added to a form - sets $loading to false on the FormControl', () => {
expect($scope.form.$loading).to.equal(false);
});

describe('when the form is submitted', () => {
context('when the form is submitted', () => {
beforeEach(() => {
angular.element(element).trigger('submit');
});

it('sets $loading to true on the FormControl', () => {
it('when the form is submitted - sets $loading to true on the FormControl', () => {
expect($scope.form.$loading).to.equal(true);
});

it('calls the submit callback function', () => {
it('when the form is submitted - calls the submit callback function', () => {
expect($scope.models.submit).to.have.been.called.with($scope.form);
});

describe('when the submit callback is resolved', () => {
context('when the submit callback is resolved', () => {
beforeEach(() => {
deferred.resolve();
$scope.$digest();
});

it('sets $loading to false on the FormControl', () => {
it('when the submit callback is resolved - sets $loading to false on the FormControl', () => {
expect($scope.form.$loading).to.equal(false);
});
});

describe('when the submit callback is rejected', () => {
context('when the submit callback is rejected', () => {
beforeEach(() => {
deferred.reject(new Error('callback rejected'));
$scope.$digest();
});

it('sets $loading to false on the FormControl', () => {
it('when the submit callback is rejected - sets $loading to false on the FormControl', () => {
expect($scope.form.$loading).to.equal(false);
});
});
});
});

describe('when the directive is not added to a form', () => {
it('the compilation fails', inject(($compile) => {
context('when the directive is not added to a form', () => {
it('when the directive is not added to a form - the compilation fails', inject(($compile) => {
element = angular.element(`
<form name="form">
<div bh-submit="models.submit(form)">
Expand Down
2 changes: 1 addition & 1 deletion test/client-unit/directives/bhUnique.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* global inject, expect */
describe('test/client-unit/directives/(directive) bhUnique', () => {
describe('test/client-unit/directives/bhUnique directive', () => {
let $scope;
let form;

Expand Down
3 changes: 2 additions & 1 deletion test/client-unit/filters/bytes.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* global inject, expect */
describe('test/client-unit/filters/Bytes Filter', () => {
describe('test/client-unit/filters/bytes filter', () => {

let bytes;

Expand Down Expand Up @@ -48,4 +48,5 @@ describe('test/client-unit/filters/Bytes Filter', () => {
expect(bytes(null, 100)).to.equal('-');
expect(bytes(undefined, 33)).to.equal('-');
});

});
2 changes: 1 addition & 1 deletion test/client-unit/filters/currency.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* global inject, expect */
describe('test/client-unit/filters/Currency Filter', () => {
describe('test/client-unit/filters/currency filter', () => {

const FC = 1;
const USD = 2;
Expand Down
2 changes: 1 addition & 1 deletion test/client-unit/filters/percentage.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* global inject, expect */
describe('test/client-unit/filters/Percentage Filter', () => {
describe('test/client-unit/filters/percentage filter', () => {

let percentage;

Expand Down
2 changes: 1 addition & 1 deletion test/client-unit/filters/telephone.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* global inject, expect */
describe('test/client-unit/filters/Telephone Filter', () => {
describe('test/client-unit/filters/telephone filter', () => {

let telephone;

Expand Down
12 changes: 6 additions & 6 deletions test/client-unit/services/BaseReportService.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ describe('test/client-unit/services/BaseReportService', () => {
parseIcon = SavedReports.parseFileUrlToIcon;
}));

describe('#parseUrlToExtension()', () => {
it('correctly parses simple paths', () => {
context('#parseUrlToExtension()', () => {
it('#parseUrlToExtension() correctly parses simple paths', () => {
expect(parseExtension('image.jpg')).to.equal('jpg');
expect(parseExtension('image.svg')).to.equal('svg');
expect(parseExtension('doc.docx')).to.equal('docx');
Expand All @@ -34,19 +34,19 @@ describe('test/client-unit/services/BaseReportService', () => {

});

it('handles error cases', () => {
it('#parseUrlToExtension() handles error cases', () => {
expect(parseExtension('')).to.equal('');
expect(parseExtension()).to.equal('');
});

it('correctly parses complex paths', () => {
it('#parseUrlToExtension() correctly parses complex paths', () => {
expect(parseExtension('a.file.with.decimals.pdf')).to.equal('pdf');
expect(parseExtension('/more/complex/file.with/decimals.gz')).to.equal('gz');
});
});

describe('#parseUrlToIcon()', () => {
it('correctly parses paths to guess their icons', () => {
context('#parseUrlToIcon()', () => {
it('#parseUrlToIcon() correctly parses paths to guess their icons', () => {
expect(parseIcon('icon.png')).to.equal('fa-file-image-o');
expect(parseIcon('icon.svg')).to.equal('fa-file-image-o');

Expand Down
10 changes: 5 additions & 5 deletions test/client-unit/services/PatientInvoiceForm.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe('test/client-unit/services/PatientInvoiceForm', () => {
httpBackend.verifyNoOutstandingRequest();
});

describe('#constructor()', () => {
context('#constructor()', () => {
let constructorForm;
let setupSpy;
let inventorySpy;
Expand All @@ -84,21 +84,21 @@ describe('test/client-unit/services/PatientInvoiceForm', () => {
inventorySpy = chai.spy.on(constructorForm.inventory, 'initialize');
});

it('calls #setup() on initialization', () => {
it('#constructor() calls #setup() on initialization', () => {
expect(setupSpy).to.have.been.called;
});

it('creates a new, empty store for the grid', () => {
it('#constructor() creates a new, empty store for the grid', () => {
expect(constructorForm.store).to.exist;
expect(constructorForm.store.identifier).to.equal('uuid');
expect(constructorForm.store.data).to.have.length(0);
});

it('initializes the inventory', () => {
it('#constructor() initializes the inventory', () => {
expect(inventorySpy).to.have.been.called;
});

it('sets the form to be invalid by default', () => {
it('#constructor() sets the form to be invalid by default', () => {
expect(constructorForm._invalid).to.equal(true);
expect(constructorForm._valid).to.equal(false);
});
Expand Down
3 changes: 1 addition & 2 deletions test/client-unit/services/Pool.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* global inject, expect */
describe('test/client-unit/services/Pool', () => {


let Pool;
let data;

Expand All @@ -18,7 +17,7 @@ describe('test/client-unit/services/Pool', () => {

it('#constructor() runs with sane defaults', () => {
let pool = new Pool();
expect(pool).to.exist;
expect(pool).to.exist; // eslint-disable-line
expect(pool.available.identifier).to.equal('id');
expect(pool.available.data).to.have.length(0);

Expand Down
1 change: 0 additions & 1 deletion test/client-unit/services/PrototypeApiService.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* global inject, expect */
describe('test/client-unit/services/PrototypeApiService', () => {


// shared common data
let api;
let httpBackend;
Expand Down
2 changes: 1 addition & 1 deletion test/client-unit/services/PurchaseOrderFormService.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe('test/client-unit/services/PurchaseOrderForm', () => {
setupSpy = chai.spy.on(form, 'setup');
});

it('calls #setup() on initialization', () => {
it('calls #setup() on initialization in the constructor', () => {
expect(setupSpy).to.have.been.called;
});

Expand Down
Empty file.
2 changes: 1 addition & 1 deletion test/client-unit/services/UniqueValidatorService.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/* global inject, expect */
describe('test/client-unit/services/(service) UniqueValidatorService', () => {
describe('test/client-unit/services/UniqueValidatorService', () => {


// these will be injected in the beforeEach() calls
Expand Down
9 changes: 4 additions & 5 deletions test/client-unit/services/VoucherForm.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('test/client-unit/services/VoucherForm', () => {
httpBackend.verifyNoOutstandingRequest();
});

describe('#constructor()', () => {
context('#constructor()', () => {
let constructorForm;
let setupSpy;

Expand All @@ -54,19 +54,19 @@ describe('test/client-unit/services/VoucherForm', () => {
setupSpy = chai.spy.on(constructorForm, 'setup');
});

it('calls #setup() on initialization', () => {
it('#constructor() calls #setup() on initialization', () => {
expect(setupSpy).to.have.been.called;
});

it('creates a new store with two items in it', () => {
it('#constructor() creates a new store with two items in it', () => {
expect(constructorForm.store).to.exist;
expect(constructorForm.store.identifier).to.equal('uuid');

// two rows should be added
expect(constructorForm.store.data).to.have.length(2);
});

it('sets default data based on Session', () => {
it('#constructor() sets default data based on Session', () => {
expect(constructorForm.details).to.exist;
expect(constructorForm.details.project_id).to.be.equal(Session.project.id);
expect(constructorForm.details.currency_id).to.be.equal(Session.enterprise.currency_id);
Expand All @@ -88,7 +88,6 @@ describe('test/client-unit/services/VoucherForm', () => {
expect(form.store.data).to.have.length(15);
});


it('#clear() removes all data from the internal store', () => {
form.clear();
expect(form.store.data).to.have.length(0);
Expand Down
2 changes: 0 additions & 2 deletions test/end-to-end/cash/registry.spec.js

This file was deleted.

2 changes: 1 addition & 1 deletion test/end-to-end/stock/stock.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const StockAggregateConsumptionTests = require('./stock.aggregate_consumption');
const StockImportTests = require('./stock.import');

test.describe('Stock E2E', () => {
test.describe('Stock Import', StockImportTests);
test.describe('test/end-to-end/stock/stock_import Stock Import', StockImportTests);
test.describe('Stock Aggregate Consumption', StockAggregateConsumptionTests);
// ??? test.describe('Stock Assign', StockAssignTests);
test.describe('Stock Entry', StockEntryTests);
Expand Down
4 changes: 2 additions & 2 deletions test/integration-stock/depots.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

const helpers = require('./helpers');

// The /depots API endpoint
describe('test/integration-stock (/depots) The depots API ', () => {
// The /depots API
describe('test/integration-stock/depots The depots API ', () => {
const { principal } = helpers.data.depots;

/**
Expand Down
Loading

0 comments on commit 2c97c63

Please sign in to comment.