salix-front/test/cypress/integration/item/ItemFixedPrice.spec.js

59 lines
2.6 KiB
JavaScript

/// <reference types="cypress" />
function goTo(n = 1) {
return `.q-virtual-scroll__content > :nth-child(${n})`;
}
const firstRow = goTo();
const secondRow = goTo(2);
`.q-virtual-scroll__content > :nth-child(1)`;
describe('Handle Items FixedPrice', () => {
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit('/#/item/fixed-price', { timeout: 5000 });
cy.waitForElement('.q-table');
cy.get(
'.q-header > .q-toolbar > :nth-child(1) > .q-btn__content > .q-icon'
).click();
});
it('filter', function () {
cy.get('.category-filter > :nth-child(2) > .q-btn__content > .q-icon').click();
cy.selectOption('.list > :nth-child(2)', 'Crisantemo');
cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click();
/* ==== End Cypress Studio ==== */
});
it('Create and delete ', function () {
cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content').click();
cy.get('.bottomButton > .q-btn > .q-btn__content > .q-icon').click();
cy.get(`${secondRow} > :nth-child(2)`).type('11');
cy.get('.q-menu .q-item').contains('#11').click();
cy.get(`${secondRow} > :nth-child(4)`).find('input').type(1);
cy.get(`${secondRow} > :nth-child(5)`).find('input').type(2);
cy.get(`${secondRow} > :nth-child(9)`).type('Warehouse One');
cy.get('.q-menu .q-item').contains('Warehouse One').click();
cy.get('.q-notification__message').should('have.text', 'Data saved');
cy.get(':nth-child(3) > .text-right > .q-btn').click();
cy.dataCy('VnConfirm_confirm').click();
});
it.skip('Massive edit', function () {
cy.get(' .bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner ').click();
cy.get('#subToolbar > .q-btn--standard').click();
cy.selectOption("[data-cy='field-to-edit']", 'Min price');
cy.dataCy('value-to-edit').find('input').type('1');
cy.get('.countLines').invoke('text').then(parseFloat).should('be.gte', 1);
cy.get('.q-mt-lg > .q-btn--standard').click();
//Falla debido a que hay una petición doble
cy.get('.q-notification__message').should('have.text', 'Data saved');
});
it('Massive remove', function () {
cy.get(' .bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner ').click();
cy.get('#subToolbar > .q-btn--flat').click();
cy.get(
'.q-card__actions > .q-btn--unelevated > .q-btn__content > .block'
).click();
cy.get('.q-notification__message').should('have.text', 'Data saved');
});
});