diff --git a/cypress.config.js b/cypress.config.js
index 5cf075e2a..033aa35c7 100644
--- a/cypress.config.js
+++ b/cypress.config.js
@@ -30,7 +30,7 @@ export default defineConfig({
trashAssetsBeforeRuns: false,
requestTimeout: 10000,
responseTimeout: 30000,
- pageLoadTimeout: 60000,
+ pageLoadTimeout: 120000,
defaultBrowser: 'chromium',
fixturesFolder: 'test/cypress/fixtures',
screenshotsFolder: 'test/cypress/screenshots',
diff --git a/docs/Dockerfile.dev b/docs/Dockerfile.dev
index 29b194ffa..3117e2c20 100644
--- a/docs/Dockerfile.dev
+++ b/docs/Dockerfile.dev
@@ -25,6 +25,8 @@ RUN apt-get update \
libnss3 \
libxss1 \
libxtst6 \
+ mesa-vulkan-drivers \
+ vulkan-tools \
xauth \
xvfb \
&& apt-get clean \
@@ -39,7 +41,7 @@ ENV PNPM_HOME="/home/app/.local/share/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN pnpm setup \
- && pnpm install --global cypress@13.6.6 \
+ && pnpm install --global cypress@14.1.0 \
&& cypress install
WORKDIR /app
diff --git a/package.json b/package.json
index 1361d1fd8..63cdfab90 100644
--- a/package.json
+++ b/package.json
@@ -47,7 +47,7 @@
"@quasar/quasar-app-extension-testing-unit-vitest": "^0.4.0",
"@vue/test-utils": "^2.4.4",
"autoprefixer": "^10.4.14",
- "cypress": "^13.6.6",
+ "cypress": "^14.1.0",
"cypress-mochawesome-reporter": "^3.8.2",
"eslint": "^9.18.0",
"eslint-config-prettier": "^10.0.1",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 31a01e69c..36d9c0644 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -71,11 +71,11 @@ devDependencies:
specifier: ^10.4.14
version: 10.4.20(postcss@8.5.1)
cypress:
- specifier: ^13.6.6
- version: 13.17.0
+ specifier: ^14.1.0
+ version: 14.1.0
cypress-mochawesome-reporter:
specifier: ^3.8.2
- version: 3.8.2(cypress@13.17.0)(mocha@11.0.1)
+ version: 3.8.2(cypress@14.1.0)(mocha@11.0.1)
eslint:
specifier: ^9.18.0
version: 9.18.0
@@ -3321,7 +3321,7 @@ packages:
/csstype@3.1.3:
resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==}
- /cypress-mochawesome-reporter@3.8.2(cypress@13.17.0)(mocha@11.0.1):
+ /cypress-mochawesome-reporter@3.8.2(cypress@14.1.0)(mocha@11.0.1):
resolution: {integrity: sha512-oJZkNzhNmN9ZD+LmZyFuPb8aWaIijyHyqYh52YOBvR6B6ckfJNCHP3A98a+/nG0H4t46CKTNwo+wNpMa4d2kjA==}
engines: {node: '>=14'}
hasBin: true
@@ -3329,7 +3329,7 @@ packages:
cypress: '>=6.2.0'
dependencies:
commander: 10.0.1
- cypress: 13.17.0
+ cypress: 14.1.0
fs-extra: 10.1.0
mochawesome: 7.1.3(mocha@11.0.1)
mochawesome-merge: 4.3.0
@@ -3338,9 +3338,9 @@ packages:
- mocha
dev: true
- /cypress@13.17.0:
- resolution: {integrity: sha512-5xWkaPurwkIljojFidhw8lFScyxhtiFHl/i/3zov+1Z5CmY4t9tjIdvSXfu82Y3w7wt0uR9KkucbhkVvJZLQSA==}
- engines: {node: ^16.0.0 || ^18.0.0 || >=20.0.0}
+ /cypress@14.1.0:
+ resolution: {integrity: sha512-pPPj8Uu9NwjaaiXAEcjYZZmgsq6v9Zs1Nw6a+zRF+ANgYSNhH4S32SjFRsvMcuOHR/8dp4GBJhBPqIPSs+TxaA==}
+ engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0}
hasBin: true
requiresBuild: true
dependencies:
diff --git a/src/components/TicketProblems.vue b/src/components/TicketProblems.vue
index 5978f4e21..c11cc2e7b 100644
--- a/src/components/TicketProblems.vue
+++ b/src/components/TicketProblems.vue
@@ -28,6 +28,17 @@ defineProps({ row: { type: Object, required: true } });
{{ t('ticketSale.reserved') }}
+
+
+ {{ t('Ticket deleted') }}
+
+
-import { ref, toRefs, computed, watch, onMounted, useAttrs } from 'vue';
+import { ref, toRefs, computed, watch, onMounted, useAttrs, nextTick } from 'vue';
import { useI18n } from 'vue-i18n';
import { useArrayData } from 'src/composables/useArrayData';
import { useRequired } from 'src/composables/useRequired';
@@ -247,6 +247,7 @@ async function fetchFilter(val) {
}
async function filterHandler(val, update) {
+ if (isLoading.value) return update();
if (!val && lastVal.value === val) {
lastVal.value = val;
return update();
@@ -294,6 +295,7 @@ async function onScroll({ to, direction, from, index }) {
await arrayData.loadMore();
setOptions(arrayData.store.data);
vnSelectRef.value.scrollTo(lastIndex);
+ await nextTick();
isLoading.value = false;
}
}
diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml
index d7187371e..7ce4e49a1 100644
--- a/src/i18n/locale/en.yml
+++ b/src/i18n/locale/en.yml
@@ -893,6 +893,8 @@ components:
VnLv:
copyText: '{copyValue} has been copied to the clipboard'
iban_tooltip: 'IBAN: ES21 1234 5678 90 0123456789'
+ VnNotes:
+ clientWithoutPhone: 'The following clients do not have a phone number and the message will not be sent to them: {clientWithoutPhone}'
weekdays:
sun: Sunday
mon: Monday
diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml
index fc3018f39..7ce2a446b 100644
--- a/src/i18n/locale/es.yml
+++ b/src/i18n/locale/es.yml
@@ -980,6 +980,8 @@ components:
VnLv:
copyText: '{copyValue} se ha copiado al portapepeles'
iban_tooltip: 'IBAN: ES21 1234 5678 90 0123456789'
+ VnNotes:
+ clientWithoutPhone: 'Estos clientes no tienen asociado número de télefono y el sms no les será enviado: {clientWithoutPhone}'
weekdays:
sun: Domingo
mon: Lunes
diff --git a/src/pages/InvoiceOut/Card/InvoiceOutDescriptor.vue b/src/pages/InvoiceOut/Card/InvoiceOutDescriptor.vue
index dfaf6c109..93508ac8b 100644
--- a/src/pages/InvoiceOut/Card/InvoiceOutDescriptor.vue
+++ b/src/pages/InvoiceOut/Card/InvoiceOutDescriptor.vue
@@ -46,6 +46,11 @@ function ticketFilter(invoice) {
+
diff --git a/src/pages/InvoiceOut/InvoiceOutList.vue b/src/pages/InvoiceOut/InvoiceOutList.vue
index a6ec9923e..7316e772d 100644
--- a/src/pages/InvoiceOut/InvoiceOutList.vue
+++ b/src/pages/InvoiceOut/InvoiceOutList.vue
@@ -54,6 +54,14 @@ const columns = computed(() => [
name: 'id',
},
},
+ {
+ align: 'left',
+ name: 'issued',
+ label: t('invoiceOut.summary.issued'),
+ component: 'date',
+ format: (row) => toDate(row.issued),
+ columnField: { component: null },
+ },
{
align: 'left',
name: 'ref',
diff --git a/src/pages/InvoiceOut/locale/en.yml b/src/pages/InvoiceOut/locale/en.yml
index 17d198351..bc73bb0ff 100644
--- a/src/pages/InvoiceOut/locale/en.yml
+++ b/src/pages/InvoiceOut/locale/en.yml
@@ -1,6 +1,7 @@
invoiceOut:
search: Search invoice
searchInfo: You can search by invoice reference
+ externalRef: External Ref.
params:
id: ID
company: Company
diff --git a/src/pages/InvoiceOut/locale/es.yml b/src/pages/InvoiceOut/locale/es.yml
index 3df95d6b2..45b948f28 100644
--- a/src/pages/InvoiceOut/locale/es.yml
+++ b/src/pages/InvoiceOut/locale/es.yml
@@ -1,6 +1,7 @@
invoiceOut:
search: Buscar factura emitida
searchInfo: Puedes buscar por referencia de la factura
+ externalRef: Ref. externa
params:
id: ID
company: Empresa
diff --git a/src/pages/Route/RouteTickets.vue b/src/pages/Route/RouteTickets.vue
index adc7dfdaa..c056a0b3d 100644
--- a/src/pages/Route/RouteTickets.vue
+++ b/src/pages/Route/RouteTickets.vue
@@ -199,12 +199,22 @@ const confirmRemove = (ticket) => {
const openSmsDialog = async () => {
const clientsId = [];
const clientsPhone = [];
-
+ const clientWithoutPhone = [];
for (let ticket of selectedRows.value) {
clientsId.push(ticket?.clientFk);
const { data: client } = await axios.get(`Clients/${ticket?.clientFk}`);
+ if (!client.phone) {
+ clientWithoutPhone.push(ticket?.clientFk);
+ continue;
+ }
clientsPhone.push(client.phone);
}
+ if (clientWithoutPhone.length) {
+ quasar.notify({
+ type: 'warning',
+ message: t('components.VnNotes.clientWithoutPhone', { clientWithoutPhone }),
+ });
+ }
quasar.dialog({
component: SendSmsDialog,
diff --git a/src/pages/Ticket/Card/TicketDescriptor.vue b/src/pages/Ticket/Card/TicketDescriptor.vue
index 1e585592f..128544343 100644
--- a/src/pages/Ticket/Card/TicketDescriptor.vue
+++ b/src/pages/Ticket/Card/TicketDescriptor.vue
@@ -95,7 +95,7 @@ function ticketFilter(ticket) {
-
+
diff --git a/src/pages/Ticket/Card/TicketSale.vue b/src/pages/Ticket/Card/TicketSale.vue
index 61b50230a..ece871918 100644
--- a/src/pages/Ticket/Card/TicketSale.vue
+++ b/src/pages/Ticket/Card/TicketSale.vue
@@ -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
@@ -692,7 +698,7 @@ watch(
-
+
@@ -740,7 +746,7 @@ watch(
{{ row?.item?.subName.toUpperCase() }}
-
+
-import { ref, nextTick } from 'vue';
+import { ref, nextTick, onMounted } from 'vue';
+import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import FetchData from 'components/FetchData.vue';
@@ -17,12 +18,12 @@ const maritalStatus = [
{ code: 'M', name: t('Married') },
{ code: 'S', name: t('Single') },
];
-async function setAdvancedSummary(data) {
- const advanced = (await useAdvancedSummary('Workers', data.id)) ?? {};
+
+onMounted(async () => {
+ const advanced = await useAdvancedSummary('Workers', useRoute().params.id);
Object.assign(form.value.formData, advanced);
- await nextTick();
- if (form.value) form.value.hasChanges = false;
-}
+ nextTick(() => (form.value.hasChanges = false));
+});
diff --git a/src/pages/Worker/Department/Card/DepartmentDescriptorProxy.vue b/src/pages/Worker/Department/Card/DepartmentDescriptorProxy.vue
index 5b556f655..c793e9319 100644
--- a/src/pages/Worker/Department/Card/DepartmentDescriptorProxy.vue
+++ b/src/pages/Worker/Department/Card/DepartmentDescriptorProxy.vue
@@ -16,6 +16,7 @@ const $props = defineProps({
v-if="$props.id"
:id="$props.id"
:summary="DepartmentSummary"
+ data-key="DepartmentDescriptorProxy"
/>
diff --git a/src/pages/Zone/Card/ZoneCard.vue b/src/pages/Zone/Card/ZoneCard.vue
index 41daff5c0..f40294e54 100644
--- a/src/pages/Zone/Card/ZoneCard.vue
+++ b/src/pages/Zone/Card/ZoneCard.vue
@@ -19,7 +19,7 @@ function notIsLocations(ifIsFalse, ifIsTrue) {
{
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 = [{}];
@@ -125,14 +126,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 }
diff --git a/src/router/modules/worker.js b/src/router/modules/worker.js
index 3eb95a96e..ff3d483cf 100644
--- a/src/router/modules/worker.js
+++ b/src/router/modules/worker.js
@@ -271,12 +271,14 @@ export default {
path: 'department',
name: 'Department',
redirect: { name: 'WorkerDepartment' },
- component: () => import('src/pages/Worker/WorkerDepartment.vue'),
+ meta: { title: 'department', icon: 'vn:greuge' },
children: [
{
+ component: () =>
+ import('src/pages/Worker/WorkerDepartment.vue'),
+ meta: { title: 'department', icon: 'vn:greuge' },
name: 'WorkerDepartment',
path: 'list',
- meta: { title: 'department', icon: 'vn:greuge' },
},
departmentCard,
],
diff --git a/test/cypress/integration/claim/claimAction.spec.js b/test/cypress/integration/claim/claimAction.spec.js
index b0a16a2ad..57b501114 100644
--- a/test/cypress/integration/claim/claimAction.spec.js
+++ b/test/cypress/integration/claim/claimAction.spec.js
@@ -1,5 +1,5 @@
///
-describe('ClaimAction', () => {
+describe.skip('ClaimAction', () => {
const claimId = 1;
const firstRow = 'tbody > :nth-child(1)';
diff --git a/test/cypress/integration/client/clientBalance.spec.js b/test/cypress/integration/client/clientBalance.spec.js
index 56ce01692..0d88a9e28 100644
--- a/test/cypress/integration/client/clientBalance.spec.js
+++ b/test/cypress/integration/client/clientBalance.spec.js
@@ -1,14 +1,14 @@
///
describe('Client balance', () => {
beforeEach(() => {
- cy.viewport(1280, 720);
cy.login('developer');
cy.visit('#/customer/1101/balance');
});
it('Should create a mandate', () => {
+ cy.waitSpinner();
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();
});
});
diff --git a/test/cypress/integration/ticket/ticketSale.spec.js b/test/cypress/integration/ticket/ticketSale.spec.js
index 81ea761c4..61ba9fe4f 100644
--- a/test/cypress/integration/ticket/ticketSale.spec.js
+++ b/test/cypress/integration/ticket/ticketSale.spec.js
@@ -1,139 +1,14 @@
///
+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');
diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js
index dfec341cd..c2dd1579f 100755
--- a/test/cypress/support/commands.js
+++ b/test/cypress/support/commands.js
@@ -92,6 +92,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);
@@ -109,6 +117,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
@@ -128,6 +137,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) {