0
0
Fork 0

fix: refs #7717 fix catalog searchbar and worker tests(refs #7323)

This commit is contained in:
Jon Elias 2024-07-23 11:46:21 +02:00
parent 368b8404fa
commit ce6a94bab8
6 changed files with 49 additions and 55 deletions

View File

@ -106,6 +106,7 @@ watch(
const isLoading = ref(false); const isLoading = ref(false);
async function search(evt) { async function search(evt) {
try {
if (evt && $props.disableSubmitEvent) return; if (evt && $props.disableSubmitEvent) return;
store.filter.where = {}; store.filter.where = {};
@ -118,9 +119,10 @@ async function search(evt) {
userParams.value = newParams; userParams.value = newParams;
if (!$props.showAll && !Object.values(filter).length) store.data = []; if (!$props.showAll && !Object.values(filter).length) store.data = [];
isLoading.value = false;
emit('search'); emit('search');
} finally {
isLoading.value = false;
}
} }
async function reload() { async function reload() {
@ -135,6 +137,7 @@ async function reload() {
} }
async function clearFilters() { async function clearFilters() {
try {
isLoading.value = true; isLoading.value = true;
store.userParamsChanged = true; store.userParamsChanged = true;
arrayData.reset(['skip', 'filter.skip', 'page']); arrayData.reset(['skip', 'filter.skip', 'page']);
@ -154,10 +157,11 @@ async function clearFilters() {
if (!$props.showAll) { if (!$props.showAll) {
store.data = []; store.data = [];
} }
isLoading.value = false;
emit('clear'); emit('clear');
emit('update:modelValue', userParams.value); emit('update:modelValue', userParams.value);
} finally {
isLoading.value = false;
}
} }
const tagsList = computed(() => { const tagsList = computed(() => {

View File

@ -101,10 +101,6 @@ onMounted(() => {
async function search() { async function search() {
const staticParams = Object.entries(store.userParams); const staticParams = Object.entries(store.userParams);
console.log('staticParams: ', staticParams);
// .filter(
// ([key, value]) => value && (props.staticParams || []).includes(key)
// );
arrayData.reset(['skip', 'page']); arrayData.reset(['skip', 'page']);
if (props.makeFetch) if (props.makeFetch)

View File

@ -19,7 +19,7 @@ const props = defineProps({
<VnFilterPanel <VnFilterPanel
:data-key="props.dataKey" :data-key="props.dataKey"
:search-button="true" :search-button="true"
:unremovable-params="['from', 'to']" :un-removable-params="['from', 'to']"
:hidden-tags="['from', 'to']" :hidden-tags="['from', 'to']"
> >
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">

View File

@ -1,5 +1,4 @@
<script setup> <script setup>
import { useI18n } from 'vue-i18n';
import { computed } from 'vue'; import { computed } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import VnCard from 'components/common/VnCard.vue'; import VnCard from 'components/common/VnCard.vue';
@ -17,18 +16,10 @@ const customRouteRedirectName = computed(() => {
const route = config[routeName.value]; const route = config[routeName.value];
if (route) return null; if (route) return null;
return 'OrderList'; return 'OrderList';
//Jon, asi es como lo dejamos
// if (routeName.value === 'OrderCatalog') return null;
// return 'OrderList';
}); });
const customFilterPanel = computed(() => { const customFilterPanel = computed(() => {
const filterPanel = config[routeName.value] ?? OrderFilter; const filterPanel = config[routeName.value] ?? OrderFilter;
return filterPanel; return filterPanel;
//Jon, asi es como lo dejamos
// if (routeName.value === 'OrderCatalog') return null;
// return 'OrderList';
// if (routeName.value === 'OrderCatalog') return OrderCatalogFilter;
// return OrderFilter;
}); });
</script> </script>

View File

@ -5,8 +5,14 @@ describe('WorkerList', () => {
cy.visit('/#/worker/list'); cy.visit('/#/worker/list');
}); });
it('should open the worker summary', () => { it('should opern the worker summary', () => {
cy.get('.bg-header > :nth-child(2) > .full-width > :nth-child(1) >').type( cy.get(
':nth-child(1) > .text-right > .q-btn > .q-btn__content > .q-icon'
).click();
});
it('should go to the worker summary', () => {
cy.get('#searchbar > .q-field > .q-field__inner > .q-field__control').type(
'jessica jones{enter}' 'jessica jones{enter}'
); );
}); });

View File

@ -2,7 +2,6 @@ describe('WorkerLocker', () => {
const workerId = 1109; const workerId = 1109;
const lockerCode = '2F'; const lockerCode = '2F';
const input = '.q-card input'; const input = '.q-card input';
const firstOpt = '[role="listbox"] .q-item:nth-child(1)';
beforeEach(() => { beforeEach(() => {
cy.viewport(1280, 720); cy.viewport(1280, 720);
cy.login('productionBoss'); cy.login('productionBoss');
@ -11,9 +10,7 @@ describe('WorkerLocker', () => {
it('should allocates a locker', () => { it('should allocates a locker', () => {
cy.get(input).click(); cy.get(input).click();
cy.get(input).type(lockerCode); cy.get(input).type(`${lockerCode}{enter}`);
cy.get(firstOpt).click(); cy.get(input).should('have.value', lockerCode);
cy.saveCard();
cy.get(input).invoke('val').should('eq', lockerCode);
}); });
}); });