Quotes
Ember framework (QC) = different approach in testing than in React (MB, PB, PA)
Test case
//quotes
//1) Open Quote with label "cypress"
//2) add an item using the 'Browse' button
//3) click on product detail, write 10 into quantity input and click on recalculat
//4) Check that Total invoice price has been changed to 174.22 EUR
Â
Code
describe('React - Products', () => {
before(() => {
cy.login('demoPartition');//API login ("demoPartition" is the setting configured in file users.js)
});
beforeEach(() => {
// Configure 'X-PriceFx-Csrf-Token' and 'X-PriceFx-jwt' cookies to be preserved after each test.
Cypress.Cookies.preserveOnce('X-PriceFx-Csrf-Token', 'X-PriceFx-jwt');
// Restore the logged in status by restoring the local storage
cy.restoreLocalStorage().then(() => {
cy.waitForSpinner();
});
});
//quotes
//1) Open Quote with label "cypress"
//2) add an item using the 'Browse' button
//3) click on product detail, write 10 into quantity input and click on recalculat
//4) Check that Total invoice price has been changed to 174.22 EUR
it('quote', () => {
cy.visit('https://demo.pricefx.eu/app/#/quotes');
//cy.url().should('contain', '/#/qc/quotes'); //assert
cy.waitForSpinner();
//Open Quote with label "cypress"
const quoteLabel = 'cypress';
const browseProductId = 'MB-0003';
//open quote
cy.get('div.dataTables_scrollHead input.pfx-quick-filter-label')
.type(quoteLabel);
cy.contains('div.dataTables_info', 'Showing 1 to 1 of 1 entries');
cy.contains('a', quoteLabel).click({force: true});
//add an item MB-0003 using the 'Browse' button
cy.contains('a', 'Items').click();
cy.waitForSpinner();
cy.contains('button', 'Browse').click();
cy.get('div.pfxui-modal_top input.pfx-quick-filter-sku').type(
browseProductId
);
cy.contains('div.pfxui-modal_top tbody tr', browseProductId).click();
cy.contains('div.pfxui-modal_top button', 'Select').click();
//click on product detail, write 10 into quantity input and click on recalculate
cy.waitForSpinner();
cy.contains('td', 'Meatball Bl').click({force: true});
cy.waitForSpinner();
cy.get('[data-focus-id="Quote Quantity"]')
.type('10');
cy.contains('button', 'Recalculate')
.click({force: true});
//Check that Total invoice price has been changed to 174.22 EUR
cy.waitForSpinner();
cy.contains('tr.slds-hint-parent', 'Total Invoice Price').should('contain', '174.22 EUR');
});
});
Download test LoginAPI-quotes here.