fix: refs #8583 workerBusiness test

This commit is contained in:
Carlos Satorres 2025-03-03 13:05:41 +01:00
parent 2b90443fcc
commit 8a984a7988
1 changed files with 25 additions and 58 deletions

View File

@ -1,75 +1,42 @@
describe('WorkerCreate', () => {
const externalRadio = '.q-radio:nth-child(2)';
const developerBossId = 120;
const payMethodCross =
':nth-child(9) > .q-select > .q-field__inner > .q-field__control > :nth-child(2)';
describe('WorkerBusiness', () => {
const saveBtn = '.q-mt-lg > .q-btn--standard';
const internalWithOutPay = {
const Business = {
'Start Date': { val: '26-12-2002', type: 'date' },
Company: { val: 1, type: 'select' },
Department: { val: 'Reciclaje', type: 'select' },
'Professional Category': { val: 1, type: 'select' },
'Work Calendar': { val: 1, type: 'select' },
'Work Center': { val: 1, type: 'select' },
Company: { val: 'VNL', type: 'select' },
Street: { val: 'S/ DEFAULTWORKERSTREET' },
Location: { val: 1, type: 'select' },
Phone: { val: '123456789' },
'Worker code': { val: 'DWW' },
Boss: { val: developerBossId, type: 'select' },
Birth: { val: '11-12-2022', type: 'date' },
};
const internal = {
Fi: { val: '78457139E' },
'Web user': { val: 'manolo' },
Name: { val: 'Manolo' },
'Last name': { val: 'Hurtado' },
'Personal email': { val: 'manolo@mydomain.com' },
Company: { val: 'VNL', type: 'select' },
Street: { val: 'S/ DEFAULTWORKERSTREET' },
Location: { val: 1, type: 'select' },
'Pay method': { val: 1, type: 'select' },
Phone: { val: '123456789' },
'Worker code': { val: 'DWW' },
Boss: { val: developerBossId, type: 'select' },
Birth: { val: '11-12-2022', type: 'date' },
};
const external = {
Fi: { val: 'Z4531219V' },
'Web user': { val: 'pepe' },
Name: { val: 'PEPE' },
'Last name': { val: 'GARCIA' },
'Personal email': { val: 'pepe@gmail.com' },
'Worker code': { val: 'PG' },
Boss: { val: developerBossId, type: 'select' },
Company: { val: `VNL`, type: 'select' },
Department: { val: `RECICLAJE`, type: 'select' },
'Professional Category': { val: `employee`, type: 'select' },
'Work Calendar': { val: `General schedule`, type: 'select' },
'Work Center': { val: `Silla`, type: 'select' },
'Contract Category': { val: `INFORMATICA`, type: 'select' },
'Contribution Code': { val: `Representantes de comercio`, type: 'select' },
'Contract Type': { val: `INDEFINIDO A TIEMPO COMPLETO`, type: 'select' },
'Transport Workers Salary': { val: `1000` },
};
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('hr');
cy.visit('/#/worker/list');
cy.visit('/#/worker/1107/business');
cy.get('.q-page-sticky > div > .q-btn').click();
});
it('should throw an error if a pay method has not been selected', () => {
cy.fillInForm(internalWithOutPay);
cy.get(payMethodCross).click();
cy.get(saveBtn).click();
cy.checkNotification('Payment method is required');
});
it('should create an internal', () => {
cy.fillInForm(internal);
cy.fillInForm(Business);
cy.get(saveBtn).click();
cy.checkNotification('Data created');
});
it('should create an external', () => {
cy.get(externalRadio).click();
cy.fillInForm(external);
cy.get(saveBtn).click();
cy.checkNotification('Data created');
});
// it('should create an internal', () => {
// cy.fillInForm(internal);
// cy.get(saveBtn).click();
// cy.checkNotification('Data created');
// });
// it('should create an external', () => {
// cy.get(externalRadio).click();
// cy.fillInForm(external);
// cy.get(saveBtn).click();
// cy.checkNotification('Data created');
// });
});