Skip to content
This repository has been archived by the owner on Mar 31, 2021. It is now read-only.

Commit

Permalink
Update inventory_singleHU_spec.js
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBestPessimist committed Aug 6, 2019
1 parent 3269fb6 commit 20120a9
Showing 1 changed file with 26 additions and 31 deletions.
57 changes: 26 additions & 31 deletions cypress/integration/inventory/inventory_singleHU_spec.js
Expand Up @@ -2,51 +2,46 @@ import { Product } from '../../support/utils/product';

import { Inventory, InventoryLine } from '../../support/utils/inventory';

import { getLanguageSpecific } from '../../support/utils/utils';
import { getLanguageSpecific, humanReadableNow } from '../../support/utils/utils';

describe('Single-HUs inventory test', function() {
const timestamp = new Date().getTime();
const productName = `SingleHUInventory ${timestamp}`;
const productValue = `${timestamp}`;
const date = humanReadableNow();
const productName = `SingleHUInventory_${date}`;
const productQty = 20;
const locatorId = 'Hauptlager_StdWarehouse_Hauptlager_0_0_0';

before(function() {
describe('Create a single HU', function() {
it('Create Product', function() {
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(1000); // see comment/doc of getLanguageSpecific
cy.fixture('product/simple_product.json').then(productJson => {
Object.assign(new Product(), productJson)
.setName(productName)
.setValue(productValue)
.setValue(productName)
.apply();
});
});

it('Create a new single-HU inventory doc', function() {
let uomName;
cy.fixture('product/simple_product.json').then(productJson => {
const uomName = getLanguageSpecific(productJson, 'c_uom');
cy.fixture('inventory/inventory.json').then(inventoryJson => {
const docTypeName = getLanguageSpecific(inventoryJson, 'singleHUInventoryDocTypeName');

const inventoryLine = new InventoryLine()
.setProductName(productName)
.setQuantity(`20`)
.setC_UOM_ID(uomName)
.setM_Locator_ID('0_0_0')
.setIsCounted(true);

new Inventory()
.setWarehouse(inventoryJson.warehouseName)
.setDocType(docTypeName)
.addInventoryLine(inventoryLine)
.apply();
});
uomName = getLanguageSpecific(productJson, 'c_uom');
});
});

//check if snapshots match
/*
it('Check snapshots', function() {
cy.get('@newInventoryRecord').then(newInventoryRecord => {
inventory.toMatchSnapshots(newInventoryRecord, 'inventory_singleHU');
cy.fixture('inventory/inventory.json').then(inventoryJson => {
const docTypeName = getLanguageSpecific(inventoryJson, 'singleHUInventoryDocTypeName');

const inventoryLine = new InventoryLine()
.setProductName(productName)
.setQuantity(productQty)
.setC_UOM_ID(uomName)
.setM_Locator_ID(locatorId)
.setIsCounted(true);

new Inventory()
.setWarehouse(inventoryJson.warehouseName)
.setDocType(docTypeName)
.addInventoryLine(inventoryLine)
.apply();
});
});
*/
});

0 comments on commit 20120a9

Please sign in to comment.