diff --git a/src/pages/Ticket/Card/TicketSale.vue b/src/pages/Ticket/Card/TicketSale.vue
index 118761b23..e680fb290 100644
--- a/src/pages/Ticket/Card/TicketSale.vue
+++ b/src/pages/Ticket/Card/TicketSale.vue
@@ -22,7 +22,6 @@ import { useVnConfirm } from 'composables/useVnConfirm';
import useNotify from 'src/composables/useNotify.js';
import axios from 'axios';
import VnTable from 'src/components/VnTable/VnTable.vue';
-import VnUsesMana from 'src/components/ui/VnUsesMana.vue';
import VnConfirm from 'src/components/ui/VnConfirm.vue';
import TicketProblems from 'src/components/TicketProblems.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
@@ -33,6 +32,7 @@ const { t } = useI18n();
const { notify } = useNotify();
const { openConfirmationModal } = useVnConfirm();
const editPriceProxyRef = ref(null);
+const editManaProxyRef = ref(null);
const stateBtnDropdownRef = ref(null);
const quasar = useQuasar();
const arrayData = useArrayData('Ticket');
@@ -53,7 +53,6 @@ const transfer = ref({
sales: [],
});
const tableRef = ref([]);
-const canProceed = ref();
watch(
() => route.params.id,
@@ -133,7 +132,6 @@ const columns = computed(() => [
align: 'left',
label: t('globals.amount'),
name: 'amount',
- format: (row) => toCurrency(getSaleTotal(row)),
},
{
align: 'left',
@@ -183,8 +181,6 @@ const resetChanges = async () => {
};
const rowToUpdate = ref(null);
const changeQuantity = async (sale) => {
- canProceed.value = await isSalePrepared(sale);
- if (!canProceed.value) return;
if (
!sale.itemFk ||
sale.quantity == null ||
@@ -193,11 +189,21 @@ const changeQuantity = async (sale) => {
return;
if (!sale.id) return addSale(sale);
+ if (await isSalePrepared(sale)) {
+ await confirmUpdate(() => updateQuantity(sale));
+ } else await updateQuantity(sale);
+};
+
+const updateQuantity = async (sale) => {
try {
+ let { quantity, id } = sale;
if (!rowToUpdate.value) return;
rowToUpdate.value = null;
sale.isNew = false;
- await updateQuantity(sale);
+ const params = { quantity: quantity };
+ await axios.post(`Sales/${id}/updateQuantity`, params);
+ notify('globals.dataSaved', 'positive');
+ tableRef.value.reload();
} catch (e) {
const { quantity } = tableRef.value.CrudModelRef.originalData.find(
(s) => s.id === sale.id,
@@ -207,12 +213,6 @@ const changeQuantity = async (sale) => {
}
};
-const updateQuantity = async ({ quantity, id }) => {
- const params = { quantity: quantity };
- await axios.post(`Sales/${id}/updateQuantity`, params);
- notify('globals.dataSaved', 'positive');
-};
-
const addSale = async (sale) => {
const params = {
barcode: sale.itemFk,
@@ -237,13 +237,17 @@ const addSale = async (sale) => {
sale.isNew = false;
arrayData.fetch({});
};
+const changeConcept = async (sale) => {
+ if (await isSalePrepared(sale)) {
+ await confirmUpdate(() => updateConcept(sale));
+ } else await updateConcept(sale);
+};
const updateConcept = async (sale) => {
- canProceed.value = await isSalePrepared(sale);
- if (!canProceed.value) return;
const data = { newConcept: sale.concept };
await axios.post(`Sales/${sale.id}/updateConcept`, data);
notify('globals.dataSaved', 'positive');
+ tableRef.value.reload();
};
const DEFAULT_EDIT = {
@@ -295,33 +299,43 @@ const onOpenEditDiscountPopover = async (sale) => {
};
}
};
-
-const updatePrice = async (sale) => {
- canProceed.value = await isSalePrepared(sale);
- if (!canProceed.value) return;
+const changePrice = async (sale) => {
const newPrice = edit.value.price;
if (newPrice != null && newPrice != sale.price) {
- await axios.post(`Sales/${sale.id}/updatePrice`, { newPrice });
- sale.price = newPrice;
- edit.value = { ...DEFAULT_EDIT };
- notify('globals.dataSaved', 'positive');
+ if (await isSalePrepared(sale)) {
+ await confirmUpdate(() => updatePrice(sale, newPrice));
+ } else updatePrice(sale, newPrice);
}
-
await getMana();
};
+const updatePrice = async (sale, newPrice) => {
+ await axios.post(`Sales/${sale.id}/updatePrice`, { newPrice });
+ sale.price = newPrice;
+ edit.value = { ...DEFAULT_EDIT };
+ notify('globals.dataSaved', 'positive');
+ tableRef.value.reload();
+};
const changeDiscount = async (sale) => {
- canProceed.value = await isSalePrepared(sale);
- if (!canProceed.value) return;
const newDiscount = edit.value.discount;
- if (newDiscount != null && newDiscount != sale.discount) updateDiscount([sale]);
+ if (newDiscount != null && newDiscount != sale.discount) {
+ if (await isSalePrepared(sale))
+ await confirmUpdate(() => updateDiscount([sale], newDiscount));
+ else await updateDiscount([sale], newDiscount);
+ }
+};
+
+const updateDiscounts = async (sales, newDiscount = null) => {
+ const salesTracking = await fetchSalesTracking();
+
+ const someSaleIsPrepared = salesTracking.some((sale) =>
+ matchSale(salesTracking, sale),
+ );
+ if (someSaleIsPrepared) await confirmUpdate(() => updateDiscount(sales, newDiscount));
+ else updateDiscount(sales, newDiscount);
};
const updateDiscount = async (sales, newDiscount = null) => {
- for (const sale of sales) {
- const canProceed = await isSalePrepared(sale);
- if (!canProceed) return;
- }
const saleIds = sales.map((sale) => sale.id);
const _newDiscount = newDiscount || edit.value.discount;
const params = {
@@ -424,9 +438,13 @@ onMounted(async () => {
const items = ref([]);
const newRow = ref({});
+const changeItem = async (sale) => {
+ if (await isSalePrepared(sale)) {
+ await confirmUpdate(() => updateItem(sale));
+ } else await updateItem(sale);
+};
+
const updateItem = async (row) => {
- canProceed.value = await isSalePrepared(row);
- if (!canProceed.value) return;
const selectedItem = items.value.find((item) => item.id === row.itemFk);
if (selectedItem) {
row.item = selectedItem;
@@ -470,7 +488,18 @@ const endNewRow = (row) => {
}
};
-async function isSalePrepared(item) {
+async function confirmUpdate(cb) {
+ await quasar
+ .dialog({
+ component: VnConfirm,
+ componentProps: {
+ title: t('Item prepared'),
+ message: t('This item is already prepared. Do you want to continue?'),
+ },
+ })
+ .onOk(cb);
+}
+async function fetchSalesTracking() {
const filter = {
params: {
where: { ticketFk: route.params.id },
@@ -482,48 +511,37 @@ async function isSalePrepared(item) {
filter: JSON.stringify(filter),
},
});
-
- const matchingSale = data.find((sale) => sale.itemFk === item.itemFk);
- if (!matchingSale) {
- return true;
- }
-
- if (
- matchingSale.hasSaleGroupDetail ||
- matchingSale.isControled ||
- matchingSale.isPrepared ||
- matchingSale.isPrevious ||
- matchingSale.isPreviousSelected
- ) {
- try {
- await new Promise((resolve, reject) => {
- quasar
- .dialog({
- component: VnConfirm,
- componentProps: {
- title: t('Item prepared'),
- message: t(
- 'This item is already prepared. Do you want to continue?',
- ),
- data: item,
- },
- })
- .onOk(() => resolve(true))
- .onCancel(() => reject(new Error('cancelled')));
- });
- } catch (error) {
- tableRef.value.reload();
- return false;
- }
- }
- return true;
+ return data;
}
+async function isSalePrepared(sale) {
+ const data = await fetchSalesTracking();
+ return matchSale(data, sale);
+}
+function matchSale(data, sale) {
+ const matchingSale = data.find(({ itemFk }) => itemFk === sale.itemFk);
+
+ if (!matchingSale) {
+ return false;
+ }
+
+ return isPrepared(matchingSale);
+}
+function isPrepared(sale) {
+ const flagsToCheck = [
+ 'hasSaleGroupDetail',
+ 'isControled',
+ 'isPrepared',
+ 'isPrevious',
+ 'isPreviousSelected',
+ ];
+ return flagsToCheck.some((flag) => sale[flag] === 1);
+}
watch(
() => newRow.value.itemFk,
(newItemFk) => {
if (newItemFk) {
- updateItem(newRow.value);
+ changeItem(newRow.value);
}
},
);
@@ -584,7 +602,7 @@ watch(
:mana="mana"
:ticket-config="ticketConfig"
@get-mana="getMana()"
- @update-discounts="updateDiscount"
+ @update-discounts="updateDiscounts"
@refresh-table="resetChanges"
/>
@@ -741,16 +759,21 @@ watch(
-
+
(rowToUpdate = row)"
@focus="edit.oldQuantity = row.quantity"
/>
@@ -764,10 +787,12 @@ watch(
editManaProxyRef.save(row)"
v-model.number="edit.price"
:label="t('basicData.price')"
type="number"
@@ -781,31 +806,30 @@ watch(
{{ toPercentage(row.discount / 100) }}
+
-
- {
- changeDiscount(row);
- popup.hide();
- }
- "
- v-model.number="edit.discount"
- :label="t('ticketSale.discount')"
- type="number"
- />
-
+ editManaProxyRef.save(row)"
+ v-model.number="edit.discount"
+ :label="t('ticketSale.discount')"
+ type="number"
+ />
{{ toPercentage(row.discount / 100) }}
+
+ {{ toCurrency(getSaleTotal(row)) }}
+
diff --git a/src/pages/Travel/Card/TravelThermographsForm.vue b/src/pages/Travel/Card/TravelThermographsForm.vue
index 7aec32972..446e5d506 100644
--- a/src/pages/Travel/Card/TravelThermographsForm.vue
+++ b/src/pages/Travel/Card/TravelThermographsForm.vue
@@ -209,7 +209,7 @@ const onThermographCreated = async (data) => {
}"
sort-by="thermographFk ASC"
option-label="thermographFk"
- option-filter-value="id"
+ option-filter-value="thermographFk"
:disable="viewAction === 'edit'"
:tooltip="t('New thermograph')"
:roles-allowed-to-create="['logistic']"
diff --git a/src/pages/Worker/Card/WorkerFormation.vue b/src/pages/Worker/Card/WorkerFormation.vue
index e05eca7f8..e8680f7dd 100644
--- a/src/pages/Worker/Card/WorkerFormation.vue
+++ b/src/pages/Worker/Card/WorkerFormation.vue
@@ -119,7 +119,7 @@ const columns = computed(() => [
:url="`Workers/${entityId}/trainingCourse`"
:url-create="`Workers/${entityId}/trainingCourse`"
save-url="TrainingCourses/crud"
- :filter="courseFilter"
+ :user-filter="courseFilter"
:create="{
urlCreate: 'trainingCourses',
title: t('Create training course'),
diff --git a/src/pages/Worker/Card/WorkerMedical.vue b/src/pages/Worker/Card/WorkerMedical.vue
index c220df76a..c04f6496b 100644
--- a/src/pages/Worker/Card/WorkerMedical.vue
+++ b/src/pages/Worker/Card/WorkerMedical.vue
@@ -3,11 +3,23 @@ import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import VnTable from 'components/VnTable/VnTable.vue';
+import { dashIfEmpty } from 'src/filters';
const tableRef = ref();
const { t } = useI18n();
const route = useRoute();
const entityId = computed(() => route.params.id);
+const centerFilter = {
+ include: [
+ {
+ relation: 'center',
+ scope: {
+ fields: ['id', 'name'],
+ },
+ },
+ ],
+};
+
const columns = [
{
align: 'left',
@@ -36,6 +48,9 @@ const columns = [
url: 'medicalCenters',
fields: ['id', 'name'],
},
+ format: (row, dashIfEmpty) => {
+ return dashIfEmpty(row.center?.name);
+ },
},
{
align: 'left',
@@ -84,6 +99,7 @@ const columns = [
ref="tableRef"
data-key="WorkerMedical"
:url="`Workers/${entityId}/medicalReview`"
+ :user-filter="centerFilter"
save-url="MedicalReviews/crud"
:create="{
urlCreate: 'medicalReviews',
diff --git a/src/pages/Worker/Card/WorkerPit.vue b/src/pages/Worker/Card/WorkerPit.vue
index 40e814452..3de60d6a0 100644
--- a/src/pages/Worker/Card/WorkerPit.vue
+++ b/src/pages/Worker/Card/WorkerPit.vue
@@ -176,6 +176,7 @@ const deleteRelative = async (id) => {
:label="t('isDescendant')"
v-model="row.isDescendant"
class="q-gutter-xs q-mb-xs"
+ data-cy="Descendant/Ascendant"
/>
{
@on-fetch="(data) => (validAddresses = data)"
/>
-
+
{
:label="t('Name')"
clearable
v-model="data.name"
+ :required="true"
/>
@@ -83,7 +84,7 @@ const setFilteredAddresses = (data) => {
type="number"
min="0"
/>
-
+
@@ -92,7 +93,7 @@ const setFilteredAddresses = (data) => {
:label="t('Price')"
type="number"
min="0"
- required="true"
+ :required="true"
clearable
/>
{
:label="t('Price optimum')"
type="number"
min="0"
- required="true"
+ :required="true"
clearable
/>
diff --git a/src/pages/Zone/Card/ZoneCalendar.vue b/src/pages/Zone/Card/ZoneCalendar.vue
deleted file mode 100644
index e69de29bb..000000000
diff --git a/src/pages/Zone/ZoneFilterPanel.vue b/src/pages/Zone/ZoneFilterPanel.vue
index 3a35527ab..bbe12189a 100644
--- a/src/pages/Zone/ZoneFilterPanel.vue
+++ b/src/pages/Zone/ZoneFilterPanel.vue
@@ -38,7 +38,12 @@ const agencies = ref([]);
-
+
@@ -53,6 +58,7 @@ const agencies = ref([]);
dense
outlined
rounded
+ data-cy="zoneFilterPanelAgencySelect"
>
diff --git a/src/pages/Zone/ZoneList.vue b/src/pages/Zone/ZoneList.vue
index 1fa539c91..a82bbb285 100644
--- a/src/pages/Zone/ZoneList.vue
+++ b/src/pages/Zone/ZoneList.vue
@@ -65,7 +65,6 @@ const tableFilter = {
const columns = computed(() => [
{
- align: 'left',
name: 'id',
label: t('list.id'),
chip: {
@@ -75,6 +74,8 @@ const columns = computed(() => [
columnFilter: {
inWhere: true,
},
+ columnClass: 'shrink-column',
+ component: 'number',
},
{
align: 'left',
@@ -106,7 +107,6 @@ const columns = computed(() => [
format: (row, dashIfEmpty) => dashIfEmpty(row?.agencyMode?.name),
},
{
- align: 'left',
name: 'price',
label: t('list.price'),
cardVisible: true,
@@ -114,9 +114,11 @@ const columns = computed(() => [
columnFilter: {
inWhere: true,
},
+ columnClass: 'shrink-column',
+ component: 'number',
},
{
- align: 'left',
+ align: 'center',
name: 'hour',
label: t('list.close'),
cardVisible: true,
@@ -129,6 +131,7 @@ const columns = computed(() => [
label: t('list.addressFk'),
cardVisible: true,
columnFilter: false,
+ columnClass: 'expand',
},
{
align: 'right',
@@ -177,67 +180,73 @@ function formatRow(row) {
-
-
- {{ dashIfEmpty(formatRow(row)) }}
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+ {{ dashIfEmpty(formatRow(row)) }}
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -245,3 +254,20 @@ es:
Search zone: Buscar zona
You can search zones by id or name: Puedes buscar zonas por id o nombre
+
+
diff --git a/src/pages/Zone/ZoneUpcoming.vue b/src/pages/Zone/ZoneUpcoming.vue
index c74ae6078..adcdfbc04 100644
--- a/src/pages/Zone/ZoneUpcoming.vue
+++ b/src/pages/Zone/ZoneUpcoming.vue
@@ -56,7 +56,7 @@ onMounted(() => weekdayStore.initStore());
-
+
describe('InvoiceOut list', () => {
const serial = 'Española rapida';
+ const columnCheckbox =
+ '.bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner';
+ const firstRowDescriptor =
+ 'tbody > :nth-child(1) > [data-col-field="clientFk"] > .no-padding > .link';
+ const firstRowCheckbox =
+ 'tbody > :nth-child(1) > :nth-child(1) > .q-checkbox > .q-checkbox__inner ';
+ const summaryPopupIcon = '.header > :nth-child(2) > .q-btn__content > .q-icon';
+ const filterBtn = '.q-scrollarea__content > .q-btn--standard > .q-btn__content';
+ const firstSummaryIcon =
+ ':nth-child(1) > .text-right > [data-cy="tableAction-0"] > .q-btn__content > .q-icon';
beforeEach(() => {
cy.viewport(1920, 1080);
@@ -9,18 +19,32 @@ describe('InvoiceOut list', () => {
cy.typeSearchbar('{enter}');
});
- it('should search and filter an invoice and enter to the summary', () => {
- cy.typeSearchbar('1{enter}');
- cy.get('.q-virtual-scroll__content > :nth-child(2) > :nth-child(7)').click();
- cy.get('.header > a.q-btn > .q-btn__content').click();
- cy.typeSearchbar('{enter}');
- cy.dataCy('InvoiceOutFilterAmountBtn').find('input').type('8.88{enter}');
+ it('should download one pdf from the subtoolbar button', () => {
+ cy.get(firstRowCheckbox).click();
+ cy.dataCy('InvoiceOutDownloadPdfBtn').click();
});
it('should download all pdfs', () => {
- cy.get('.bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner').click();
+ cy.get(columnCheckbox).click();
cy.dataCy('InvoiceOutDownloadPdfBtn').click();
- cy.get('.bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner').click();
+ });
+
+ it('should open the invoice descriptor from table icon', () => {
+ cy.get(firstSummaryIcon).click();
+ cy.get('.cardSummary').should('be.visible');
+ cy.get('.summaryHeader > div').should('include.text', 'A1111111');
+ });
+
+ it('should open the client descriptor', () => {
+ cy.get(firstRowDescriptor).click();
+ cy.get(summaryPopupIcon).click();
+ });
+
+ it('should filter the results by client ID, then check the first result is correct', () => {
+ cy.dataCy('Customer ID_input').type('1103');
+ cy.get(filterBtn).click();
+ cy.get(firstRowDescriptor).click();
+ cy.get('.q-item > .q-item__label').should('include.text', '1103');
});
it('should give an error when manual invoicing a ticket that is already invoiced', () => {
@@ -31,11 +55,14 @@ describe('InvoiceOut list', () => {
cy.checkNotification('This ticket is already invoiced');
});
- it('should create a manual invoice and enter to its summary', () => {
+ it('should create a manual invoice and enter to its summary, then delete that invoice', () => {
cy.dataCy('vnTableCreateBtn').click();
- cy.dataCy('InvoiceOutCreateTicketinput').type(8);
+ cy.dataCy('InvoiceOutCreateTicketinput').type(9);
cy.selectOption('[data-cy="InvoiceOutCreateSerialSelect"]', serial);
cy.dataCy('FormModelPopup_save').click();
cy.checkNotification('Data created');
+ cy.dataCy('descriptor-more-opts').click();
+ cy.get('.q-menu > .q-list > :nth-child(4)').click();
+ cy.dataCy('VnConfirm_confirm').click();
});
});
diff --git a/test/cypress/integration/invoiceOut/invoiceOutNegativeBases.spec.js b/test/cypress/integration/invoiceOut/invoiceOutNegativeBases.spec.js
index 02b7fbb43..4d530de05 100644
--- a/test/cypress/integration/invoiceOut/invoiceOutNegativeBases.spec.js
+++ b/test/cypress/integration/invoiceOut/invoiceOutNegativeBases.spec.js
@@ -1,11 +1,26 @@
///
describe('InvoiceOut negative bases', () => {
+ const getDescriptors = (opt) =>
+ `:nth-child(1) > [data-col-field="${opt}"] > .no-padding > .link`;
+
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/invoice-out/negative-bases`);
});
+ it('should open the posible descriptors', () => {
+ cy.get(getDescriptors('clientId')).click();
+ cy.get('.descriptor').should('be.visible');
+ cy.get('.q-item > .q-item__label').should('include.text', '1101');
+ cy.get(getDescriptors('ticketFk')).click();
+ cy.get('.descriptor').should('be.visible');
+ cy.get('.q-item > .q-item__label').should('include.text', '23');
+ cy.get(getDescriptors('workerName')).click();
+ cy.get('.descriptor').should('be.visible');
+ cy.get('.q-item > .q-item__label').should('include.text', '18');
+ });
+
it('should filter and download as CSV', () => {
cy.get('input[name="ticketFk"]').type('23{enter}');
cy.get('#subToolbar > .q-btn').click();
diff --git a/test/cypress/integration/invoiceOut/invoiceOutSummary.spec.js b/test/cypress/integration/invoiceOut/invoiceOutSummary.spec.js
index 44b0a9961..333f7e2c4 100644
--- a/test/cypress/integration/invoiceOut/invoiceOutSummary.spec.js
+++ b/test/cypress/integration/invoiceOut/invoiceOutSummary.spec.js
@@ -5,40 +5,91 @@ describe('InvoiceOut summary', () => {
Type: { val: 'Error in customer data', type: 'select' },
};
+ const firstRowDescriptors = (opt) =>
+ `tbody > :nth-child(1) > :nth-child(${opt}) > .q-btn`;
+ const toCustomerSummary = '[href="#/customer/1101"]';
+ const toTicketList = '[href="#/ticket/list?table={%22refFk%22:%22T1111111%22}"]';
+ const selectMenuOption = (opt) => `.q-menu > .q-list > :nth-child(${opt})`;
+ const confirmSend = '.q-btn--unelevated';
+
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
- cy.visit(`/#/invoice-out/list`);
+ cy.visit(`/#/invoice-out/1/summary`);
});
- it('should generate the invoice PDF', () => {
- cy.typeSearchbar('T1111111{enter}');
- cy.dataCy('descriptor-more-opts').click();
- cy.get('.q-menu > .q-list > :nth-child(6)').click();
- cy.dataCy('VnConfirm_confirm').click();
- cy.checkNotification('The invoice PDF document has been regenerated');
+ it('open the descriptors', () => {
+ cy.get(firstRowDescriptors(1)).click();
+ cy.get('.descriptor').should('be.visible');
+ cy.get('.q-item > .q-item__label').should('include.text', '1');
+ cy.get(firstRowDescriptors(2)).click();
+ cy.get('.descriptor').should('be.visible');
+ cy.get('.q-item > .q-item__label').should('include.text', '1101');
});
- it('should refund the invoice ', () => {
+
+ it('should open the client summary and the ticket list', () => {
+ cy.get(toCustomerSummary).click();
+ cy.get('.descriptor').should('be.visible');
+ cy.get('.q-item > .q-item__label').should('include.text', '1101');
+ });
+
+ it('should open the ticket list', () => {
+ cy.get(toTicketList).click();
+ cy.get('.descriptor').should('be.visible');
+ cy.dataCy('vnFilterPanelChip').should('include.text', 'T1111111');
+ });
+
+ it('should transfer the invoice ', () => {
cy.typeSearchbar('T1111111{enter}');
cy.dataCy('descriptor-more-opts').click();
- cy.get('.q-menu > .q-list > :nth-child(7)').click();
- cy.get('#q-portal--menu--3 > .q-menu > .q-list > :nth-child(2)').click();
- cy.checkNotification('The following refund ticket have been created');
+ cy.get(selectMenuOption(1)).click();
+ cy.fillInForm(transferInvoice);
+ cy.get('.q-mt-lg > .q-btn').click();
+ cy.checkNotification('Transferred invoice');
+ });
+
+ it('should send the invoice as PDF', () => {
+ cy.dataCy('descriptor-more-opts').click();
+ cy.get(selectMenuOption(3)).click();
+ cy.dataCy('InvoiceOutDescriptorMenuSendPdfOption').click();
+ cy.get(confirmSend).click();
+ cy.checkNotification('Notification sent');
+ });
+
+ it('should send the invoice as CSV', () => {
+ cy.dataCy('descriptor-more-opts').click();
+ cy.get(selectMenuOption(3)).click();
+ cy.dataCy('InvoiceOutDescriptorMenuSendCsvOption').click();
+ cy.get(confirmSend).click();
+ cy.checkNotification('Notification sent');
});
it('should delete an invoice ', () => {
cy.typeSearchbar('T2222222{enter}');
cy.dataCy('descriptor-more-opts').click();
- cy.get('.q-menu > .q-list > :nth-child(4)').click();
+ cy.get(selectMenuOption(4)).click();
cy.dataCy('VnConfirm_confirm').click();
cy.checkNotification('InvoiceOut deleted');
});
- it('should transfer the invoice ', () => {
- cy.typeSearchbar('T1111111{enter}');
+
+ it('should book the invoice', () => {
cy.dataCy('descriptor-more-opts').click();
- cy.get('.q-menu > .q-list > :nth-child(1)').click();
- cy.fillInForm(transferInvoice);
- cy.get('.q-mt-lg > .q-btn').click();
- cy.checkNotification('Transferred invoice');
+ cy.get(selectMenuOption(5)).click();
+ cy.dataCy('VnConfirm_confirm').click();
+ cy.checkNotification('InvoiceOut booked');
+ });
+
+ it('should generate the invoice PDF', () => {
+ cy.dataCy('descriptor-more-opts').click();
+ cy.get(selectMenuOption(6)).click();
+ cy.dataCy('VnConfirm_confirm').click();
+ cy.checkNotification('The invoice PDF document has been regenerated');
+ });
+
+ it('should refund the invoice ', () => {
+ cy.dataCy('descriptor-more-opts').click();
+ cy.get(selectMenuOption(7)).click();
+ cy.get('#q-portal--menu--3 > .q-menu > .q-list > :nth-child(2)').click();
+ cy.checkNotification('The following refund ticket have been created');
});
});
diff --git a/test/cypress/integration/route/routeExtendedList.spec.js b/test/cypress/integration/route/routeExtendedList.spec.js
new file mode 100644
index 000000000..34d3d3a29
--- /dev/null
+++ b/test/cypress/integration/route/routeExtendedList.spec.js
@@ -0,0 +1,205 @@
+describe('Route extended list', () => {
+ const getSelector = (colField) => `tr:last-child > [data-col-field="${colField}"]`;
+
+ const selectors = {
+ worker: getSelector('workerFk'),
+ agency: getSelector('agencyModeFk'),
+ vehicle: getSelector('vehicleFk'),
+ date: getSelector('dated'),
+ description: getSelector('description'),
+ served: getSelector('isOk'),
+ lastRowSelectCheckBox: 'tbody > tr:last-child > :nth-child(1) .q-checkbox__inner',
+ removeBtn: '[title="Remove"]',
+ resetBtn: '[title="Reset"]',
+ confirmBtn: 'VnConfirm_confirm',
+ saveBtn: 'crudModelDefaultSaveBtn',
+ saveFormBtn: 'FormModelPopup_save',
+ cloneBtn: '#st-actions > .q-btn-group > :nth-child(1)',
+ downloadBtn: '#st-actions > .q-btn-group > :nth-child(2)',
+ markServedBtn: '#st-actions > .q-btn-group > :nth-child(3)',
+ searchbar: 'searchbar',
+ firstTicketsRowSelectCheckBox:
+ '.q-card > :nth-child(2) > .q-table__container > .q-table__middle > .q-table > tbody > :nth-child(1) > .q-table--col-auto-width > .q-checkbox > .q-checkbox__inner > .q-checkbox__bg > .q-checkbox__svg',
+ };
+
+ const checkboxState = {
+ check: 'check',
+ uncheck: 'close',
+ };
+ const url = '/#/route/extended-list';
+ const dataCreated = 'Data created';
+ const dataSaved = 'Data saved';
+
+ const originalFields = [
+ { selector: selectors.worker, type: 'select', value: 'logistic' },
+ { selector: selectors.agency, type: 'select', value: 'Super-Man delivery' },
+ { selector: selectors.vehicle, type: 'select', value: '3333-IMK' },
+ { selector: selectors.date, type: 'date', value: '01/02/2024' },
+ { 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.vehicle, type: 'select', value: '1111-IMK' },
+ { selector: selectors.date, type: 'date', value: '01/01/2001' },
+ { selector: selectors.description, type: 'input', value: 'Description updated' },
+ { selector: selectors.served, type: 'checkbox', value: checkboxState.check },
+ ];
+
+ function fillField(selector, type, value) {
+ switch (type) {
+ case 'select':
+ cy.get(selector).should('be.visible').click();
+ cy.dataCy('null_select').clear().type(value);
+ cy.get('.q-item').contains(value).click();
+ break;
+ case 'input':
+ cy.get(selector).should('be.visible').click();
+ cy.dataCy('null_input').clear().type(`${value}{enter}`);
+ break;
+ case 'date':
+ cy.get(selector).should('be.visible').click();
+ cy.dataCy('null_inputDate').clear().type(`${value}{enter}`);
+ break;
+ case 'checkbox':
+ cy.get(selector).should('be.visible').click().click();
+ break;
+ }
+ }
+
+ beforeEach(() => {
+ cy.viewport(1920, 1080);
+ cy.login('developer');
+ cy.visit(url);
+ 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()
+ .should('be.visible')
+ .should('have.length.greaterThan', 0);
+ });
+
+ it('Should create new route', () => {
+ cy.addBtnClick();
+
+ const data = {
+ Worker: { val: 'logistic', type: 'select' },
+ Agency: { val: 'Super-Man delivery', type: 'select' },
+ Vehicle: { val: '3333-IMK', type: 'select' },
+ Date: { val: '02-01-2024', type: 'date' },
+ From: { val: '01-01-2024', type: 'date' },
+ To: { val: '10-01-2024', type: 'date' },
+ 'Km start': { val: 1000 },
+ 'Km end': { val: 1200 },
+ Description: { val: 'Test route' },
+ };
+
+ cy.fillInForm(data);
+
+ cy.dataCy(selectors.saveFormBtn).click();
+ cy.checkNotification(dataCreated);
+ cy.url().should('include', '/summary');
+ });
+
+ it('Should reset changed values when click reset button', () => {
+ updateFields.forEach(({ selector, type, value }) => {
+ fillField(selector, type, value);
+ });
+
+ cy.get('[title="Reset"]').click();
+
+ originalFields.forEach(({ selector, value }) => {
+ cy.validateContent(selector, value);
+ });
+ });
+
+ 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.get('.q-card__actions > .q-btn--standard > .q-btn__content').click();
+ cy.validateContent(selectors.date, '05/10/2001');
+ });
+
+ it('Should download selected route', () => {
+ const downloadsFolder = Cypress.config('downloadsFolder');
+ cy.get(selectors.lastRowSelectCheckBox).click();
+ cy.get(selectors.downloadBtn).click();
+ cy.wait(5000);
+
+ 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', () => {
+ cy.get(selectors.lastRowSelectCheckBox).click();
+ cy.get(selectors.markServedBtn).click();
+
+ cy.typeSearchbar('{enter}');
+ cy.validateContent(selectors.served, checkboxState.check);
+ });
+
+ it('Should delete the selected route', () => {
+ cy.get(selectors.lastRowSelectCheckBox).click();
+
+ cy.get(selectors.removeBtn).click();
+ cy.dataCy(selectors.confirmBtn).click();
+
+ cy.checkNotification(dataSaved);
+ });
+
+ it('Should save changes in route', () => {
+ updateFields.forEach(({ selector, type, value }) => {
+ fillField(selector, type, value);
+ });
+
+ cy.dataCy(selectors.saveBtn).should('not.be.disabled').click();
+ cy.checkNotification(dataSaved);
+
+ cy.typeSearchbar('{enter}');
+
+ updateFields.forEach(({ selector, value }) => {
+ 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);
+ });
+
+ it('Should redirect to the summary from the route summary pop-up', () => {
+ cy.dataCy('tableAction-1').last().click();
+ cy.get('.header > .q-icon').should('be.visible').click();
+ cy.url().should('include', '/summary');
+ });
+
+ it('Should redirect to the summary when click go to summary icon', () => {
+ cy.dataCy('tableAction-2').last().click();
+ cy.url().should('include', '/summary');
+ });
+});
diff --git a/test/cypress/integration/ticket/ticketSale.spec.js b/test/cypress/integration/ticket/ticketSale.spec.js
index aed8dc85a..63562bd26 100644
--- a/test/cypress/integration/ticket/ticketSale.spec.js
+++ b/test/cypress/integration/ticket/ticketSale.spec.js
@@ -1,122 +1,208 @@
///
describe('TicketSale', () => {
- 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');
+ describe('Free ticket #31', () => {
+ beforeEach(() => {
+ cy.login('developer');
+ cy.viewport(1920, 1080);
+ cy.visit('/#/ticket/31/sale');
});
- 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');
- });
+ const firstRow = 'tbody > :nth-child(1)';
- 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');
- });
+ const selectFirstRow = () => {
+ cy.waitForElement(firstRow);
+ cy.get(firstRow).find('.q-checkbox__inner').click();
+ };
- 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('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('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('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('marks row as reserved', () => {
- selectFirstRow();
- cy.dataCy('ticketSaleMoreActionsDropdown').click();
- cy.waitForElement('[data-cy="markAsReservedItem"]');
- cy.dataCy('markAsReservedItem').click();
- cy.dataCy('ticketSaleReservedIcon').should('exist');
- });
+ 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('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('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('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('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('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('marks row as reserved', () => {
+ selectFirstRow();
+ cy.dataCy('ticketSaleMoreActionsDropdown').click();
+ cy.waitForElement('[data-cy="markAsReservedItem"]');
+ cy.dataCy('markAsReservedItem').click();
+ cy.dataCy('ticketSaleReservedIcon').should('exist');
+ });
- 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();
- //check the new ticket has been created succesfully
- cy.get('.q-item > .q-item__label').should('not.have.text', ' #32');
- });
+ 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('should redirect to ticket logs', () => {
- cy.get(firstRow).find('.q-btn:last').click();
- cy.url().should('match', /\/ticket\/31\/log/);
+ 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();
+ //check the new ticket has been created succesfully
+ 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('Ticket prepared #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);
+ cy.get(':nth-child(10) > .q-btn').click();
+ cy.waitForElement('[data-cy="ticketEditManaProxy"]');
+ cy.dataCy('ticketEditManaProxy').should('exist');
+ cy.waitForElement('[data-cy="Price_input"]');
+ cy.dataCy('Price_input').clear();
+ cy.dataCy('Price_input').type(price);
+ cy.dataCy('saveManaBtn').click();
+ handleVnConfirm();
+
+ cy.get(':nth-child(10) > .q-btn > .q-btn__content').should(
+ 'have.text',
+ `€${price}`,
+ );
+ });
+ it('update dicount', () => {
+ const discount = Math.floor(Math.random() * 100) + 1;
+ selectFirstRow();
+ cy.get(':nth-child(11) > .q-btn').click();
+ cy.waitForElement('[data-cy="ticketEditManaProxy"]');
+ cy.dataCy('ticketEditManaProxy').should('exist');
+ cy.waitForElement('[data-cy="Disc_input"]');
+ cy.dataCy('Disc_input').clear();
+ cy.dataCy('Disc_input').type(discount);
+ cy.dataCy('saveManaBtn').click();
+ handleVnConfirm();
+
+ cy.get(':nth-child(11) > .q-btn > .q-btn__content').should(
+ 'have.text',
+ `${discount}.00%`,
+ );
+ });
+
+ it('change concept', () => {
+ const quantity = Math.floor(Math.random() * 100) + 1;
+ cy.waitForElement(firstRow);
+ cy.get(':nth-child(8) > .row').click();
+ cy.get(
+ '.q-menu > [data-v-ca3f07a4=""] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="undefined_input"]',
+ )
+ .type(quantity)
+ .type('{enter}');
+ handleVnConfirm();
+
+ cy.get(':nth-child(8) >.row').should('contain.text', `${quantity}`);
+ });
+ it('changequantity ', () => {
+ const quantity = Math.floor(Math.random() * 100) + 1;
+ cy.waitForElement(firstRow);
+ cy.dataCy('ticketSaleQuantityInput').clear();
+ cy.dataCy('ticketSaleQuantityInput').type(quantity).trigger('tab');
+ cy.get('.q-page > :nth-child(6)').click();
+
+ handleVnConfirm();
+
+ cy.get('[data-cy="ticketSaleQuantityInput"]')
+ .find('[data-cy="undefined_input"]')
+ .should('have.value', `${quantity}`);
+ });
});
});
+
+function handleVnConfirm() {
+ cy.get('[data-cy="VnConfirm_confirm"] > .q-btn__content > .block').click();
+ cy.waitForElement('.q-notification__message');
+
+ cy.get('.q-notification__message').should('be.visible');
+ cy.checkNotification('Data saved');
+}
diff --git a/test/cypress/integration/wagon/wagonType/wagonTypeCreate.spec.js b/test/cypress/integration/wagon/wagonType/wagonTypeCreate.spec.js
index 2cd43984a..49d7d9f01 100644
--- a/test/cypress/integration/wagon/wagonType/wagonTypeCreate.spec.js
+++ b/test/cypress/integration/wagon/wagonType/wagonTypeCreate.spec.js
@@ -8,7 +8,7 @@ describe('WagonTypeCreate', () => {
it('should create a new wagon type and then delete it', () => {
cy.get('.q-page-sticky > div > .q-btn').click();
- cy.get('input').first().type('Example for testing');
+ cy.dataCy('Name_input').type('Example for testing');
cy.get('[data-cy="FormModelPopup_save"]').click();
cy.get('[title="Remove"] > .q-btn__content > .q-icon').first().click();
});
diff --git a/test/cypress/integration/worker/workerCreate.spec.js b/test/cypress/integration/worker/workerCreate.spec.js
index 7f2810395..71fd6b347 100644
--- a/test/cypress/integration/worker/workerCreate.spec.js
+++ b/test/cypress/integration/worker/workerCreate.spec.js
@@ -2,9 +2,24 @@ describe('WorkerCreate', () => {
const externalRadio = '.q-radio:nth-child(2)';
const developerBossId = 120;
const payMethodCross =
- '.grid-create .full-width > :nth-child(9) .q-select .q-field__append:not(.q-anchor--skip)';
+ ':nth-child(9) > .q-select > .q-field__inner > .q-field__control > :nth-child(2)';
const saveBtn = '.q-mt-lg > .q-btn--standard';
+ const internalWithOutPay = {
+ Fi: { val: '78457139E' },
+ 'Web user': { val: 'manolo' },
+ Name: { val: 'Manolo' },
+ 'Last name': { val: 'Hurtado' },
+ 'Personal email': { val: 'manolo@mydomain.com' },
+ Company: { val: 'VNL', type: 'select' },
+ Street: { val: 'S/ DEFAULTWORKERSTREET' },
+ Location: { val: 1, type: 'select' },
+ Phone: { val: '123456789' },
+ 'Worker code': { val: 'DWW' },
+ Boss: { val: developerBossId, type: 'select' },
+ Birth: { val: '11-12-2022', type: 'date' },
+ };
+
const internal = {
Fi: { val: '78457139E' },
'Web user': { val: 'manolo' },
@@ -14,6 +29,7 @@ describe('WorkerCreate', () => {
Company: { val: 'VNL', type: 'select' },
Street: { val: 'S/ DEFAULTWORKERSTREET' },
Location: { val: 1, type: 'select' },
+ 'Pay method': { val: 1, type: 'select' },
Phone: { val: '123456789' },
'Worker code': { val: 'DWW' },
Boss: { val: developerBossId, type: 'select' },
@@ -37,17 +53,14 @@ describe('WorkerCreate', () => {
});
it('should throw an error if a pay method has not been selected', () => {
- cy.fillInForm(internal);
+ cy.fillInForm(internalWithOutPay);
cy.get(payMethodCross).click();
cy.get(saveBtn).click();
cy.checkNotification('Payment method is required');
});
it('should create an internal', () => {
- cy.fillInForm({
- ...internal,
- 'Pay method': { val: 'PayMethod one', type: 'select' },
- });
+ cy.fillInForm(internal);
cy.get(saveBtn).click();
cy.checkNotification('Data created');
});
diff --git a/test/cypress/integration/worker/workerNotificationsManager.spec.js b/test/cypress/integration/worker/workerNotificationsManager.spec.js
index f121b3894..ad48d8a6c 100644
--- a/test/cypress/integration/worker/workerNotificationsManager.spec.js
+++ b/test/cypress/integration/worker/workerNotificationsManager.spec.js
@@ -18,7 +18,7 @@ describe('WorkerNotificationsManager', () => {
cy.visit(`/#/worker/${salesPersonId}/notifications`);
cy.get(firstAvailableNotification).click();
cy.checkNotification(
- 'The notification subscription of this worker cant be modified'
+ 'The notification subscription of this worker cant be modified',
);
});
diff --git a/test/cypress/integration/worker/workerPit.spec.js b/test/cypress/integration/worker/workerPit.spec.js
index cc3a87637..19cbebc20 100644
--- a/test/cypress/integration/worker/workerPit.spec.js
+++ b/test/cypress/integration/worker/workerPit.spec.js
@@ -8,7 +8,8 @@ describe('WorkerPit', () => {
const spousePensionInput = '[data-cy="Spouse Pension_input"]';
const spousePension = '120';
const addRelative = '[data-cy="addRelative"]';
- const isDescendantSelect = '[data-cy="Descendant/Ascendant_select"]';
+ const isDescendantSelect = '[data-cy="Descendant/Ascendant"]';
+ const Descendant = 'Descendiente';
const birthedInput = '[data-cy="Birth Year_input"]';
const birthed = '2002';
const adoptionYearInput = '[data-cy="Adoption Year_input"]';
@@ -28,11 +29,8 @@ describe('WorkerPit', () => {
cy.get(spouseNifInput).type(spouseNif);
cy.get(spousePensionInput).type(spousePension);
cy.get(savePIT).click();
- });
-
- it('complete relative', () => {
cy.get(addRelative).click();
- cy.get(isDescendantSelect).type('{downArrow}{downArrow}{enter}');
+ cy.get(isDescendantSelect).type(Descendant);
cy.get(birthedInput).type(birthed);
cy.get(adoptionYearInput).type(adoptionYear);
cy.get(saveRelative).click();
diff --git a/test/cypress/integration/zone/zoneList.spec.js b/test/cypress/integration/zone/zoneList.spec.js
index 8d01d4e4e..68e924635 100644
--- a/test/cypress/integration/zone/zoneList.spec.js
+++ b/test/cypress/integration/zone/zoneList.spec.js
@@ -1,4 +1,5 @@
describe('ZoneList', () => {
+ const agency = 'inhouse pickup';
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
@@ -6,11 +7,15 @@ describe('ZoneList', () => {
});
it('should filter by agency', () => {
- cy.get('input[aria-label="Agency"]').type('{downArrow}{enter}');
+ cy.dataCy('zoneFilterPanelNameInput').type('{downArrow}{enter}');
});
it('should open the zone summary', () => {
- cy.get('input[aria-label="Name"]').type('zone refund');
- cy.get('.q-scrollarea__content > .q-btn--standard > .q-btn__content').click();
+ 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,
+ );
});
});