Merge branch 'dev' into 7414-ticketHistoryChanges
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jose Antonio Tubau 2025-02-27 07:48:31 +00:00
commit 6ce55eead6
41 changed files with 311 additions and 225 deletions

2
Jenkinsfile vendored
View File

@ -122,7 +122,7 @@ pipeline {
} }
post { post {
always { always {
sh "docker-compose ${env.COMPOSE_PARAMS} down" sh "docker-compose ${env.COMPOSE_PARAMS} down -v"
junit( junit(
testResults: 'junit/e2e.xml', testResults: 'junit/e2e.xml',
allowEmptyResults: true allowEmptyResults: true

View File

@ -31,6 +31,7 @@ export default defineConfig({
requestTimeout: 10000, requestTimeout: 10000,
responseTimeout: 30000, responseTimeout: 30000,
pageLoadTimeout: 60000, pageLoadTimeout: 60000,
defaultBrowser: 'chromium',
fixturesFolder: 'test/cypress/fixtures', fixturesFolder: 'test/cypress/fixtures',
screenshotsFolder: 'test/cypress/screenshots', screenshotsFolder: 'test/cypress/screenshots',
supportFile: 'test/cypress/support/index.js', supportFile: 'test/cypress/support/index.js',
@ -38,17 +39,10 @@ export default defineConfig({
downloadsFolder: 'test/cypress/downloads', downloadsFolder: 'test/cypress/downloads',
video: false, video: false,
specPattern: 'test/cypress/integration/**/*.spec.js', specPattern: 'test/cypress/integration/**/*.spec.js',
experimentalRunAllSpecs: false, experimentalRunAllSpecs: true,
watchForFileChanges: false, watchForFileChanges: true,
reporter: 'cypress-mochawesome-reporter', reporter,
reporterOptions: { reporterOptions,
charts: true,
reportPageTitle: 'Cypress Inline Reporter',
reportFilename: '[status]_[datetime]-report',
embeddedScreenshots: true,
reportDir: 'test/cypress/reports',
inlineAssets: true,
},
component: { component: {
componentFolder: 'src', componentFolder: 'src',
testFiles: '**/*.spec.js', testFiles: '**/*.spec.js',

View File

@ -91,7 +91,6 @@ const components = {
event: updateEvent, event: updateEvent,
attrs: { attrs: {
...defaultAttrs, ...defaultAttrs,
style: 'min-width: 150px',
}, },
forceAttrs, forceAttrs,
}, },

View File

@ -31,6 +31,7 @@ import VnLv from 'components/ui/VnLv.vue';
import VnTableOrder from 'src/components/VnTable/VnOrder.vue'; import VnTableOrder from 'src/components/VnTable/VnOrder.vue';
import VnTableFilter from './VnTableFilter.vue'; import VnTableFilter from './VnTableFilter.vue';
import { getColAlign } from 'src/composables/getColAlign'; import { getColAlign } from 'src/composables/getColAlign';
import RightMenu from '../common/RightMenu.vue';
const arrayData = useArrayData(useAttrs()['data-key']); const arrayData = useArrayData(useAttrs()['data-key']);
const $props = defineProps({ const $props = defineProps({
@ -50,10 +51,6 @@ const $props = defineProps({
type: Boolean, type: Boolean,
default: true, default: true,
}, },
rightSearchIcon: {
type: Boolean,
default: true,
},
rowClick: { rowClick: {
type: [Function, Boolean], type: [Function, Boolean],
default: null, default: null,
@ -165,7 +162,6 @@ const app = inject('app');
const editingRow = ref(null); const editingRow = ref(null);
const editingField = ref(null); const editingField = ref(null);
const isTableMode = computed(() => mode.value == TABLE_MODE); const isTableMode = computed(() => mode.value == TABLE_MODE);
const showRightIcon = computed(() => $props.rightSearch || $props.rightSearchIcon);
const selectRegex = /select/; const selectRegex = /select/;
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']); const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']);
const tableModes = [ const tableModes = [
@ -414,20 +410,13 @@ async function renderInput(rowId, field, clickedElement) {
eventHandlers: { eventHandlers: {
'update:modelValue': async (value) => { 'update:modelValue': async (value) => {
if (isSelect && value) { if (isSelect && value) {
row[column.name] = value[column.attrs?.optionValue ?? 'id']; await updateSelectValue(value, column, row, oldValue);
row[column?.name + 'TextValue'] =
value[column.attrs?.optionLabel ?? 'name'];
await column?.cellEvent?.['update:modelValue']?.(
value,
oldValue,
row,
);
} else row[column.name] = value; } else row[column.name] = value;
await column?.cellEvent?.['update:modelValue']?.(value, oldValue, row); await column?.cellEvent?.['update:modelValue']?.(value, oldValue, row);
}, },
keyup: async (event) => { keyup: async (event) => {
if (event.key === 'Enter') if (event.key === 'Enter')
await destroyInput(rowIndex, field, clickedElement); await destroyInput(rowId, field, clickedElement);
}, },
keydown: async (event) => { keydown: async (event) => {
switch (event.key) { switch (event.key) {
@ -458,6 +447,17 @@ async function renderInput(rowId, field, clickedElement) {
node.el?.querySelector('span > div > div').focus(); node.el?.querySelector('span > div > div').focus();
} }
async function updateSelectValue(value, column, row, oldValue) {
row[column.name] = value[column.attrs?.optionValue ?? 'id'];
row[column?.name + 'VnTableTextValue'] = value[column.attrs?.optionLabel ?? 'name'];
if (column?.attrs?.find?.label)
row[column?.attrs?.find?.label] = value[column.attrs?.optionLabel ?? 'name'];
await column?.cellEvent?.['update:modelValue']?.(value, oldValue, row);
}
async function destroyInput(rowIndex, field, clickedElement) { async function destroyInput(rowIndex, field, clickedElement) {
if (!clickedElement) if (!clickedElement)
clickedElement = document.querySelector( clickedElement = document.querySelector(
@ -520,9 +520,9 @@ function getToggleIcon(value) {
} }
function formatColumnValue(col, row, dashIfEmpty) { function formatColumnValue(col, row, dashIfEmpty) {
if (col?.format || row[col?.name + 'TextValue']) { if (col?.format || row[col?.name + 'VnTableTextValue']) {
if (selectRegex.test(col?.component) && row[col?.name + 'TextValue']) { if (selectRegex.test(col?.component) && row[col?.name + 'VnTableTextValue']) {
return dashIfEmpty(row[col?.name + 'TextValue']); return dashIfEmpty(row[col?.name + 'VnTableTextValue']);
} else { } else {
return col.format(row, dashIfEmpty); return col.format(row, dashIfEmpty);
} }
@ -555,19 +555,33 @@ function formatColumnValue(col, row, dashIfEmpty) {
} }
return dashIfEmpty(row[col?.name]); return dashIfEmpty(row[col?.name]);
} }
function cardClick(_, row) { function cardClick(_, row) {
if ($props.redirect) router.push({ path: `/${$props.redirect}/${row.id}` }); if ($props.redirect) router.push({ path: `/${$props.redirect}/${row.id}` });
} }
function removeTextValue(data, getChanges) {
let changes = data.updates;
if (!changes) return data;
for (const change of changes) {
for (const key in change.data) {
if (key.endsWith('VnTableTextValue')) {
delete change.data[key];
}
}
}
data.updates = changes.filter((change) => Object.keys(change.data).length > 0);
if ($attrs?.beforeSaveFn) data = $attrs.beforeSaveFn(data, getChanges);
return data;
}
</script> </script>
<template> <template>
<QDrawer <RightMenu v-if="$props.rightSearch">
v-if="$props.rightSearch" <template #right-panel>
v-model="stateStore.rightDrawer"
side="right"
:width="256"
:overlay="$props.overlay"
>
<QScrollArea class="fit">
<VnTableFilter <VnTableFilter
:data-key="$attrs['data-key']" :data-key="$attrs['data-key']"
:columns="columns" :columns="columns"
@ -581,8 +595,8 @@ function cardClick(_, row) {
<slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" /> <slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
</template> </template>
</VnTableFilter> </VnTableFilter>
</QScrollArea> </template>
</QDrawer> </RightMenu>
<CrudModel <CrudModel
v-bind="$attrs" v-bind="$attrs"
:class="$attrs['class'] ?? 'q-px-md'" :class="$attrs['class'] ?? 'q-px-md'"
@ -591,6 +605,7 @@ function cardClick(_, row) {
@on-fetch="(...args) => emit('onFetch', ...args)" @on-fetch="(...args) => emit('onFetch', ...args)"
:search-url="searchUrl" :search-url="searchUrl"
:disable-infinite-scroll="isTableMode" :disable-infinite-scroll="isTableMode"
:before-save-fn="removeTextValue"
@save-changes="reload" @save-changes="reload"
:has-sub-toolbar="$props.hasSubToolbar ?? isEditable" :has-sub-toolbar="$props.hasSubToolbar ?? isEditable"
:auto-load="hasParams || $attrs['auto-load']" :auto-load="hasParams || $attrs['auto-load']"
@ -635,6 +650,7 @@ function cardClick(_, row) {
:skip="columnsVisibilitySkipped" :skip="columnsVisibilitySkipped"
/> />
<QBtnToggle <QBtnToggle
v-if="!tableModes.some((mode) => mode.disable)"
v-model="mode" v-model="mode"
toggle-color="primary" toggle-color="primary"
class="bg-vn-section-color" class="bg-vn-section-color"

View File

@ -76,6 +76,15 @@ onBeforeMount(async () => {
); );
}); });
const routeName = computed(() => {
const DESCRIPTOR_PROXY = 'DescriptorProxy';
let name = $props.dataKey;
if ($props.dataKey.includes(DESCRIPTOR_PROXY)) {
name = name.split(DESCRIPTOR_PROXY)[0];
}
return `${name}Summary`;
});
async function getData() { async function getData() {
store.url = $props.url; store.url = $props.url;
store.filter = $props.filter ?? {}; store.filter = $props.filter ?? {};
@ -154,9 +163,7 @@ const toModule = computed(() =>
{{ t('components.smartCard.openSummary') }} {{ t('components.smartCard.openSummary') }}
</QTooltip> </QTooltip>
</QBtn> </QBtn>
<RouterLink <RouterLink :to="{ name: routeName, params: { id: entity.id } }">
:to="{ name: `${dataKey}Summary`, params: { id: entity.id } }"
>
<QBtn <QBtn
class="link" class="link"
color="white" color="white"
@ -218,7 +225,7 @@ const toModule = computed(() =>
<div class="icons"> <div class="icons">
<slot name="icons" :entity="entity" /> <slot name="icons" :entity="entity" />
</div> </div>
<div class="actions justify-center"> <div class="actions justify-center" data-cy="descriptor_actions">
<slot name="actions" :entity="entity" /> <slot name="actions" :entity="entity" />
</div> </div>
<slot name="after" /> <slot name="after" />

View File

@ -153,6 +153,7 @@ globals:
maxTemperature: Max maxTemperature: Max
minTemperature: Min minTemperature: Min
changePass: Change password changePass: Change password
setPass: Set password
deleteConfirmTitle: Delete selected elements deleteConfirmTitle: Delete selected elements
changeState: Change state changeState: Change state
raid: 'Raid {daysInForward} days' raid: 'Raid {daysInForward} days'

View File

@ -157,6 +157,7 @@ globals:
maxTemperature: Máx maxTemperature: Máx
minTemperature: Mín minTemperature: Mín
changePass: Cambiar contraseña changePass: Cambiar contraseña
setPass: Establecer contraseña
deleteConfirmTitle: Eliminar los elementos seleccionados deleteConfirmTitle: Eliminar los elementos seleccionados
changeState: Cambiar estado changeState: Cambiar estado
raid: 'Redada {daysInForward} días' raid: 'Redada {daysInForward} días'
@ -786,7 +787,7 @@ worker:
notes: Notas notes: Notas
operator: operator:
numberOfWagons: Número de vagones numberOfWagons: Número de vagones
train: tren train: Tren
itemPackingType: Tipo de embalaje itemPackingType: Tipo de embalaje
warehouse: Almacén warehouse: Almacén
sector: Sector sector: Sector

View File

@ -25,12 +25,13 @@ const $props = defineProps({
const { t } = useI18n(); const { t } = useI18n();
const { hasAccount } = toRefs($props); const { hasAccount } = toRefs($props);
const { openConfirmationModal } = useVnConfirm(); const { openConfirmationModal } = useVnConfirm();
const arrayData = useArrayData('Account');
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
const state = useState(); const state = useState();
const user = state.getUser(); const user = state.getUser();
const { notify } = useQuasar(); const { notify } = useQuasar();
const account = computed(() => useArrayData('Account').store.data[0]); const account = computed(() => arrayData.store.data);
account.value.hasAccount = hasAccount.value; account.value.hasAccount = hasAccount.value;
const entityId = computed(() => +route.params.id); const entityId = computed(() => +route.params.id);
const hasitManagementAccess = ref(); const hasitManagementAccess = ref();
@ -39,7 +40,7 @@ const isHimself = computed(() => user.value.id === account.value.id);
const url = computed(() => const url = computed(() =>
isHimself.value isHimself.value
? 'Accounts/change-password' ? 'Accounts/change-password'
: `Accounts/${entityId.value}/setPassword` : `Accounts/${entityId.value}/setPassword`,
); );
async function updateStatusAccount(active) { async function updateStatusAccount(active) {
@ -153,6 +154,7 @@ onMounted(() => {
t('account.card.actions.disableAccount.title'), t('account.card.actions.disableAccount.title'),
t('account.card.actions.disableAccount.subtitle'), t('account.card.actions.disableAccount.subtitle'),
() => deleteAccount(), () => deleteAccount(),
() => deleteAccount(),
) )
" "
> >
@ -172,6 +174,7 @@ onMounted(() => {
t('account.card.actions.enableAccount.title'), t('account.card.actions.enableAccount.title'),
t('account.card.actions.enableAccount.subtitle'), t('account.card.actions.enableAccount.subtitle'),
() => updateStatusAccount(true), () => updateStatusAccount(true),
() => updateStatusAccount(true),
) )
" "
> >
@ -186,6 +189,7 @@ onMounted(() => {
t('account.card.actions.disableAccount.title'), t('account.card.actions.disableAccount.title'),
t('account.card.actions.disableAccount.subtitle'), t('account.card.actions.disableAccount.subtitle'),
() => updateStatusAccount(false), () => updateStatusAccount(false),
() => updateStatusAccount(false),
) )
" "
> >
@ -201,6 +205,7 @@ onMounted(() => {
t('account.card.actions.activateUser.title'), t('account.card.actions.activateUser.title'),
t('account.card.actions.activateUser.title'), t('account.card.actions.activateUser.title'),
() => updateStatusUser(true), () => updateStatusUser(true),
() => updateStatusUser(true),
) )
" "
> >
@ -215,6 +220,7 @@ onMounted(() => {
t('account.card.actions.deactivateUser.title'), t('account.card.actions.deactivateUser.title'),
t('account.card.actions.deactivateUser.title'), t('account.card.actions.deactivateUser.title'),
() => updateStatusUser(false), () => updateStatusUser(false),
() => updateStatusUser(false),
) )
" "
> >

View File

@ -639,7 +639,7 @@ onMounted(() => {
'flex-wrap': 'wrap', 'flex-wrap': 'wrap',
gap: '16px', gap: '16px',
position: 'relative', position: 'relative',
height: '450px', height: '500px',
}, },
columnGridStyle: { columnGridStyle: {
'max-width': '50%', 'max-width': '50%',
@ -650,7 +650,7 @@ onMounted(() => {
:is-editable="editableMode" :is-editable="editableMode"
:without-header="!editableMode" :without-header="!editableMode"
:with-filters="editableMode" :with-filters="editableMode"
:right-search="true" :right-search="editableMode"
:right-search-icon="true" :right-search-icon="true"
:row-click="false" :row-click="false"
:columns="columns" :columns="columns"

View File

@ -274,7 +274,7 @@ onBeforeMount(async () => {
:array-data-props="{ :array-data-props="{
url: 'Entries/filter', url: 'Entries/filter',
order: 'landed DESC', order: 'landed DESC',
userFilter: EntryFilter, userFilter: entryQueryFilter,
}" }"
> >
<template #advanced-menu> <template #advanced-menu>

View File

@ -3,7 +3,7 @@ import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import { dashIfEmpty, toDate, toHour } from 'src/filters'; import { toDate, toHour } from 'src/filters';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { usePrintService } from 'src/composables/usePrintService'; import { usePrintService } from 'src/composables/usePrintService';

View File

@ -45,8 +45,6 @@ const filter = {
:label="t('parking.sector')" :label="t('parking.sector')"
:value="entity.sector?.description" :value="entity.sector?.description"
/> />
<VnLv :label="t('parking.row')" :value="entity.row" />
<VnLv :label="t('parking.column')" :value="entity.column" />
</QCard> </QCard>
</template> </template>
</CardSummary> </CardSummary>

View File

@ -1,19 +1,15 @@
<script setup> <script setup>
import { onMounted, onUnmounted } from 'vue'; import { computed, onMounted, onUnmounted } from 'vue';
import { useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import VnPaginate from 'components/ui/VnPaginate.vue'; import VnTable from 'components/VnTable/VnTable.vue';
import CardList from 'components/ui/CardList.vue';
import VnLv from 'components/ui/VnLv.vue';
import ParkingFilter from './ParkingFilter.vue';
import ParkingSummary from './Card/ParkingSummary.vue';
import exprBuilder from './ParkingExprBuilder.js';
import VnSection from 'src/components/common/VnSection.vue'; import VnSection from 'src/components/common/VnSection.vue';
import ParkingFilter from './ParkingFilter.vue';
import exprBuilder from './ParkingExprBuilder.js';
import ParkingSummary from './Card/ParkingSummary.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const { push } = useRouter();
const { t } = useI18n(); const { t } = useI18n();
const { viewSummary } = useSummaryDialog(); const { viewSummary } = useSummaryDialog();
const dataKey = 'ParkingList'; const dataKey = 'ParkingList';
@ -24,7 +20,48 @@ onUnmounted(() => (stateStore.rightDrawer = false));
const filter = { const filter = {
fields: ['id', 'sectorFk', 'code', 'pickingOrder'], fields: ['id', 'sectorFk', 'code', 'pickingOrder'],
}; };
const columns = computed(() => [
{
align: 'left',
name: 'code',
label: t('globals.code'),
isId: true,
isTitle: true,
columnFilter: false,
sortable: true,
},
{
align: 'left',
name: 'sector',
label: t('parking.sector'),
format: (val) => val.sector.description ?? '',
sortable: true,
cardVisible: true,
},
{
align: 'left',
name: 'pickingOrder',
label: t('parking.pickingOrder'),
sortable: true,
cardVisible: true,
},
{
align: 'right',
label: '',
name: 'tableActions',
actions: [
{
title: t('components.smartCard.viewSummary'),
icon: 'preview',
action: (row) => viewSummary(row.id, ParkingSummary),
isPrimary: true,
},
],
},
]);
</script> </script>
<template> <template>
<VnSection <VnSection
:data-key="dataKey" :data-key="dataKey"
@ -40,41 +77,24 @@ const filter = {
<ParkingFilter data-key="ParkingList" /> <ParkingFilter data-key="ParkingList" />
</template> </template>
<template #body> <template #body>
<QPage class="column items-center q-pa-md"> <VnTable
<div class="vn-card-list"> :data-key="dataKey"
<VnPaginate :data-key="dataKey"> :columns="columns"
<template #body="{ rows }"> is-editable="false"
<CardList :right-search="false"
v-for="row of rows" :use-model="true"
:key="row.id" :disable-option="{ table: true }"
:id="row.id" redirect="shelving/parking"
:title="row.code" default-mode="card"
@click=" >
push({ path: `/shelving/parking/${row.id}/summary` }) <template #actions="{ row }">
" <QBtn
> :label="t('components.smartCard.openSummary')"
<template #list-items> @click.stop="viewSummary(row.id, ParkingSummary)"
<VnLv color="primary"
label="Sector" />
:value="row.sector?.description" </template>
/> </VnTable>
<VnLv
:label="t('parking.pickingOrder')"
:value="row.pickingOrder"
/>
</template>
<template #actions>
<QBtn
:label="t('components.smartCard.openSummary')"
@click.stop="viewSummary(row.id, ParkingSummary)"
color="primary"
/>
</template>
</CardList>
</template>
</VnPaginate>
</div>
</QPage>
</template> </template>
</VnSection> </VnSection>
</template> </template>

View File

@ -17,6 +17,12 @@ const maritalStatus = [
{ code: 'M', name: t('Married') }, { code: 'M', name: t('Married') },
{ code: 'S', name: t('Single') }, { code: 'S', name: t('Single') },
]; ];
async function setAdvancedSummary(data) {
const advanced = (await useAdvancedSummary('Workers', data.id)) ?? {};
Object.assign(form.value.formData, advanced);
await nextTick();
if (form.value) form.value.hasChanges = false;
}
</script> </script>
<template> <template>
<FetchData <FetchData
@ -36,18 +42,22 @@ const maritalStatus = [
:url-update="`Workers/${$route.params.id}`" :url-update="`Workers/${$route.params.id}`"
auto-load auto-load
model="Worker" model="Worker"
@on-fetch=" @on-fetch="setAdvancedSummary"
async (data) => {
Object.assign(data, (await useAdvancedSummary('Workers', data.id)) ?? {});
await $nextTick();
if (form) form.hasChanges = false;
}
"
> >
<template #form="{ data }"> <template #form="{ data }">
<VnRow> <VnRow>
<VnInput :label="t('Name')" clearable v-model="data.firstName" /> <VnInput
<VnInput :label="t('Last name')" clearable v-model="data.lastName" /> :label="t('Name')"
clearable
v-model="data.firstName"
:required="true"
/>
<VnInput
:label="t('Last name')"
clearable
v-model="data.lastName"
:required="true"
/>
</VnRow> </VnRow>
<VnRow> <VnRow>
<VnInput v-model="data.phone" :label="t('Business phone')" clearable /> <VnInput v-model="data.phone" :label="t('Business phone')" clearable />

View File

@ -12,6 +12,11 @@ const $props = defineProps({
<template> <template>
<QPopupProxy> <QPopupProxy>
<WorkerDescriptor v-if="$props.id" :id="$props.id" :summary="WorkerSummary" /> <WorkerDescriptor
v-if="$props.id"
:id="$props.id"
:summary="WorkerSummary"
data-key="WorkerDescriptorProxy"
/>
</QPopupProxy> </QPopupProxy>
</template> </template>

View File

@ -54,9 +54,8 @@ watch(
selected.value = []; selected.value = [];
} }
}, },
{ immediate: true, deep: true } { immediate: true, deep: true },
); );
</script> </script>
<template> <template>
@ -105,6 +104,7 @@ watch(
:options="trainsData" :options="trainsData"
hide-selected hide-selected
v-model="row.trainFk" v-model="row.trainFk"
:required="true"
/> />
</VnRow> </VnRow>
<VnRow> <VnRow>
@ -115,12 +115,14 @@ watch(
option-label="code" option-label="code"
option-value="code" option-value="code"
v-model="row.itemPackingTypeFk" v-model="row.itemPackingTypeFk"
:required="true"
/> />
<VnSelect <VnSelect
:label="t('worker.operator.warehouse')" :label="t('worker.operator.warehouse')"
:options="warehousesData" :options="warehousesData"
hide-selected hide-selected
v-model="row.warehouseFk" v-model="row.warehouseFk"
:required="true"
/> />
</VnRow> </VnRow>
<VnRow> <VnRow>
@ -175,6 +177,7 @@ watch(
:label="t('worker.operator.isOnReservationMode')" :label="t('worker.operator.isOnReservationMode')"
v-model="row.isOnReservationMode" v-model="row.isOnReservationMode"
lazy-rules lazy-rules
:required="true"
/> />
</VnRow> </VnRow>
<VnRow> <VnRow>

View File

@ -1,8 +1,8 @@
src/pages/Worker/Card/WorkerPBX.vue
<script setup> <script setup>
import { useI18n } from 'vue-i18n';
import FormModel from 'src/components/FormModel.vue'; import FormModel from 'src/components/FormModel.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
const { t } = useI18n();
</script> </script>
<template> <template>
@ -26,3 +26,8 @@ import VnInput from 'src/components/common/VnInput.vue';
</template> </template>
</FormModel> </FormModel>
</template> </template>
<i18n>
es:
It must be a 4-digit number and must not end in 00: Debe ser un número de 4 cifras y no terminar en 00
</i18n>

View File

@ -140,6 +140,7 @@ function reloadData() {
id="deviceProductionFk" id="deviceProductionFk"
hide-selected hide-selected
data-cy="pda-dialog-select" data-cy="pda-dialog-select"
:required="true"
> >
<template #option="scope"> <template #option="scope">
<QItem v-bind="scope.itemProps"> <QItem v-bind="scope.itemProps">

View File

@ -1,16 +1,9 @@
<script setup> <script setup>
import VnSection from 'src/components/common/VnSection.vue';
import WorkerDepartmentTree from './WorkerDepartmentTree.vue'; import WorkerDepartmentTree from './WorkerDepartmentTree.vue';
</script> </script>
<template> <template>
<VnSection data-key="WorkerDepartment" :search-bar="false"> <QPage class="q-pa-md flex justify-center"> <WorkerDepartmentTree /> </QPage>
<template #body>
<div class="flex flex-center q-pa-md">
<WorkerDepartmentTree />
</div>
</template>
</VnSection>
</template> </template>
<i18n> <i18n>

View File

@ -0,0 +1,24 @@
describe('ClaimNotes', () => {
const descriptorOptions = '[data-cy="descriptor-more-opts-menu"] > .q-list';
const url = '/#/account/1/summary';
it('should see all the account options', () => {
cy.login('itManagement');
cy.visit(url);
cy.dataCy('descriptor-more-opts').click();
cy.get(descriptorOptions)
.find('.q-item')
.its('length')
.then((count) => {
cy.log('Número de opciones:', count);
expect(count).to.equal(5);
});
});
it('should not see any option', () => {
cy.login('salesPerson');
cy.visit(url);
cy.dataCy('descriptor-more-opts').click();
cy.get(descriptorOptions).should('not.be.visible');
});
});

View File

@ -35,8 +35,7 @@ describe('ClaimDevelopment', () => {
cy.saveCard(); cy.saveCard();
}); });
// TODO: #8112 it('should add and remove new line', () => {
xit('should add and remove new line', () => {
cy.wait(['@workers', '@workers']); cy.wait(['@workers', '@workers']);
cy.addCard(); cy.addCard();

View File

@ -8,10 +8,7 @@ describe('ClaimNotes', () => {
it('should add a new note', () => { it('should add a new note', () => {
const message = 'This is a new message.'; const message = 'This is a new message.';
cy.get('.q-textarea') cy.get('.q-textarea').should('not.be.disabled').type(message);
.should('be.visible')
.should('not.be.disabled')
.type(message);
cy.get(saveBtn).click(); cy.get(saveBtn).click();
cy.get(firstNote).should('have.text', message); cy.get(firstNote).should('have.text', message);

View File

@ -25,33 +25,33 @@ describe.skip('ClaimPhoto', () => {
it('should open first image dialog change to second and close', () => { it('should open first image dialog change to second and close', () => {
cy.get(':nth-last-child(1) > .q-card').click(); cy.get(':nth-last-child(1) > .q-card').click();
cy.get('.q-carousel__slide > .q-img > .q-img__container > .q-img__image').should( cy.get('.q-carousel__slide > .q-img > .q-img__container > .q-img__image').should(
'be.visible' 'be.visible',
); );
cy.get('.q-carousel__control > button').click(); cy.get('.q-carousel__control > button').click();
cy.get( cy.get(
'.q-dialog__inner > .q-toolbar > .q-btn > .q-btn__content > .q-icon' '.q-dialog__inner > .q-toolbar > .q-btn > .q-btn__content > .q-icon',
).click(); ).click();
cy.get('.q-carousel__slide > .q-img > .q-img__container > .q-img__image').should( cy.get('.q-carousel__slide > .q-img > .q-img__container > .q-img__image').should(
'not.be.visible' 'not.be.visible',
); );
}); });
it('should remove third and fourth file', () => { it('should remove third and fourth file', () => {
cy.get( cy.get(
'.multimediaParent > :nth-last-child(1) > .q-btn > .q-btn__content > .q-icon' '.multimediaParent > :nth-last-child(1) > .q-btn > .q-btn__content > .q-icon',
).click(); ).click();
cy.get( cy.get(
'.q-card__actions > .q-btn--unelevated > .q-btn__content > .block' '.q-card__actions > .q-btn--unelevated > .q-btn__content > .block',
).click(); ).click();
cy.get('.q-notification__message').should('have.text', 'Data deleted'); cy.get('.q-notification__message').should('have.text', 'Data deleted');
cy.get( cy.get(
'.multimediaParent > :nth-last-child(1) > .q-btn > .q-btn__content > .q-icon' '.multimediaParent > :nth-last-child(1) > .q-btn > .q-btn__content > .q-icon',
).click(); ).click();
cy.get( cy.get(
'.q-card__actions > .q-btn--unelevated > .q-btn__content > .block' '.q-card__actions > .q-btn--unelevated > .q-btn__content > .block',
).click(); ).click();
cy.get('.q-notification__message').should('have.text', 'Data deleted'); cy.get('.q-notification__message').should('have.text', 'Data deleted');
}); });

View File

@ -4,7 +4,6 @@ describe('Client consignee', () => {
cy.viewport(1280, 720); cy.viewport(1280, 720);
cy.login('developer'); cy.login('developer');
cy.visit('#/customer/1107/address'); cy.visit('#/customer/1107/address');
cy.domContentLoad();
}); });
it('Should load layout', () => { it('Should load layout', () => {
cy.get('.q-card').should('be.visible'); cy.get('.q-card').should('be.visible');

View File

@ -4,7 +4,6 @@ describe('Client fiscal data', () => {
cy.viewport(1280, 720); cy.viewport(1280, 720);
cy.login('developer'); cy.login('developer');
cy.visit('#/customer/1107/fiscal-data'); cy.visit('#/customer/1107/fiscal-data');
cy.domContentLoad();
}); });
it('Should change required value when change customer', () => { it('Should change required value when change customer', () => {
cy.get('.q-card').should('be.visible'); cy.get('.q-card').should('be.visible');

View File

@ -1,7 +1,6 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('Client list', () => { describe('Client list', () => {
beforeEach(() => { beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer'); cy.login('developer');
cy.visit('/#/customer/list', { cy.visit('/#/customer/list', {
timeout: 5000, timeout: 5000,
@ -28,7 +27,7 @@ describe('Client list', () => {
Email: { val: `user.test${randomInt}@cypress.com` }, Email: { val: `user.test${randomInt}@cypress.com` },
'Sales person': { val: 'salesPerson', type: 'select' }, 'Sales person': { val: 'salesPerson', type: 'select' },
Location: { val: '46000', type: 'select' }, Location: { val: '46000', type: 'select' },
'Business type': { val: 'Otros', type: 'select' }, 'Business type': { val: 'others', type: 'select' },
}; };
cy.fillInForm(data); cy.fillInForm(data);
@ -37,6 +36,7 @@ describe('Client list', () => {
cy.checkNotification('Data created'); cy.checkNotification('Data created');
cy.url().should('include', '/summary'); cy.url().should('include', '/summary');
}); });
it('Client list search client', () => { it('Client list search client', () => {
const search = 'Jessica Jones'; const search = 'Jessica Jones';
cy.searchByLabel('Name', search); cy.searchByLabel('Name', search);
@ -59,6 +59,7 @@ describe('Client list', () => {
cy.checkValueForm(1, search); cy.checkValueForm(1, search);
cy.checkValueForm(2, search); cy.checkValueForm(2, search);
}); });
it('Client founded create order', () => { it('Client founded create order', () => {
const search = 'Jessica Jones'; const search = 'Jessica Jones';
cy.searchByLabel('Name', search); cy.searchByLabel('Name', search);

View File

@ -9,7 +9,7 @@ describe('InvoiceInList', () => {
cy.viewport(1920, 1080); cy.viewport(1920, 1080);
cy.login('developer'); cy.login('developer');
cy.visit(`/#/invoice-in/list`); cy.visit(`/#/invoice-in/list`);
cy.get('#searchbar input').should('be.visible').type('{enter}'); cy.get('#searchbar input').type('{enter}');
}); });
it('should redirect on clicking a invoice', () => { it('should redirect on clicking a invoice', () => {
@ -21,7 +21,7 @@ describe('InvoiceInList', () => {
cy.url().should('include', `/invoice-in/${id}/summary`); cy.url().should('include', `/invoice-in/${id}/summary`);
}); });
}); });
// https://redmine.verdnatura.es/issues/8420
it('should open the details', () => { it('should open the details', () => {
cy.get(firstDetailBtn).click(); cy.get(firstDetailBtn).click();
cy.get(summaryHeaders).eq(1).contains('Basic data'); cy.get(summaryHeaders).eq(1).contains('Basic data');

View File

@ -11,7 +11,7 @@ describe('Handle Items FixedPrice', () => {
cy.visit('/#/item/fixed-price', { timeout: 5000 }); cy.visit('/#/item/fixed-price', { timeout: 5000 });
cy.waitForElement('.q-table'); cy.waitForElement('.q-table');
cy.get( cy.get(
'.q-header > .q-toolbar > :nth-child(1) > .q-btn__content > .q-icon' '.q-header > .q-toolbar > :nth-child(1) > .q-btn__content > .q-icon',
).click(); ).click();
}); });
it.skip('filter', function () { it.skip('filter', function () {
@ -38,7 +38,7 @@ describe('Handle Items FixedPrice', () => {
cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click(); cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click();
cy.get(`${firstRow} > .text-right > .q-btn > .q-btn__content > .q-icon`).click(); cy.get(`${firstRow} > .text-right > .q-btn > .q-btn__content > .q-icon`).click();
cy.get( cy.get(
'.q-card__actions > .q-btn--unelevated > .q-btn__content > .block' '.q-card__actions > .q-btn--unelevated > .q-btn__content > .block',
).click(); ).click();
cy.get('.q-notification__message').should('have.text', 'Data saved'); cy.get('.q-notification__message').should('have.text', 'Data saved');
}); });
@ -56,7 +56,7 @@ describe('Handle Items FixedPrice', () => {
cy.get(' .bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner ').click(); cy.get(' .bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner ').click();
cy.get('#subToolbar > .q-btn--flat').click(); cy.get('#subToolbar > .q-btn--flat').click();
cy.get( cy.get(
'.q-card__actions > .q-btn--unelevated > .q-btn__content > .block' '.q-card__actions > .q-btn--unelevated > .q-btn__content > .block',
).click(); ).click();
cy.get('.q-notification__message').should('have.text', 'Data saved'); cy.get('.q-notification__message').should('have.text', 'Data saved');
}); });

View File

@ -15,6 +15,7 @@ describe('Item list', () => {
cy.get('.q-menu .q-item').contains('Anthurium').click(); cy.get('.q-menu .q-item').contains('Anthurium').click();
cy.get('.q-virtual-scroll__content > :nth-child(4) > :nth-child(4)').click(); cy.get('.q-virtual-scroll__content > :nth-child(4) > :nth-child(4)').click();
}); });
// https://redmine.verdnatura.es/issues/8421 // https://redmine.verdnatura.es/issues/8421
it.skip('should create an item', () => { it.skip('should create an item', () => {
const data = { const data = {
@ -28,7 +29,7 @@ describe('Item list', () => {
cy.dataCy('FormModelPopup_save').click(); cy.dataCy('FormModelPopup_save').click();
cy.checkNotification('Data created'); cy.checkNotification('Data created');
cy.get( cy.get(
':nth-child(2) > .q-drawer > .q-drawer__content > .q-scrollarea > .q-scrollarea__container > .q-scrollarea__content' ':nth-child(2) > .q-drawer > .q-drawer__content > .q-scrollarea > .q-scrollarea__container > .q-scrollarea__content',
).should('be.visible'); ).should('be.visible');
}); });
}); });

View File

@ -1,23 +0,0 @@
/// <reference types="cypress" />
describe('ParkingBasicData', () => {
const codeInput = 'form .q-card .q-input input';
const sectorSelect = 'form .q-card .q-select input';
const sectorOpt = '.q-menu .q-item';
beforeEach(() => {
cy.login('developer');
cy.visit(`/#/shelving/parking/1/basic-data`);
});
it('should edit the code and sector', () => {
cy.get(sectorSelect).type('Second');
cy.get(sectorOpt).click();
cy.get(codeInput).eq(0).clear();
cy.get(codeInput).eq(0).type('900-001');
cy.saveCard();
cy.get(sectorSelect).should('have.value', 'Second sector');
cy.get(codeInput).should('have.value', '900-001');
});
});

View File

@ -1,33 +0,0 @@
/// <reference types="cypress" />
describe('ParkingList', () => {
const searchbar = '#searchbar input';
const firstCard = '.q-card:nth-child(1)';
const firstChipId =
':nth-child(1) > :nth-child(1) > .justify-between > .flex > .q-chip > .q-chip__content';
const firstDetailBtn =
':nth-child(1) > :nth-child(1) > .card-list-body > .actions > .q-btn';
const summaryHeader = '.summaryBody .header';
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/shelving/parking/list`);
});
it('should redirect on clicking a parking', () => {
cy.get(searchbar).type('{enter}');
cy.get(firstChipId)
.invoke('text')
.then((content) => {
const id = content.substring(4);
cy.get(firstCard).click();
cy.url().should('include', `/parking/${id}/summary`);
});
});
it('should open the details', () => {
cy.get(searchbar).type('{enter}');
cy.get(firstDetailBtn).click();
cy.get(summaryHeader).contains('Basic data');
});
});

View File

@ -0,0 +1,32 @@
/// <reference types="cypress" />
describe('ParkingBasicData', () => {
const codeInput = 'form .q-card .q-input input';
const sectorSelect = 'form .q-card .q-select input';
const sectorOpt = '.q-menu .q-item';
beforeEach(() => {
cy.login('developer');
cy.visit(`/#/shelving/parking/1/basic-data`);
});
it('should give an error if the code aldready exists', () => {
cy.get(codeInput).eq(0).should('have.value', '700-01').clear();
cy.get(codeInput).eq(0).type('700-02');
cy.saveCard();
cy.get('.q-notification__message').should('have.text', 'The code already exists');
});
it('should edit the code and sector', () => {
cy.get(sectorSelect).type('First');
cy.get(sectorOpt).click();
cy.get(codeInput).eq(0).clear();
cy.get(codeInput).eq(0).type('700-01');
cy.dataCy('Picking order_input').clear().type(80230);
cy.saveCard();
cy.get('.q-notification__message').should('have.text', 'Data saved');
cy.get(sectorSelect).should('have.value', 'First sector');
cy.get(codeInput).should('have.value', '700-01');
cy.dataCy('Picking order_input').should('have.value', 80230);
});
});

View File

@ -0,0 +1,30 @@
/// <reference types="cypress" />
describe('ParkingList', () => {
const searchbar = '#searchbar input';
const firstCard = ':nth-child(1) > .q-card > .no-margin > .q-py-none';
const summaryHeader = '.summaryBody .header';
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/shelving/parking/list`);
});
it('should redirect on clicking a parking', () => {
cy.get(searchbar).type('{enter}');
cy.get(firstCard).click();
cy.get(summaryHeader).contains('Basic data');
});
it('should filter and redirect if there is only one result', () => {
cy.dataCy('Code_input').type('1{enter}');
cy.dataCy('Sector_select').type('Normal{enter}');
cy.get(summaryHeader).contains('Basic data');
});
it('should filter and redirect to summary if only one result', () => {
cy.dataCy('Code_input').type('A{enter}');
cy.dataCy('Sector_select').type('First Sector{enter}');
cy.url().should('match', /\/shelving\/parking\/\d+\/summary/);
});
});

View File

@ -30,8 +30,6 @@ describe('Ticket descriptor', () => {
it('should set the weight of the ticket', () => { it('should set the weight of the ticket', () => {
cy.visit('/#/ticket/10/summary'); cy.visit('/#/ticket/10/summary');
cy.intercept('GET', /\/api\/Tickets\/\d/).as('ticket');
cy.wait('@ticket');
cy.openActionsDescriptor(); cy.openActionsDescriptor();
cy.contains(listItem, setWeightOpt).click(); cy.contains(listItem, setWeightOpt).click();
cy.intercept('POST', /\/api\/Tickets\/\d+\/setWeight/).as('weight'); cy.intercept('POST', /\/api\/Tickets\/\d+\/setWeight/).as('weight');

View File

@ -1,6 +1,5 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
// https://redmine.verdnatura.es/issues/8423 describe('Ticket expedtion', () => {
describe.skip('Ticket expedtion', () => {
const tableContent = '.q-table .q-virtual-scroll__content'; const tableContent = '.q-table .q-virtual-scroll__content';
const stateTd = 'td:nth-child(9)'; const stateTd = 'td:nth-child(9)';

View File

@ -3,7 +3,6 @@ describe('VnInput Component', () => {
cy.login('developer'); cy.login('developer');
cy.viewport(1920, 1080); cy.viewport(1920, 1080);
cy.visit('/#/supplier/1/fiscal-data'); cy.visit('/#/supplier/1/fiscal-data');
cy.domContentLoad();
}); });
it('should replace character at cursor position in insert mode', () => { it('should replace character at cursor position in insert mode', () => {
@ -14,8 +13,7 @@ describe('VnInput Component', () => {
cy.dataCy('supplierFiscalDataAccount').type('{movetostart}'); cy.dataCy('supplierFiscalDataAccount').type('{movetostart}');
// Escribe un número y verifica que se reemplace correctamente // Escribe un número y verifica que se reemplace correctamente
cy.dataCy('supplierFiscalDataAccount').type('999'); cy.dataCy('supplierFiscalDataAccount').type('999');
cy.dataCy('supplierFiscalDataAccount') cy.dataCy('supplierFiscalDataAccount').should('have.value', '9990000001');
.should('have.value', '9990000001');
}); });
it('should replace character at cursor position in insert mode', () => { it('should replace character at cursor position in insert mode', () => {
@ -26,14 +24,12 @@ describe('VnInput Component', () => {
cy.dataCy('supplierFiscalDataAccount').type('{movetostart}'); cy.dataCy('supplierFiscalDataAccount').type('{movetostart}');
// Escribe un número y verifica que se reemplace correctamente en la posicion incial // Escribe un número y verifica que se reemplace correctamente en la posicion incial
cy.dataCy('supplierFiscalDataAccount').type('999'); cy.dataCy('supplierFiscalDataAccount').type('999');
cy.dataCy('supplierFiscalDataAccount') cy.dataCy('supplierFiscalDataAccount').should('have.value', '9990000001');
.should('have.value', '9990000001');
}); });
it('should respect maxlength prop', () => { it('should respect maxlength prop', () => {
cy.dataCy('supplierFiscalDataAccount').clear(); cy.dataCy('supplierFiscalDataAccount').clear();
cy.dataCy('supplierFiscalDataAccount').type('123456789012345'); cy.dataCy('supplierFiscalDataAccount').type('123456789012345');
cy.dataCy('supplierFiscalDataAccount') cy.dataCy('supplierFiscalDataAccount').should('have.value', '1234567890'); // asumiendo que maxlength es 10
.should('have.value', '1234567890'); // asumiendo que maxlength es 10
}); });
}); });

View File

@ -17,7 +17,6 @@ describe('VnLocation', () => {
cy.viewport(1280, 720); cy.viewport(1280, 720);
cy.login('developer'); cy.login('developer');
cy.visit('/#/supplier/567/fiscal-data', { timeout: 7000 }); cy.visit('/#/supplier/567/fiscal-data', { timeout: 7000 });
cy.domContentLoad();
cy.get(createLocationButton).click(); cy.get(createLocationButton).click();
}); });
it('should filter provinces based on selected country', () => { it('should filter provinces based on selected country', () => {

View File

@ -18,6 +18,6 @@ describe('WagonCreate', () => {
).type('100'); ).type('100');
cy.dataCy('Type_select').type('{downarrow}{enter}'); cy.dataCy('Type_select').type('{downarrow}{enter}');
cy.get('[title="Remove"] > .q-btn__content > .q-icon').click(); cy.get('[title="Remove"] > .q-btn__content > .q-icon').first().click();
}); });
}); });

View File

@ -1,4 +1,4 @@
describe('WorkerCreate', () => { describe.skip('WorkerCreate', () => {
const externalRadio = '.q-radio:nth-child(2)'; const externalRadio = '.q-radio:nth-child(2)';
const developerBossId = 120; const developerBossId = 120;
const payMethodCross = const payMethodCross =

View File

@ -9,13 +9,7 @@ describe('ZoneBasicData', () => {
}); });
it('should throw an error if the name is empty', () => { it('should throw an error if the name is empty', () => {
cy.intercept('GET', /\/api\/Zones\/4./).as('zone'); cy.get('[data-cy="zone-basic-data-name"] input').type('{selectall}{backspace}');
cy.wait('@zone').then(() => {
cy.get('[data-cy="zone-basic-data-name"] input').type(
'{selectall}{backspace}',
);
});
cy.get(saveBtn).click(); cy.get(saveBtn).click();
cy.checkNotification("can't be blank"); cy.checkNotification("can't be blank");

View File

@ -33,7 +33,8 @@ Cypress.Commands.add('waitUntil', { prevSubject: 'optional' }, waitUntil);
Cypress.Commands.add('resetDB', () => { Cypress.Commands.add('resetDB', () => {
cy.exec('pnpm run resetDatabase'); cy.exec('pnpm run resetDatabase');
}); });
Cypress.Commands.add('login', (user) => {
Cypress.Commands.add('login', (user = 'developer') => {
//cy.visit('/#/login'); //cy.visit('/#/login');
cy.request({ cy.request({
method: 'POST', method: 'POST',
@ -56,9 +57,12 @@ Cypress.Commands.add('login', (user) => {
}); });
}); });
Cypress.Commands.add('domContentLoad', (element, timeout = 5000) => { Cypress.Commands.overwrite('visit', (originalFn, url, options) => {
originalFn(url, options);
cy.waitUntil(() => cy.document().then((doc) => doc.readyState === 'complete')); cy.waitUntil(() => cy.document().then((doc) => doc.readyState === 'complete'));
cy.waitUntil(() => cy.get('main').should('exist'));
}); });
Cypress.Commands.add('waitForElement', (element, timeout = 10000) => { Cypress.Commands.add('waitForElement', (element, timeout = 10000) => {
cy.get(element, { timeout }).should('be.visible').and('not.be.disabled'); cy.get(element, { timeout }).should('be.visible').and('not.be.disabled');
}); });
@ -112,7 +116,7 @@ function selectItem(selector, option, ariaControl, hasWrite = true) {
.find((item) => item.innerText.includes(option)); .find((item) => item.innerText.includes(option));
if (matchingItem) return cy.wrap(matchingItem).click(); if (matchingItem) return cy.wrap(matchingItem).click();
if (hasWrite) cy.get(selector).clear().type(option, { delay: 0 }); if (hasWrite) cy.get(selector).clear().type(option);
return selectItem(selector, option, ariaControl, false); return selectItem(selector, option, ariaControl, false);
}); });
} }
@ -329,8 +333,13 @@ Cypress.Commands.add('openUserPanel', () => {
Cypress.Commands.add('checkNotification', (text) => { Cypress.Commands.add('checkNotification', (text) => {
cy.get('.q-notification', { timeout: 10000 }) cy.get('.q-notification', { timeout: 10000 })
.should('be.visible') .should('be.visible')
.filter((_, el) => Cypress.$(el).text().includes(text)) .should('have.length.greaterThan', 0)
.should('have.length.greaterThan', 0); .should(($elements) => {
const found = $elements
.toArray()
.some((el) => Cypress.$(el).text().includes(text));
expect(found).to.be.true;
});
}); });
Cypress.Commands.add('openActions', (row) => { Cypress.Commands.add('openActions', (row) => {
@ -376,7 +385,13 @@ Cypress.Commands.add('clickButtonWith', (type, value) => {
} }
}); });
Cypress.Commands.add('clickButtonWithIcon', (iconClass) => { Cypress.Commands.add('clickButtonWithIcon', (iconClass) => {
cy.get(`.q-icon.${iconClass}`).parent().click(); cy.waitForElement('[data-cy="descriptor_actions"]');
cy.get('[data-cy="loading-spinner"]', { timeout: 10000 }).should('not.be.visible');
cy.get('.q-btn')
.filter((index, el) => Cypress.$(el).find('.q-icon.' + iconClass).length > 0)
.then(($btn) => {
cy.wrap($btn).click();
});
}); });
Cypress.Commands.add('clickButtonWithText', (buttonText) => { Cypress.Commands.add('clickButtonWithText', (buttonText) => {
cy.get('.q-btn').contains(buttonText).click(); cy.get('.q-btn').contains(buttonText).click();