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

Commit

Permalink
Merge pull request #317 from metasfresh/gh308-app
Browse files Browse the repository at this point in the history
#308 Materialentnahme complete HU
  • Loading branch information
TheBestPessimist committed Aug 19, 2019
2 parents 2b57991 + 8714745 commit c82c1c9
Show file tree
Hide file tree
Showing 2 changed files with 159 additions and 0 deletions.
151 changes: 151 additions & 0 deletions cypress/integration/logistics/materialentnahme_complete_HU.js
@@ -0,0 +1,151 @@
import { BPartner } from '../../support/utils/bpartner';
import { BPartnerLocation } from '../../support/utils/bpartner_ui';
import { DiscountSchema } from '../../support/utils/discountschema';
import { ProductCategory } from '../../support/utils/product';
import { PackingMaterial } from '../../support/utils/packing_material';
import { PackingInstructions } from '../../support/utils/packing_instructions';
import { PackingInstructionsVersion } from '../../support/utils/packing_instructions_version';
import { Builder } from '../../support/utils/builder';
import { humanReadableNow } from '../../support/utils/utils';
import { PurchaseOrder, PurchaseOrderLine } from '../../support/utils/purchase_order';
import {
applyFilters,
selectNotFrequentFilterWidget,
toggleNotFrequentFilters,
clearNotFrequentFilters,
} from '../../support/functions';

const date = humanReadableNow();
const productForPackingMaterial = `ProductPackingMaterial_${date}`;
const packingInstructionsName = `ProductPackingInstructions_${date}`;
const productName1 = `Product1_${date}`;
const productCategoryName = `ProductCategoryName_${date}`;
const discountSchemaName = `DiscountSchema_${date}`;
const priceSystemName = `PriceSystem_${date}`;
const priceListName = `PriceList_${date}`;
const priceListVersionName = `PriceListVersion_${date}`;
const productType = 'Item';
const vendorName = `Vendor_${date}`;
const materialentnahme = 'Materialentnahmelager';
const warehouseName = 'Hauptlager_StdWarehouse_Hauptlager_0_0_0';

describe('Change warehouse to Materialentnahmelager', function() {
it('Create price entities', function() {
Builder.createBasicPriceEntities(priceSystemName, priceListVersionName, priceListName, false);
cy.fixture('discount/discountschema.json').then(discountSchemaJson => {
Object.assign(new DiscountSchema(), discountSchemaJson)
.setName(discountSchemaName)
.apply();
});
});
it('Create packing related entities', function() {
// eslint-disable-next-line
Builder.createProductWithPriceUsingExistingCategory(priceListName, productForPackingMaterial, productForPackingMaterial, productType, "24_Gebinde");
cy.fixture('product/packing_material.json').then(packingMaterialJson => {
Object.assign(new PackingMaterial(), packingMaterialJson)
.setName(productForPackingMaterial)
.setProduct(productForPackingMaterial)
.apply();
});
cy.fixture('product/packing_instructions.json').then(packingInstructionsJson => {
Object.assign(new PackingInstructions(), packingInstructionsJson)
.setName(packingInstructionsName)
.apply();
});
cy.fixture('product/packing_instructions_version.json').then(pivJson => {
Object.assign(new PackingInstructionsVersion(), pivJson)
.setName(packingInstructionsName)
.setPackingInstructions(packingInstructionsName)
.setPackingMaterial(productForPackingMaterial)
.apply();
});
});

it('Create category', function() {
cy.fixture('product/simple_productCategory.json').then(productCategoryJson => {
Object.assign(new ProductCategory(), productCategoryJson)
.setName(productCategoryName)
.setValue(productCategoryName)
.apply();
});
});

it('Create product1', function() {
Builder.createProductWithPriceAndCUTUAllocationUsingExistingCategory(
productCategoryName,
productCategoryName,
priceListName,
productName1,
productName1,
productType,
packingInstructionsName
);
});

it('Create vendor', function() {
new BPartner({ name: vendorName })
.setVendor(true)
.setVendorPricingSystem(priceSystemName)
.setVendorDiscountSchema(discountSchemaName)
.setPaymentTerm('30 days net')
.addLocation(new BPartnerLocation('Address1').setCity('Cologne').setCountry('Deutschland'))
.apply();

cy.readAllNotifications();
});
});

describe('Create a purchase order and Material Receipts', function() {
it('Create a purchase order and visit Material Receipt Candidates', function() {
new PurchaseOrder()
.setBPartner(vendorName)
.setPriceSystem(priceSystemName)
.setPoReference('test')
.addLine(new PurchaseOrderLine().setProduct(productName1).setQuantity(1))
.apply();
cy.completeDocument();
});

it('Visit referenced Material Receipt Candidates', function() {
cy.openReferencedDocuments('M_ReceiptSchedule');
cy.expectNumberOfRows(2);
});

it('Create Material Receipt 1', function() {
cy.selectNthRow(0).click();
cy.executeQuickAction('WEBUI_M_ReceiptSchedule_ReceiveHUs_UsingDefaults', false);
cy.selectNthRow(0, true);
cy.executeQuickAction('WEBUI_M_HU_CreateReceipt_NoParams', false, true);
cy.pressDoneButton();
});
it('Check if Materialentnahmelager warehouse exists', function() {
cy.visitWindow('139');
toggleNotFrequentFilters();
selectNotFrequentFilterWidget('default');
cy.writeIntoStringField('Name', materialentnahme, false, null, true);
applyFilters();

cy.expectNumberOfRows(1);
});
it('Change warehouse in handling unit editor', function() {
cy.visitWindow('540189');
toggleNotFrequentFilters();
selectNotFrequentFilterWidget('default');
cy.writeIntoLookupListField('M_Product_ID', productName1, productName1, false, false, null, true);
cy.writeIntoLookupListField('M_Locator_ID', warehouseName, warehouseName, false, false, null, true);
applyFilters();

cy.selectNthRow(0).click();
cy.executeQuickAction('WEBUI_M_HU_MoveToDirectWarehouse', false, false, false);

clearNotFrequentFilters();

toggleNotFrequentFilters();
selectNotFrequentFilterWidget('default');
cy.writeIntoLookupListField('M_Product_ID', productName1, productName1, false, false, null, true);
cy.writeIntoLookupListField('M_Locator_ID', materialentnahme, materialentnahme, false, false, null, true);
applyFilters();

cy.expectNumberOfRows(2);
});
});
8 changes: 8 additions & 0 deletions cypress/support/functions/index.js
Expand Up @@ -32,11 +32,19 @@ const confirmCalendarDay = () => {
.click();
};

const clearNotFrequentFilters = () => {
cy.get('.filters-not-frequent')
.click()
.find('.filter-clear')
.click();
}

export {
toggleFrequentFilters,
toggleNotFrequentFilters,
selectFrequentFilterWidget,
selectNotFrequentFilterWidget,
applyFilters,
confirmCalendarDay,
clearNotFrequentFilters,
};

0 comments on commit c82c1c9

Please sign in to comment.