Skip to content

Commit

Permalink
Added fixtures for all demo shops.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmiseev committed Dec 10, 2024
1 parent 56fbfb6 commit 8ae14e0
Show file tree
Hide file tree
Showing 15 changed files with 1,274 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describeDmsSuiteAndMp('order creation dms', { tags: ['@mp', '@marketplace-order-
selectStoreScenario.execute(staticFixtures.store.name);
});

it('merchant user should be able close an order from guest', (): void => {
skipB2BIt('merchant user should be able close an order from guest', (): void => {
addOneProductToCart();
checkoutMpScenario.execute({ isGuest: true, shouldTriggerOmsInCli: true });

Expand Down Expand Up @@ -104,20 +104,16 @@ describeDmsSuiteAndMp('order creation dms', { tags: ['@mp', '@marketplace-order-
password: staticFixtures.defaultPassword,
});

if (['b2b-mp'].includes(Cypress.env('repositoryId'))) {
cy.runCliCommands(['console oms:check-condition', 'console oms:check-timeout']);
}

closeOrderFromMerchantPortal(orderReference);
closeOrderFromBackoffice();
});
}

function closeOrderFromMerchantPortal(orderReference: string): void {
if (!['b2b-mp', 'suite'].includes(Cypress.env('repositoryId'))) {
salesOrdersPage.visit();
salesOrdersPage.update({ query: orderReference, action: ActionEnum.sendToDistribution });

salesOrdersPage.visit();
salesOrdersPage.update({ query: orderReference, action: ActionEnum.confirmAtCenter });
}

salesOrdersPage.visit();
salesOrdersPage.update({ query: orderReference, action: ActionEnum.ship });

Expand Down Expand Up @@ -163,6 +159,10 @@ describeDmsSuiteAndMp('order creation dms', { tags: ['@mp', '@marketplace-order-
},
});
}

function skipB2BIt(description: string, testFn: () => void): void {
(['b2b-mp'].includes(Cypress.env('repositoryId')) ? it.skip : it)(description, testFn);
}
});

function describeDmsSuiteAndMp(title: string, options: { tags: string[] }, fn: () => void): void {
Expand Down
18 changes: 9 additions & 9 deletions cypress/e2e/mp/marketplace-order-management/order-creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describeSuiteAndMp('order creation', { tags: ['@mp', '@marketplace-order-managem
({ staticFixtures, dynamicFixtures } = Cypress.env());
});

it('merchant user should be able close an order from guest', (): void => {
skipB2BIt('merchant user should be able close an order from guest', (): void => {
addOneProductToCart();
checkoutMpScenario.execute({ isGuest: true, shouldTriggerOmsInCli: true });

Expand Down Expand Up @@ -76,20 +76,16 @@ describeSuiteAndMp('order creation', { tags: ['@mp', '@marketplace-order-managem
password: staticFixtures.defaultPassword,
});

if (['b2b-mp'].includes(Cypress.env('repositoryId'))) {
cy.runCliCommands(['console oms:check-condition', 'console oms:check-timeout']);
}

closeOrderFromMerchantPortal(orderReference);
closeOrderFromBackoffice();
});
}

function closeOrderFromMerchantPortal(orderReference: string): void {
if (!['b2b-mp', 'suite'].includes(Cypress.env('repositoryId'))) {
salesOrdersPage.visit();
salesOrdersPage.update({ query: orderReference, action: ActionEnum.sendToDistribution });

salesOrdersPage.visit();
salesOrdersPage.update({ query: orderReference, action: ActionEnum.confirmAtCenter });
}

salesOrdersPage.visit();
salesOrdersPage.update({ query: orderReference, action: ActionEnum.ship });

Expand All @@ -108,6 +104,10 @@ describeSuiteAndMp('order creation', { tags: ['@mp', '@marketplace-order-managem

salesDetailPage.triggerOms({ state: 'Close' });
}

function skipB2BIt(description: string, testFn: () => void): void {
(['b2b-mp'].includes(Cypress.env('repositoryId')) ? it.skip : it)(description, testFn);
}
});

function describeSuiteAndMp(title: string, options: { tags: string[] }, fn: () => void): void {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,262 @@
{
"data": {
"type": "dynamic-fixtures",
"attributes": {
"synchronize": true,
"operations": [
{
"type": "transfer",
"name": "LocaleTransfer",
"key": "localeEN",
"arguments": { "id_locale": 66, "locale_name": "en_US" }
},
{
"type": "transfer",
"name": "LocaleTransfer",
"key": "localeDE",
"arguments": { "id_locale": 46, "locale_name": "de_DE" }
},
{
"type": "helper",
"name": "haveCountry",
"key": "country"
},
{
"type": "helper",
"name": "haveUser",
"key": "rootUser",
"arguments": [{ "password": "change123" }]
},
{
"type": "helper",
"name": "addUserToGroup",
"arguments": ["#rootUser.id_user", 1]
},
{
"type": "helper",
"name": "haveCustomer",
"key": "customer",
"arguments": [{ "locale": "#localeEN", "password": "change123" }]
},
{
"type": "helper",
"name": "haveCustomerAddress",
"key": "address",
"arguments": [{ "fkCustomer": "#customer.id_customer", "fkCountry": "#country.id_country" }]
},
{
"type": "helper",
"name": "confirmCustomer",
"key": "confirmedCustomer",
"arguments": ["#customer"]
},
{
"type": "helper",
"name": "haveCompany",
"key": "company",
"arguments": [{ "isActive": true, "status": "approved" }]
},
{
"type": "helper",
"name": "haveCompanyBusinessUnit",
"key": "businessUnit",
"arguments": [{ "fkCompany": "#company.id_company" }]
},
{
"type": "helper",
"name": "havePermissionByKey",
"key": "permission1",
"arguments": ["AddCartItemPermissionPlugin"]
},
{
"type": "helper",
"name": "havePermissionByKey",
"key": "permission2",
"arguments": ["ChangeCartItemPermissionPlugin"]
},
{
"type": "helper",
"name": "havePermissionByKey",
"key": "permission3",
"arguments": ["RemoveCartItemPermissionPlugin"]
},
{
"type": "helper",
"name": "havePermissionByKey",
"key": "permission4",
"arguments": ["PlaceOrderWithAmountUpToPermissionPlugin"]
},
{
"type": "helper",
"name": "havePermissionByKey",
"key": "permission5",
"arguments": ["PlaceOrderPermissionPlugin"]
},
{
"type": "helper",
"name": "havePermissionByKey",
"key": "permission6",
"arguments": ["SeeBusinessUnitOrdersPermissionPlugin"]
},
{
"type": "helper",
"name": "haveCompanyRoleWithPermissions",
"arguments": [
{ "isDefault": true, "fkCompany": "#company.id_company" },
["#permission1", "#permission2", "#permission3", "#permission4", "#permission5", "#permission6"]
]
},
{
"type": "helper",
"name": "haveCompanyUser",
"key": "companyUser",
"arguments": [
{
"customer": "#customer",
"fkCustomer": "#customer.id_customer",
"fkCompany": "#company.id_company",
"fkCompanyBusinessUnit": "#businessUnit.id_company_business_unit"
}
]
},
{
"type": "builder",
"name": "LocalizedAttributesBuilder",
"key": "localizedAttribute"
},
{
"type": "transfer",
"name": "StoreTransfer",
"key": "store",
"arguments": { "id_store": 1, "name": "DE" }
},
{
"type": "array-object",
"key": "stores",
"arguments": ["#store"]
},
{
"type": "helper",
"name": "haveUser",
"key": "merchantUser",
"arguments": [{ "password": "change123" }]
},
{
"type": "builder",
"name": "MerchantProfileBuilder",
"key": "merchantProfile"
},
{
"type": "helper",
"name": "haveMerchant",
"key": "merchant",
"arguments": [
{
"merchantProfile": "#merchantProfile",
"isActive": true,
"isOpenForRelationRequest": true,
"status": "approved",
"storeRelation": {
"idStores": ["#store.id_store"]
}
}
]
},
{
"type": "helper",
"name": "haveUrl",
"key": "merchantUrl1",
"arguments": [
{
"fkLocale": "#localeEN.id_locale",
"fkResourceMerchant": "#merchant.id_merchant",
"urlPrefix": "/en/merchant/dummy-en-prefix-",
"url": "#merchant.name"
}
]
},
{
"type": "helper",
"name": "haveUrl",
"arguments": [
{
"fkLocale": "#localeDE.id_locale",
"fkResourceMerchant": "#merchant.id_merchant",
"urlPrefix": "/de/merchant/dummy-de-prefix-",
"url": "#merchant.name"
}
]
},
{
"type": "helper",
"name": "haveMerchantUserWithAclEntities",
"arguments": ["#merchant", "#merchantUser"]
},
{
"type": "transfer",
"name": "ProductImageTransfer",
"key": "productImage",
"arguments": {
"externalUrlSmall": "https://images.icecat.biz/img/gallery_mediums/30691822_1486.jpg",
"externalUrlLarge": "https://images.icecat.biz/img/gallery/30691822_1486.jpg"
}
},
{
"type": "helper",
"name": "haveFullProduct",
"key": "merchantProduct",
"arguments": [
{},
{
"idTaxSet": 1,
"localizedAttributes": [
{ "locale": "#localeEN", "name": "#localizedAttribute.name" },
{ "locale": "#localeDE", "name": "#localizedAttribute.name" }
]
}
]
},
{
"type": "helper",
"name": "haveProductImageSet",
"arguments": [
{
"name": "default",
"idProduct": "#merchantProduct.id_product_concrete",
"idProductAbstract": "#merchantProduct.fk_product_abstract",
"productImages": ["#productImage"]
}
]
},
{
"type": "helper",
"name": "havePriceProduct",
"arguments": [
{
"skuProductAbstract": "#merchantProduct.abstract_sku",
"skuProduct": "#merchantProduct.sku",
"moneyValue": { "netAmount": 50000, "grossAmount": 50000 }
}
]
},
{
"type": "helper",
"name": "haveProductInStock",
"arguments": [
{ "sku": "#merchantProduct.sku", "isNeverOutOfStock": "1", "fkStock": 1, "stockType": "Warehouse1" }
]
},
{
"type": "helper",
"name": "haveMerchantProduct",
"arguments": [
{
"idProductAbstract": "#merchantProduct.fk_product_abstract",
"idMerchant": "#merchant.id_merchant"
}
]
}
]
}
}
}
Loading

0 comments on commit 8ae14e0

Please sign in to comment.