forked from verdnatura/salix-front
60 lines
1.9 KiB
JavaScript
60 lines
1.9 KiB
JavaScript
describe('WorkerCreate', () => {
|
|
const externalRadio = '.q-toolbar .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' },
|
|
Street: { val: 'S/ DEFAULTWORKERSTREET' },
|
|
Location: { val: 1, type: 'select' },
|
|
Phone: { val: '123456789' },
|
|
'Worker code': { val: 'DWW' },
|
|
Boss: { val: developerBossId, type: 'select' },
|
|
Birth: { val: '2022-12-11T23:00:00.000Z', type: 'date', day: 11 },
|
|
};
|
|
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/create');
|
|
});
|
|
|
|
it('should throw an error if a pay method has not been selected', () => {
|
|
cy.fillInForm(internal);
|
|
cy.saveCard();
|
|
cy.get(notification).should(
|
|
'contains.text',
|
|
'That payment method requires an IBAN'
|
|
);
|
|
});
|
|
|
|
it('should create an internal', () => {
|
|
cy.fillInForm({
|
|
...internal,
|
|
'Pay method': { val: 'PayMethod one', type: 'select' },
|
|
});
|
|
cy.saveCard();
|
|
cy.get(notification).should('contains.text', 'Data created');
|
|
});
|
|
|
|
it('should create an external', () => {
|
|
cy.get(externalRadio).click();
|
|
cy.fillInForm(external);
|
|
cy.saveCard();
|
|
cy.get(notification).should('contains.text', 'Data created');
|
|
});
|
|
});
|