Skip to content

Commit

Permalink
start end-to-end test
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremielodi committed Sep 11, 2020
1 parent c90ccc6 commit b8b92b1
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 6 deletions.
7 changes: 6 additions & 1 deletion test/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3417,5 +3417,10 @@ INSERT INTO `village` (`uuid`, `name`, `sector_uuid`, `longitude`, `latitude`) V

INSERT INTO `donor`(`id`, `display_name`) VALUES(1, 'Jeremie LODI');

SET @donation_uuid = HUID('ae735e99-8faf-417b-aa63-9b404fca390d');
INSERT INTO `donation`(`uuid`, `date`, `donor_id`)
VALUES(HUID('ae735e99-8faf-417b-aa63-9b404fca390d'), NOW(), 1);
VALUES(@donation_uuid, NOW(), 1);


INSERT INTO `donation_item` (`uuid`, `donation_uuid`, `inventory_uuid`, `quantity`, `unit_price`)
VALUES(HUID(uuid()), @donation_uuid, @multivitamine, 200, 1300);
1 change: 0 additions & 1 deletion test/end-to-end/fillForm/fillForm.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class FillFormManagementPage {
await browser.findElement(by.css('[name="nombreFois"]')).sendKeys(fillForm.nombreFois);
await components.dateEditor.set(new Date(fillForm.date), null, '.title');
await browser.findElement(by.css('[name="voie"]')).sendKeys(fillForm.voie);
components.dateEditor.set(new Date(fillForm.date));
await browser.findElement(by.css('[ng-model="hours"]')).sendKeys(fillForm.hours);
await browser.findElement(by.css('[ng-model="minutes"]')).sendKeys(fillForm.minutes);

Expand Down
2 changes: 1 addition & 1 deletion test/end-to-end/shared/components/bhDateEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = {
* @param {String} id - a CSS id to select on.
*/
set : async function set(date, id, elementClick) {
const elementCloseComponent = elementClick || '.header-image';
const elementCloseComponent = elementClick || '[bh-date-editor-label]';

// fail hard if the user did not pass into
/* if (!(date instanceof Date)) {
Expand Down
10 changes: 10 additions & 0 deletions test/end-to-end/stock/stock.entry.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ function StockEntryPage() {
await FU.modal.submit();
};

/**
* @method setDonation
* @param {string} rowNumber - the purchase line on the modal
*/
page.setDonation = async (rowNumber) => {
await components.stockEntryExitType.set('donation');
await GU.selectRow('DonationGrid', rowNumber);
await FU.modal.submit();
};

/**
* @method setTransfer
* @param {string} rowNumber - movement line on the modal grid
Expand Down
22 changes: 22 additions & 0 deletions test/end-to-end/stock/stock.entry.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,29 @@ function StockEntryTests() {
await page.setDepot(DEPOT_PRINCIPAL);
});

it('Should enter stock from a donation', async () => {

// select the purchase order
await page.setDonation(0);

await page.setDate(new Date());

await page.setDescription(DESCRIPTION.concat(' - Donation'));

const lots = [
{ label : 'LY-ONE', quantity : 100, expiration_date : expireInThreeYears },
{ label : 'LY-TWO', quantity : 50, expiration_date : expireInTwoYears },
{ label : 'LY-THREE', quantity : 50, expiration_date : expireInOneYear },
];

await page.setLots(0, lots, false);

// submit
await page.submit();
});

it('Should enter stock from a purchase order', async () => {
await this.timeout(60000);
// select the purchase order
await page.setPurchase(0);

Expand Down
6 changes: 3 additions & 3 deletions test/end-to-end/stock/stock.inventories.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ function StockInventoriesRegistryTests() {
await filters.resetFilters();
});

it('find 3 inventory by state (security reached)', async () => {
it('find 2 inventory by state (security reached)', async () => {
await FU.radio('$ctrl.searchQueries.status', 2);
await FU.modal.submit();
await GU.expectRowCount(gridId, 3);
await GU.expectRowCount(gridId, 2);

await filters.resetFilters();
});
Expand All @@ -77,7 +77,7 @@ function StockInventoriesRegistryTests() {
await FU.radio('$ctrl.searchQueries.status', 4);
await FU.modal.submit();

await GU.expectRowCount(gridId, 7);
await GU.expectRowCount(gridId, 8);
await filters.resetFilters();
});

Expand Down

0 comments on commit b8b92b1

Please sign in to comment.