75 lines
3.1 KiB
JavaScript
75 lines
3.1 KiB
JavaScript
/// <reference types="cypress" />
|
|
describe('Handle Items FixedPrice', () => {
|
|
const grouping = 'Grouping price';
|
|
const saveEditBtn = '.q-mt-lg > .q-btn--standard';
|
|
const createForm = {
|
|
'Grouping price': { val: '5' },
|
|
'Packing price': { val: '5' },
|
|
Started: { val: '01-01-2001', type: 'date' },
|
|
Ended: { val: '15-01-2001', type: 'date' },
|
|
};
|
|
|
|
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 by category', () => {
|
|
cy.get('.category-filter > :nth-child(1) > .q-btn__content > .q-icon').click();
|
|
cy.get('.q-table__middle').should('be.visible').should('have.length', 1);
|
|
});
|
|
|
|
it('should create a new fixed price, then delete it', () => {
|
|
cy.dataCy('vnTableCreateBtn').click();
|
|
cy.dataCy('FixedPriceCreateNameSelect').type('Melee weapon combat fist 15cm');
|
|
cy.get('.q-menu .q-item').contains('Melee weapon combat fist 15cm').click();
|
|
cy.dataCy('FixedPriceCreateWarehouseSelect').type('Warehouse One');
|
|
cy.get('.q-menu .q-item').contains('Warehouse One').click();
|
|
cy.get('.q-menu').then(($menu) => {
|
|
if ($menu.is(':visible')) {
|
|
cy.dataCy('FixedPriceCreateWarehouseSelect').as('focusedElement').focus();
|
|
cy.dataCy('FixedPriceCreateWarehouseSelect').blur();
|
|
}
|
|
});
|
|
cy.fillInForm(createForm);
|
|
cy.dataCy('FormModelPopup_save').click();
|
|
cy.checkNotification('Data created');
|
|
cy.get('[data-col-field="name"]').each(($el) => {
|
|
cy.wrap($el)
|
|
.invoke('text')
|
|
.then((text) => {
|
|
if (text.includes('Melee weapon combat fist 15cm')) {
|
|
cy.wrap($el).parent().find('.q-checkbox').click();
|
|
cy.get('[data-cy="crudModelDefaultRemoveBtn"]').click();
|
|
cy.dataCy('VnConfirm_confirm').click().click();
|
|
cy.checkNotification('Data saved');
|
|
}
|
|
});
|
|
});
|
|
});
|
|
|
|
it('should edit all items', () => {
|
|
cy.get('.bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner').click();
|
|
cy.dataCy('FixedPriceToolbarEditBtn').should('not.be.disabled');
|
|
cy.dataCy('FixedPriceToolbarEditBtn').click();
|
|
cy.dataCy('EditFixedPriceSelectOption').type(grouping);
|
|
cy.get('.q-menu .q-item').contains(grouping).click();
|
|
cy.dataCy('EditFixedPriceValueOption').type('5');
|
|
cy.get(saveEditBtn).click();
|
|
cy.checkNotification('Data saved');
|
|
});
|
|
|
|
it('should remove all items', () => {
|
|
cy.get('.bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner').click();
|
|
cy.dataCy('crudModelDefaultRemoveBtn').should('not.be.disabled');
|
|
cy.dataCy('crudModelDefaultRemoveBtn').click();
|
|
cy.dataCy('VnConfirm_confirm').click();
|
|
cy.checkNotification('Data saved');
|
|
});
|
|
});
|