2024-03-15 15:30:12 +00:00
|
|
|
/// <reference types="cypress" />
|
|
|
|
describe('Ticket descriptor', () => {
|
2024-10-08 11:18:51 +00:00
|
|
|
const listItem = '[role="menu"] .q-list .q-item';
|
|
|
|
const toCloneOpt = 'To clone ticket';
|
|
|
|
const setWeightOpt = 'Set weight';
|
2024-03-28 08:46:18 +00:00
|
|
|
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;
|
2024-09-13 08:13:03 +00:00
|
|
|
const weightValue = '.summaryBody.row :nth-child(1) > :nth-child(9) > .value > span';
|
2024-03-15 15:30:12 +00:00
|
|
|
beforeEach(() => {
|
|
|
|
cy.login('developer');
|
2024-09-06 09:55:39 +00:00
|
|
|
cy.viewport(1920, 1080);
|
2024-03-15 15:30:12 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should clone the ticket without warehouse', () => {
|
2024-09-06 09:55:39 +00:00
|
|
|
cy.visit('/#/ticket/1/summary');
|
2024-03-15 15:30:12 +00:00
|
|
|
cy.openActionsDescriptor();
|
2024-10-08 11:18:51 +00:00
|
|
|
cy.contains(listItem, toCloneOpt).click();
|
2024-03-15 15:30:12 +00:00
|
|
|
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', () => {
|
2024-09-06 09:55:39 +00:00
|
|
|
cy.visit('/#/ticket/10/summary');
|
2024-09-05 06:56:38 +00:00
|
|
|
cy.openActionsDescriptor();
|
2024-10-08 11:18:51 +00:00
|
|
|
cy.contains(listItem, setWeightOpt).click();
|
2024-09-06 09:55:39 +00:00
|
|
|
cy.intercept('POST', /\/api\/Tickets\/\d+\/setWeight/).as('weight');
|
|
|
|
cy.get('.q-dialog input').type(weight);
|
2024-09-05 06:56:38 +00:00
|
|
|
cy.clickConfirm();
|
2024-09-06 09:55:39 +00:00
|
|
|
cy.wait('@weight');
|
|
|
|
cy.get(weightValue).contains(weight);
|
2024-09-05 06:56:38 +00:00
|
|
|
});
|
2024-03-15 15:30:12 +00:00
|
|
|
});
|