diff --git a/cypress.config.js b/cypress.config.js index dfe963a12..368b92d8d 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -31,7 +31,6 @@ export default defineConfig({ requestTimeout: 10000, responseTimeout: 30000, pageLoadTimeout: 60000, - defaultBrowser: 'chromium', fixturesFolder: 'test/cypress/fixtures', screenshotsFolder: 'test/cypress/screenshots', supportFile: 'test/cypress/support/index.js', @@ -39,10 +38,17 @@ export default defineConfig({ downloadsFolder: 'test/cypress/downloads', video: false, specPattern: 'test/cypress/integration/**/*.spec.js', - experimentalRunAllSpecs: true, - watchForFileChanges: true, - reporter, - reporterOptions, + experimentalRunAllSpecs: false, + watchForFileChanges: false, + reporter: 'cypress-mochawesome-reporter', + reporterOptions: { + charts: true, + reportPageTitle: 'Cypress Inline Reporter', + reportFilename: '[status]_[datetime]-report', + embeddedScreenshots: true, + reportDir: 'test/cypress/reports', + inlineAssets: true, + }, component: { componentFolder: 'src', testFiles: '**/*.spec.js', diff --git a/src/components/FormModelPopup.vue b/src/components/FormModelPopup.vue index 672eeff7a..85943e91e 100644 --- a/src/components/FormModelPopup.vue +++ b/src/components/FormModelPopup.vue @@ -1,12 +1,13 @@ diff --git a/src/pages/Claim/ClaimFilter.vue b/src/pages/Claim/ClaimFilter.vue index 6c941f59e..0fe7fc588 100644 --- a/src/pages/Claim/ClaimFilter.vue +++ b/src/pages/Claim/ClaimFilter.vue @@ -106,7 +106,6 @@ const props = defineProps({ :label="t('claim.zone')" v-model="params.zoneFk" url="Zones" - :use-like="false" outlined rounded dense diff --git a/src/pages/Claim/locale/en.yml b/src/pages/Claim/locale/en.yml index 11b4a2ca4..cdfa3963b 100644 --- a/src/pages/Claim/locale/en.yml +++ b/src/pages/Claim/locale/en.yml @@ -13,7 +13,6 @@ claim: province: Province zone: Zone customerId: client ID - assignedTo: Assigned created: Created details: Details item: Item diff --git a/src/pages/Claim/locale/es.yml b/src/pages/Claim/locale/es.yml index d35d2c8e7..00f880f0c 100644 --- a/src/pages/Claim/locale/es.yml +++ b/src/pages/Claim/locale/es.yml @@ -13,7 +13,6 @@ claim: province: Provincia zone: Zona customerId: ID de cliente - assignedTo: Asignado a created: Creado details: Detalles item: Artículo diff --git a/src/pages/Customer/CustomerFilter.vue b/src/pages/Customer/CustomerFilter.vue index 21de8fa9b..1c5a08304 100644 --- a/src/pages/Customer/CustomerFilter.vue +++ b/src/pages/Customer/CustomerFilter.vue @@ -143,6 +143,7 @@ const exprBuilder = (param, value) => { outlined rounded auto-load + sortBy="name ASC" /> diff --git a/src/pages/Customer/CustomerList.vue b/src/pages/Customer/CustomerList.vue index b8c1a743e..0bfca7910 100644 --- a/src/pages/Customer/CustomerList.vue +++ b/src/pages/Customer/CustomerList.vue @@ -78,10 +78,20 @@ const columns = computed(() => [ component: 'select', attrs: { url: 'Workers/activeWithInheritedRole', - fields: ['id', 'name'], + fields: ['id', 'name', 'firstName'], where: { role: 'salesPerson' }, optionFilter: 'firstName', }, + columnFilter: { + component: 'select', + attrs: { + url: 'Workers/activeWithInheritedRole', + fields: ['id', 'name', 'firstName'], + where: { role: 'salesPerson' }, + optionLabel: 'firstName', + optionValue: 'id', + }, + }, create: false, columnField: { component: null, diff --git a/src/pages/Customer/components/CustomerNewPayment.vue b/src/pages/Customer/components/CustomerNewPayment.vue index 8f61bac89..6ecccc544 100644 --- a/src/pages/Customer/components/CustomerNewPayment.vue +++ b/src/pages/Customer/components/CustomerNewPayment.vue @@ -77,7 +77,6 @@ onBeforeMount(() => { function setPaymentType(accounting) { if (!accounting) return; accountingType.value = accounting.accountingType; - initialData.description = []; initialData.payed = Date.vnNew(); isCash.value = accountingType.value.code == 'cash'; @@ -87,14 +86,14 @@ function setPaymentType(accounting) { initialData.payed.getDate() + accountingType.value.daysInFuture, ); maxAmount.value = accountingType.value && accountingType.value.maxAmount; - if (accountingType.value.code == 'compensation') return (initialData.description = ''); - if (accountingType.value.receiptDescription) - initialData.description.push(accountingType.value.receiptDescription); - if (initialData.description) initialData.description.push(initialData.description); - initialData.description = initialData.description.join(', '); + let descriptions = []; + if (accountingType.value.receiptDescription) + descriptions.push(accountingType.value.receiptDescription); + if (initialData.description) descriptions.push(initialData.description); + initialData.description = descriptions.join(', '); } const calculateFromAmount = (event) => { diff --git a/src/pages/Customer/components/CustomerSamplesCreate.vue b/src/pages/Customer/components/CustomerSamplesCreate.vue index 8d241441d..1294a5d25 100644 --- a/src/pages/Customer/components/CustomerSamplesCreate.vue +++ b/src/pages/Customer/components/CustomerSamplesCreate.vue @@ -18,6 +18,7 @@ import VnInput from 'src/components/common/VnInput.vue'; import VnInputDate from 'src/components/common/VnInputDate.vue'; import CustomerSamplesPreview from 'src/pages/Customer/components/CustomerSamplesPreview.vue'; import FormPopup from 'src/components/FormPopup.vue'; +import { useArrayData } from 'src/composables/useArrayData'; const { dialogRef, onDialogOK } = useDialogPluginComponent(); @@ -39,7 +40,7 @@ const optionsSamplesVisible = ref([]); const sampleType = ref({ hasPreview: false }); const initialData = reactive({}); const entityId = computed(() => route.params.id); -const customer = computed(() => state.get('Customer')); +const customer = computed(() => useArrayData('Customer').store?.data); const filterEmailUsers = { where: { userFk: user.value.id } }; const filterClientsAddresses = { include: [ @@ -65,9 +66,9 @@ const filterSamplesVisible = { defineEmits(['confirm', ...useDialogPluginComponent.emits]); onBeforeMount(async () => { - initialData.clientFk = customer.value.id; - initialData.recipient = customer.value.email; - initialData.recipientId = customer.value.id; + initialData.clientFk = customer.value?.id; + initialData.recipient = customer.value?.email; + initialData.recipientId = customer.value?.id; }); const setEmailUser = (data) => { diff --git a/src/pages/Item/Card/ItemDiary.vue b/src/pages/Item/Card/ItemDiary.vue index 4b6775183..31b3c328e 100644 --- a/src/pages/Item/Card/ItemDiary.vue +++ b/src/pages/Item/Card/ItemDiary.vue @@ -27,7 +27,7 @@ const user = state.getUser(); const today = Date.vnNew(); today.setHours(0, 0, 0, 0); const warehousesOptions = ref([]); -const itemBalances = computed(() => arrayDataItemBalances.store.data); +const itemBalances = computed(() => arrayDataItemBalances.store.data || []); const where = computed(() => arrayDataItemBalances.store.filter.where || {}); const showWhatsBeforeInventory = ref(false); const inventoriedDate = ref(null); @@ -313,8 +313,8 @@ async function updateWarehouse(warehouseFk) { row.lineFk == row.lastPreparedLineFk ? 'black' : row.balance < 0 - ? 'negative' - : '' + ? 'negative' + : '' " dense style="font-size: 14px" diff --git a/src/pages/Item/Card/ItemTags.vue b/src/pages/Item/Card/ItemTags.vue index ed23ab5a6..ab26b9cae 100644 --- a/src/pages/Item/Card/ItemTags.vue +++ b/src/pages/Item/Card/ItemTags.vue @@ -87,7 +87,7 @@ const insertTag = (rows) => { tagFk: undefined, }" :default-remove="false" - :filter="{ + :user-filter="{ fields: ['id', 'itemFk', 'tagFk', 'value', 'priority'], where: { itemFk: route.params.id }, include: { @@ -119,6 +119,7 @@ const insertTag = (rows) => { " :required="true" :rules="validate('itemTag.tagFk')" + :data-cy="`tag${row?.tag?.name}`" /> { :label="t('itemTags.value')" :is-clearable="false" @keyup.enter.stop="(data) => itemTagsRef.onSubmit(data)" + :data-cy="`tag${row?.tag?.name}Value`" /> { name="delete" size="sm" dense + :data-cy="`deleteTag${row?.tag?.name}`" > {{ t('itemTags.removeTag') }} @@ -177,6 +180,7 @@ const insertTag = (rows) => { icon="add" v-shortcut="'+'" fab + data-cy="createNewTag" > {{ t('itemTags.addTag') }} diff --git a/src/pages/Route/RouteExtendedList.vue b/src/pages/Route/RouteExtendedList.vue index a8d847711..f32dcd0d9 100644 --- a/src/pages/Route/RouteExtendedList.vue +++ b/src/pages/Route/RouteExtendedList.vue @@ -335,7 +335,6 @@ const openTicketsDialog = (id) => { { { -import { ref } from 'vue'; +import axios from 'axios'; import { useI18n } from 'vue-i18n'; +import { computed, ref } from 'vue'; +import { useRoute } from 'vue-router'; import { toCurrency } from 'src/filters'; import VnUsesMana from 'components/ui/VnUsesMana.vue'; const $props = defineProps({ - mana: { - type: Number, - default: null, - }, newPrice: { type: Number, default: 0, }, - usesMana: { - type: Boolean, - default: false, - }, - manaCode: { - type: String, - default: 'mana', - }, sale: { type: Object, default: null, }, }); +const route = useRoute(); +const mana = ref(null); +const usesMana = ref(false); + const emit = defineEmits(['save', 'cancel']); const { t } = useI18n(); @@ -38,32 +32,47 @@ const save = (sale = $props.sale) => { QPopupProxyRef.value.hide(); }; +const getMana = async () => { + const { data } = await axios.get(`Tickets/${route.params.id}/getSalesPersonMana`); + mana.value = data; + await getUsesMana(); +}; + +const getUsesMana = async () => { + const { data } = await axios.get('Sales/usesMana'); + usesMana.value = data; +}; + const cancel = () => { emit('cancel'); QPopupProxyRef.value.hide(); }; +const hasMana = computed(() => typeof mana.value === 'number'); defineExpose({ save }); diff --git a/src/pages/Worker/Card/WorkerDescriptor.vue b/src/pages/Worker/Card/WorkerDescriptor.vue index de3f634e2..0e946f1dd 100644 --- a/src/pages/Worker/Card/WorkerDescriptor.vue +++ b/src/pages/Worker/Card/WorkerDescriptor.vue @@ -111,6 +111,7 @@ const handlePhotoUpdated = (evt = false) => { -
-
- - - - -
-
+ + + + @@ -254,20 +246,3 @@ es: Search zone: Buscar zona You can search zones by id or name: Puedes buscar zonas por id o nombre - - diff --git a/test/cypress/integration/claim/claimAction.spec.js b/test/cypress/integration/claim/claimAction.spec.js index e98be85fc..b0a16a2ad 100644 --- a/test/cypress/integration/claim/claimAction.spec.js +++ b/test/cypress/integration/claim/claimAction.spec.js @@ -1,6 +1,6 @@ /// describe('ClaimAction', () => { - const claimId = 2; + const claimId = 1; const firstRow = 'tbody > :nth-child(1)'; const destinationRow = '.q-item__section > .q-field'; diff --git a/test/cypress/integration/item/itemTag.spec.js b/test/cypress/integration/item/itemTag.spec.js index d7a9ea4b3..425eaffe6 100644 --- a/test/cypress/integration/item/itemTag.spec.js +++ b/test/cypress/integration/item/itemTag.spec.js @@ -1,4 +1,3 @@ -/// describe('Item tag', () => { beforeEach(() => { cy.viewport(1920, 1080); @@ -8,25 +7,27 @@ describe('Item tag', () => { cy.waitForElement('[data-cy="itemTags"]'); }); + const createNewTag = 'createNewTag'; + const saveBtn = 'crudModelDefaultSaveBtn'; + const newTag = 'tagundefined'; + it('should throw an error adding an existent tag', () => { - cy.get('.q-page-sticky > div').click(); - cy.selectOption(':nth-child(8) > .q-select', 'Tallos'); - cy.get(':nth-child(8) > [label="Value"]').type('1'); - cy.dataCy('crudModelDefaultSaveBtn').click(); + cy.dataCy(createNewTag).click(); + cy.dataCy(newTag).should('be.visible').click().type('Genero{enter}'); + cy.dataCy('tagGeneroValue').eq(1).should('be.visible'); + cy.dataCy(saveBtn).click(); cy.checkNotification("The tag or priority can't be repeated for an item"); }); it('should add a new tag', () => { - cy.get('.q-page-sticky > div').click(); - cy.selectOption(':nth-child(8) > .q-select', 'Ancho de la base'); - cy.get(':nth-child(8) > [label="Value"]').type('50'); - cy.dataCy('crudModelDefaultSaveBtn').click(); + cy.dataCy(createNewTag).click(); + cy.dataCy(newTag).should('be.visible').click().type('Forma{enter}'); + cy.dataCy('tagFormaValue').should('be.visible').type('50'); + cy.dataCy(saveBtn).click(); + cy.checkNotification('Data saved'); - cy.dataCy('itemTags') - .children(':nth-child(8)') - .find('.justify-center > .q-icon') - .click(); - cy.dataCy('VnConfirm_confirm').click(); + cy.dataCy('deleteTagForma').should('be.visible').click(); + cy.dataCy('VnConfirm_confirm').should('be.visible').click(); cy.checkNotification('Data saved'); }); });