diff --git a/Jenkinsfile b/Jenkinsfile index 63577dad5..df2421a0e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -123,7 +123,7 @@ pipeline { sh "docker-compose ${env.COMPOSE_PARAMS} up -d" image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ --init") { - sh 'sh test/cypress/cypressParallel.sh 2' + sh 'sh test/cypress/cypressParallel.sh 3' } } } diff --git a/src/components/TransferInvoiceForm.vue b/src/components/TransferInvoiceForm.vue index c4ef1454a..1434b79bc 100644 --- a/src/components/TransferInvoiceForm.vue +++ b/src/components/TransferInvoiceForm.vue @@ -87,7 +87,7 @@ const makeInvoice = async () => { (data) => ( (rectificativeTypeOptions = data), (transferInvoiceParams.cplusRectificationTypeFk = data.filter( - (type) => type.description == 'I – Por diferencias' + (type) => type.description == 'I – Por diferencias', )[0].id) ) " @@ -100,7 +100,7 @@ const makeInvoice = async () => { (data) => ( (siiTypeInvoiceOutsOptions = data), (transferInvoiceParams.siiTypeInvoiceOutFk = data.filter( - (type) => type.code == 'R4' + (type) => type.code == 'R4', )[0].id) ) " @@ -122,7 +122,6 @@ const makeInvoice = async () => { $props.dataKey === route.meta.moduleName); +const DESCRIPTOR_PROXY = 'DescriptorProxy'; +const moduleName = ref(); +const isSameModuleName = route.matched[1].meta.moduleName !== moduleName.value; defineExpose({ getData }); onBeforeMount(async () => { @@ -76,15 +80,18 @@ onBeforeMount(async () => { ); }); -const routeName = computed(() => { - const DESCRIPTOR_PROXY = 'DescriptorProxy'; - +function getName() { let name = $props.dataKey; if ($props.dataKey.includes(DESCRIPTOR_PROXY)) { name = name.split(DESCRIPTOR_PROXY)[0]; } - return `${name}Summary`; + return name; +} +const routeName = computed(() => { + let routeName = getName(); + return `${routeName}Summary`; }); + async function getData() { store.url = $props.url; store.filter = $props.filter ?? {}; @@ -120,20 +127,35 @@ function copyIdText(id) { const emit = defineEmits(['onFetch']); -const iconModule = computed(() => route.matched[1].meta.icon); -const toModule = computed(() => - route.matched[1].path.split('/').length > 2 - ? route.matched[1].redirect - : route.matched[1].children[0].redirect, -); +const iconModule = computed(() => { + moduleName.value = getName(); + if (isSameModuleName) { + return router.options.routes[1].children.find((r) => r.name === moduleName.value) + ?.meta?.icon; + } else { + return route.matched[1].meta.icon; + } +}); + +const toModule = computed(() => { + moduleName.value = getName(); + if (isSameModuleName) { + return router.options.routes[1].children.find((r) => r.name === moduleName.value) + ?.children[0]?.redirect; + } else { + return route.matched[1].path.split('/').length > 2 + ? route.matched[1].redirect + : route.matched[1].children[0].redirect; + } +}); - + :icon="iconModule" color="white" class="link" - :to="$attrs['to-module'] ?? toModule" + :to="toModule" > {{ t('globals.goToModuleIndex') }} - + + - @@ -396,7 +396,6 @@ watchEffect(selectedRows); :label=" t('invoiceOutList.tableVisibleColumns.taxArea') " - :options="taxAreasOptions" option-label="code" option-value="code" /> diff --git a/src/pages/InvoiceOut/InvoiceOutNegativeBasesFilter.vue b/src/pages/InvoiceOut/InvoiceOutNegativeBasesFilter.vue index cd9836bb7..579ab8871 100644 --- a/src/pages/InvoiceOut/InvoiceOutNegativeBasesFilter.vue +++ b/src/pages/InvoiceOut/InvoiceOutNegativeBasesFilter.vue @@ -20,7 +20,7 @@ const props = defineProps({ diff --git a/src/pages/Route/Card/RouteDescriptor.vue b/src/pages/Route/Card/RouteDescriptor.vue index 503cd1941..01fb9c4ba 100644 --- a/src/pages/Route/Card/RouteDescriptor.vue +++ b/src/pages/Route/Card/RouteDescriptor.vue @@ -27,12 +27,16 @@ const getZone = async () => { const filter = { where: { routeFk: $props.id ? $props.id : route.params.id }, }; - const { data } = await axios.get('Tickets/findOne', { + const { data } = await axios.get('Tickets/filter', { params: { filter: JSON.stringify(filter), }, }); - zoneId.value = data.zoneFk; + + if (!data.length) return; + const firstRecord = data[0]; + + zoneId.value = firstRecord.zoneFk; const { data: zoneData } = await axios.get(`Zones/${zoneId.value}`); zone.value = zoneData.name; }; diff --git a/src/pages/Wagon/Card/WagonCard.vue b/src/pages/Wagon/Card/WagonCard.vue index 644a30ffa..1694dad7b 100644 --- a/src/pages/Wagon/Card/WagonCard.vue +++ b/src/pages/Wagon/Card/WagonCard.vue @@ -1,6 +1,6 @@ - + diff --git a/src/pages/Wagon/WagonList.vue b/src/pages/Wagon/WagonList.vue index e716686d1..16c5fca63 100644 --- a/src/pages/Wagon/WagonList.vue +++ b/src/pages/Wagon/WagonList.vue @@ -8,6 +8,7 @@ import VnTable from 'src/components/VnTable/VnTable.vue'; import { computed, ref } from 'vue'; import VnSelect from 'src/components/common/VnSelect.vue'; import VnInput from 'src/components/common/VnInput.vue'; +import VnSection from 'src/components/common/VnSection.vue'; const quasar = useQuasar(); const arrayData = useArrayData('WagonList'); @@ -15,6 +16,7 @@ const store = arrayData.store; const router = useRouter(); const { t } = useI18n(); const tableRef = ref(); +const dataKey = 'WagonList'; const filter = { include: { relation: 'type', @@ -75,101 +77,110 @@ function navigate(id) { } async function remove(row) { - try { - await axios.delete(`Wagons/${row.id}`).then(async () => { - quasar.notify({ - message: t('wagon.list.removeItem'), - type: 'positive', - }); - store.data.splice(store.data.indexOf(row), 1); - window.location.reload(); + await axios.delete(`Wagons/${row.id}`).then(async () => { + quasar.notify({ + message: t('wagon.list.removeItem'), + type: 'positive', }); - } catch (error) { - // - } + store.data.splice(store.data.indexOf(row), 1); + window.location.reload(); + }); } - - - - - - - + - - + + + + + + + + + + + {{ t('wagon.warnings.noData') }} + + + + - - - - {{ t('wagon.warnings.noData') }} - - - - + - + es: Create new wagon: Crear nuevo vagón - \ No newline at end of file + diff --git a/src/pages/Zone/Card/ZoneCard.vue b/src/pages/Zone/Card/ZoneCard.vue index 41daff5c0..205ed074b 100644 --- a/src/pages/Zone/Card/ZoneCard.vue +++ b/src/pages/Zone/Card/ZoneCard.vue @@ -1,38 +1,7 @@ - - + diff --git a/src/pages/Zone/Card/ZoneEventExclusionForm.vue b/src/pages/Zone/Card/ZoneEventExclusionForm.vue index 4b6aa52bd..3828c998f 100644 --- a/src/pages/Zone/Card/ZoneEventExclusionForm.vue +++ b/src/pages/Zone/Card/ZoneEventExclusionForm.vue @@ -171,9 +171,10 @@ onMounted(() => { openConfirmationModal( t('eventsPanel.deleteTitle'), t('eventsPanel.deleteSubtitle'), - () => deleteEvent() + () => deleteEvent(), ) " + data-cy="ZoneEventExclusionDeleteBtn" /> { diff --git a/src/pages/Zone/Card/ZoneEvents.vue b/src/pages/Zone/Card/ZoneEvents.vue index 1e6debd25..2fa7dfb43 100644 --- a/src/pages/Zone/Card/ZoneEvents.vue +++ b/src/pages/Zone/Card/ZoneEvents.vue @@ -1,18 +1,14 @@ - - - + + + + + { await fetchData(); }, - { immediate: true, deep: true } + { immediate: true, deep: true }, ); const formatWdays = (event) => { @@ -178,9 +176,10 @@ onMounted(async () => { openConfirmationModal( t('zone.deleteTitle'), t('zone.deleteSubtitle'), - () => deleteEvent(event.id) + () => deleteEvent(event.id), ) " + data-cy="ZoneEventsPanelDeleteBtn" > {{ t('eventsPanel.delete') }} diff --git a/src/pages/Zone/Card/ZoneLocationsTree.vue b/src/pages/Zone/Card/ZoneLocationsTree.vue index 5c87faf99..083436440 100644 --- a/src/pages/Zone/Card/ZoneLocationsTree.vue +++ b/src/pages/Zone/Card/ZoneLocationsTree.vue @@ -1,6 +1,7 @@ + + + { - - + diff --git a/src/pages/Zone/Card/ZoneSearchbar.vue b/src/pages/Zone/Card/ZoneSearchbar.vue deleted file mode 100644 index d1188a1e8..000000000 --- a/src/pages/Zone/Card/ZoneSearchbar.vue +++ /dev/null @@ -1,74 +0,0 @@ - - - - - diff --git a/src/pages/Zone/Card/ZoneSummary.vue b/src/pages/Zone/Card/ZoneSummary.vue index 5b29b495b..2c56fa3e2 100644 --- a/src/pages/Zone/Card/ZoneSummary.vue +++ b/src/pages/Zone/Card/ZoneSummary.vue @@ -60,10 +60,11 @@ onMounted(async () => { #{{ entity.id }} - {{ entity.name }} diff --git a/src/pages/Zone/ZoneDeliveryDays.vue b/src/pages/Zone/ZoneDeliveryDays.vue index d95c64d8b..ddde3f6b3 100644 --- a/src/pages/Zone/ZoneDeliveryDays.vue +++ b/src/pages/Zone/ZoneDeliveryDays.vue @@ -3,7 +3,6 @@ import { ref } from 'vue'; import ZoneDeliveryPanel from './ZoneDeliveryPanel.vue'; import ZoneCalendarGrid from './ZoneCalendarGrid.vue'; import RightMenu from 'src/components/common/RightMenu.vue'; -import ZoneSearchbar from './Card/ZoneSearchbar.vue'; const firstDay = ref(null); const lastDay = ref(null); @@ -11,7 +10,6 @@ const events = ref([]); - diff --git a/src/pages/Zone/ZoneDeliveryPanel.vue b/src/pages/Zone/ZoneDeliveryPanel.vue index 993ec274f..a8cb05afc 100644 --- a/src/pages/Zone/ZoneDeliveryPanel.vue +++ b/src/pages/Zone/ZoneDeliveryPanel.vue @@ -89,7 +89,7 @@ watch( v-model="formData.geoFk" url="Postcodes/location" :fields="['geoFk', 'code', 'townFk', 'countryFk']" - :sort-by="['code ASC']" + :sort-by="'code ASC'" option-value="geoFk" option-label="code" :filter-options="['code']" diff --git a/src/pages/Zone/ZoneFilterPanel.vue b/src/pages/Zone/ZoneFilterPanel.vue deleted file mode 100644 index ff65479e4..000000000 --- a/src/pages/Zone/ZoneFilterPanel.vue +++ /dev/null @@ -1,69 +0,0 @@ - - - - (agencies = data)" - auto-load - /> - - - - {{ t(`filterPanel.${tag.label}`) }}: - {{ tag.value }} - - - - - - - - - - - - - - - - - diff --git a/src/pages/Zone/ZoneList.vue b/src/pages/Zone/ZoneList.vue index eb54ec15b..869b0c12c 100644 --- a/src/pages/Zone/ZoneList.vue +++ b/src/pages/Zone/ZoneList.vue @@ -14,9 +14,7 @@ import VnTable from 'src/components/VnTable/VnTable.vue'; import VnSelect from 'src/components/common/VnSelect.vue'; import VnInput from 'src/components/common/VnInput.vue'; import VnInputTime from 'src/components/common/VnInputTime.vue'; -import RightMenu from 'src/components/common/RightMenu.vue'; -import ZoneFilterPanel from './ZoneFilterPanel.vue'; -import ZoneSearchbar from './Card/ZoneSearchbar.vue'; +import VnSection from 'src/components/common/VnSection.vue'; const { t } = useI18n(); const router = useRouter(); @@ -25,7 +23,7 @@ const { viewSummary } = useSummaryDialog(); const { openConfirmationModal } = useVnConfirm(); const tableRef = ref(); const warehouseOptions = ref([]); - +const dataKey = 'ZoneList'; const tableFilter = { include: [ { @@ -114,6 +112,7 @@ const columns = computed(() => [ columnFilter: { inWhere: true, }, + columnClass: 'shrink-column', }, { align: 'left', @@ -169,77 +168,128 @@ function formatRow(row) { return dashIfEmpty(`${row?.address?.nickname}, ${row?.address?.postcode?.town?.name} (${row?.address?.province?.name})`); } + +const exprBuilder = (param, value) => { + switch (param) { + case 'name': + return { + name: { like: `%${value}%` }, + }; + case 'code': + return { + code: { like: `%${value}%` }, + }; + case 'agencyModeFk': + return { + agencyModeFk: value, + }; + case 'search': + return /^\d+$/.test(value) ? { id: value } : { name: { like: `%${value}%` } }; + case 'price': + return { + price: value, + }; + } +}; - - - - - - - - - {{ dashIfEmpty(formatRow(row)) }} + + + + + + {{ dashIfEmpty(formatRow(row)) }} + + + + + + + + + + + + + - - - - - - - - - - + + + es: Search zone: Buscar zona diff --git a/src/pages/Zone/ZoneUpcoming.vue b/src/pages/Zone/ZoneUpcoming.vue index adcdfbc04..b8664dc2f 100644 --- a/src/pages/Zone/ZoneUpcoming.vue +++ b/src/pages/Zone/ZoneUpcoming.vue @@ -7,7 +7,6 @@ import FetchData from 'components/FetchData.vue'; import { toDateFormat } from 'src/filters/date.js'; import { useWeekdayStore } from 'src/stores/useWeekdayStore'; -import ZoneSearchbar from './Card/ZoneSearchbar.vue'; const { t } = useI18n(); const weekdayStore = useWeekdayStore(); @@ -31,7 +30,7 @@ const columns = computed(() => [ label: t('list.id'), name: 'id', field: 'zoneFk', - align: 'left', + align: 'center', }, ]); @@ -53,7 +52,6 @@ onMounted(() => weekdayStore.initStore()); @on-fetch="(data) => (details = data)" auto-load /> - diff --git a/src/pages/Zone/locale/en.yml b/src/pages/Zone/locale/en.yml index e53e7b560..22f4b1ae6 100644 --- a/src/pages/Zone/locale/en.yml +++ b/src/pages/Zone/locale/en.yml @@ -11,10 +11,13 @@ zone: m3Max: Max m³ deleteTitle: This item will be deleted deleteSubtitle: Are you sure you want to continue? - volumetric: Volumetric bonus: Bonus closing: Closing travelingDays: Traveling days + search: Search zone + searchInfo: Search zone by id or name + searchLocations: Search locations + searchLocationsInfo: Search locations by post code list: clone: Clone id: Id @@ -30,6 +33,7 @@ list: confirmCloneTitle: All it's properties will be copied confirmCloneSubtitle: Do you want to clone this zone? warehouse: Warehouse + isVolumetric: Volumetric createZone: Create zone zoneSummary: Summary addressFk: Address diff --git a/src/pages/Zone/locale/es.yml b/src/pages/Zone/locale/es.yml index bc31e74a9..777bc1c03 100644 --- a/src/pages/Zone/locale/es.yml +++ b/src/pages/Zone/locale/es.yml @@ -15,6 +15,10 @@ zone: bonus: Bonificación closing: Cierre travelingDays: Días de viaje + search: Buscar zona + searchInfo: Buscar zona por Id o nombre + searchLocations: Buscar localización + searchLocationsInfo: Buscar localización por código postal list: clone: Clonar id: Id diff --git a/src/router/modules/wagon.js b/src/router/modules/wagon.js index 4a322d305..798c671eb 100644 --- a/src/router/modules/wagon.js +++ b/src/router/modules/wagon.js @@ -1,52 +1,60 @@ import { RouterView } from 'vue-router'; +const wagonCard = { + name: 'WagonCard', + path: ':id', + component: () => import('src/pages/Wagon/Card/WagonCard.vue'), + redirect: { name: 'WagonEdit' }, + meta: { + menu: ['WagonEdit'], + }, + children: [ + { + path: 'edit', + name: 'WagonEdit', + meta: { + title: 'wagonEdit', + icon: 'edit', + }, + component: () => import('src/pages/Wagon/WagonCreate.vue'), + }, + ], +}; + export default { - path: '/wagon', name: 'Wagon', + path: '/wagon', meta: { title: 'wagons', icon: 'vn:trolley', moduleName: 'Wagon', + menu: ['WagonList', 'WagonTypeList', 'WagonCounter'], }, component: RouterView, redirect: { name: 'WagonMain' }, - menus: { - main: ['WagonList', 'WagonTypeList', 'WagonCounter', 'WagonTray'], - card: [], - }, children: [ { - path: '/wagon', + path: '', name: 'WagonMain', component: () => import('src/components/common/VnModule.vue'), - redirect: { name: 'WagonList' }, + redirect: { name: 'WagonIndexMain' }, children: [ { - path: 'list', - name: 'WagonList', - meta: { - title: 'list', - icon: 'vn:trolley', - }, + path: '', + name: 'WagonIndexMain', + redirect: { name: 'WagonList' }, component: () => import('src/pages/Wagon/WagonList.vue'), - }, - { - path: 'create', - name: 'WagonCreate', - meta: { - title: 'wagonCreate', - icon: 'create', - }, - component: () => import('src/pages/Wagon/WagonCreate.vue'), - }, - { - path: ':id/edit', - name: 'WagonEdit', - meta: { - title: 'wagonEdit', - icon: 'edit', - }, - component: () => import('src/pages/Wagon/WagonCreate.vue'), + children: [ + { + name: 'WagonList', + path: 'list', + meta: { + title: 'list', + icon: 'view_list', + }, + }, + wagonCard, + ], }, { path: 'counter', @@ -57,40 +65,32 @@ export default { }, component: () => import('src/pages/Wagon/WagonCounter.vue'), }, - ], - }, - { - path: '/wagon/type', - name: 'WagonTypeMain', - component: () => import('src/components/common/VnModule.vue'), - redirect: { name: 'WagonTypeList' }, - children: [ { - path: 'list', - name: 'WagonTypeList', - meta: { - title: 'typesList', - icon: 'view_list', - }, - component: () => import('src/pages/Wagon/Type/WagonTypeList.vue'), - }, - { - path: 'create', - name: 'WagonTypeCreate', - meta: { - title: 'typeCreate', - icon: 'create', - }, - component: () => import('src/pages/Wagon/Type/WagonTypeList.vue'), - }, - { - path: ':id/edit', - name: 'WagonTypeEdit', - meta: { - title: 'typeEdit', - icon: 'edit', - }, - component: () => import('src/pages/Wagon/Type/WagonTypeEdit.vue'), + path: 'type', + name: 'WagonTypeMain', + redirect: { name: 'WagonTypeList' }, + children: [ + { + path: 'list', + name: 'WagonTypeList', + meta: { + title: 'typesList', + icon: 'view_list', + }, + component: () => + import('src/pages/Wagon/Type/WagonTypeList.vue'), + }, + { + path: ':id/edit', + name: 'WagonTypeEdit', + meta: { + title: 'typeEdit', + icon: 'edit', + }, + component: () => + import('src/pages/Wagon/Type/WagonTypeEdit.vue'), + }, + ], }, ], }, diff --git a/src/router/modules/zone.js b/src/router/modules/zone.js index f400a708e..f48a715b9 100644 --- a/src/router/modules/zone.js +++ b/src/router/modules/zone.js @@ -1,24 +1,12 @@ import { RouterView } from 'vue-router'; -export default { - path: '/zone', - name: 'Zone', +const zoneCard = { + name: 'ZoneCard', + path: ':id', + component: () => import('src/pages/Zone/Card/ZoneCard.vue'), + redirect: { name: 'ZoneSummary' }, meta: { - title: 'zones', - icon: 'vn:zone', - moduleName: 'Zone', - keyBinding: 'z', - }, - component: RouterView, - redirect: { name: 'ZoneMain' }, - menus: { - main: [ - 'ZoneList', - 'ZoneDeliveryDays', - 'ZoneUpcomingList', - 'ZoneUpcomingDeliveries', - ], - card: [ + menu: [ 'ZoneBasicData', 'ZoneWarehouses', 'ZoneHistory', @@ -28,19 +16,102 @@ export default { }, children: [ { - path: '/zone', + name: 'ZoneSummary', + path: 'summary', + meta: { + title: 'summary', + icon: 'launch', + }, + component: () => import('src/pages/Zone/Card/ZoneSummary.vue'), + }, + { + path: 'basic-data', + name: 'ZoneBasicData', + meta: { + title: 'basicData', + icon: 'vn:settings', + }, + component: () => import('src/pages/Zone/Card/ZoneBasicData.vue'), + }, + { + path: 'location', + name: 'ZoneLocations', + meta: { + title: 'locations', + icon: 'my_location', + }, + component: () => import('src/pages/Zone/Card/ZoneLocations.vue'), + }, + { + path: 'warehouses', + name: 'ZoneWarehouses', + meta: { + title: 'warehouses', + icon: 'home', + }, + component: () => import('src/pages/Zone/Card/ZoneWarehouses.vue'), + }, + { + path: 'log', + name: 'ZoneHistory', + meta: { + title: 'log', + icon: 'history', + }, + component: () => import('src/pages/Zone/Card/ZoneLog.vue'), + }, + { + path: 'events', + name: 'ZoneEvents', + meta: { + title: 'calendar', + icon: 'vn:calendar', + }, + component: () => import('src/pages/Zone/Card/ZoneEvents.vue'), + }, + ], +}; + +export default { + name: 'Zone', + path: '/zone', + meta: { + title: 'zones', + icon: 'vn:zone', + moduleName: 'Zone', + keyBinding: 'z', + menu: [ + 'ZoneList', + 'ZoneDeliveryDays', + 'ZoneUpcomingList', + 'ZoneUpcomingDeliveries', + ], + }, + component: RouterView, + redirect: { name: 'ZoneMain' }, + children: [ + { name: 'ZoneMain', + path: '', component: () => import('src/components/common/VnModule.vue'), - redirect: { name: 'ZoneList' }, + redirect: { name: 'ZoneIndexMain' }, children: [ { - path: 'list', - name: 'ZoneList', - meta: { - title: 'zonesList', - icon: 'view_list', - }, + path: '', + name: 'ZoneIndexMain', + redirect: { name: 'ZoneList' }, component: () => import('src/pages/Zone/ZoneList.vue'), + children: [ + { + name: 'ZoneList', + path: 'list', + meta: { + title: 'list', + icon: 'view_list', + }, + }, + zoneCard, + ], }, { path: 'delivery-days', @@ -62,67 +133,5 @@ export default { }, ], }, - { - name: 'ZoneCard', - path: ':id', - component: () => import('src/pages/Zone/Card/ZoneCard.vue'), - redirect: { name: 'ZoneSummary' }, - children: [ - { - name: 'ZoneSummary', - path: 'summary', - meta: { - title: 'summary', - icon: 'launch', - }, - component: () => import('src/pages/Zone/Card/ZoneSummary.vue'), - }, - { - name: 'ZoneBasicData', - path: 'basic-data', - meta: { - title: 'basicData', - icon: 'vn:settings', - }, - component: () => import('src/pages/Zone/Card/ZoneBasicData.vue'), - }, - { - name: 'ZoneLocations', - path: 'location', - meta: { - title: 'locations', - icon: 'my_location', - }, - component: () => import('src/pages/Zone/Card/ZoneLocations.vue'), - }, - { - name: 'ZoneWarehouses', - path: 'warehouses', - meta: { - title: 'warehouses', - icon: 'home', - }, - component: () => import('src/pages/Zone/Card/ZoneWarehouses.vue'), - }, - { - name: 'ZoneHistory', - path: 'log', - meta: { - title: 'log', - icon: 'history', - }, - component: () => import('src/pages/Zone/Card/ZoneLog.vue'), - }, - { - name: 'ZoneEvents', - path: 'events', - meta: { - title: 'calendar', - icon: 'vn:calendar', - }, - component: () => import('src/pages/Zone/Card/ZoneEvents.vue'), - }, - ], - }, ], }; diff --git a/test/cypress/integration/route/routeExtendedList.spec.js b/test/cypress/integration/route/routeExtendedList.spec.js index e3505ad60..5fda93b25 100644 --- a/test/cypress/integration/route/routeExtendedList.spec.js +++ b/test/cypress/integration/route/routeExtendedList.spec.js @@ -32,18 +32,18 @@ describe.skip('Route extended list', () => { const originalFields = [ { selector: selectors.worker, type: 'select', value: 'logistic' }, - { selector: selectors.agency, type: 'select', value: 'Super-Man delivery' }, + { selector: selectors.agency, type: 'select', value: 'inhouse pickup' }, { selector: selectors.vehicle, type: 'select', value: '3333-IMK' }, - { selector: selectors.date, type: 'date', value: '01/02/2024' }, + { selector: selectors.date, type: 'date', value: '01/01/2001' }, { selector: selectors.description, type: 'input', value: 'Test route' }, { selector: selectors.served, type: 'checkbox', value: checkboxState.uncheck }, ]; const updateFields = [ { selector: selectors.worker, type: 'select', value: 'salesperson' }, - { selector: selectors.agency, type: 'select', value: 'inhouse pickup' }, + { selector: selectors.agency, type: 'select', value: 'Super-Man delivery' }, { selector: selectors.vehicle, type: 'select', value: '1111-IMK' }, - { selector: selectors.date, type: 'date', value: '01/01/2001' }, + { selector: selectors.date, type: 'date', value: '11/01/2001' }, { selector: selectors.description, type: 'input', value: 'Description updated' }, { selector: selectors.served, type: 'checkbox', value: checkboxState.check }, ]; @@ -57,11 +57,11 @@ describe.skip('Route extended list', () => { break; case 'input': cy.get(selector).should('be.visible').click(); - cy.dataCy('null_input').clear().type(`${value}{enter}`); + cy.dataCy('null_input').clear().type(`${value}`); break; case 'date': cy.get(selector).should('be.visible').click(); - cy.dataCy('null_inputDate').clear().type(`${value}{enter}`); + cy.dataCy('null_inputDate').clear().type(`${value}`); break; case 'checkbox': cy.get(selector).should('be.visible').click().click(); @@ -76,15 +76,6 @@ describe.skip('Route extended list', () => { cy.typeSearchbar('{enter}'); }); - after(() => { - cy.visit(url); - cy.typeSearchbar('{enter}'); - cy.get(selectors.lastRowSelectCheckBox).click(); - - cy.get(selectors.removeBtn).click(); - cy.dataCy(selectors.confirmBtn).click(); - }); - it('Should list routes', () => { cy.get('.q-table') .children() @@ -97,9 +88,9 @@ describe.skip('Route extended list', () => { const data = { Worker: { val: 'logistic', type: 'select' }, - Agency: { val: 'Super-Man delivery', type: 'select' }, + Agency: { val: 'inhouse pickup', type: 'select' }, Vehicle: { val: '3333-IMK', type: 'select' }, - Date: { val: '02-01-2024', type: 'date' }, + Date: { val: '01-01-2001', type: 'date' }, From: { val: '01-01-2024', type: 'date' }, To: { val: '10-01-2024', type: 'date' }, 'Km start': { val: 1000 }, @@ -129,7 +120,7 @@ describe.skip('Route extended list', () => { it('Should clone selected route', () => { cy.get(selectors.lastRowSelectCheckBox).click(); cy.get(selectors.cloneBtn).click(); - cy.dataCy('route.Starting date_inputDate').type('10-05-2001{enter}'); + cy.dataCy('route.Starting date_inputDate').type('10-05-2001').click(); cy.get('.q-card__actions > .q-btn--standard > .q-btn__content').click(); cy.validateContent(selectors.date, '05/10/2001'); }); @@ -142,10 +133,6 @@ describe.skip('Route extended list', () => { const fileName = 'download.zip'; cy.readFile(`${downloadsFolder}/${fileName}`).should('exist'); - - cy.task('deleteFile', `${downloadsFolder}/${fileName}`).then((deleted) => { - expect(deleted).to.be.true; - }); }); it('Should mark as served the selected route', () => { @@ -165,6 +152,13 @@ describe.skip('Route extended list', () => { cy.checkNotification(dataSaved); }); + it('Should add ticket to route', () => { + cy.dataCy('tableAction-0').last().click(); + cy.get(selectors.firstTicketsRowSelectCheckBox).click(); + cy.get('.q-card__actions > .q-btn--standard > .q-btn__content').click(); + cy.checkNotification(dataSaved); + }); + it('Should save changes in route', () => { updateFields.forEach(({ selector, type, value }) => { fillField(selector, type, value); @@ -175,18 +169,15 @@ describe.skip('Route extended list', () => { cy.typeSearchbar('{enter}'); - updateFields.forEach(({ selector, value }) => { + updateFields.forEach(({ selector, value, type }) => { + if (type === 'date') { + const [month, day, year] = value.split('/'); + value = `${day}/${month}/${year}`; + } cy.validateContent(selector, value); }); }); - it('Should add ticket to route', () => { - cy.dataCy('tableAction-0').last().click(); - cy.get(selectors.firstTicketsRowSelectCheckBox).click(); - cy.get('.q-card__actions > .q-btn--standard > .q-btn__content').click(); - cy.checkNotification(dataSaved); - }); - it('Should open summary pop-up when click summuary icon', () => { cy.dataCy('tableAction-1').last().click(); cy.get('.summaryHeader > :nth-child(2').should('contain', updateFields[4].value); diff --git a/test/cypress/integration/wagon/wagonCreate.spec.js b/test/cypress/integration/wagon/wagonCreate.spec.js index 6d185ea69..88855fdf9 100644 --- a/test/cypress/integration/wagon/wagonCreate.spec.js +++ b/test/cypress/integration/wagon/wagonCreate.spec.js @@ -1,4 +1,4 @@ -describe.skip('WagonCreate', () => { +describe('WagonCreate', () => { beforeEach(() => { cy.viewport(1280, 720); cy.login('developer'); @@ -17,7 +17,7 @@ describe.skip('WagonCreate', () => { '.grid-create > [label="Volume"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="Volume_input"]', ).type('100'); cy.selectOption('[data-cy="Type_select"]', '1'); - + cy.dataCy('FormModelPopup_save').click(); cy.get('[title="Remove"] > .q-btn__content > .q-icon').first().click(); }); }); diff --git a/test/cypress/integration/wagon/wagonType/wagonTypeCreate.spec.js b/test/cypress/integration/wagon/wagonType/wagonTypeCreate.spec.js index 49d7d9f01..915927a6d 100644 --- a/test/cypress/integration/wagon/wagonType/wagonTypeCreate.spec.js +++ b/test/cypress/integration/wagon/wagonType/wagonTypeCreate.spec.js @@ -2,7 +2,7 @@ describe('WagonTypeCreate', () => { beforeEach(() => { cy.viewport(1920, 1080); cy.login('developer'); - cy.visit('/#/wagon/type/create'); + cy.visit('/#/wagon/type/list'); cy.waitForElement('.q-page', 6000); }); diff --git a/test/cypress/integration/zone/zoneCalendar.spec.js b/test/cypress/integration/zone/zoneCalendar.spec.js index d71c29142..07661a17d 100644 --- a/test/cypress/integration/zone/zoneCalendar.spec.js +++ b/test/cypress/integration/zone/zoneCalendar.spec.js @@ -1,20 +1,18 @@ describe('ZoneCalendar', () => { const addEventBtn = '.q-page-sticky > div > .q-btn'; const submitBtn = '.q-mt-lg > .q-btn--standard'; - const deleteBtn = '.q-item__section--side > .q-btn'; - const from = '.q-field__control-container > [data-cy="ZoneEventsFromDate"]'; - const to = '.q-field__control-container > [data-cy="ZoneEventsToDate"]'; + const deleteBtn = '[data-cy="ZoneEventsPanelDeleteBtn"]'; beforeEach(() => { cy.login('developer'); cy.viewport(1920, 1080); - cy.visit(`/#/zone/11/events`); + cy.visit(`/#/zone/13/events`); }); it('should include a one day event, then delete it', () => { cy.get(addEventBtn).click(); cy.dataCy('ZoneEventInclusionDayRadio').click(); - cy.get('.q-card > :nth-child(5)').type('02/04/2001'); + cy.get('.q-card > :nth-child(5)').type('01/01/2001'); cy.get(submitBtn).click(); cy.get(deleteBtn).click(); cy.dataCy('VnConfirm_confirm').click(); @@ -47,7 +45,7 @@ describe('ZoneCalendar', () => { cy.get( '.q-current-day > .q-calendar-month__day--content > [data-cy="ZoneCalendarDay"]', ).click(); - cy.get('.q-mt-lg > :nth-child(2)').click(); + cy.dataCy('ZoneEventExclusionDeleteBtn').click(); cy.dataCy('VnConfirm_confirm').click(); }); }); diff --git a/test/cypress/integration/zone/zoneCreate.spec.js b/test/cypress/integration/zone/zoneCreate.spec.js index 9ef1945bf..fadf5b07f 100644 --- a/test/cypress/integration/zone/zoneCreate.spec.js +++ b/test/cypress/integration/zone/zoneCreate.spec.js @@ -1,4 +1,4 @@ -describe.skip('ZoneCreate', () => { +describe('ZoneCreate', () => { const data = { Name: { val: 'Zone pickup D' }, Price: { val: '3' }, diff --git a/test/cypress/integration/zone/zoneList.spec.js b/test/cypress/integration/zone/zoneList.spec.js index b1b0db3fc..c84b1b017 100644 --- a/test/cypress/integration/zone/zoneList.spec.js +++ b/test/cypress/integration/zone/zoneList.spec.js @@ -1,26 +1,18 @@ describe('ZoneList', () => { const agency = 'inhouse pickup'; + const firstSummaryIcon = + ':nth-child(1) > .q-table--col-auto-width > [data-cy="tableAction-0"]'; beforeEach(() => { cy.viewport(1280, 720); cy.login('developer'); cy.visit('/#/zone/list'); - }); - - it('should filter by agency', () => { - cy.dataCy('zoneFilterPanelAgencySelect').type(agency); - cy.get('.q-menu .q-item').contains(agency).click(); - cy.get(':nth-child(1) > [data-col-field="agencyModeFk"]').should( - 'include.text', - agency, - ); + cy.typeSearchbar('{enter}'); }); it('should open the zone summary', () => { - cy.dataCy('zoneFilterPanelAgencySelect').type(agency); - cy.get('.q-menu .q-item').contains(agency).click(); - cy.dataCy('tableAction-0').eq(1).click(); + cy.get(firstSummaryIcon).click(); cy.get('.header > .q-icon').click(); - cy.url().should('include', 'zone/2/summary'); + cy.url().should('include', 'zone/1/summary'); }); it('should clone the zone', () => { @@ -29,7 +21,5 @@ describe('ZoneList', () => { cy.dataCy('VnConfirm_confirm').click(); cy.url().should('not.include', 'zone/2/'); cy.url().should('match', /zone\/\d+\/basic-data/); - cy.get('.list-box > :nth-child(1)').should('include.text', agency); - cy.get('.title > span').should('include.text', 'Zone pickup B'); }); }); diff --git a/test/cypress/integration/zone/zoneLocations.spec.js b/test/cypress/integration/zone/zoneLocations.spec.js index 04b7f1991..cdc2c778b 100644 --- a/test/cypress/integration/zone/zoneLocations.spec.js +++ b/test/cypress/integration/zone/zoneLocations.spec.js @@ -3,7 +3,8 @@ describe('ZoneLocations', () => { Warehouse: { val: 'Warehouse One', type: 'select' }, }; - const postalCode = '[style=""] > :nth-child(1) > :nth-child(1) > :nth-child(2) > :nth-child(1) > :nth-child(1) > :nth-child(2) > :nth-child(1) > .q-tree__node--parent > .q-tree__node-collapsible > .q-tree__children' + const postalCode = + '[style=""] > :nth-child(1) > :nth-child(1) > :nth-child(2) > :nth-child(1) > :nth-child(1) > :nth-child(2) > :nth-child(1) > .q-tree__node--parent > .q-tree__node-collapsible > .q-tree__children'; beforeEach(() => { cy.viewport(1280, 720); @@ -12,12 +13,14 @@ describe('ZoneLocations', () => { }); it('should show all locations on entry', () => { - cy.get('.q-tree > :nth-child(1) > :nth-child(2) > :nth-child(1)').children().should('have.length', 9); + cy.get('.q-tree > :nth-child(1) > :nth-child(2) > :nth-child(1)') + .children() + .should('have.length', 9); }); it('should be able to search by postal code', () => { cy.get('#searchbarForm').type('46680'); cy.get('.router-link-active > .q-icon').click(); - cy.get(postalCode).should('include.text', '46680') + cy.get(postalCode).should('include.text', '46680'); }); }); diff --git a/test/cypress/integration/zone/zoneWarehouse.spec.js b/test/cypress/integration/zone/zoneWarehouse.spec.js index b2c1c1ed2..bca5ced22 100644 --- a/test/cypress/integration/zone/zoneWarehouse.spec.js +++ b/test/cypress/integration/zone/zoneWarehouse.spec.js @@ -1,4 +1,4 @@ -describe.skip('ZoneWarehouse', () => { +describe('ZoneWarehouse', () => { const data = { Warehouse: { val: 'Warehouse Two', type: 'select' }, };