Skip to content

Commit

Permalink
Merge pull request #4 from spryker/feature/cc-32736/dev-merchant-rela…
Browse files Browse the repository at this point in the history
…tions

CC-32421 Merchant Relation Requests & Enhanced Merchant Relations.
  • Loading branch information
dmiseev authored Mar 27, 2024
2 parents 8a1d02d + 154263d commit 895bd65
Show file tree
Hide file tree
Showing 146 changed files with 4,302 additions and 627 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
import { container } from '@utils';
import { RequestManagementDynamicFixtures, RequestManagementStaticFixtures } from '@interfaces/backoffice';
import { UserLoginScenario } from '@scenarios/backoffice';
import {
ActionEnum,
MerchantRelationRequestEditPage,
MerchantRelationRequestListPage,
MerchantRelationshipListPage,
} from '@pages/backoffice';

/**
* Merchant Relation Requests & Enhanced Merchant Relations checklists: {@link https://spryker.atlassian.net/wiki/spaces/CCS/pages/4105896492/Business+Journey+B2B+Marketplace+-+to+automate}
*/
describe('request management', { tags: ['@merchant-b2b-contract-requests'] }, (): void => {
const merchantRelationRequestListPage = container.get(MerchantRelationRequestListPage);
const merchantRelationRequestEditPage = container.get(MerchantRelationRequestEditPage);
const merchantRelationshipListPage = container.get(MerchantRelationshipListPage);
const userLoginScenario = container.get(UserLoginScenario);

let dynamicFixtures: RequestManagementDynamicFixtures;
let staticFixtures: RequestManagementStaticFixtures;

before((): void => {
({ dynamicFixtures, staticFixtures } = Cypress.env());
});

beforeEach((): void => {
userLoginScenario.execute({
username: dynamicFixtures.rootUser.username,
password: staticFixtures.defaultPassword,
});
});

it('operator should be able to see all requests from all merchants', (): void => {
const merchants = [dynamicFixtures.merchant1, dynamicFixtures.merchant2, dynamicFixtures.merchant3];

merchants.forEach((merchant) => {
merchantRelationRequestListPage.visit();
merchantRelationRequestListPage.update({
action: ActionEnum.edit,
idMerchant: merchant.id_merchant,
});

cy.contains(merchant.name);
});
});

it('operator should be able to see internal comments from all merchant users', (): void => {
merchantRelationRequestListPage.visit();
merchantRelationRequestListPage.update({
action: ActionEnum.edit,
idMerchant: dynamicFixtures.merchant1.id_merchant,
});

cy.contains(staticFixtures.internalCommentFromMerchantUser1);
cy.contains(staticFixtures.internalCommentFromMerchantUser2);
});

it('operator should be able to add internal comment', (): void => {
merchantRelationRequestListPage.visit();
merchantRelationRequestListPage.update({
action: ActionEnum.edit,
idMerchant: dynamicFixtures.merchant1.id_merchant,
});

merchantRelationRequestEditPage.addInternalComment({ comment: staticFixtures.internalCommentFromRootUser });

merchantRelationRequestListPage.visit();
merchantRelationRequestListPage.update({
action: ActionEnum.edit,
idMerchant: dynamicFixtures.merchant1.id_merchant,
});

cy.contains(staticFixtures.internalCommentFromRootUser);
});

it('operator should be able to add internal comment with emoji', (): void => {
merchantRelationRequestListPage.visit();
merchantRelationRequestListPage.update({
action: ActionEnum.edit,
idMerchant: dynamicFixtures.merchant1.id_merchant,
});

merchantRelationRequestEditPage.addInternalComment({
comment: staticFixtures.internalCommentFromRootUserWithEmoji,
});

merchantRelationRequestListPage.visit();
merchantRelationRequestListPage.update({
action: ActionEnum.edit,
idMerchant: dynamicFixtures.merchant1.id_merchant,
});

cy.contains(staticFixtures.internalCommentFromRootUserWithEmoji);
});

it('operator should be able to reject request', (): void => {
merchantRelationRequestListPage.visit();
merchantRelationRequestListPage.update({
action: ActionEnum.edit,
idMerchant: dynamicFixtures.merchant3.id_merchant,
});

merchantRelationRequestEditPage.reject();

merchantRelationRequestListPage.visit();
merchantRelationRequestListPage.update({
action: ActionEnum.view,
idMerchant: dynamicFixtures.merchant3.id_merchant,
});

cy.contains('Rejected');

merchantRelationshipListPage.visit();
merchantRelationshipListPage.applyFilters({ idCompany: dynamicFixtures.company2.id_company });
merchantRelationshipListPage.getEditButtons().should('have.length', 0);
});

it('operator should be able to approve request (additionally copy internal comments to relation)', (): void => {
merchantRelationRequestListPage.visit();
merchantRelationRequestListPage.update({
action: ActionEnum.edit,
idMerchant: dynamicFixtures.merchant1.id_merchant,
});

merchantRelationRequestEditPage.approve({ isSplitEnabled: false });

merchantRelationRequestListPage.visit();
merchantRelationRequestListPage.update({
action: ActionEnum.view,
idMerchant: dynamicFixtures.merchant1.id_merchant,
});
cy.contains('Approved');

merchantRelationshipListPage.visit();
merchantRelationshipListPage.update({ idCompany: dynamicFixtures.company1.id_company });

cy.contains(staticFixtures.internalCommentFromMerchantUser1);
cy.contains(staticFixtures.internalCommentFromMerchantUser2);
});

it('operator should be able to approve request with enabled BU splitting', (): void => {
merchantRelationRequestListPage.visit();
merchantRelationRequestListPage.update({
action: ActionEnum.edit,
idMerchant: dynamicFixtures.merchant2.id_merchant,
});

merchantRelationRequestEditPage.approve({ isSplitEnabled: true });

merchantRelationRequestListPage.visit();
merchantRelationRequestListPage.update({
action: ActionEnum.view,
idMerchant: dynamicFixtures.merchant2.id_merchant,
});
cy.contains('Approved');

merchantRelationshipListPage.visit();
merchantRelationshipListPage.applyFilters({ idCompany: dynamicFixtures.company2.id_company });
merchantRelationshipListPage.getEditButtons().should('have.length', 2);
});
});
12 changes: 8 additions & 4 deletions cypress/e2e/backoffice/order-management/order-creation.cy.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { container } from '@utils';
import { OrderCreationDynamicFixtures, OrderManagementStaticFixtures } from '@interfaces/backoffice';
import { SalesIndexPage } from '@pages/backoffice';
import { CartPage } from '@pages/yves';
import { UserLoginScenario } from '@scenarios/backoffice';
import { CheckoutScenario, CustomerLoginScenario } from '@scenarios/yves';
import { container } from '@utils';

