2024-06-10 11:54:02 +00:00
|
|
|
describe('WorkerCreate', () => {
|
2024-07-12 07:16:32 +00:00
|
|
|
const externalRadio = '.q-radio:nth-child(2)';
|
2024-06-10 11:54:02 +00:00
|
|
|
const notification = '.q-notification__message';
|
|
|
|
const developerBossId = 120;
|
2024-08-21 14:36:45 +00:00
|
|
|
const payMethodCross =
|
|
|
|
'.grid-create .full-width > :nth-child(9) .q-select .q-field__append:not(.q-anchor--skip)';
|
|
|
|
const saveBtn = '.q-mt-lg > .q-btn--standard';
|
2024-06-10 11:54:02 +00:00
|
|
|
|
|
|
|
const internal = {
|
|
|
|
Fi: { val: '78457139E' },
|
2024-06-10 12:42:41 +00:00
|
|
|
'Web user': { val: 'manolo' },
|
|
|
|
Name: { val: 'Manolo' },
|
|
|
|
'Last name': { val: 'Hurtado' },
|
|
|
|
'Personal email': { val: 'manolo@mydomain.com' },
|
2024-07-12 07:16:32 +00:00
|
|
|
Company: { val: 'VNL', type: 'select' },
|
2024-06-10 11:54:02 +00:00
|
|
|
Street: { val: 'S/ DEFAULTWORKERSTREET' },
|
|
|
|
Location: { val: 1, type: 'select' },
|
|
|
|
Phone: { val: '123456789' },
|
|
|
|
'Worker code': { val: 'DWW' },
|
|
|
|
Boss: { val: developerBossId, type: 'select' },
|
2024-07-16 08:42:35 +00:00
|
|
|
Birth: { val: '11-12-2022', type: 'date' },
|
2024-06-10 11:54:02 +00:00
|
|
|
};
|
|
|
|
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' },
|
|
|
|
};
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
cy.viewport(1280, 720);
|
|
|
|
cy.login('hr');
|
2024-07-12 07:16:32 +00:00
|
|
|
cy.visit('/#/worker/list');
|
|
|
|
cy.get('.q-page-sticky > div > .q-btn').click();
|
2024-06-10 11:54:02 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should throw an error if a pay method has not been selected', () => {
|
|
|
|
cy.fillInForm(internal);
|
2024-08-21 14:36:45 +00:00
|
|
|
cy.get(payMethodCross).click();
|
|
|
|
cy.get(saveBtn).click();
|
2024-07-12 07:16:32 +00:00
|
|
|
cy.get(notification).should('contains.text', 'Payment method is required');
|
2024-06-10 11:54:02 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should create an internal', () => {
|
|
|
|
cy.fillInForm({
|
|
|
|
...internal,
|
|
|
|
'Pay method': { val: 'PayMethod one', type: 'select' },
|
|
|
|
});
|
2024-08-21 14:36:45 +00:00
|
|
|
cy.get(saveBtn).click();
|
2024-06-10 11:54:02 +00:00
|
|
|
cy.get(notification).should('contains.text', 'Data created');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should create an external', () => {
|
|
|
|
cy.get(externalRadio).click();
|
|
|
|
cy.fillInForm(external);
|
2024-08-21 14:36:45 +00:00
|
|
|
cy.get(saveBtn).click();
|
2024-06-10 11:54:02 +00:00
|
|
|
cy.get(notification).should('contains.text', 'Data created');
|
|
|
|
});
|
|
|
|
});
|