0
0
Fork 0
salix-front-mindshore-fork2/test/cypress/integration/worker/workerCreate.spec.js

63 lines
2.2 KiB
JavaScript
Raw Normal View History

describe('WorkerCreate', () => {
const externalRadio = '.q-radio:nth-child(2)';
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';
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' },
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' },
2024-07-16 08:42:35 +00:00
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' },
};
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('hr');
cy.visit('/#/worker/list');
cy.get('.q-page-sticky > div > .q-btn').click();
});
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();
cy.get(notification).should('contains.text', 'Payment method is required');
});
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();
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();
cy.get(notification).should('contains.text', 'Data created');
});
});