describe('order creation', { tags: ['@order-management'] }, (): void => {
const cartPage = container.get(CartPage);
Expand Down Expand Up @@ -33,14 +33,16 @@ describe('order creation', { tags: ['@order-management'] }, (): void => {
username: dynamicFixtures.rootUser.username,
password: staticFixtures.defaultPassword,
});
salesIndexPage.viewLastPlacedOrder();

salesIndexPage.visit();
salesIndexPage.view();

cy.get('body').contains(dynamicFixtures.product.name);
});

it('should be able to create an order by guest', (): void => {
cartPage.visit();
cartPage.quickAddToCart(dynamicFixtures.product.sku, 1);
cartPage.quickAddToCart({ sku: dynamicFixtures.product.sku, quantity: 1 });

checkoutScenario.execute({ isGuest: true });
cy.contains('Your order has been placed successfully!');
Expand All @@ -49,7 +51,9 @@ describe('order creation', { tags: ['@order-management'] }, (): void => {
username: dynamicFixtures.rootUser.username,
password: staticFixtures.defaultPassword,
});
salesIndexPage.viewLastPlacedOrder();

salesIndexPage.visit();
salesIndexPage.view();

cy.get('body').contains(dynamicFixtures.product.name);
});
Expand Down
53 changes: 23 additions & 30 deletions cypress/e2e/backoffice/return-management/return-creation.cy.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { container } from '@utils';
import { ReturnCreationDynamicFixtures, ReturnManagementStaticFixtures } from '@interfaces/backoffice';
import { SalesDetailPage, SalesIndexPage, SalesReturnGuiCreatePage } from '@pages/backoffice';
import { SalesDetailPage, SalesIndexPage, SalesReturnCreatePage } from '@pages/backoffice';
import { UserLoginScenario } from '@scenarios/backoffice';
import { CheckoutScenario, CustomerLoginScenario } from '@scenarios/yves';
import { container } from '@utils';

describe('return creation', { tags: ['@return-management'] }, (): void => {
const salesIndexPage = container.get(SalesIndexPage);
const salesDetailPage = container.get(SalesDetailPage);
const salesReturnGuiCreatePage = container.get(SalesReturnGuiCreatePage);
const salesReturnCreatePage = container.get(SalesReturnCreatePage);
const customerLoginScenario = container.get(CustomerLoginScenario);
const userLoginScenario = container.get(UserLoginScenario);
const checkoutScenario = container.get(CheckoutScenario);
Expand All @@ -24,53 +24,46 @@ describe('return creation', { tags: ['@return-management'] }, (): void => {
email: dynamicFixtures.customer.email,
password: staticFixtures.defaultPassword,
});
});

it('should be able to create return from (from shipped order state)', (): void => {
checkoutScenario.execute({
isGuest: false,
isMultiShipment: false,
idCustomerAddress: dynamicFixtures.address.id_customer_address,
});

userLoginScenario.execute({
username: dynamicFixtures.rootUser.username,
password: staticFixtures.defaultPassword,
});
});

it('should be able to create return from (from shipped order state)', (): void => {
salesIndexPage.visit();
salesIndexPage.viewLastPlacedOrder();
salesDetailPage.triggerOms('Pay', true);
salesDetailPage.triggerOms('Skip timeout');
salesDetailPage.triggerOms('skip picking');
salesDetailPage.triggerOms('Ship');
salesIndexPage.view();

salesDetailPage.triggerOms({ state: 'Pay', shouldTriggerOmsInCli: true });
salesDetailPage.triggerOms({ state: 'Skip timeout' });
salesDetailPage.triggerOms({ state: 'skip picking' });
salesDetailPage.triggerOms({ state: 'Ship' });

salesDetailPage.createReturn();
salesReturnGuiCreatePage.createReturnForAllOrderItems();
salesDetailPage.create();
salesReturnCreatePage.create();

cy.contains('Return was successfully created.');
});

