8583-workerE2ETest #1570

Merged
carlossa merged 37 commits from 8583-workerE2ETest into dev 2025-03-10 11:32:58 +00:00
11 changed files with 150 additions and 25 deletions

View File

@ -96,6 +96,7 @@ async function setAdvancedSummary(data) {
option-label="name" option-label="name"
option-value="code" option-value="code"
v-model="data.maritalStatus" v-model="data.maritalStatus"
data-cy="MaritalStatus"
/> />
</VnRow> </VnRow>
@ -107,6 +108,7 @@ async function setAdvancedSummary(data) {
option-label="name" option-label="name"
option-value="id" option-value="id"
v-model="data.originCountryFk" v-model="data.originCountryFk"
data-cy="country"
/> />
<VnSelect <VnSelect
:label="t('Education level')" :label="t('Education level')"
@ -132,7 +134,7 @@ async function setAdvancedSummary(data) {
<VnInputDate :label="t('seniority')" v-model="data.seniority" /> <VnInputDate :label="t('seniority')" v-model="data.seniority" />
</VnRow> </VnRow>
<VnRow> <VnRow>
<VnInput v-model="data.fi" :label="t('fi')" /> <VnInput v-model="data.fi" :label="t('fi')" data-cy="fi" />
<VnInputDate :label="t('birth')" v-model="data.birth" /> <VnInputDate :label="t('birth')" v-model="data.birth" />
</VnRow> </VnRow>
<VnRow wrap> <VnRow wrap>

View File

@ -98,12 +98,14 @@ watch(
<VnInput <VnInput
:label="t('worker.operator.numberOfWagons')" :label="t('worker.operator.numberOfWagons')"
v-model="row.numberOfWagons" v-model="row.numberOfWagons"
data-cy="numberOfWagons"
/> />
<VnSelect <VnSelect
:label="t('worker.operator.train')" :label="t('worker.operator.train')"
:options="trainsData" :options="trainsData"
hide-selected hide-selected
v-model="row.trainFk" v-model="row.trainFk"
data-cy="train"
:required="true" :required="true"
/> />
</VnRow> </VnRow>
@ -116,6 +118,7 @@ watch(
option-value="code" option-value="code"
v-model="row.itemPackingTypeFk" v-model="row.itemPackingTypeFk"
:required="true" :required="true"
data-cy="itemPackingType"
/> />
<VnSelect <VnSelect
:label="t('worker.operator.warehouse')" :label="t('worker.operator.warehouse')"
@ -123,6 +126,7 @@ watch(
hide-selected hide-selected
v-model="row.warehouseFk" v-model="row.warehouseFk"
:required="true" :required="true"
data-cy="warehouse"
/> />
</VnRow> </VnRow>
<VnRow> <VnRow>
@ -132,6 +136,7 @@ watch(
hide-selected hide-selected
option-label="description" option-label="description"
v-model="row.sectorFk" v-model="row.sectorFk"
data-cy="sector"
/> />
<VnSelect <VnSelect
:label="t('worker.operator.labeler')" :label="t('worker.operator.labeler')"
@ -139,6 +144,7 @@ watch(
hide-selected hide-selected
option-label="name" option-label="name"
v-model="row.labelerFk" v-model="row.labelerFk"
data-cy="labeler"
> >
<template #option="scope"> <template #option="scope">
<QItem v-bind="scope.itemProps"> <QItem v-bind="scope.itemProps">
@ -160,11 +166,13 @@ watch(
:label="t('worker.operator.linesLimit')" :label="t('worker.operator.linesLimit')"
v-model="row.linesLimit" v-model="row.linesLimit"
lazy-rules lazy-rules
data-cy="linesLimit"
/> />
<VnInput <VnInput
:label="t('worker.operator.volumeLimit')" :label="t('worker.operator.volumeLimit')"
v-model="row.volumeLimit" v-model="row.volumeLimit"
lazy-rules lazy-rules
data-cy="volumeLimit"
/> />
</VnRow> </VnRow>
<VnRow> <VnRow>
@ -172,6 +180,7 @@ watch(
:label="t('worker.operator.sizeLimit')" :label="t('worker.operator.sizeLimit')"
v-model="row.sizeLimit" v-model="row.sizeLimit"
lazy-rules lazy-rules
data-cy="sizeLimit"
/> />
<VnInput <VnInput
:label="t('worker.operator.isOnReservationMode')" :label="t('worker.operator.isOnReservationMode')"

View File

@ -68,8 +68,14 @@ const deleteRelative = async (id) => {
:label="t('familySituation')" :label="t('familySituation')"
clearable clearable
v-model="data.familySituation" v-model="data.familySituation"
data-cy="familySituation"
/>
<VnInput
:label="t('spouseNif')"
clearable
v-model="data.spouseNif"
data-cy="spouseNif"
/> />
<VnInput :label="t('spouseNif')" clearable v-model="data.spouseNif" />
</VnRow> </VnRow>
<VnRow> <VnRow>
<VnSelect <VnSelect
@ -93,11 +99,13 @@ const deleteRelative = async (id) => {
clearable clearable
v-model="data.childPension" v-model="data.childPension"
:label="t(`childPension`)" :label="t(`childPension`)"
data-cy="childPension"
/> />
<VnInput <VnInput
clearable clearable
v-model="data.spousePension" v-model="data.spousePension"
:label="t(`spousePension`)" :label="t(`spousePension`)"
data-cy="spousePension"
/> />
</VnRow> </VnRow>
<VnRow wrap> <VnRow wrap>
@ -190,12 +198,14 @@ const deleteRelative = async (id) => {
type="number" type="number"
v-model="row.birthed" v-model="row.birthed"
:label="t(`birthed`)" :label="t(`birthed`)"
data-cy="birthed"
/> />
<VnInput <VnInput
type="number" type="number"
v-model="row.adoptionYear" v-model="row.adoptionYear"
:label="t(`adoptionYear`)" :label="t(`adoptionYear`)"
data-cy="adoptionYear"
/> />
<QCheckbox <QCheckbox
v-model="row.isDependend" v-model="row.isDependend"

View File

@ -53,7 +53,7 @@ const title = computed(() => (isEditMode.value ? t('Edit entry') : t('Add time')
const urlCreate = computed(() => const urlCreate = computed(() =>
isEditMode.value isEditMode.value
? `WorkerTimeControls/${$props.entryId}/updateTimeEntry` ? `WorkerTimeControls/${$props.entryId}/updateTimeEntry`
: `WorkerTimeControls/${route.params.id}/addTimeEntry` : `WorkerTimeControls/${route.params.id}/addTimeEntry`,
); );
onBeforeMount(() => { onBeforeMount(() => {
@ -83,6 +83,7 @@ onBeforeMount(() => {
autofocus autofocus
:required="true" :required="true"
:is-clearable="false" :is-clearable="false"
data-cy="entryHour"
/> />
<VnSelect <VnSelect
:label="t('Type')" :label="t('Type')"
@ -91,6 +92,7 @@ onBeforeMount(() => {
option-value="code" option-value="code"
option-label="description" option-label="description"
hide-selected hide-selected
data-cy="entryType"
/> />
</template> </template>
</FormModelPopup> </FormModelPopup>

View File

@ -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');
});
});

View File

@ -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 = {
Review

porque la variable va en mayus?

porque la variable va en mayus?
Review

Así lo quiso la BDD

Así lo quiso la BDD
'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,
Review

esto es lo mismo que hacer cy.fillInForm(Business), no?

esto es lo mismo que hacer cy.fillInForm(Business), no?
Review

Curioso porque si no estaba así, en jenkins no pasaba 🤷‍♂️

Curioso porque si no estaba así, en jenkins no pasaba 🤷‍♂️
});
cy.get(saveBtn).click();
cy.checkNotification('Data created');
});
});

View File

@ -0,0 +1,23 @@
/// <reference types="cypress" />
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();
carlossa marked this conversation as resolved Outdated

este es el botón mas de la tabla? creo que está en commands

este es el botón mas de la tabla? creo que está en commands
});
it('should create a medical Review', () => {
cy.fillInForm(medicalReview);
cy.get(saveBtn).click();
cy.checkNotification('Data created');
});
});

View File

@ -0,0 +1,13 @@
/// <reference types="cypress" />
describe('WorkerNotes', () => {
const userId = 1106;
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit(`/#/worker/${userId}/notes`);
carlossa marked this conversation as resolved
Review

revisar

revisar
});
it('Should load layout', () => {
cy.get('.q-card').should('be.visible');
});
});

View File

@ -0,0 +1,19 @@
/// <reference types="cypress" />
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');
});
});

View File

@ -1,19 +1,5 @@
describe('WorkerPit', () => { 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 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 saveRelative = '[data-cy="workerPitRelativeSaveBtn"]';
const savePIT = '#st-actions > .q-btn-group > .q-btn--standard'; const savePIT = '#st-actions > .q-btn-group > .q-btn--standard';
@ -24,15 +10,15 @@ describe('WorkerPit', () => {
}); });
it('complete PIT', () => { it('complete PIT', () => {
cy.get(familySituationInput).type(familySituation); cy.dataCy('familySituation').type('1');
cy.get(childPensionInput).type(childPension); cy.dataCy('childPension').type('120');
cy.get(spouseNifInput).type(spouseNif); cy.dataCy('spouseNif').type('65117125P');
cy.get(spousePensionInput).type(spousePension); cy.dataCy('spousePension').type('120');
cy.get(savePIT).click(); cy.get(savePIT).click();
cy.get(addRelative).click(); cy.get(addRelative).click();
cy.get(isDescendantSelect).type(Descendant); cy.dataCy('Descendant/Ascendant').type('Descendiente');
cy.get(birthedInput).type(birthed); cy.dataCy('birthed').type('2002');
cy.get(adoptionYearInput).type(adoptionYear); cy.dataCy('adoptionYear').type('2004');
cy.get(saveRelative).click(); cy.get(saveRelative).click();
}); });
}); });

View File

@ -1,4 +1,6 @@
describe('WorkerSummary', () => { describe('WorkerSummary', () => {
const departmentDescriptor = ':nth-child(1) > :nth-child(3) > .value > .link';
const roleDescriptor = ':nth-child(3) > :nth-child(4) > .value > .link';
beforeEach(() => { beforeEach(() => {
cy.viewport(1280, 720); cy.viewport(1280, 720);
cy.login('developer'); cy.login('developer');
@ -10,7 +12,17 @@ describe('WorkerSummary', () => {
cy.get('.summaryHeader > div').should('have.text', '19 - salesboss salesboss'); cy.get('.summaryHeader > div').should('have.text', '19 - salesboss salesboss');
cy.get(':nth-child(1) > :nth-child(2) > .value > span').should( cy.get(':nth-child(1) > :nth-child(2) > .value > span').should(
'have.text', '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');
});
}); });