feat: refs #8600 added calendar e2e and modified basic data
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jon Elias 2025-02-19 16:15:22 +01:00
parent eab18e4d14
commit 21d2438c5d
6 changed files with 67 additions and 22 deletions

View File

@ -29,10 +29,10 @@ const setFilteredAddresses = (data) => {
<template #form="{ data, validate }">
<VnRow>
<VnInput
data-cy="zone-basic-data-name"
:label="t('Name')"
clearable
v-model="data.name"
data-cy="ZoneBasicDataName"
:required="true"
/>
</VnRow>
@ -75,7 +75,6 @@ const setFilteredAddresses = (data) => {
min="0"
/>
</VnRow>
<VnRow>
<VnInput
v-model="data.travelingDays"
@ -86,7 +85,6 @@ const setFilteredAddresses = (data) => {
/>
<VnInputTime v-model="data.hour" :label="t('Closing')" :required="true" />
</VnRow>
<VnRow>
<VnInput
v-model="data.price"
@ -95,6 +93,7 @@ const setFilteredAddresses = (data) => {
min="0"
:required="true"
clearable
data-cy="ZoneBasicDataPrice"
/>
<VnInput
v-model="data.priceOptimum"

View File

@ -58,7 +58,7 @@ const arrayData = useArrayData('ZoneEvents');
const createEvent = async () => {
eventInclusionFormData.value.weekDays = weekdayStore.toSet(
eventInclusionFormData.value.wdays
eventInclusionFormData.value.wdays,
);
if (inclusionType.value == 'day') eventInclusionFormData.value.weekDays = '';
@ -74,7 +74,7 @@ const createEvent = async () => {
else
await axios.put(
`Zones/${route.params.id}/events/${props.event?.id}`,
eventInclusionFormData.value
eventInclusionFormData.value,
);
await refetchEvents();
@ -123,12 +123,14 @@ onMounted(() => {
dense
val="day"
:label="t('eventsInclusionForm.oneDay')"
data-cy="ZoneEventInclusionDayRadio"
/>
<QRadio
v-model="inclusionType"
dense
val="indefinitely"
:label="t('eventsInclusionForm.indefinitely')"
data-cy="ZoneEventInclusionIndefinitelyRadio"
/>
<QRadio
v-model="inclusionType"
@ -136,6 +138,7 @@ onMounted(() => {
val="range"
:label="t('eventsInclusionForm.rangeOfDates')"
class="q-mb-sm"
data-cy="ZoneEventInclusionRangeRadio"
/>
</div>
<VnRow>
@ -156,10 +159,12 @@ onMounted(() => {
<VnInputDate
:label="t('eventsInclusionForm.from')"
v-model="eventInclusionFormData.started"
data-cy="ZoneEventsFromDate"
/>
<VnInputDate
:label="t('eventsInclusionForm.to')"
v-model="eventInclusionFormData.ended"
data-cy="ZoneEventsToDate"
/>
</VnRow>
<VnRow>
@ -221,7 +226,7 @@ onMounted(() => {
openConfirmationModal(
t('zone.deleteTitle'),
t('zone.deleteSubtitle'),
() => deleteEvent()
() => deleteEvent(),
)
"
/>

View File

@ -185,6 +185,7 @@ const handleDateClick = (timestamp) => {
:class="{
'--today': isToday(timestamp),
}"
data-cy="ZoneCalendarDay"
>
<QPopupProxy v-if="isZoneDeliveryView">
<ZoneClosingTable

View File

@ -46,7 +46,7 @@ watch(
inq.value = {
deliveryMethodFk: { inq: deliveryMethods.value[deliveryMethodFk.value] },
};
}
},
);
</script>
@ -98,6 +98,7 @@ watch(
outlined
rounded
map-key="geoFk"
data-cy="ZoneDeliveryDaysPostcodeSelect"
>
<template #option="{ itemProps, opt }">
<QItem v-bind="itemProps">
@ -129,6 +130,7 @@ watch(
dense
outlined
rounded
data-cy="ZoneDeliveryDaysAgencySelect"
/>
<VnSelect
v-else

View File

@ -1,5 +1,5 @@
describe('ZoneBasicData', () => {
const priceBasicData = '[data-cy="Price_input"]';
const priceBasicData = '[data-cy="ZoneBasicDataPrice"]';
const saveBtn = '.q-btn-group > .q-btn--standard';
beforeEach(() => {
@ -8,26 +8,13 @@ describe('ZoneBasicData', () => {
cy.visit('/#/zone/4/basic-data');
});
it('should throw an error if the name is empty', () => {
cy.intercept('GET', /\/api\/Zones\/4./).as('zone');
cy.wait('@zone').then(() => {
cy.get('[data-cy="zone-basic-data-name"] input').type(
'{selectall}{backspace}',
);
});
cy.get(saveBtn).click();
cy.checkNotification("can't be blank");
});
it('should throw an error if the price is empty', () => {
cy.get(priceBasicData).clear();
cy.get(saveBtn).click();
cy.checkNotification('cannot be blank');
});
it("should edit the basicData's zone", () => {
it("should edit the basicData's zone name", () => {
cy.get('.q-card > :nth-child(1)').type(' modified');
cy.get(saveBtn).click();
cy.checkNotification('Data saved');

View File

@ -0,0 +1,51 @@
describe('ZoneCalendar', () => {
const addEventBtn = '.q-page-sticky > div > .q-btn';
const submitBtn = '.q-mt-lg > .q-btn--standard';
const deleteBtn = '.q-item__section--side > .q-btn';
const from = '.q-field__control-container > [data-cy="ZoneEventsFromDate"]';
const to = '.q-field__control-container > [data-cy="ZoneEventsToDate"]';
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit(`/#/zone/11/events`);
});
it('should include a one day event, then delete it', () => {
cy.get(addEventBtn).click();
cy.dataCy('ZoneEventInclusionDayRadio').click();
cy.get('.q-card > :nth-child(5)').type('02/04/2001');
cy.get(submitBtn).click();
cy.get(deleteBtn).click();
cy.dataCy('VnConfirm_confirm').click();
});
it('should include an indefinitely event for monday and tuesday', () => {
cy.get(addEventBtn).click();
cy.get('.flex > .q-gutter-x-sm > :nth-child(1)').click();
cy.get('.flex > .q-gutter-x-sm > :nth-child(2)').click();
cy.get(submitBtn).click();
cy.get(deleteBtn).click();
cy.dataCy('VnConfirm_confirm').click();
});
it('should include a range of dates event', () => {
cy.get(addEventBtn).click();
cy.dataCy('ZoneEventInclusionRangeRadio').click();
cy.get('.flex > .q-gutter-x-sm > :nth-child(1)').click();
cy.get(from).type('01/01/2001');
cy.get(to).type('31/01/2001');
cy.get(submitBtn).click();
cy.get(deleteBtn).click();
cy.dataCy('VnConfirm_confirm').click();
});
it('should exclude an event', () => {
cy.visit(`/#/zone/2/events`);
cy.get('.q-mb-sm > .q-radio__inner').click();
cy.get(
'.q-current-day > .q-calendar-month__day--content > [data-cy="ZoneCalendarDay"]',
).click();
cy.get('.q-mt-lg > .q-btn--standard').click();
});
});