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

59 lines
2.0 KiB
JavaScript

describe('WorkerCreate', () => {
const externalRadio = '.q-radio:nth-child(2)';
const notification = '.q-notification__message';
const developerBossId = 120;
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' },
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' },
};
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);
cy.get('.q-mt-lg > .q-btn--standard').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' },
});
cy.get('.q-mt-lg > .q-btn--standard').click();
cy.get(notification).should('contains.text', 'Data created');
});
it('should create an external', () => {
cy.get(externalRadio).click();
cy.fillInForm(external);
cy.get('.q-mt-lg > .q-btn--standard').click();
cy.get(notification).should('contains.text', 'Data created');
});
});