Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 8626-addTestCasesInRouteListTest
gitea/salix-front/pipeline/pr-dev This commit is unstable Details

This commit is contained in:
Jose Antonio Tubau 2025-03-13 08:13:24 +01:00
commit 5ec4a9bc5b
21 changed files with 12607 additions and 9018 deletions

View File

@ -25,6 +25,8 @@ RUN apt-get update \
libnss3 \
libxss1 \
libxtst6 \
mesa-vulkan-drivers \
vulkan-tools \
xauth \
xvfb \
&& apt-get clean \

File diff suppressed because it is too large Load Diff

View File

@ -28,6 +28,17 @@ defineProps({ row: { type: Object, required: true } });
{{ t('ticketSale.reserved') }}
</QTooltip>
</QIcon>
<QIcon
v-if="row?.isDeleted"
color="primary"
name="vn:deletedTicket"
size="xs"
data-cy="ticketDeletedIcon"
>
<QTooltip>
{{ t('Ticket deleted') }}
</QTooltip>
</QIcon>
<QIcon
v-if="row?.hasRisk"
name="vn:risk"

View File

@ -920,12 +920,24 @@ const rowCtrlClickFunction = computed(() => {
:row-index="index"
>
<VnColumn
:column="col"
:column="{
...col,
disable:
col?.component ===
'checkbox'
? true
: false,
}"
:row="row"
:is-editable="false"
v-model="row[col.name]"
component-prop="columnField"
:show-label="true"
:show-label="
col?.component ===
'checkbox'
? false
: true
"
/>
</slot>
</span>

View File

@ -7,6 +7,7 @@ import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnInputDate from 'components/common/VnInputDate.vue';
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
const { t } = useI18n();
const props = defineProps({
@ -30,7 +31,7 @@ const states = ref();
<QItem>
<QItemSection>
<VnInput
:label="t('Customer ID')"
:label="t('globals.params.clientFk')"
v-model="params.clientFk"
is-outlined
/>
@ -38,13 +39,17 @@ const states = ref();
</QItem>
<QItem>
<QItemSection>
<VnInput v-model="params.fi" :label="t('FI')" is-outlined />
<VnInput
v-model="params.fi"
:label="t('globals.params.fi')"
is-outlined
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInputNumber
:label="t('Amount')"
:label="t('globals.amount')"
v-model="params.amount"
is-outlined
data-cy="InvoiceOutFilterAmountBtn"
@ -54,7 +59,7 @@ const states = ref();
<QItem>
<QItemSection>
<QInput
:label="t('Min')"
:label="t('invoiceOut.params.min')"
dense
lazy-rules
outlined
@ -65,7 +70,7 @@ const states = ref();
</QItemSection>
<QItemSection>
<QInput
:label="t('Max')"
:label="t('invoiceOut.params.max')"
dense
lazy-rules
outlined
@ -78,7 +83,7 @@ const states = ref();
<QItem>
<QItemSection>
<QCheckbox
:label="t('Has PDF')"
:label="t('invoiceOut.params.hasPdf')"
toggle-indeterminate
v-model="params.hasPdf"
/>
@ -88,14 +93,31 @@ const states = ref();
<QItemSection>
<VnInputDate
v-model="params.created"
:label="t('Created')"
:label="t('invoiceOut.params.created')"
is-outlined
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInputDate v-model="params.dued" :label="t('Dued')" is-outlined />
<VnInputDate
v-model="params.dued"
:label="t('invoiceOut.params.dued')"
is-outlined
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
outlined
rounded
:label="t('globals.params.departmentFk')"
v-model="params.departmentFk"
option-value="id"
option-label="name"
url="Departments"
/>
</QItemSection>
</QItem>
</template>

View File

@ -16,6 +16,7 @@ import VnRow from 'src/components/ui/VnRow.vue';
import VnRadio from 'src/components/common/VnRadio.vue';
import VnInput from 'src/components/common/VnInput.vue';
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
import DepartmentDescriptorProxy from 'src/pages/Worker/Department/Card/DepartmentDescriptorProxy.vue';
import VnSection from 'src/components/common/VnSection.vue';
const { t } = useI18n();
@ -86,6 +87,20 @@ const columns = computed(() => [
component: null,
},
},
{
align: 'left',
name: 'departmentFk',
label: t('globals.params.departmentFk'),
component: 'select',
attrs: {
url: 'Departments',
},
create: true,
columnField: {
component: null,
},
format: (row, dashIfEmpty) => dashIfEmpty(row.departmentName),
},
{
align: 'left',
name: 'companyFk',
@ -229,6 +244,12 @@ watchEffect(selectedRows);
<CustomerDescriptorProxy :id="row.clientFk" />
</span>
</template>
<template #column-departmentFk="{ row }">
<span class="link" @click.stop>
{{ row.departmentName || '-' }}
<DepartmentDescriptorProxy :id="row?.departmentFk" />
</span>
</template>
<template #more-create-dialog="{ data }">
<div class="row q-col-gutter-xs col-span-2">
<div class="col-12">

View File

@ -221,7 +221,7 @@ en:
attenderFk: Atender
clientFk: Client id
warehouseFk: Warehouse
requesterFk: Salesperson
requesterFk: Requester
from: From
to: To
mine: For me
@ -239,7 +239,7 @@ es:
attenderFk: Comprador
clientFk: Id cliente
warehouseFk: Almacén
requesterFk: Comercial
requesterFk: Solicitante
from: Desde
to: Hasta
mine: Para mi

View File

@ -84,7 +84,7 @@ item:
attenderFk: Atender
clientFk: Client id
warehouseFk: Warehouse
requesterFk: Salesperson
requesterFk: Requester
from: From
to: To
mine: For me

View File

@ -93,7 +93,7 @@ item:
attenderFk: Comprador
clientFk: Id cliente
warehouseFk: Almacén
requesterFk: Comercial
requesterFk: Solicitante
from: Desde
to: Hasta
mine: Para mi

View File

@ -43,16 +43,22 @@ const columns = computed(() => [
},
{
align: 'left',
label: t('isOwn'),
label: t('agency.isOwn'),
name: 'isOwn',
component: 'checkbox',
columnFilter: {
inWhere: true,
},
cardVisible: true,
},
{
align: 'left',
label: t('isAnyVolumeAllowed'),
label: t('agency.isAnyVolumeAllowed'),
name: 'isAnyVolumeAllowed',
component: 'checkbox',
columnFilter: {
inWhere: true,
},
cardVisible: true,
},
{
@ -61,7 +67,7 @@ const columns = computed(() => [
name: 'tableActions',
actions: [
{
title: t('Client ticket list'),
title: t('globals.pageTitles.summary'),
icon: 'preview',
action: (row) => viewSummary(row?.id, AgencySummary),
isPrimary: true,
@ -107,11 +113,3 @@ const columns = computed(() => [
justify-content: center;
}
</style>
<i18n>
es:
isOwn: Tiene propietario
isAnyVolumeAllowed: Permite cualquier volumen
en:
isOwn: Has owner
isAnyVolumeAllowed: Allows any volume
</i18n>

View File

@ -6,6 +6,7 @@ import { useI18n } from 'vue-i18n';
import CardSummary from 'components/ui/CardSummary.vue';
import VnLv from 'components/ui/VnLv.vue';
import VnTitle from 'src/components/common/VnTitle.vue';
import VnCheckbox from 'components/common/VnCheckbox.vue';
const route = useRoute();
const $props = defineProps({ id: { type: Number, default: 0 } });
@ -24,12 +25,12 @@ const entityId = computed(() => $props.id || route.params.id);
:text="t('globals.pageTitles.basicData')"
/>
<VnLv :label="t('globals.name')" :value="agency.name" />
<QCheckbox
<VnCheckbox
:label="t('agency.isOwn')"
v-model="agency.isOwn"
:disable="true"
/>
<QCheckbox
<VnCheckbox
:label="t('agency.isAnyVolumeAllowed')"
v-model="agency.isAnyVolumeAllowed"
:disable="true"

View File

@ -1,11 +1,12 @@
agency:
search: Search agency
searchInfo: You can search by name
searchInfo: You can search by name and by id
isOwn: Own
isAnyVolumeAllowed: Any volume allowed
removeItem: Agency removed successfully
notification:
removeItemError: Error removing agency
removeItem: WorkCenter removed successfully
removeItemError: Error removing work center
removeItem: Work center removed successfully
pageTitles:
agency: Agency
searchBar:

View File

@ -1,15 +1,14 @@
agency:
search: Buscar agencia
searchInfo: Puedes buscar por nombre
searchInfo: Puedes buscar por nombre y por id
isOwn: Propio
isAnyVolumeAllowed: Cualquier volumen
removeItem: Agencia eliminada correctamente
notification:
removeItemError: Error al eliminar la agencia
removeItemError: Error al eliminar la el centro de trabajo
removeItem: Centro de trabajo eliminado correctamente
pageTitles:
agency: Agencia
searchBar:
info: Puedes buscar por nombre o id
label: Buscar agencia...

View File

@ -49,6 +49,12 @@ route:
shipped: Shipped
agencyAgreement: Agency agreement
agencyModeName: Agency route
isOwn: Own
isAnyVolumeallowed: Any volume allowed
Worker: Worker
Agency: Agency
Vehicle: Vehicle
Description: Description
hourStarted: H.Start
hourFinished: H.End
createRoute: Create route

View File

@ -50,6 +50,8 @@ route:
shipped: Fecha preparación
agencyModeName: Agencia Ruta
agencyAgreement: Agencia Acuerdo
isOwn: Propio
isAnyVolumeAllowed: Cualquier volumen
Worker: Trabajador
Agency: Agencia
Vehicle: Vehículo

View File

@ -110,7 +110,7 @@ function getInfo() {
</template>
<template #icons="{ entity }">
<QCardActions class="q-gutter-x-xs">
<TicketProblems :row="{ ...entity?.client, ...problems }" />
<TicketProblems :row="{ ...entity?.client, ...problems, ...entity }" />
</QCardActions>
</template>
<template #actions="{ entity }">

View File

@ -174,22 +174,28 @@ const getSaleTotal = (sale) => {
return price - discount;
};
const getRowUpdateInputEvents = (sale) => ({
'keyup.enter': () => {
changeQuantity(sale);
},
blur: () => {
changeQuantity(sale);
},
});
const getRowUpdateInputEvents = (sale) => {
return {
'keyup.enter': (evt) => {
console.error(evt);
changeQuantity(sale);
},
blur: (evt) => {
console.error(evt);
changeQuantity(sale);
},
};
};
const resetChanges = async () => {
arrayData.fetch({ append: false });
tableRef.value.reload();
selectedRows.value = [];
};
const changeQuantity = async (sale) => {
if (!sale.itemFk || sale.quantity == null || sale?.originalQuantity === sale.quantity)
return;
else sale.originalQuantity = sale.quantity;
if (!sale.id) return addSale(sale);
if (await isSalePrepared(sale)) {
@ -235,7 +241,7 @@ const addSale = async (sale) => {
notify('globals.dataSaved', 'positive');
sale.isNew = false;
arrayData.fetch({});
resetChanges();
};
const changeConcept = async (sale) => {
if (await isSalePrepared(sale)) {
@ -310,7 +316,7 @@ const changeDiscount = async (sale) => {
}
};
const updateDiscounts = async (sales, newDiscount = null) => {
const updateDiscounts = async (sales, newDiscount) => {
const salesTracking = await fetchSalesTracking();
const someSaleIsPrepared = salesTracking.some((sale) =>
@ -320,12 +326,11 @@ const updateDiscounts = async (sales, newDiscount = null) => {
else updateDiscount(sales, newDiscount);
};
const updateDiscount = async (sales, newDiscount = null) => {
const saleIds = sales.map((sale) => sale.id);
const _newDiscount = newDiscount || edit.value.discount;
const updateDiscount = async (sales, newDiscount = 0) => {
const salesIds = sales.map(({ id }) => id);
const params = {
salesIds: saleIds,
newDiscount: _newDiscount,
salesIds,
newDiscount,
manaCode: manaCode.value,
};
await axios.post(`Tickets/${route.params.id}/updateDiscount`, params);
@ -474,7 +479,7 @@ const endNewRow = (row) => {
};
async function confirmUpdate(cb) {
await quasar
quasar
.dialog({
component: VnConfirm,
componentProps: {
@ -664,6 +669,7 @@ watch(
selection: 'multiple',
}"
:right-search="false"
:search-url="false"
:column-search="false"
:disable-option="{ card: true }"
auto-load
@ -703,7 +709,7 @@ watch(
</template>
<template #column-image="{ row }">
<div class="image-wrapper">
<VnImg :id="parseInt(row?.item?.id)" class="rounded" />
<VnImg v-if="row.item" :id="parseInt(row?.item?.id)" class="rounded" />
</div>
</template>
<template #column-visible="{ row }">
@ -751,7 +757,7 @@ watch(
{{ row?.item?.subName.toUpperCase() }}
</div>
</div>
<FetchedTags :item="row.item" :max-length="6" />
<FetchedTags v-if="row.item" :item="row.item" :max-length="6" />
<QPopupProxy v-if="row.id && isTicketEditable">
<VnInput
v-model="row.concept"

View File

@ -73,6 +73,7 @@ const onNodeExpanded = async (nodeKeysArray) => {
const response = await axios.get(`Zones/${route.params.id}/getLeaves`, {
params,
});
response.data = JSON.parse(response.data);
if (response.data) {
node.childs = response.data.map((n) => {
if (n.sons > 0) n.childs = [{}];
@ -126,14 +127,17 @@ watch(
async (val) => {
if (!val) return;
// // Se triggerea cuando se actualiza el store.data, el cual es el resultado del fetch de la searchbar
val = JSON.parse(val);
if (!nodes.value[0]) nodes.value = [defaultNode];
nodes.value[0].childs = [...val];
const fetchedNodeKeys = val.flatMap(getNodeIds);
state.set('Tree', [...fetchedNodeKeys]);
expanded.value = [null, ...fetchedNodeKeys];
const fetchs = [];
for (let n of state.get('Tree')) {
await fetchNodeLeaves(n);
fetchs.push(fetchNodeLeaves(n));
}
await Promise.all(fetchs);
previousExpandedNodes.value = new Set(expanded.value);
},
{ immediate: true },

View File

@ -1,14 +1,13 @@
/// <reference types="cypress" />
describe('Client balance', () => {
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit('#/customer/1101/balance');
});
it('Should create a mandate', () => {
cy.get('.q-page-sticky > div > .q-btn').click();
cy.selectOption('[data-cy="paymentBank"]', 2);
cy.dataCy('paymentAmount_input').type('100');
cy.dataCy('paymentAmount_input').clear().type('100');
cy.saveCard();
});
});

View File

@ -1,139 +1,14 @@
/// <reference types="cypress" />
const firstRow = 'tbody > :nth-child(1)';
describe('TicketSale', () => {
describe.skip('Free ticket #31', () => {
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit('/#/ticket/31/sale');
});
const firstRow = 'tbody > :nth-child(1)';
const selectFirstRow = () => {
cy.waitForElement(firstRow);
cy.get(firstRow).find('.q-checkbox__inner').click();
};
it('it should add item to basket', () => {
cy.window().then((win) => {
cy.stub(win, 'open').as('windowOpen');
});
cy.dataCy('ticketSaleAddToBasketBtn').should('exist');
cy.dataCy('ticketSaleAddToBasketBtn').click();
cy.get('@windowOpen').should('be.calledWithMatch', /\/order\/\d+\/catalog/);
});
it('should send SMS', () => {
selectFirstRow();
cy.dataCy('ticketSaleMoreActionsDropdown').click();
cy.waitForElement('[data-cy="sendShortageSMSItem"]');
cy.dataCy('sendShortageSMSItem').should('exist');
cy.dataCy('sendShortageSMSItem').click();
cy.dataCy('vnSmsDialog').should('exist');
cy.dataCy('sendSmsBtn').click();
cy.checkNotification('SMS sent');
});
it('should recalculate price when "Recalculate price" is clicked', () => {
cy.intercept('POST', '**/recalculatePrice').as('recalculatePrice');
selectFirstRow();
cy.dataCy('ticketSaleMoreActionsDropdown').click();
cy.waitForElement('[data-cy="recalculatePriceItem"]');
cy.dataCy('recalculatePriceItem').should('exist');
cy.dataCy('recalculatePriceItem').click();
cy.wait('@recalculatePrice').its('response.statusCode').should('eq', 200);
cy.checkNotification('Data saved');
});
it('should update discount when "Update discount" is clicked', () => {
selectFirstRow();
cy.dataCy('ticketSaleMoreActionsDropdown').click();
cy.waitForElement('[data-cy="updateDiscountItem"]');
cy.dataCy('updateDiscountItem').should('exist');
cy.dataCy('updateDiscountItem').click();
cy.waitForElement('[data-cy="ticketSaleDiscountInput"]');
cy.dataCy('ticketSaleDiscountInput').find('input').focus();
cy.dataCy('ticketSaleDiscountInput').find('input').type('10');
cy.dataCy('saveManaBtn').click();
cy.waitForElement('.q-notification__message');
cy.checkNotification('Data saved');
});
it('adds claim', () => {
selectFirstRow();
cy.dataCy('ticketSaleMoreActionsDropdown').click();
cy.dataCy('createClaimItem').click();
cy.dataCy('VnConfirm_confirm').click();
cy.url().should('contain', 'claim/');
// Delete created claim to avoid cluttering the database
cy.dataCy('descriptor-more-opts').click();
cy.dataCy('deleteClaim').click();
cy.dataCy('VnConfirm_confirm').click();
cy.checkNotification('Data deleted');
});
it('marks row as reserved', () => {
selectFirstRow();
cy.dataCy('ticketSaleMoreActionsDropdown').click();
cy.waitForElement('[data-cy="markAsReservedItem"]');
cy.dataCy('markAsReservedItem').click();
cy.dataCy('ticketSaleReservedIcon').should('exist');
});
it('unmarks row as reserved', () => {
selectFirstRow();
cy.dataCy('ticketSaleMoreActionsDropdown').click();
cy.waitForElement('[data-cy="unmarkAsReservedItem"]');
cy.dataCy('unmarkAsReservedItem').click();
cy.dataCy('ticketSaleReservedIcon').should('not.exist');
});
it('refunds row with warehouse', () => {
selectFirstRow();
cy.dataCy('ticketSaleMoreActionsDropdown').click();
cy.dataCy('ticketSaleRefundItem').click();
cy.dataCy('ticketSaleRefundWithWarehouse').click();
cy.checkNotification('The following refund ticket have been created');
});
it('refunds row without warehouse', () => {
selectFirstRow();
cy.dataCy('ticketSaleMoreActionsDropdown').click();
cy.dataCy('ticketSaleRefundItem').click();
cy.dataCy('ticketSaleRefundWithoutWarehouse').click();
cy.checkNotification('The following refund ticket have been created');
});
it('transfer sale to a new ticket', () => {
cy.visit('/#/ticket/32/sale');
cy.get('.q-item > .q-item__label').should('have.text', ' #32');
selectFirstRow();
cy.dataCy('ticketSaleTransferBtn').click();
cy.dataCy('ticketTransferPopup').should('exist');
cy.dataCy('ticketTransferNewTicketBtn').click();
cy.get('.q-item > .q-item__label').should('not.have.text', ' #32');
});
it('should redirect to ticket logs', () => {
cy.get(firstRow).find('.q-btn:last').click();
cy.url().should('match', /\/ticket\/31\/log/);
});
});
describe.skip('Ticket prepared #23', () => {
describe('Ticket #23', () => {
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit('/#/ticket/23/sale');
});
const firstRow = 'tbody > :nth-child(1)';
const selectFirstRow = () => {
cy.waitForElement(firstRow);
cy.get(firstRow).find('.q-checkbox__inner').click();
};
it('update price', () => {
const price = Number((Math.random() * 99 + 1).toFixed(2));
cy.waitForElement(firstRow);
@ -196,8 +71,144 @@ describe('TicketSale', () => {
.should('have.value', `${quantity}`);
});
});
});
describe('Ticket to add claim #24', () => {
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit('/#/ticket/24/sale');
});
it('adds claim', () => {
selectFirstRow();
cy.dataCy('ticketSaleMoreActionsDropdown').click();
cy.dataCy('createClaimItem').click();
cy.dataCy('VnConfirm_confirm').click();
cy.url().should('contain', 'claim/');
// Delete created claim to avoid cluttering the database
cy.dataCy('descriptor-more-opts').click();
cy.dataCy('deleteClaim').click();
cy.dataCy('VnConfirm_confirm').click();
});
});
describe('Free ticket #31', () => {
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit('/#/ticket/31/sale');
});
it('it should add item to basket', () => {
cy.window().then((win) => {
cy.stub(win, 'open').as('windowOpen');
});
cy.dataCy('ticketSaleAddToBasketBtn').should('exist');
cy.dataCy('ticketSaleAddToBasketBtn').click();
cy.get('@windowOpen').should('be.calledWithMatch', /\/order\/\d+\/catalog/);
});
it('should send SMS', () => {
selectFirstRow();
cy.dataCy('ticketSaleMoreActionsDropdown').click();
cy.waitForElement('[data-cy="sendShortageSMSItem"]');
cy.dataCy('sendShortageSMSItem').should('exist');
cy.dataCy('sendShortageSMSItem').click();
cy.dataCy('vnSmsDialog').should('exist');
cy.dataCy('sendSmsBtn').click();
cy.checkNotification('SMS sent');
});
it('should recalculate price when "Recalculate price" is clicked', () => {
cy.intercept('POST', '**/recalculatePrice').as('recalculatePrice');
selectFirstRow();
cy.dataCy('ticketSaleMoreActionsDropdown').click();
cy.waitForElement('[data-cy="recalculatePriceItem"]');
cy.dataCy('recalculatePriceItem').should('exist');
cy.dataCy('recalculatePriceItem').click();
cy.wait('@recalculatePrice').its('response.statusCode').should('eq', 200);
cy.checkNotification('Data saved');
cy.dataCy('ticketSaleMoreActionsDropdown').should('be.disabled');
});
it('should update discount when "Update discount" is clicked', () => {
selectFirstRow();
cy.dataCy('ticketSaleMoreActionsDropdown').click();
cy.waitForElement('[data-cy="updateDiscountItem"]');
cy.dataCy('updateDiscountItem').should('exist');
cy.dataCy('updateDiscountItem').click();
cy.waitForElement('[data-cy="ticketSaleDiscountInput"]');
cy.dataCy('ticketSaleDiscountInput').find('input').focus();
cy.dataCy('ticketSaleDiscountInput').find('input').type('10');
cy.dataCy('saveManaBtn').click();
cy.waitForElement('.q-notification__message');
cy.checkNotification('Data saved');
cy.dataCy('ticketSaleMoreActionsDropdown').should('be.disabled');
});
it('adds claim', () => {
selectFirstRow();
cy.dataCy('ticketSaleMoreActionsDropdown').click();
cy.dataCy('createClaimItem').click();
cy.dataCy('VnConfirm_confirm').click();
cy.checkNotification('Future ticket date not allowed');
});
it('marks row as reserved', () => {
selectFirstRow();
cy.dataCy('ticketSaleMoreActionsDropdown').click();
cy.waitForElement('[data-cy="markAsReservedItem"]');
cy.dataCy('markAsReservedItem').click();
cy.dataCy('ticketSaleReservedIcon').should('exist');
});
it('unmarks row as reserved', () => {
selectFirstRow();
cy.dataCy('ticketSaleMoreActionsDropdown').click();
cy.waitForElement('[data-cy="unmarkAsReservedItem"]');
cy.dataCy('unmarkAsReservedItem').click();
cy.dataCy('ticketSaleReservedIcon').should('not.exist');
});
it('refunds row with warehouse', () => {
selectFirstRow();
cy.dataCy('ticketSaleMoreActionsDropdown').click();
cy.dataCy('ticketSaleRefundItem').click();
cy.dataCy('ticketSaleRefundWithWarehouse').click();
cy.checkNotification('The following refund ticket have been created');
});
it('refunds row without warehouse', () => {
selectFirstRow();
cy.dataCy('ticketSaleMoreActionsDropdown').click();
cy.dataCy('ticketSaleRefundItem').click();
cy.dataCy('ticketSaleRefundWithoutWarehouse').click();
cy.checkNotification('The following refund ticket have been created');
});
it('should redirect to ticket logs', () => {
cy.get(firstRow).find('.q-btn:last').click();
cy.url().should('match', /\/ticket\/31\/log/);
});
});
describe('Ticket to transfer #32', () => {
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit('/#/ticket/32/sale');
});
it('transfer sale to a new ticket', () => {
cy.get('.q-item > .q-item__label').should('have.text', ' #32');
selectFirstRow();
cy.dataCy('ticketSaleTransferBtn').click();
cy.dataCy('ticketTransferPopup').should('exist');
cy.dataCy('ticketTransferNewTicketBtn').click();
cy.get('.q-item > .q-item__label').should('not.have.text', ' #32');
});
});
});
function selectFirstRow() {
cy.waitForElement(firstRow);
cy.get(firstRow).find('.q-checkbox__inner').click();
}
function handleVnConfirm() {
cy.get('[data-cy="VnConfirm_confirm"]').click();
cy.waitForElement('.q-notification__message');

View File

@ -62,12 +62,7 @@ Cypress.Commands.overwrite('visit', (originalFn, url, options, waitRequest = tru
originalFn(url, options);
cy.waitUntil(() => cy.document().then((doc) => doc.readyState === 'complete'));
cy.waitUntil(() => cy.get('main').should('exist'));
if (waitRequest)
cy.get('body').then(($body) => {
if ($body.find('[data-cy="loading-spinner"]').length) {
cy.get('[data-cy="loading-spinner"]').should('not.be.visible');
}
});
if (waitRequest) cy.waitSpinner();
});
Cypress.Commands.add('waitForElement', (element) => {
@ -99,6 +94,14 @@ Cypress.Commands.add('getValue', (selector) => {
});
});
Cypress.Commands.add('waitSpinner', () => {
cy.get('body').then(($body) => {
if ($body.find('[data-cy="loading-spinner"]').length) {
cy.get('[data-cy="loading-spinner"]').should('not.be.visible');
}
});
});
// Fill Inputs
Cypress.Commands.add('selectOption', (selector, option, timeout = 2500) => {
cy.waitForElement(selector, timeout);
@ -116,6 +119,7 @@ Cypress.Commands.add('selectOption', (selector, option, timeout = 2500) => {
function selectItem(selector, option, ariaControl, hasWrite = true) {
if (!hasWrite) cy.wait(100);
cy.waitSpinner();
getItems(ariaControl).then((items) => {
const matchingItem = items
@ -135,6 +139,7 @@ function getItems(ariaControl, startTime = Cypress._.now(), timeout = 2500) {
.should('exist')
.find('.q-item')
.should('exist')
.should('be.visible')
.then(($items) => {
if (!$items?.length || $items.first().text().trim() === '') {
if (Cypress._.now() - startTime > timeout) {