diff --git a/src/pages/Worker/Card/WorkerBasicData.vue b/src/pages/Worker/Card/WorkerBasicData.vue index a78983e5c..b8c1c54df 100644 --- a/src/pages/Worker/Card/WorkerBasicData.vue +++ b/src/pages/Worker/Card/WorkerBasicData.vue @@ -96,6 +96,7 @@ async function setAdvancedSummary(data) { option-label="name" option-value="code" v-model="data.maritalStatus" + data-cy="MaritalStatus" /> @@ -107,6 +108,7 @@ async function setAdvancedSummary(data) { option-label="name" option-value="id" v-model="data.originCountryFk" + data-cy="country" /> - + diff --git a/src/pages/Worker/Card/WorkerOperator.vue b/src/pages/Worker/Card/WorkerOperator.vue index 8ab802b9f..34d9ba020 100644 --- a/src/pages/Worker/Card/WorkerOperator.vue +++ b/src/pages/Worker/Card/WorkerOperator.vue @@ -98,12 +98,14 @@ watch( @@ -116,6 +118,7 @@ watch( option-value="code" v-model="row.itemPackingTypeFk" :required="true" + data-cy="itemPackingType" /> @@ -132,6 +136,7 @@ watch( hide-selected option-label="description" v-model="row.sectorFk" + data-cy="sector" /> diff --git a/test/cypress/integration/order/orderList.spec.js b/test/cypress/integration/order/orderList.spec.js index 8b8852a02..c48b317a8 100644 --- a/test/cypress/integration/order/orderList.spec.js +++ b/test/cypress/integration/order/orderList.spec.js @@ -34,8 +34,8 @@ describe('OrderList', () => { cy.dataCy('Customer ID_input').type('1101{enter}'); cy.dataCy('vnTableCreateBtn').click(); cy.dataCy('landedDate').find('input').type('06/01/2001'); - cy.get(agencyCreateSelect).click(); - cy.get('.q-menu > div> .q-item:nth-child(1)').click(); + cy.selectOption(agencyCreateSelect, 1); + cy.intercept('GET', /\/api\/Orders\/\d/).as('orderSale'); cy.get('[data-cy="FormModelPopup_save"] > .q-btn__content > .block').click(); cy.wait('@orderSale'); @@ -60,8 +60,8 @@ describe('OrderList', () => { cy.get(clientCreateSelect).should('have.value', 'Bruce Wayne'); cy.get(addressCreateSelect).should('have.value', 'Bruce Wayne'); cy.dataCy('landedDate').find('input').type('06/01/2001'); - cy.get(agencyCreateSelect).click(); - cy.get('.q-menu > div> .q-item:nth-child(1)').click(); + cy.selectOption(agencyCreateSelect, 1); + cy.intercept('GET', /\/api\/Orders\/\d/).as('orderSale'); cy.get('[data-cy="FormModelPopup_save"] > .q-btn__content > .block').click(); cy.wait('@orderSale'); diff --git a/test/cypress/integration/ticket/negative/TicketLackDetail.spec.js b/test/cypress/integration/ticket/negative/TicketLackDetail.spec.js index 19f4dc3b2..7b1932b11 100644 --- a/test/cypress/integration/ticket/negative/TicketLackDetail.spec.js +++ b/test/cypress/integration/ticket/negative/TicketLackDetail.spec.js @@ -139,7 +139,7 @@ describe.skip('Ticket Lack detail', () => { cy.wait('@getItemGetSimilar'); }); describe('Replace item if', () => { - it('Quantity is less than available', () => { + it.skip('Quantity is less than available', () => { cy.get(':nth-child(1) > .text-right > .q-btn').click(); }); }); diff --git a/test/cypress/integration/worker/workerBasicData.spec.js b/test/cypress/integration/worker/workerBasicData.spec.js new file mode 100644 index 000000000..cf452a044 --- /dev/null +++ b/test/cypress/integration/worker/workerBasicData.spec.js @@ -0,0 +1,15 @@ +describe('WorkerBasicData', () => { + beforeEach(() => { + cy.viewport(1280, 720); + cy.login('developer'); + cy.visit('/#/worker/1107/basic-data'); + }); + + it('should modify worker summary', () => { + cy.dataCy('MaritalStatus').type('Married'); + cy.dataCy('fi').type('42572374H'); + cy.dataCy('country').type('Alemania'); + cy.saveCard(); + cy.checkNotification('Data saved'); + }); +}); diff --git a/test/cypress/integration/worker/workerBusiness.spec.js b/test/cypress/integration/worker/workerBusiness.spec.js new file mode 100644 index 000000000..1650b66c7 --- /dev/null +++ b/test/cypress/integration/worker/workerBusiness.spec.js @@ -0,0 +1,34 @@ +describe('WorkerBusiness', () => { + const saveBtn = '.q-mt-lg > .q-btn--standard'; + const contributionCode = `Representantes de comercio`; + const contractType = `INDEFINIDO A TIEMPO COMPLETO`; + + const Business = { + 'Start Date': { val: '26-12-2002', type: 'date' }, + 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: contributionCode, type: 'select' }, + Rate: { val: `5` }, + 'Contract Type': { val: contractType, type: 'select' }, + 'Transport Workers Salary': { val: `1000` }, + }; + + beforeEach(() => { + cy.viewport(1280, 720); + cy.login('hr'); + cy.visit('/#/worker/1107/business'); + cy.addCard(); + }); + + it('should create a business', () => { + cy.fillInForm({ + ...Business, + }); + cy.get(saveBtn).click(); + cy.checkNotification('Data created'); + }); +}); diff --git a/test/cypress/integration/worker/workerMutual.spec.js b/test/cypress/integration/worker/workerMutual.spec.js new file mode 100644 index 000000000..a6d2c5f4f --- /dev/null +++ b/test/cypress/integration/worker/workerMutual.spec.js @@ -0,0 +1,23 @@ +/// +describe('WorkerMutual', () => { + const userId = 1106; + const saveBtn = '.q-mt-lg > .q-btn--standard'; + const medicalReview = { + Date: { val: '01-01-2001', type: 'date' }, + 'Formation Center': { val: '1', type: 'select' }, + Invoice: { val: '24532' }, + Amount: { val: '540' }, + }; + beforeEach(() => { + cy.viewport(1280, 720); + cy.login('developer'); + cy.visit(`/#/worker/${userId}/medical`); + cy.addCard(); + }); + + it('should create a medical Review', () => { + cy.fillInForm(medicalReview); + cy.get(saveBtn).click(); + cy.checkNotification('Data created'); + }); +}); diff --git a/test/cypress/integration/worker/workerNotes.spec.js b/test/cypress/integration/worker/workerNotes.spec.js new file mode 100644 index 000000000..661314ac9 --- /dev/null +++ b/test/cypress/integration/worker/workerNotes.spec.js @@ -0,0 +1,13 @@ +/// +describe('WorkerNotes', () => { + const userId = 1106; + beforeEach(() => { + cy.viewport(1280, 720); + cy.login('developer'); + cy.visit(`/#/worker/${userId}/notes`); + }); + + it('Should load layout', () => { + cy.get('.q-card').should('be.visible'); + }); +}); diff --git a/test/cypress/integration/worker/workerOperator.spec.js b/test/cypress/integration/worker/workerOperator.spec.js new file mode 100644 index 000000000..95839aeba --- /dev/null +++ b/test/cypress/integration/worker/workerOperator.spec.js @@ -0,0 +1,19 @@ +/// +describe('WorkerOperator', () => { + const userId = 1106; + beforeEach(() => { + cy.viewport(1280, 720); + cy.login('hr'); + cy.visit(`/#/worker/${userId}/operator`); + }); + + it('should fill the operator form', () => { + cy.dataCy('numberOfWagons').type('4'); + cy.dataCy('linesLimit').type('6'); + cy.dataCy('volumeLimit').type('3'); + cy.dataCy('sizeLimit').type('3'); + cy.saveCard(); + + cy.checkNotification('Data saved'); + }); +}); diff --git a/test/cypress/integration/worker/workerPit.spec.js b/test/cypress/integration/worker/workerPit.spec.js index 19cbebc20..04f232648 100644 --- a/test/cypress/integration/worker/workerPit.spec.js +++ b/test/cypress/integration/worker/workerPit.spec.js @@ -1,19 +1,5 @@ describe('WorkerPit', () => { - const familySituationInput = '[data-cy="Family Situation_input"]'; - const familySituation = '1'; - const childPensionInput = '[data-cy="Child Pension_input"]'; - const childPension = '120'; - const spouseNifInput = '[data-cy="Spouse Pension_input"]'; - const spouseNif = '65117125P'; - const spousePensionInput = '[data-cy="Spouse Pension_input"]'; - const spousePension = '120'; const addRelative = '[data-cy="addRelative"]'; - const isDescendantSelect = '[data-cy="Descendant/Ascendant"]'; - const Descendant = 'Descendiente'; - const birthedInput = '[data-cy="Birth Year_input"]'; - const birthed = '2002'; - const adoptionYearInput = '[data-cy="Adoption Year_input"]'; - const adoptionYear = '2004'; const saveRelative = '[data-cy="workerPitRelativeSaveBtn"]'; const savePIT = '#st-actions > .q-btn-group > .q-btn--standard'; @@ -24,15 +10,15 @@ describe('WorkerPit', () => { }); it('complete PIT', () => { - cy.get(familySituationInput).type(familySituation); - cy.get(childPensionInput).type(childPension); - cy.get(spouseNifInput).type(spouseNif); - cy.get(spousePensionInput).type(spousePension); + cy.dataCy('familySituation').type('1'); + cy.dataCy('childPension').type('120'); + cy.dataCy('spouseNif').type('65117125P'); + cy.dataCy('spousePension').type('120'); cy.get(savePIT).click(); cy.get(addRelative).click(); - cy.get(isDescendantSelect).type(Descendant); - cy.get(birthedInput).type(birthed); - cy.get(adoptionYearInput).type(adoptionYear); + cy.dataCy('Descendant/Ascendant').type('Descendiente'); + cy.dataCy('birthed').type('2002'); + cy.dataCy('adoptionYear').type('2004'); cy.get(saveRelative).click(); }); }); diff --git a/test/cypress/integration/worker/workerSummary.spec.js b/test/cypress/integration/worker/workerSummary.spec.js index 3d70fdf96..c50b2c943 100644 --- a/test/cypress/integration/worker/workerSummary.spec.js +++ b/test/cypress/integration/worker/workerSummary.spec.js @@ -1,4 +1,6 @@ describe('WorkerSummary', () => { + const departmentDescriptor = ':nth-child(1) > :nth-child(3) > .value > .link'; + const roleDescriptor = ':nth-child(3) > :nth-child(4) > .value > .link'; beforeEach(() => { cy.viewport(1280, 720); cy.login('developer'); @@ -10,7 +12,17 @@ describe('WorkerSummary', () => { cy.get('.summaryHeader > div').should('have.text', '19 - salesboss salesboss'); cy.get(':nth-child(1) > :nth-child(2) > .value > span').should( 'have.text', - 'salesBossNick' + 'salesBossNick', ); }); + + it('should try descriptors', () => { + cy.waitForElement('.summaryHeader'); + cy.get(departmentDescriptor).click(); + cy.get('.descriptor').should('be.visible'); + cy.get('.q-item > .q-item__label').should('include.text', '43'); + cy.get(roleDescriptor).click(); + cy.get('.descriptor').should('be.visible'); + cy.get('.q-item > .q-item__label').should('include.text', '19'); + }); });