Skip to content

Commit

Permalink
CC-34501: Fixes issues after bugfixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmiseev committed Nov 15, 2024
1 parent 1769de6 commit 88bc072
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 8 deletions.
15 changes: 9 additions & 6 deletions cypress/e2e/yves/order-amendment/order-amendment-start.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { container } from '@utils';
import { OrderAmendmentStartDynamicFixtures, OrderAmendmentStaticFixtures } from '@interfaces/yves';
import { CartPage, CatalogPage, CustomerOverviewPage, OrderDetailsPage, ProductPage } from '@pages/yves';
import { CheckoutScenario, CustomerLoginScenario } from '@scenarios/yves';
import { DenyProductScenario, RemoveProductStockScenario, UserLoginScenario } from '@scenarios/backoffice';
import { RemoveProductStockScenario, UserLoginScenario } from '@scenarios/backoffice';
import { SalesDetailPage, SalesIndexPage } from '@pages/backoffice';
import { DeactivateProductScenario } from '../../../support/scenarios/backoffice/deactivate-product-scenario';

/**
* Order Amendment checklists: {@link https://spryker.atlassian.net/wiki/spaces/CCS/pages/4545871873/Initialisation+Order+Amendment+Process}
Expand All @@ -22,7 +23,7 @@ import { SalesDetailPage, SalesIndexPage } from '@pages/backoffice';

const customerLoginScenario = container.get(CustomerLoginScenario);
const checkoutScenario = container.get(CheckoutScenario);
const denyProductScenario = container.get(DenyProductScenario);
const deactivateProductScenario = container.get(DeactivateProductScenario);
const userLoginScenario = container.get(UserLoginScenario);
const removeProductStockScenario = container.get(RemoveProductStockScenario);

Expand Down Expand Up @@ -99,7 +100,7 @@ import { SalesDetailPage, SalesIndexPage } from '@pages/backoffice';

it('customer should not be able to amend order when item was deactivated', (): void => {
placeCustomerOrder(dynamicFixtures.customer5.email, dynamicFixtures.address5.id_customer_address);
denyProductInBackoffice();
deactivateProductInBackoffice();

customerLoginScenario.execute({
email: dynamicFixtures.customer5.email,
Expand All @@ -110,7 +111,9 @@ import { SalesDetailPage, SalesIndexPage } from '@pages/backoffice';
orderDetailsPage.editOrder();

cartPage.assertPageLocation();
cy.contains(`Product sku ${dynamicFixtures.productInActive.sku} is not active.`).should('exist');
cy.contains(`Inactive item ${dynamicFixtures.productInActive.sku} was removed from your shopping cart.`).should(
'exist'
);
cy.get('body').contains(dynamicFixtures.product.name).should('exist');
cy.get('body').contains(dynamicFixtures.productInActive.name).should('not.exist');
});
Expand Down Expand Up @@ -142,13 +145,13 @@ import { SalesDetailPage, SalesIndexPage } from '@pages/backoffice';
checkoutScenario.execute({ idCustomerAddress: idCustomerAddress, shouldTriggerOmsInCli: true });
}

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

denyProductScenario.execute({
deactivateProductScenario.execute({
abstractSku: dynamicFixtures.productInActive.abstract_sku,
shouldTriggerPublishAndSync: true,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class ProductManagementEditVariantPage extends BackofficePage {

protected PAGE_URL = '/product-management/edit/variant';

activateFirstConcreteProduct = (): void => {
activate = (): void => {
this.repository.getActivateButton().click();

this.repository.getSearchableDECheckbox().check();
Expand All @@ -23,4 +23,8 @@ export class ProductManagementEditVariantPage extends BackofficePage {

this.repository.getSaveButton().click();
};

deactivate = (): void => {
this.repository.getDeactivateButton().click();
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { injectable } from 'inversify';
@autoWired
export class ProductManagementEditVariantRepository {
getActivateButton = (): Cypress.Chainable => cy.get('a:contains("Activate")');
getDeactivateButton = (): Cypress.Chainable => cy.get('a:contains("Deactivate")');
getSearchableDECheckbox = (): Cypress.Chainable => cy.get('#product_concrete_form_edit_general_de_DE_is_searchable');
getEnUsCollapsedBlock = (): Cypress.Chainable =>
cy.get('#tab-content-general > .panel-body > .collapsed > .ibox-title > .collapse-link > .ibox-tools > .fas');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class CreateProductScenario {
this.productManagementListPage.update({ query: productAbstract.sku, action: ActionEnum.edit });
this.productManagementEditPage.openFirstVariant();

this.productManagementEditVariantPage.activateFirstConcreteProduct();
this.productManagementEditVariantPage.activate();

if (params?.shouldTriggerPublishAndSync) {
cy.runCliCommands(['console queue:worker:start --stop-when-empty']);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import {
ActionEnum,
ProductManagementEditPage,
ProductManagementEditVariantPage,
ProductManagementListPage,
} from '@pages/backoffice';
import { autoWired } from '@utils';
import { inject, injectable } from 'inversify';

@injectable()
@autoWired
export class DeactivateProductScenario {
@inject(ProductManagementListPage) private productManagementListPage: ProductManagementListPage;
@inject(ProductManagementEditPage) private productManagementEditPage: ProductManagementEditPage;
@inject(ProductManagementEditVariantPage) private productManagementEditVariantPage: ProductManagementEditVariantPage;

execute = (params: ExecuteParams): void => {
this.productManagementListPage.visit();
this.productManagementListPage.update({ query: params.abstractSku, action: ActionEnum.edit });
this.productManagementEditPage.openFirstVariant();

this.productManagementEditVariantPage.deactivate();

if (params?.shouldTriggerPublishAndSync) {
cy.runCliCommands(['console queue:worker:start --stop-when-empty']);
}
};
}

interface ExecuteParams {
abstractSku: string;
shouldTriggerPublishAndSync?: boolean;
}

0 comments on commit 88bc072

Please sign in to comment.