Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

How to check values in master data?

Precondition

  • You need to have login and correct struncture of the .spec.js file in your test (API or FE) - see this page: NEW-Login

Products

  1. We need to find “data-row-key” for row that we are checking

2. Write a regex for your checked data - for example this one: /^Long Island Iced Tea$/

  • Value has to be in this format: /^data$/

    • String has to be between / /

    • ^ means start of the string

    • $ means end of string

Code for checking, that Product “BV-001” has Product Name = “Long Island Iced Tea“

cy.get('[data-row-key="59.P"]')
  .contains(/^Long Island Iced Tea$/)
  .should('contain', 'Long Island Iced Tea');  

Test code:

 //Products
  //1) open Product master
  //2) find product MB-0016 and check that contains value "D"
  //3) find product CypressTST and check more values
    
it('Products', () => {
    cy.visit('/#/md/products');
    cy.url().should('contain', '/#/md/products'); //assert
    cy.waitForSpinner();

    //check product MB-0016
    const FirstVariable = 'MB-0016';

    cy.contains('.ucTableHeaderColumnContextMenu', 'Product Id')
      .find('[data-test="quickFilter-input"]')//click on the quick filter
      .type(FirstVariable + '{enter}', { force: true }); //variable
    cy.contains('.ant-pagination-total-text', '1 row');//check only 1 result
    cy.get('[data-row-key="16.P"]').contains(/^D$/).should('contain', 'D');//assertion that product contains value "D"      
    cy.waitForSpinner();

    //check product CypressTST
    const SecondVariable = 'CypressTST';

    cy.contains('.ucTableHeaderColumnContextMenu', 'Product Id')
      .find('[data-test="quickFilter-input"]') //click on the quick filter
      .clear({ force: true }) //value deletion in the quick filter
      .type(SecondVariable + '{enter}', { force: true }); //variable
    cy.contains('.ant-pagination-total-text', '1 row');
    cy.get('[data-row-key="120.P"]').contains(/^Others$/).should('contain', 'Others');
    cy.get('[data-row-key="120.P"]').contains(/^A a a A$/).should('contain', 'A a a A');
    cy.get('[data-row-key="120.P"]').contains(/^Somehitng Beautiful$/).should('contain', 'Somehitng Beautiful');
    cy.waitForSpinner();

  });


Price parameters

  • Is possible to open specific PP table by adding number in URL - for example 2344 (https://demo.pricefx.eu/app/modules/#/md/priceparameters/2344)

  • Two options how to check specific value - possible to see in added code

  • Percentage (displayed in PP table for example 40.00%) should be checked by “40“ or 40.00%

  //Price parameters
  //1) open Price parameters
  //2) go to table "margin targets" - id of the table = 2344
  //3) find attribute "Alcoholic"
  //4) check that value for Alcoholic is 40%

  it('Price parameters', () => {
    cy.visit('/#/md/priceparameters/2344'); //2344 is PP table TargetMargin
    cy.url().should('contain', '/#/md/priceparameters/2344'); //assert
    cy.waitForSpinner();

    //First option how to test, that row "Alcoholic" contains value 40
    cy.contains('tr', 'Alcoholic').should('contain', '40')

    //Second option how to check same thing
    //click on right container, write "==Alcoholic" into quick filter and check that cell contains 40
    const Variable = '==Alcoholic';
    cy.contains('.ucLayoutVerticalSplitter__innerContainer', 'Price Parameter Values: Target Margin per Prod Group')//click on right container (values in PP table)
      .contains('.ucTableHeaderColumnContextMenu', 'Name')
      .find('[data-test="quickFilter-input"]')
      .type(Variable + '{enter}'); //variable
    cy.waitForSpinner();
    //value checking - could be 40.00% or 40
    cy.contains('.ucTableEditableCell', '40');
  });


Product extensions

  • Same options for testing values as previous categories

  • Switching between PX is possible via URL

Test code:

  //Product Extensions
  //1) open Product extensions - product_Costs
  //2) find product MB-0007
  //3) check that 6 rows are displayed
  //4) find row 539.PX30 and check, that this row contains value €14.29
  //5) switch to CrossSell PX
  //6) switch to ProceGuidance PX
  it('Product extensions', () => {
    
    //category Product cost
    cy.visit('/#/md/product-extensions/Product_Costs'); 
    cy.url().should('contain', '/#/md/product-extensions/Product_Costs'); //assert

    const PXvariable = 'MB-0007';
    cy.contains('.ucTableHeaderColumnContextMenu', 'Product ID')
      .find('[data-test="quickFilter-input"]')//click on the quick filter
      .type(PXvariable + '{enter}', { force: true }); //variable
    cy.contains('.ant-pagination-total-text', '6 row');//check that 6 rows are displayed
    cy.get('[data-row-key="539.PX30"]').contains(/^€14.29$/).should('contain', '€14.29');//assertion      
    cy.waitForSpinner();

    //category Cross Sell
    cy.visit('/#/md/product-extensions/CrossSell'); 
    cy.url().should('contain', '/#/md/product-extensions/CrossSell'); //assert
    cy.waitForSpinner();

    //category Price Guidance per segment
    cy.visit('/#/md/product-extensions/PriceGuidance'); 
    cy.url().should('contain', '/#/md/product-extensions/PriceGuidance'); //assert
    cy.waitForSpinner();
  });

Download test

  • Used API login - needs to be configured here - NEW-Login

  • Run time 25s

  • Used FE login - not needed to configure (only baseURL)

  • Run time 29s

  • No labels