forked from verdnatura/salix-front
feat: refs #4988 agency e2e
This commit is contained in:
parent
43aadd4fc6
commit
663c093a00
|
@ -89,9 +89,14 @@ globals:
|
||||||
basicData: Basic data
|
basicData: Basic data
|
||||||
log: Logs
|
log: Logs
|
||||||
parkingList: Parkings list
|
parkingList: Parkings list
|
||||||
|
agencyList: Agencies list
|
||||||
|
agency: Agency
|
||||||
|
workCenters: Work centers
|
||||||
|
modes: Modes
|
||||||
created: Created
|
created: Created
|
||||||
worker: Worker
|
worker: Worker
|
||||||
now: Now
|
now: Now
|
||||||
|
name: Name
|
||||||
errors:
|
errors:
|
||||||
statusUnauthorized: Access denied
|
statusUnauthorized: Access denied
|
||||||
statusInternalServerError: An internal server error has ocurred
|
statusInternalServerError: An internal server error has ocurred
|
||||||
|
@ -1146,13 +1151,17 @@ item:
|
||||||
stemMultiplier: Multiplier
|
stemMultiplier: Multiplier
|
||||||
producer: Producer
|
producer: Producer
|
||||||
landed: Landed
|
landed: Landed
|
||||||
create:
|
agency:
|
||||||
name: Name
|
isOwn: Own
|
||||||
tag: Tag
|
isAnyVolumeAllowed: Any volume allowed
|
||||||
priority: Priority
|
notification:
|
||||||
type: Type
|
removeItem: Agency removed successfully
|
||||||
intrastat: Intrastat
|
removeItemError: Error removing agency
|
||||||
origin: Origin
|
pageTitles:
|
||||||
|
agency: Agency
|
||||||
|
searchBar:
|
||||||
|
info: You can search by agency code
|
||||||
|
label: Search agency...
|
||||||
components:
|
components:
|
||||||
topbar: {}
|
topbar: {}
|
||||||
userPanel:
|
userPanel:
|
||||||
|
|
|
@ -89,9 +89,14 @@ globals:
|
||||||
basicData: Datos básicos
|
basicData: Datos básicos
|
||||||
log: Historial
|
log: Historial
|
||||||
parkingList: Listado de parkings
|
parkingList: Listado de parkings
|
||||||
|
agencyList: Listado de agencias
|
||||||
|
agency: Agencia
|
||||||
|
workCenters: Centros de trabajo
|
||||||
|
modes: Modos
|
||||||
created: Fecha creación
|
created: Fecha creación
|
||||||
worker: Trabajador
|
worker: Trabajador
|
||||||
now: Ahora
|
now: Ahora
|
||||||
|
name: Nombre
|
||||||
errors:
|
errors:
|
||||||
statusUnauthorized: Acceso denegado
|
statusUnauthorized: Acceso denegado
|
||||||
statusInternalServerError: Ha ocurrido un error interno del servidor
|
statusInternalServerError: Ha ocurrido un error interno del servidor
|
||||||
|
@ -1152,6 +1157,14 @@ item:
|
||||||
type: Tipo
|
type: Tipo
|
||||||
intrastat: Intrastat
|
intrastat: Intrastat
|
||||||
origin: Origen
|
origin: Origen
|
||||||
|
agency:
|
||||||
|
isOwn: Propio
|
||||||
|
isAnyVolumeAllowed: Cualquier volumen
|
||||||
|
removeItem: Agencia eliminada correctamente
|
||||||
|
notification:
|
||||||
|
removeItemError: Error al eliminar la agencia
|
||||||
|
pageTitles:
|
||||||
|
agency: Agencia
|
||||||
components:
|
components:
|
||||||
topbar: {}
|
topbar: {}
|
||||||
userPanel:
|
userPanel:
|
||||||
|
|
|
@ -30,7 +30,7 @@ const warehouses = ref([]);
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnSelectFilter
|
<VnSelectFilter
|
||||||
v-model="data.sectorFk"
|
v-model="data.warehouseFk"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
:label="t('globals.warehouse')"
|
:label="t('globals.warehouse')"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import CardList from 'src/components/ui/CardList.vue';
|
import CardList from 'src/components/ui/CardList.vue';
|
||||||
|
@ -7,19 +7,9 @@ import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const router = useRouter();
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
console.log('route: ', route.path);
|
console.log('route: ', route.path);
|
||||||
const routeId = route.params.id;
|
const routeId = route.params.id;
|
||||||
const toAgencyModeCreate = (consigneeId) => {
|
|
||||||
router.push({
|
|
||||||
name: 'AgencyMode',
|
|
||||||
params: {
|
|
||||||
id: route.params.id,
|
|
||||||
consigneeId,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center q-pa-md">
|
||||||
|
@ -51,25 +41,10 @@ const toAgencyModeCreate = (consigneeId) => {
|
||||||
<VnLv :label="t('inflation')" :value="row?.inflation" />
|
<VnLv :label="t('inflation')" :value="row?.inflation" />
|
||||||
<VnLv :label="t('globals.code')" :value="row?.code" />
|
<VnLv :label="t('globals.code')" :value="row?.code" />
|
||||||
</template>
|
</template>
|
||||||
<template #actions>
|
|
||||||
<QBtn
|
|
||||||
:label="t('globals.edit')"
|
|
||||||
@click.stop="toAgencyModeCreate(row.id)"
|
|
||||||
color="primary"
|
|
||||||
icon="edit"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</CardList>
|
</CardList>
|
||||||
</template>
|
</template>
|
||||||
</VnPaginate>
|
</VnPaginate>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<QPageSticky :offset="[18, 18]">
|
|
||||||
<QBtn @click.stop="toAgencyModeCreate()" color="primary" fab icon="add" />
|
|
||||||
<QTooltip>
|
|
||||||
{{ t('New mode') }}
|
|
||||||
</QTooltip>
|
|
||||||
</QPageSticky>
|
|
||||||
</QPage>
|
</QPage>
|
||||||
</template>
|
</template>
|
||||||
<i18n>
|
<i18n>
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import axios from 'axios';
|
||||||
|
import { useQuasar } from 'quasar';
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
@ -17,6 +19,7 @@ const route = useRoute();
|
||||||
const paginate = ref();
|
const paginate = ref();
|
||||||
const dialog = ref();
|
const dialog = ref();
|
||||||
const routeId = computed(() => route.params.id);
|
const routeId = computed(() => route.params.id);
|
||||||
|
const quasar = useQuasar();
|
||||||
|
|
||||||
const initialData = computed(() => {
|
const initialData = computed(() => {
|
||||||
return {
|
return {
|
||||||
|
@ -24,6 +27,23 @@ const initialData = computed(() => {
|
||||||
workCenterFk: null,
|
workCenterFk: null,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function deleteWorCenter(id) {
|
||||||
|
try {
|
||||||
|
await axios.delete(`AgencyWorkCenters/${id}`).then(async () => {
|
||||||
|
quasar.notify({
|
||||||
|
message: t('agency.notification.removeItem'),
|
||||||
|
type: 'positive',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
quasar.notify({
|
||||||
|
message: t('agency.notification.removeItemError'),
|
||||||
|
type: 'error',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
paginate.value.fetch();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="centerCard">
|
<div class="centerCard">
|
||||||
|
@ -54,7 +74,13 @@ const initialData = computed(() => {
|
||||||
<VnLv :value="row?.workCenter?.name" icon="delete" />
|
<VnLv :value="row?.workCenter?.name" icon="delete" />
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
<QItemSection side>
|
<QItemSection side>
|
||||||
<QBtn icon="delete" color="primary" round flat />
|
<QBtn
|
||||||
|
@click.stop="deleteWorCenter(row.id)"
|
||||||
|
icon="delete"
|
||||||
|
color="primary"
|
||||||
|
round
|
||||||
|
flat
|
||||||
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
</QCard>
|
</QCard>
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
describe('template spec', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit(`/#/agency`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('passes', () => {
|
||||||
|
cy.visit(`/#/agency`);
|
||||||
|
/* ==== Generated with Cypress Studio ==== */
|
||||||
|
cy.get(':nth-child(1) > :nth-child(1) > .card-list-body > .list-items').click();
|
||||||
|
cy.get('[href="#/agency/1/workCenter"] > .q-item__section--main').click();
|
||||||
|
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
|
||||||
|
cy.get('#f_fa5833a2-f919-4542-b663-e72b3ba4ffe5').click();
|
||||||
|
cy.get('#f_fa5833a2-f919-4542-b663-e72b3ba4ffe5_0').click();
|
||||||
|
cy.get('#formModel > .q-card').click();
|
||||||
|
cy.get('.q-btn--standard > .q-btn__content > .block').click();
|
||||||
|
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
|
||||||
|
cy.get('#f_94743509-f7a7-4e5c-83f4-61ab52c7cd72').click();
|
||||||
|
cy.get('#f_94743509-f7a7-4e5c-83f4-61ab52c7cd72_1 > .q-item__section').click();
|
||||||
|
cy.get('.q-btn--standard > .q-btn__content > .block').click();
|
||||||
|
cy.get('.q-btn--flat > .q-btn__content > .block').;
|
||||||
|
/* ==== End Cypress Studio ==== */
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,33 @@
|
||||||
|
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
|
||||||
|
import { createWrapper, axios } from 'app/test/vitest/helper';
|
||||||
|
import AgencyWorkCenter from 'pages/Agency/Card/AgencyWorkcenter.vue';
|
||||||
|
|
||||||
|
describe('AgencyWorkCenter', () => {
|
||||||
|
let vm;
|
||||||
|
beforeAll(() => {
|
||||||
|
vm = createWrapper(AgencyWorkCenter, {
|
||||||
|
global: {
|
||||||
|
claim: {
|
||||||
|
id: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}).vm;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
vi.clearAllMocks();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('remove()', () => {
|
||||||
|
it('should delete the AgencyMode', async () => {
|
||||||
|
vi.spyOn(axios, 'delete').mockResolvedValue({ data: true });
|
||||||
|
vi.spyOn(vm.quasar, 'notify');
|
||||||
|
|
||||||
|
await vm.deleteWorCenter(1);
|
||||||
|
|
||||||
|
expect(vm.quasar.notify).toHaveBeenCalledWith(
|
||||||
|
expect.objectContaining({ type: 'positive' })
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -1 +0,0 @@
|
||||||
// This file will be run before each test file
|
|
Loading…
Reference in New Issue