Skip to content

Commit

Permalink
Restructured tests into smaller parts.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmiseev committed Mar 13, 2024
1 parent 6cdc3f2 commit 2ea4e2d
Show file tree
Hide file tree
Showing 38 changed files with 1,040 additions and 547 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { OrderManagementStaticFixtures, OrderManagementSuite1DynamicFixtures } from '@interfaces/backoffice';
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 management suite 1', { tags: ['@order-management'] }, (): void => {
describe('order creation', { tags: ['@order-management'] }, (): void => {
const cartPage = container.get(CartPage);
const salesIndexPage = container.get(SalesIndexPage);
const loginCustomerScenario = container.get(CustomerLoginScenario);
const checkoutScenario = container.get(CheckoutScenario);
const userLoginScenario = container.get(UserLoginScenario);

let staticFixtures: OrderManagementStaticFixtures;
let dynamicFixtures: OrderManagementSuite1DynamicFixtures;
let dynamicFixtures: OrderCreationDynamicFixtures;

before((): void => {
({ staticFixtures, dynamicFixtures } = Cypress.env());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { ReturnManagementStaticFixtures, ReturnManagementSuite1DynamicFixtures } from '@interfaces/backoffice';
import { ReturnCreationDynamicFixtures, ReturnManagementStaticFixtures } from '@interfaces/backoffice';
import { SalesDetailPage, SalesIndexPage, SalesReturnGuiCreatePage } from '@pages/backoffice';
import { UserLoginScenario } from '@scenarios/backoffice';
import { CheckoutScenario, CustomerLoginScenario } from '@scenarios/yves';
import { container } from '@utils';

describe('return management suite 1', { tags: ['@return-management'] }, (): void => {
describe('return creation', { tags: ['@return-management'] }, (): void => {
const salesIndexPage = container.get(SalesIndexPage);
const salesDetailPage = container.get(SalesDetailPage);
const salesReturnGuiCreatePage = container.get(SalesReturnGuiCreatePage);
const customerLoginScenario = container.get(CustomerLoginScenario);
const userLoginScenario = container.get(UserLoginScenario);
const checkoutScenario = container.get(CheckoutScenario);

let dynamicFixtures: ReturnManagementSuite1DynamicFixtures;
let dynamicFixtures: ReturnCreationDynamicFixtures;
let staticFixtures: ReturnManagementStaticFixtures;

before((): void => {
Expand All @@ -39,7 +39,7 @@ describe('return management suite 1', { tags: ['@return-management'] }, (): void

salesIndexPage.visit();
salesIndexPage.viewLastPlacedOrder();
salesDetailPage.triggerOms('Pay');
salesDetailPage.triggerOms('Pay', true);
salesDetailPage.triggerOms('Skip timeout');
salesDetailPage.triggerOms('skip picking');
salesDetailPage.triggerOms('Ship');
Expand All @@ -63,7 +63,7 @@ describe('return management suite 1', { tags: ['@return-management'] }, (): void

salesIndexPage.visit();
salesIndexPage.viewLastPlacedOrder();
salesDetailPage.triggerOms('Pay');
salesDetailPage.triggerOms('Pay', true);
salesDetailPage.triggerOms('Skip timeout');
salesDetailPage.triggerOms('skip picking');
salesDetailPage.triggerOms('Ship');
Expand Down
84 changes: 84 additions & 0 deletions cypress/e2e/mp/marketplace-agent-assist/agent-authorization.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
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}
*/
describe('agent authorization', { tags: ['@marketplace-agent-assist'] }, (): void => {
const yvesLoginPage = container.get(LoginPage);
const yvesAgentLoginPage = container.get(AgentLoginPage);
const backofficeIndexPage = container.get(IndexPage);
const userLoginScenario = container.get(UserLoginScenario);
const merchantAgentLoginUserScenario = container.get(MerchantAgentLoginUserScenario);

let dynamicFixtures: AgentAuthorizationDynamicFixtures;
let staticFixtures: MarketplaceAgentAssistStaticFixtures;

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

it('agent (customer) should be able to login to backoffice', (): void => {
userLoginScenario.execute({
username: dynamicFixtures.customerAgentUser.username,
password: staticFixtures.defaultPassword,
});

backofficeIndexPage.visit();
backofficeIndexPage.assertPageLocation();
});

it('agent (merchant user) should be able to login to backoffice', (): void => {
merchantAgentLoginUserScenario.execute({
username: dynamicFixtures.merchantAgentUser.username,
password: staticFixtures.defaultPassword,
});

backofficeIndexPage.visit();
backofficeIndexPage.assertPageLocation();
});

it('agent (merchant user) should not be able to login to storefront agent dashboard', (): void => {
yvesAgentLoginPage.visit();
yvesAgentLoginPage.login(dynamicFixtures.merchantAgentUser.username, 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);

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);

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);

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);

cy.contains(yvesLoginPage.getFailedAuthenticationText());
yvesLoginPage.assertPageLocation();
});
});
166 changes: 166 additions & 0 deletions cypress/e2e/mp/marketplace-agent-assist/agent-dashboard.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
import { AgentDashboardDynamicFixtures, MarketplaceAgentAssistStaticFixtures } from '@interfaces/mp';
import { AgentDashboardPage, DashboardPage, AgentLoginPage as MpAgentLoginPage } from '@pages/mp';
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}
*/
describe('agent dashboard', { tags: ['@marketplace-agent-assist'] }, (): void => {
const mpAgentLoginPage = container.get(MpAgentLoginPage);
const mpDashboardPage = container.get(DashboardPage);
const mpAgentDashboardPage = container.get(AgentDashboardPage);
const userLoginScenario = container.get(UserLoginScenario);
const merchantAgentLoginUserScenario = container.get(MerchantAgentLoginUserScenario);

let dynamicFixtures: AgentDashboardDynamicFixtures;
let staticFixtures: MarketplaceAgentAssistStaticFixtures;

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

it('agent should be able to see "Merchant Users" table', (): void => {
merchantAgentLoginUserScenario.execute({
username: dynamicFixtures.merchantAgentUser.username,
password: staticFixtures.defaultPassword,
});

mpAgentDashboardPage.visit();
mpAgentDashboardPage.assertPageLocation();
mpAgentDashboardPage.getDashboardSidebarSelector().contains('Merchant Users');

cy.contains('Merchant');
cy.contains('Merchant Approval');
cy.contains('First Name');
cy.contains('Last Name');
cy.contains('Email');
cy.contains('User Status');
});

it('agent should be able to see active merchant user in a table', (): void => {
merchantAgentLoginUserScenario.execute({
username: dynamicFixtures.merchantAgentUser.username,
password: staticFixtures.defaultPassword,
});

mpAgentDashboardPage.visit();
mpAgentDashboardPage.findMerchantUser(dynamicFixtures.merchantUser.username).should('exist');
});

it('agent should be able to filter by merchant user properties', (): void => {
merchantAgentLoginUserScenario.execute({
username: dynamicFixtures.merchantAgentUser.username,
password: staticFixtures.defaultPassword,
});

mpAgentDashboardPage.visit();
mpAgentDashboardPage.findMerchantUser(dynamicFixtures.merchant.name, 3).should('exist');
mpAgentDashboardPage.findMerchantUser(dynamicFixtures.merchantUser.username).should('exist');
});

it('agent should be able to see/assist inactive merchant user in a table', (): void => {
mpAgentLoginPage.visit();
mpAgentLoginPage.login(dynamicFixtures.merchantAgentUser.username, staticFixtures.defaultPassword);

mpAgentDashboardPage.visit();
mpAgentDashboardPage.findMerchantUser(dynamicFixtures.deactivatedMerchantUser.username).should('exist');

mpAgentDashboardPage.visit();
mpAgentDashboardPage.assistMerchantUser(dynamicFixtures.deactivatedMerchantUser.username);

mpDashboardPage.assertPageLocation();
});

it('agent should be able to see/assist deleted merchant user in a table', (): void => {
mpAgentLoginPage.visit();
mpAgentLoginPage.login(dynamicFixtures.merchantAgentUser.username, staticFixtures.defaultPassword);

mpAgentDashboardPage.visit();
mpAgentDashboardPage.findMerchantUser(dynamicFixtures.deletedMerchantUser.username).should('exist');

mpAgentDashboardPage.visit();
mpAgentDashboardPage.assistMerchantUser(dynamicFixtures.deletedMerchantUser.username);

mpDashboardPage.assertPageLocation();
});

it('agent should be able to see/assist merchant users from active (without approved access) merchant', (): void => {
userLoginScenario.execute({
username: dynamicFixtures.rootUser.username,
password: staticFixtures.defaultPassword,
});

mpAgentLoginPage.visit();
mpAgentLoginPage.login(dynamicFixtures.merchantAgentUser.username, staticFixtures.defaultPassword);

mpAgentDashboardPage.visit();
mpAgentDashboardPage
.findMerchantUser(dynamicFixtures.merchantUserFromActiveDeniedMerchant.username)
.should('exist');

mpAgentDashboardPage.visit();
mpAgentDashboardPage.assistMerchantUser(dynamicFixtures.merchantUserFromActiveDeniedMerchant.username);

mpDashboardPage.assertPageLocation();
});

it('agent should be able to see/assist merchant users from inactive (with approved access) merchant', (): void => {
userLoginScenario.execute({
username: dynamicFixtures.rootUser.username,
password: staticFixtures.defaultPassword,
});

mpAgentLoginPage.visit();
mpAgentLoginPage.login(dynamicFixtures.merchantAgentUser.username, staticFixtures.defaultPassword);

mpAgentDashboardPage.visit();
mpAgentDashboardPage
.findMerchantUser(dynamicFixtures.merchantUserFromInactiveApprovedMerchant.username)
.should('exist');

mpAgentDashboardPage.visit();
mpAgentDashboardPage.assistMerchantUser(dynamicFixtures.merchantUserFromInactiveApprovedMerchant.username);

mpDashboardPage.assertPageLocation();
});

it('agent should be able to see/assist merchant users from inactive (without approved access) merchant', (): void => {
userLoginScenario.execute({
username: dynamicFixtures.rootUser.username,
password: staticFixtures.defaultPassword,
});

mpAgentLoginPage.visit();
mpAgentLoginPage.login(dynamicFixtures.merchantAgentUser.username, staticFixtures.defaultPassword);

mpAgentDashboardPage.visit();
mpAgentDashboardPage
.findMerchantUser(dynamicFixtures.merchantUserFromInactiveDeniedMerchant.username)
.should('exist');

mpAgentDashboardPage.visit();
mpAgentDashboardPage.assistMerchantUser(dynamicFixtures.merchantUserFromInactiveDeniedMerchant.username);

mpDashboardPage.assertPageLocation();
});

it('agent should be able to see/assist merchant users from active (with approved access) merchant', (): void => {
userLoginScenario.execute({
username: dynamicFixtures.rootUser.username,
password: staticFixtures.defaultPassword,
});

mpAgentLoginPage.visit();
mpAgentLoginPage.login(dynamicFixtures.merchantAgentUser.username, staticFixtures.defaultPassword);

mpAgentDashboardPage.visit();
mpAgentDashboardPage.findMerchantUser(dynamicFixtures.merchantUser.username).should('exist');

mpAgentDashboardPage.visit();
mpAgentDashboardPage.assistMerchantUser(dynamicFixtures.merchantUser.username);

mpDashboardPage.assertPageLocation();
});
});
Loading

0 comments on commit 2ea4e2d

Please sign in to comment.