0
0
Fork 0
salix-front-mindshore-fork2/test/cypress/integration/ticket/ticketDescriptor.spec.js

46 lines
1.5 KiB
JavaScript
Raw Normal View History

2024-03-15 15:30:12 +00:00
/// <reference types="cypress" />
describe('Ticket descriptor', () => {
const toCloneOpt = '[role="menu"] .q-list > :nth-child(5)';
2024-09-05 06:56:38 +00:00
const setWeightOpt = '[role="menu"] .q-list > :nth-child(6)';
const warehouseValue = ':nth-child(1) > :nth-child(6) > .value > span';
2024-03-15 15:30:12 +00:00
const summaryHeader = '.summaryHeader > div';
2024-09-05 06:56:38 +00:00
const weight = 25;
const ticketId = 1;
2024-03-15 15:30:12 +00:00
beforeEach(() => {
cy.login('developer');
cy.visit(`/#/ticket/${ticketId}/summary`);
});
it('should clone the ticket without warehouse', () => {
cy.openLeftMenu();
cy.openActionsDescriptor();
cy.get(toCloneOpt).click();
cy.clickConfirm();
2024-08-27 08:27:51 +00:00
cy.get(warehouseValue).contains('Warehouse One');
2024-03-15 15:30:12 +00:00
cy.get(summaryHeader)
.invoke('text')
.then((text) => {
const [, owner] = text.split('-');
cy.wrap(owner.trim()).should('eq', 'Bruce Wayne (1101)');
});
});
2024-09-05 06:56:38 +00:00
it('should set the weight of the ticket', () => {
cy.openLeftMenu();
cy.openActionsDescriptor();
cy.get(setWeightOpt).click();
cy.get('.q-dialog input').type(25);
cy.clickConfirm();
cy.get('.q-notification').should('contain', 'Peso establecido');
cy.intercept('POST', /\/api\/Tickets\/\d+/).as('worker');
cy.wait('@worker').then(() =>
cy.get(descriptorTitle).should('include.text', 'Jessica')
);
cy.get('@fetchSpy').should('have.been.called');
});
2024-03-15 15:30:12 +00:00
});