it('should be able to create return from (from delivery order state)', (): void => {
checkoutScenario.execute({
isGuest: false,
isMultiShipment: false,
idCustomerAddress: dynamicFixtures.address.id_customer_address,
});
userLoginScenario.execute({
username: dynamicFixtures.rootUser.username,
password: staticFixtures.defaultPassword,
});

salesIndexPage.visit();
salesIndexPage.viewLastPlacedOrder();
salesDetailPage.triggerOms('Pay', true);
salesDetailPage.triggerOms('Skip timeout');
salesDetailPage.triggerOms('skip picking');
salesDetailPage.triggerOms('Ship');
salesDetailPage.triggerOms('Stock update');
salesIndexPage.view();

salesDetailPage.triggerOms({ state: 'Pay', shouldTriggerOmsInCli: true });
salesDetailPage.triggerOms({ state: 'Skip timeout' });
salesDetailPage.triggerOms({ state: 'skip picking' });
salesDetailPage.triggerOms({ state: 'Ship' });
salesDetailPage.triggerOms({ state: 'Stock update' });

salesDetailPage.createReturn();
salesReturnGuiCreatePage.createReturnForAllOrderItems();
salesDetailPage.create();
salesReturnCreatePage.create();

cy.contains('Return was successfully created.');
});
Expand Down
27 changes: 21 additions & 6 deletions cypress/e2e/mp/marketplace-agent-assist/agent-authorization.cy.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { container } from '@utils';
import { AgentAuthorizationDynamicFixtures, MarketplaceAgentAssistStaticFixtures } from '@interfaces/mp';
import { IndexPage } from '@pages/backoffice';
import { AgentLoginPage, LoginPage } from '@pages/yves';
import { UserLoginScenario } from '@scenarios/backoffice';
import { MerchantAgentLoginUserScenario } from '@scenarios/mp';
import { container } from '@utils';

/**
* Agent Assist in Merchant Portal checklists: {@link https://spryker.atlassian.net/wiki/spaces/CCS/pages/3975741526/Agent+Assist+in+Merchant+Portal+Checklists}
Expand Down Expand Up @@ -44,39 +44,54 @@ describe('agent authorization', { tags: ['@marketplace-agent-assist'] }, (): voi

it('agent (merchant user) should not be able to login to storefront agent dashboard', (): void => {
yvesAgentLoginPage.visit();
yvesAgentLoginPage.login(dynamicFixtures.merchantAgentUser.username, staticFixtures.defaultPassword);
yvesAgentLoginPage.login({
username: dynamicFixtures.merchantAgentUser.username,
password: staticFixtures.defaultPassword,
});

cy.contains(yvesAgentLoginPage.getFailedAuthenticationText());
yvesAgentLoginPage.assertPageLocation();
});

it('merchant user should not be able to login to storefront agent dashboard', (): void => {
yvesAgentLoginPage.visit();
yvesAgentLoginPage.login(dynamicFixtures.merchantAgentUser.username, staticFixtures.defaultPassword);
yvesAgentLoginPage.login({
username: dynamicFixtures.merchantUser.username,
password: staticFixtures.defaultPassword,
});

cy.contains(yvesAgentLoginPage.getFailedAuthenticationText());
yvesAgentLoginPage.assertPageLocation();
});

it('agent (merchant user) should not be able to login to storefront', (): void => {
yvesLoginPage.visit();
yvesLoginPage.login(dynamicFixtures.merchantAgentUser.username, staticFixtures.defaultPassword);
yvesLoginPage.login({
email: dynamicFixtures.merchantAgentUser.username,
password: staticFixtures.defaultPassword,
});

cy.contains(yvesLoginPage.getFailedAuthenticationText());
yvesLoginPage.assertPageLocation();
});

it('agent (customer) should not be able to login to storefront', (): void => {
yvesLoginPage.visit();
yvesLoginPage.login(dynamicFixtures.customerAgentUser.username, staticFixtures.defaultPassword);
yvesLoginPage.login({
email: dynamicFixtures.customerAgentUser.username,
password: staticFixtures.defaultPassword,
});

cy.contains(yvesLoginPage.getFailedAuthenticationText());
yvesLoginPage.assertPageLocation();
});

it('merchant user should not be able to login to storefront', (): void => {
yvesLoginPage.visit();
yvesLoginPage.login(dynamicFixtures.merchantUser.username, staticFixtures.defaultPassword);
yvesLoginPage.login({
email: dynamicFixtures.merchantUser.username,
password: staticFixtures.defaultPassword,
});

cy.contains(yvesLoginPage.getFailedAuthenticationText());
yvesLoginPage.assertPageLocation();
Expand Down
Loading

0 comments on commit 895bd65

Please sign in to comment.