Master Data Check
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: Login
Products
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:
Download test
Used API login - needs to be configured here - Login
Run time 25s
Download the LoginAPI-MasterDataCheck here.
Used FE login - not needed to configure (only baseURL)
Run time 29s
Download the LoginFE-MasterDataCheck here.