feat: refs #4988 agency e2e
This commit is contained in:
parent
43aadd4fc6
commit
663c093a00
|
@ -89,9 +89,14 @@ globals:
|
|||
basicData: Basic data
|
||||
log: Logs
|
||||
parkingList: Parkings list
|
||||
agencyList: Agencies list
|
||||
agency: Agency
|
||||
workCenters: Work centers
|
||||
modes: Modes
|
||||
created: Created
|
||||
worker: Worker
|
||||
now: Now
|
||||
name: Name
|
||||
errors:
|
||||
statusUnauthorized: Access denied
|
||||
statusInternalServerError: An internal server error has ocurred
|
||||
|
@ -1146,13 +1151,17 @@ item:
|
|||
stemMultiplier: Multiplier
|
||||
producer: Producer
|
||||
landed: Landed
|
||||
create:
|
||||
name: Name
|
||||
tag: Tag
|
||||
priority: Priority
|
||||
type: Type
|
||||
intrastat: Intrastat
|
||||
origin: Origin
|
||||
agency:
|
||||
isOwn: Own
|
||||
isAnyVolumeAllowed: Any volume allowed
|
||||
notification:
|
||||
removeItem: Agency removed successfully
|
||||
removeItemError: Error removing agency
|
||||
pageTitles:
|
||||
agency: Agency
|
||||
searchBar:
|
||||
info: You can search by agency code
|
||||
label: Search agency...
|
||||
components:
|
||||
topbar: {}
|
||||
userPanel:
|
||||
|
|
|
@ -89,9 +89,14 @@ globals:
|
|||
basicData: Datos básicos
|
||||
log: Historial
|
||||
parkingList: Listado de parkings
|
||||
agencyList: Listado de agencias
|
||||
agency: Agencia
|
||||
workCenters: Centros de trabajo
|
||||
modes: Modos
|
||||
created: Fecha creación
|
||||
worker: Trabajador
|
||||
now: Ahora
|
||||
name: Nombre
|
||||
errors:
|
||||
statusUnauthorized: Acceso denegado
|
||||
statusInternalServerError: Ha ocurrido un error interno del servidor
|
||||
|
@ -1152,6 +1157,14 @@ item:
|
|||
type: Tipo
|
||||
intrastat: Intrastat
|
||||
origin: Origen
|
||||
agency:
|
||||
isOwn: Propio
|
||||
isAnyVolumeAllowed: Cualquier volumen
|
||||
removeItem: Agencia eliminada correctamente
|
||||
notification:
|
||||
removeItemError: Error al eliminar la agencia
|
||||
pageTitles:
|
||||
agency: Agencia
|
||||
components:
|
||||
topbar: {}
|
||||
userPanel:
|
||||
|
|
|
@ -30,7 +30,7 @@ const warehouses = ref([]);
|
|||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelectFilter
|
||||
v-model="data.sectorFk"
|
||||
v-model="data.warehouseFk"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
:label="t('globals.warehouse')"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
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';
|
||||
|
||||
const { t } = useI18n();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
console.log('route: ', route.path);
|
||||
const routeId = route.params.id;
|
||||
const toAgencyModeCreate = (consigneeId) => {
|
||||
router.push({
|
||||
name: 'AgencyMode',
|
||||
params: {
|
||||
id: route.params.id,
|
||||
consigneeId,
|
||||
},
|
||||
});
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<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('globals.code')" :value="row?.code" />
|
||||
</template>
|
||||
<template #actions>
|
||||
<QBtn
|
||||
:label="t('globals.edit')"
|
||||
@click.stop="toAgencyModeCreate(row.id)"
|
||||
color="primary"
|
||||
icon="edit"
|
||||
/>
|
||||
</template>
|
||||
</CardList>
|
||||
</template>
|
||||
</VnPaginate>
|
||||
</div>
|
||||
|
||||
<QPageSticky :offset="[18, 18]">
|
||||
<QBtn @click.stop="toAgencyModeCreate()" color="primary" fab icon="add" />
|
||||
<QTooltip>
|
||||
{{ t('New mode') }}
|
||||
</QTooltip>
|
||||
</QPageSticky>
|
||||
</QPage>
|
||||
</template>
|
||||
<i18n>
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<script setup>
|
||||
import axios from 'axios';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { ref, computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
@ -17,6 +19,7 @@ const route = useRoute();
|
|||
const paginate = ref();
|
||||
const dialog = ref();
|
||||
const routeId = computed(() => route.params.id);
|
||||
const quasar = useQuasar();
|
||||
|
||||
const initialData = computed(() => {
|
||||
return {
|
||||
|
@ -24,6 +27,23 @@ const initialData = computed(() => {
|
|||
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>
|
||||
<template>
|
||||
<div class="centerCard">
|
||||
|
@ -54,7 +74,13 @@ const initialData = computed(() => {
|
|||
<VnLv :value="row?.workCenter?.name" icon="delete" />
|
||||
</QItemSection>
|
||||
<QItemSection side>
|
||||
<QBtn icon="delete" color="primary" round flat />
|
||||
<QBtn
|
||||
@click.stop="deleteWorCenter(row.id)"
|
||||
icon="delete"
|
||||
color="primary"
|
||||
round
|
||||
flat
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</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