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

Commit

Permalink
#145 removed methods from builder
Browse files Browse the repository at this point in the history
#145 Purchase order from sales order
  • Loading branch information
cristinastefan90 committed Jul 17, 2019
1 parent 7285ec6 commit df0eb79
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 48 deletions.
43 changes: 29 additions & 14 deletions cypress/integration/purchase/purchase_order_from_sales_order.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
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 { ProductCategory, ProductPrice, Product } 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';
Expand Down Expand Up @@ -83,18 +82,34 @@ describe('Create Purchase order - material receipt - invoice', function() {
.addLocation(new BPartnerLocation('Address1').setCity('Cologne').setCountry('Deutschland'))
.apply();

/**Create product to use in sales order - order line with both purchase price list and sales price list*/
Builder.createBasicProductEntitiesWithBusinessPartnerAndCUTUAllocationAndPrices(
productCategoryName,
productCategoryValue,
purchasePriceList,
salesPriceList,
productName1,
productValue1,
productType,
packingInstructionsName,
vendorName
);
cy.fixture('product/simple_productCategory.json').then(productCategoryJson => {
Object.assign(new ProductCategory(), productCategoryJson)
.setName(productCategoryName)
.setValue(productCategoryValue)
.apply();
});

let productPrice1;
let productPrice2;
cy.fixture('product/product_price.json').then(productPriceJson => {
productPrice1 = Object.assign(new ProductPrice(), productPriceJson).setPriceList(purchasePriceList);
});
cy.fixture('product/product_price.json').then(productPriceJson => {
productPrice2 = Object.assign(new ProductPrice(), productPriceJson).setPriceList(salesPriceList);
});

cy.fixture('product/simple_product.json').then(productJson => {
Object.assign(new Product(), productJson)
.setName(productName1)
.setValue(productValue1)
.setProductType(productType)
.setProductCategory(productCategoryValue + '_' + productCategoryName)
.addProductPrice(productPrice1)
.addProductPrice(productPrice2)
.setCUTUAllocation(packingInstructionsName)
.setBusinessPartner(vendorName)
.apply();
});
});
it('Create a sales order', function() {
cy.visitWindow('143', 'NEW');
Expand Down
34 changes: 0 additions & 34 deletions cypress/support/utils/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,40 +75,6 @@ export class Builder {
});
}

static createBasicProductEntitiesWithBusinessPartnerAndCUTUAllocation(
productCategoryName,
productCategoryValue,
priceListName,
productName,
productValue,
productType,
packingInstructionsName,
businessPartner
) {
cy.fixture('product/simple_productCategory.json').then(productCategoryJson => {
Object.assign(new ProductCategory(), productCategoryJson)
.setName(productCategoryName)
.setValue(productCategoryValue)
.apply();
});

let productPrice;
cy.fixture('product/product_price.json').then(productPriceJson => {
productPrice = Object.assign(new ProductPrice(), productPriceJson).setPriceList(priceListName);
});

cy.fixture('product/simple_product.json').then(productJson => {
Object.assign(new Product(), productJson)
.setName(productName)
.setValue(productValue)
.setProductType(productType)
.setProductCategory(productCategoryValue + '_' + productCategoryName)
.addProductPrice(productPrice)
.setCUTUAllocation(packingInstructionsName)
.setBusinessPartner(businessPartner)
.apply();
});
}
static createBasicProductEntitiesWithBusinessPartnerAndCUTUAllocationAndPrices(
productCategoryName,
productCategoryValue,
Expand Down

0 comments on commit df0eb79

Please sign in to comment.