#8582 - test: e2e monitorTicket #1391
|
@ -69,7 +69,7 @@ const refresh = () => window.location.reload();
|
|||
'no-visible': !stateQuery.isLoading().value,
|
||||
}"
|
||||
size="sm"
|
||||
data-cy="loading-spinner"
|
||||
data-cy="navBar-spinner"
|
||||
/>
|
||||
<QSpace />
|
||||
<div id="searchbar" class="searchbar"></div>
|
||||
|
|
|
@ -741,6 +741,7 @@ const rowCtrlClickFunction = computed(() => {
|
|||
withFilters
|
||||
"
|
||||
:column="col"
|
||||
:data-cy="`column-filter-${col.name}`"
|
||||
:show-title="true"
|
||||
:data-key="$attrs['data-key']"
|
||||
v-model="params[columnName(col)]"
|
||||
|
|
|
@ -212,6 +212,7 @@ const getLocale = (label) => {
|
|||
color="primary"
|
||||
style="position: fixed; z-index: 1; right: 0; bottom: 0"
|
||||
icon="search"
|
||||
data-cy="vnFilterPanel_search"
|
||||
@click="search()"
|
||||
>
|
||||
<QTooltip bottom anchor="bottom right">
|
||||
|
@ -229,6 +230,7 @@ const getLocale = (label) => {
|
|||
<QItemSection top side>
|
||||
<QBtn
|
||||
@click="clearFilters"
|
||||
data-cy="clearFilters"
|
||||
color="primary"
|
||||
dense
|
||||
flat
|
||||
|
@ -292,6 +294,7 @@ const getLocale = (label) => {
|
|||
</QList>
|
||||
</QForm>
|
||||
<QInnerLoading
|
||||
data-cy="filterPanel-spinner"
|
||||
:label="t('globals.pleaseWait')"
|
||||
:showing="isLoading"
|
||||
color="primary"
|
||||
|
|
|
@ -11,7 +11,7 @@ const $props = defineProps({
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<QPopupProxy>
|
||||
<QPopupProxy data-cy="CustomerDescriptor">
|
||||
<CustomerDescriptor v-if="$props.id" :id="$props.id" :summary="CustomerSummary" />
|
||||
</QPopupProxy>
|
||||
</template>
|
||||
|
|
|
@ -228,11 +228,15 @@ async function handleTicketConfig(data) {
|
|||
url="TicketConfigs"
|
||||
:filter="{ fields: ['lackAlertPrice'] }"
|
||||
@on-fetch="handleTicketConfig"
|
||||
auto-load
|
||||
></FetchData>
|
||||
<QInnerLoading
|
||||
:showing="isLoading"
|
||||
:label="t && t('globals.pleaseWait')"
|
||||
color="primary"
|
||||
/>
|
||||
|
||||
<VnTable
|
||||
v-if="ticketConfig"
|
||||
v-if="!isLoading"
|
||||
auto-load
|
||||
data-cy="proposalTable"
|
||||
ref="proposalTableRef"
|
||||
|
|
|
@ -8,14 +8,14 @@ import VnRow from 'src/components/ui/VnRow.vue';
|
|||
class="q-pa-md"
|
||||
:style="{ 'flex-direction': $q.screen.lt.lg ? 'column' : 'row', gap: '0px' }"
|
||||
>
|
||||
<div style="flex: 0.3">
|
||||
<div style="flex: 0.3" data-cy="clientsOnWebsite">
|
||||
<span
|
||||
class="q-ml-md text-body1"
|
||||
v-text="$t('salesMonitor.clientsOnWebsite')"
|
||||
/>
|
||||
<SalesClientTable />
|
||||
</div>
|
||||
<div style="flex: 0.7">
|
||||
<div style="flex: 0.7" data-cy="recentOrderActions">
|
||||
<span
|
||||
class="q-ml-md text-body1"
|
||||
v-text="$t('salesMonitor.recentOrderActions')"
|
||||
|
|
|
@ -9,6 +9,7 @@ import { toDateFormat, toDateTimeFormat } from 'src/filters/date.js';
|
|||
import { toCurrency } from 'src/filters';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
import axios from 'axios';
|
||||
import VnDateBadge from 'src/components/common/VnDateBadge.vue';
|
||||
import useOpenURL from 'src/composables/useOpenURL';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
@ -165,16 +166,7 @@ const openTab = (id) => useOpenURL(`#/order/${id}/summary`);
|
|||
</div>
|
||||
</template>
|
||||
<template #column-dateSend="{ row }">
|
||||
<QTd>
|
||||
<QBadge
|
||||
:color="getBadgeColor(row.date_send)"
|
||||
text-color="black"
|
||||
class="q-pa-sm"
|
||||
style="font-size: 14px"
|
||||
>
|
||||
{{ toDateFormat(row.date_send) }}
|
||||
</QBadge>
|
||||
</QTd>
|
||||
<VnDateBadge :date="row.date_send" />
|
||||
</template>
|
||||
|
||||
<template #column-clientFk="{ row }">
|
||||
|
|
|
@ -9,6 +9,7 @@ import VnInput from 'src/components/common/VnInput.vue';
|
|||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import { dateRange } from 'src/filters';
|
||||
import VnCheckbox from 'src/components/common/VnCheckbox.vue';
|
||||
|
||||
defineProps({ dataKey: { type: String, required: true } });
|
||||
const { t, te } = useI18n();
|
||||
|
@ -209,7 +210,7 @@ const getLocale = (label) => {
|
|||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QCheckbox
|
||||
<VnCheckbox
|
||||
:label="t('params.myTeam')"
|
||||
v-model="params.myTeam"
|
||||
toggle-indeterminate
|
||||
|
@ -218,7 +219,7 @@ const getLocale = (label) => {
|
|||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QCheckbox
|
||||
<VnCheckbox
|
||||
:label="t('params.problems')"
|
||||
v-model="params.problems"
|
||||
toggle-indeterminate
|
||||
|
@ -227,7 +228,7 @@ const getLocale = (label) => {
|
|||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QCheckbox
|
||||
<VnCheckbox
|
||||
:label="t('params.pending')"
|
||||
v-model="params.pending"
|
||||
toggle-indeterminate
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import DepartmentDescriptorProxy from 'src/pages/Worker/Department/Card/DepartmentDescriptorProxy.vue';
|
||||
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
|
||||
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
|
||||
|
@ -168,9 +167,11 @@ const columns = computed(() => [
|
|||
component: 'select',
|
||||
name: 'provinceFk',
|
||||
attrs: {
|
||||
options: provinceOpts.value,
|
||||
'option-value': 'id',
|
||||
'option-label': 'name',
|
||||
url: 'Provinces',
|
||||
fields: ['id', 'name'],
|
||||
sortBy: ['name ASC'],
|
||||
optionValue: 'id',
|
||||
optionLabel: 'name',
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
|
@ -183,9 +184,11 @@ const columns = computed(() => [
|
|||
component: 'select',
|
||||
name: 'stateFk',
|
||||
attrs: {
|
||||
options: stateOpts.value,
|
||||
'option-value': 'id',
|
||||
'option-label': 'name',
|
||||
sortBy: ['name ASC'],
|
||||
url: 'States',
|
||||
fields: ['id', 'name'],
|
||||
optionValue: 'id',
|
||||
optionLabel: 'name',
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
|
@ -212,9 +215,12 @@ const columns = computed(() => [
|
|||
component: 'select',
|
||||
name: 'zoneFk',
|
||||
attrs: {
|
||||
options: zoneOpts.value,
|
||||
'option-value': 'id',
|
||||
'option-label': 'name',
|
||||
url: 'Zones',
|
||||
fields: ['id', 'name'],
|
||||
sortBy: ['name ASC'],
|
||||
|
||||
optionValue: 'id',
|
||||
optionLabel: 'name',
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
|
@ -225,11 +231,12 @@ const columns = computed(() => [
|
|||
align: 'left',
|
||||
columnFilter: {
|
||||
component: 'select',
|
||||
url: 'PayMethods',
|
||||
attrs: {
|
||||
options: PayMethodOpts.value,
|
||||
optionValue: 'id',
|
||||
url: 'PayMethods',
|
||||
fields: ['id', 'name'],
|
||||
sortBy: ['id ASC'],
|
||||
optionLabel: 'name',
|
||||
optionValue: 'id',
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
|
@ -254,7 +261,9 @@ const columns = computed(() => [
|
|||
columnFilter: {
|
||||
component: 'select',
|
||||
attrs: {
|
||||
options: DepartmentOpts.value,
|
||||
url: 'Departments',
|
||||
fields: ['id', 'name'],
|
||||
sortBy: ['id ASC'],
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
|
@ -265,11 +274,12 @@ const columns = computed(() => [
|
|||
align: 'left',
|
||||
columnFilter: {
|
||||
component: 'select',
|
||||
url: 'ItemPackingTypes',
|
||||
attrs: {
|
||||
options: ItemPackingTypeOpts.value,
|
||||
'option-value': 'code',
|
||||
'option-label': 'code',
|
||||
url: 'ItemPackingTypes',
|
||||
fields: ['code'],
|
||||
sortBy: ['code ASC'],
|
||||
optionValue: 'code',
|
||||
optionCode: 'code',
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
|
@ -324,60 +334,6 @@ const totalPriceColor = (ticket) => {
|
|||
const openTab = (id) => useOpenURL(`#/ticket/${id}/sale`);
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
url="Provinces"
|
||||
:filter="{
|
||||
fields: ['id', 'name'],
|
||||
order: 'name ASC',
|
||||
}"
|
||||
auto-load
|
||||
@on-fetch="(data) => (provinceOpts = data)"
|
||||
/>
|
||||
<FetchData
|
||||
url="States"
|
||||
:filter="{
|
||||
fields: ['id', 'name'],
|
||||
order: 'name ASC',
|
||||
}"
|
||||
auto-load
|
||||
@on-fetch="(data) => (stateOpts = data)"
|
||||
/>
|
||||
<FetchData
|
||||
url="Zones"
|
||||
:filter="{
|
||||
fields: ['id', 'name'],
|
||||
order: 'name ASC',
|
||||
}"
|
||||
auto-load
|
||||
@on-fetch="(data) => (zoneOpts = data)"
|
||||
/>
|
||||
<FetchData
|
||||
url="ItemPackingTypes"
|
||||
:filter="{
|
||||
fields: ['code'],
|
||||
order: 'code ASC',
|
||||
}"
|
||||
auto-load
|
||||
@on-fetch="(data) => (ItemPackingTypeOpts = data)"
|
||||
/>
|
||||
<FetchData
|
||||
url="Departments"
|
||||
:filter="{
|
||||
fields: ['id', 'name'],
|
||||
order: 'id ASC',
|
||||
}"
|
||||
auto-load
|
||||
@on-fetch="(data) => (DepartmentOpts = data)"
|
||||
/>
|
||||
<FetchData
|
||||
url="PayMethods"
|
||||
:filter="{
|
||||
fields: ['id', 'name'],
|
||||
order: 'id ASC',
|
||||
}"
|
||||
auto-load
|
||||
@on-fetch="(data) => (PayMethodOpts = data)"
|
||||
/>
|
||||
<MonitorTicketSearchbar />
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
|
|
|
@ -10,7 +10,7 @@ const $props = defineProps({
|
|||
});
|
||||
</script>
|
||||
<template>
|
||||
<QPopupProxy>
|
||||
<QPopupProxy data-cy="TicketDescriptor">
|
||||
<TicketDescriptor v-if="$props.id" :id="$props.id" :summary="TicketSummary" />
|
||||
</QPopupProxy>
|
||||
</template>
|
||||
|
|
|
@ -11,7 +11,7 @@ const $props = defineProps({
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<QPopupProxy>
|
||||
<QPopupProxy data-cy="DepartmentDescriptor">
|
||||
<DepartmentDescriptor
|
||||
v-if="$props.id"
|
||||
:id="$props.id"
|
||||
|
|
|
@ -53,7 +53,7 @@ describe('invoiceInCorrective', () => {
|
|||
it('should show/hide the section if it is a corrective invoice', () => {
|
||||
cy.visit('/#/invoice-in/1/summary');
|
||||
cy.get('[data-cy="InvoiceInCorrective-menu-item"]').should('not.exist');
|
||||
cy.clicDescriptorAction(4);
|
||||
cy.clickDescriptorAction(4);
|
||||
cy.get('[data-cy="InvoiceInCorrective-menu-item"]').should('exist');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -64,17 +64,17 @@ describe('InvoiceInDescriptor', () => {
|
|||
beforeEach(() => cy.visit('/#/invoice-in/1/summary'));
|
||||
|
||||
it('should navigate to the supplier summary', () => {
|
||||
cy.clicDescriptorAction(1);
|
||||
cy.clickDescriptorAction(1);
|
||||
cy.url().should('to.match', /supplier\/\d+\/summary/);
|
||||
});
|
||||
|
||||
it('should navigate to the entry summary', () => {
|
||||
cy.clicDescriptorAction(2);
|
||||
cy.clickDescriptorAction(2);
|
||||
cy.url().should('to.match', /entry\/\d+\/summary/);
|
||||
});
|
||||
|
||||
it('should navigate to the invoiceIn list', () => {
|
||||
cy.clicDescriptorAction(3);
|
||||
cy.clickDescriptorAction(3);
|
||||
cy.url().should('to.match', /invoice-in\/list\?table=\{.*supplierFk.+\}/);
|
||||
});
|
||||
});
|
||||
|
@ -93,7 +93,7 @@ describe('InvoiceInDescriptor', () => {
|
|||
createCorrective();
|
||||
redirect(originalId);
|
||||
|
||||
cy.clicDescriptorAction(4);
|
||||
cy.clickDescriptorAction(4);
|
||||
cy.validateVnTableRows({
|
||||
cols: [
|
||||
{
|
||||
|
@ -141,7 +141,7 @@ function createCorrective() {
|
|||
function redirect(subtitle) {
|
||||
const regex = new RegExp(`InvoiceIns/${subtitle}\\?filter=.*`);
|
||||
cy.intercept('GET', regex).as('getOriginal');
|
||||
cy.clicDescriptorAction(4);
|
||||
cy.clickDescriptorAction(4);
|
||||
cy.wait('@getOriginal');
|
||||
cy.validateDescriptor({ subtitle });
|
||||
}
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/// <reference types="cypress" />
|
||||
|
||||
describe('Monitor Clients actions', () => {
|
||||
beforeEach(() => {
|
||||
cy.login('salesPerson');
|
||||
cy.intercept('GET', '**/Departments**').as('departments');
|
||||
cy.visit('/#/monitor/clients-actions');
|
||||
cy.waitForElement('.q-page');
|
||||
cy.wait('@departments').then((xhr) => {
|
||||
cy.window().then((win) => {
|
||||
const user = JSON.parse(win.sessionStorage.getItem('user'));
|
||||
const { where } = JSON.parse(xhr.request.query.filter);
|
||||
expect(where.id.like).to.include(user.departmentFk.toString());
|
||||
});
|
||||
});
|
||||
cy.intercept('GET', '**/SalesMonitors/ordersFilter*').as('ordersFilter');
|
||||
cy.intercept('GET', '**/SalesMonitors/clientsFilter*').as('clientsFilter');
|
||||
});
|
||||
it('Should filter by field', () => {
|
||||
cy.get('.q-page').should('be.visible');
|
||||
cy.dataCy('clientsOnWebsite')
|
||||
.find('[data-cy="column-filter-departmentFk"] [data-cy="_select"]')
|
||||
.click();
|
||||
cy.dataCy('recentOrderActions').within(() => {
|
||||
cy.getRowCol('clientFk').find('span').should('have.class', 'link').click();
|
||||
});
|
||||
cy.checkVisibleDescriptor('Customer');
|
||||
|
||||
cy.dataCy('recentOrderActions').within(() => {
|
||||
cy.getRowCol('departmentFk', 2)
|
||||
.find('span')
|
||||
.should('have.class', 'link')
|
||||
.click();
|
||||
});
|
||||
|
||||
cy.checkVisibleDescriptor('Department');
|
||||
|
||||
cy.dataCy('clientsOnWebsite')
|
||||
|
||||
.find('.q-ml-md')
|
||||
.should('have.text', 'Clients on website');
|
||||
cy.dataCy('recentOrderActions')
|
||||
.find('.q-ml-md')
|
||||
.should('have.text', 'Recent order actions');
|
||||
jorgep marked this conversation as resolved
Outdated
jorgep
commented
Creo que es mejor validar el contenido de las columnas. puedes usar validateVnTableCol creo que se llama el comando Creo que es mejor validar el contenido de las columnas. puedes usar validateVnTableCol creo que se llama el comando
jsegarra
commented
Porque es mucho trabajo y porque esa responsabilidad de devolver los datos correctos debe ser del back, de si las relaciones y los wheres estan bien configurados Porque es mucho trabajo y porque esa responsabilidad de devolver los datos correctos debe ser del back, de si las relaciones y los wheres estan bien configurados
jorgep
commented
Si te cambian las fixtures , fallará el test, lo digo por eso. Con la fn que te digo no es mucho trabajo, si te refieres a que se gasta mucho tiempo en lanzar el test, eso sí. Pregunta a @juan Si te cambian las fixtures , fallará el test, lo digo por eso. Con la fn que te digo no es mucho trabajo, si te refieres a que se gasta mucho tiempo en lanzar el test, eso sí. Pregunta a @juan
jsegarra
commented
Lo hablamos el lunes Lo hablamos el lunes
jorgep
commented
Cómo has quedado con Juan/Javi? Cómo has quedado con Juan/Javi?
jsegarra
commented
Te he pegado una captura de lo que he hablado con Javi/Alex Te he pegado una captura de lo que he hablado con Javi/Alex
|
||||
cy.dataCy('From_inputDate').should('have.value', '01/01/2001');
|
||||
cy.dataCy('To_inputDate').should('have.value', '01/01/2001');
|
||||
});
|
||||
jorgep marked this conversation as resolved
Outdated
jorgep
commented
Porque no lo separas en its? o cambia el nombre del test load layout and filter Porque no lo separas en its? o cambia el nombre del test load layout and filter
jsegarra
commented
Not working para its Not working para its
cy.get(`${clientFk}`).its('[data-cy="_select"]').type('Bruce Banner');
jorgep
commented
Me refería a separarlo en varios tests. Me refería a separarlo en varios tests.
jsegarra
commented
ahhh vale, en it ahhh vale, en it
Porque buscamos comprimir la logica en el menor numero de iteracones o its para ganar en performance y evitar logins + accesos a a la ruta innecesarios, y asi ahorrar tiempo y recursos.
jorgep
commented
Vale, pero cambia el nombre del test. Vale, pero cambia el nombre del test.
jsegarra
commented
Lo he cambiado a Should filter by field Lo he cambiado a Should filter by field
|
||||
});
|
|
@ -0,0 +1,69 @@
|
|||
/// <reference types="cypress" />
|
||||
describe('Monitor Tickets Table', () => {
|
||||
beforeEach(() => {
|
||||
cy.viewport(1920, 1080);
|
||||
cy.login('salesPerson');
|
||||
cy.visit('/#/monitor/tickets');
|
||||
cy.waitForElement('.q-page');
|
||||
cy.intercept('GET', '**/SalesMonitors/salesFilter*').as('filterRequest');
|
||||
cy.openRightMenu();
|
||||
});
|
||||
it('should open new tab when ctrl+click on client link', () => {
|
||||
cy.intercept('GET', '**/SalesMonitors/salesFilter*').as('filterRequest');
|
||||
|
||||
cy.window().then((win) => {
|
||||
cy.stub(win, 'open').as('windowOpen');
|
||||
});
|
||||
|
||||
cy.getRowCol('provinceFk').click({ ctrlKey: true });
|
||||
cy.get('@windowOpen').should('be.calledWithMatch', /\/ticket\/\d+\/sale/);
|
||||
});
|
||||
it('should open the descriptorProxy and SummaryPopup', () => {
|
||||
cy.getRowCol('totalProblems');
|
||||
|
||||
cy.getRowCol('id').find('span').should('have.class', 'link').click();
|
||||
cy.checkVisibleDescriptor('Ticket');
|
||||
|
||||
cy.getRowCol('zoneFk').find('span').should('have.class', 'link').click();
|
||||
cy.checkVisibleDescriptor('Zone');
|
||||
|
||||
cy.getRowCol('clientFk').find('span').should('have.class', 'link').click();
|
||||
cy.checkVisibleDescriptor('Customer');
|
||||
|
||||
jorgep marked this conversation as resolved
Outdated
jorgep
commented
Juan dijo que no testeáramos los filtros de cada sección , de todas maneras aquí solo estas comprobando que se han añadido/quitado los parámetros en la url(Parece más de VnFilterPanel). Sería ver que los datos han sido filtrados. El de daysAgo como tiene lógica si se podría testear. Juan dijo que no testeáramos los filtros de cada sección , de todas maneras aquí solo estas comprobando que se han añadido/quitado los parámetros en la url(Parece más de VnFilterPanel). Sería ver que los datos han sido filtrados. El de daysAgo como tiene lógica si se podría testear.
jsegarra
commented
En la reunión dijimos de no crear una tarea para hacer el test de todos los filtros, pero eso no quita que se haga donde haga falta no? En la reunión dijimos de no crear una tarea para hacer el test de todos los filtros, pero eso no quita que se haga donde haga falta no?
De todas maneras, veo correcto lo que comentas de que esa comprobación debería ser de MonitorTicketFilter usando vitest.
Si te parece, creo tarea para esto ultimo
jorgep
commented
Lo que te diga @juan Lo que te diga @juan
jsegarra
commented
Lo he quitado, asi que no haria falta revisar nada mas Lo he quitado, asi que no haria falta revisar nada mas
jorgep
commented
Sigues validando filtros, lo que te diga Juan Sigues validando filtros, lo que te diga Juan
jsegarra
commented
He hablado con Javi y Juan al respecto He hablado con Javi y Juan al respecto
Te adjunto una foto
Pero ya no deberían estar validándose
jsegarra
commented
Solo hay 1, creo que es asumible Solo hay 1, creo que es asumible
jorgep
commented
Alex dice en la foto que si es de vnTable no se validen. Juan y Javi que han dicho? Alex dice en la foto que si es de vnTable no se validen. Juan y Javi que han dicho?
|
||||
cy.getRowCol('departmentFk').find('span').should('have.class', 'link').click();
|
||||
cy.checkVisibleDescriptor('Department');
|
||||
|
||||
cy.getRowCol('shippedDate').find('.q-badge');
|
||||
cy.tableActions().click({ ctrlKey: true });
|
||||
cy.tableActions(1).click();
|
||||
cy.get('.summaryHeader').should('exist');
|
||||
});
|
||||
|
||||
it('clear scopeDays', () => {
|
||||
cy.get('[data-cy="Days onward_input"]').clear().type('2');
|
||||
cy.searchInFilterPanel();
|
||||
cy.get('.q-chip__content > span').should('have.text', '"2"');
|
||||
cy.waitSpinner();
|
||||
checkScopeDays(2);
|
||||
cy.get('[data-cy="Days onward_input"]').clear();
|
||||
cy.searchInFilterPanel();
|
||||
cy.get('.q-chip__content > span').should('have.text', '"0"');
|
||||
cy.waitSpinner();
|
||||
checkScopeDays(0);
|
||||
});
|
||||
});
|
||||
|
||||
function checkScopeDays(scopeDays) {
|
||||
cy.url().then((url) => {
|
||||
const urlParams = new URLSearchParams(url.split('?')[1]);
|
||||
const saleMonitorTickets = JSON.parse(
|
||||
decodeURIComponent(urlParams.get('saleMonitorTickets')),
|
||||
);
|
||||
expect(saleMonitorTickets.scopeDays).to.equal(scopeDays);
|
||||
const fromDate = new Date(saleMonitorTickets.from);
|
||||
const toDate = new Date(saleMonitorTickets.to);
|
||||
expect(toDate.getDate() - fromDate.getDate()).to.equal(
|
||||
saleMonitorTickets.scopeDays,
|
||||
);
|
||||
});
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
describe('OrderCatalog', () => {
|
||||
beforeEach(() => {
|
||||
cy.login('developer');
|
||||
cy.viewport(1920, 720);
|
||||
cy.viewport(1920, 1080);
|
||||
cy.visit('/#/order/8/catalog');
|
||||
});
|
||||
|
||||
|
|
|
@ -6,9 +6,7 @@ describe('ParkingBasicData', () => {
|
|||
beforeEach(() => {
|
||||
cy.login('developer');
|
||||
cy.visit(`/#/shelving/parking/1/basic-data`);
|
||||
cy.get('[data-cy="loading-spinner"]', { timeout: 10000 }).should(
|
||||
'not.be.visible',
|
||||
);
|
||||
cy.get('[data-cy="navBar-spinner"]', { timeout: 10000 }).should('not.be.visible');
|
||||
});
|
||||
|
||||
it('should give an error if the code aldready exists', () => {
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
Cypress.Commands.add('checkVisibleDescriptor', (alias) =>
|
||||
cy
|
||||
.get(`[data-cy="${alias}Descriptor"] [data-cy="vnDescriptor"] > .header`)
|
||||
jorgep marked this conversation as resolved
jorgep
commented
[data-cy="${alias}Descriptor"] [data-cy="vnDescriptor"] no vale así? [data-cy="${alias}Descriptor"] [data-cy="vnDescriptor"] no vale así?
jsegarra
commented
Si y no. Si y no.
Poniendo .header valido que se está renderizando , porque quitándolo, se puede dar el caso que exista en el DOM pero no se visualice
|
||||
.should('exist')
|
||||
.and('be.visible'),
|
||||
);
|
|
@ -2,9 +2,7 @@ Cypress.Commands.add('getRow', (index = 1) =>
|
|||
cy.get(`.vnTable .q-virtual-scroll__content tr:nth-child(${index})`),
|
||||
jsegarra marked this conversation as resolved
Outdated
jorgep
commented
mejor hacer .vnTable .q virtual-scroll__content resto del selector creo yo... Ser un poco más especifico y si se puede cambiar el idice de fila, ya no lo llamaría firstRow, select row o algo así. mejor hacer .vnTable .q virtual-scroll__content resto del selector creo yo... Ser un poco más especifico y si se puede cambiar el idice de fila, ya no lo llamaría firstRow, select row o algo así.
|
||||
);
|
||||
Cypress.Commands.add('getRowCol', (field, index = 1) =>
|
||||
cy.get(
|
||||
`.vnTable .q-virtual-scroll__content > :nth-child(${index}) > [data-col-field="${field}"]`,
|
||||
),
|
||||
cy.getRow(index).find(`[data-col-field="${field}"]`),
|
||||
);
|
||||
|
||||
Cypress.Commands.add('vnTableCreateBtn', () =>
|
||||
|
@ -14,3 +12,9 @@ Cypress.Commands.add('vnTableCreateBtn', () =>
|
|||
Cypress.Commands.add('waitTableScrollLoad', () =>
|
||||
cy.waitForElement('[data-q-vs-anchor]'),
|
||||
);
|
||||
|
||||
Cypress.Commands.add('tableActions', (n = 0, child = 1) =>
|
||||
cy.get(
|
||||
`:nth-child(${child}) > .q-table--col-auto-width > [data-cy="tableAction-${n}"] > .q-btn__content > .q-icon`,
|
||||
),
|
||||
);
|
||||
|
|
|
@ -78,20 +78,21 @@ Cypress.Commands.add('waitForElement', (element) => {
|
|||
Cypress.Commands.add('getValue', (selector) => {
|
||||
cy.get(selector).then(($el) => {
|
||||
if ($el.find('.q-checkbox__inner').length > 0) {
|
||||
return cy.get(selector + '.q-checkbox__inner');
|
||||
return cy.get(`${selector}.q-checkbox__inner`);
|
||||
}
|
||||
// Si es un QSelect
|
||||
if ($el.find('.q-select__dropdown-icon').length) {
|
||||
return cy
|
||||
.get(
|
||||
selector +
|
||||
'> .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > input',
|
||||
`${
|
||||
selector
|
||||
}> .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > input`,
|
||||
)
|
||||
.invoke('val');
|
||||
}
|
||||
// Si es un QSelect
|
||||
if ($el.find('span').length) {
|
||||
return cy.get(selector + ' span').then(($span) => {
|
||||
return cy.get(`${selector} span`).then(($span) => {
|
||||
return $span[0].innerText;
|
||||
});
|
||||
}
|
||||
|
@ -100,10 +101,15 @@ Cypress.Commands.add('getValue', (selector) => {
|
|||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add('waitSpinner', () => {
|
||||
Cypress.Commands.add('waitSpinner', (_spinner = 'navBar') => {
|
||||
const spinners = {
|
||||
navBar: '[data-cy="navBar-spinner"]',
|
||||
filterPanel: '[data-cy="filterPanel-spinner"]',
|
||||
};
|
||||
const spinner = spinners[_spinner];
|
||||
cy.get('body').then(($body) => {
|
||||
jsegarra marked this conversation as resolved
Outdated
jorgep
commented
Quitar Quitar
|
||||
if ($body.find('[data-cy="loading-spinner"]').length) {
|
||||
cy.get('[data-cy="loading-spinner"]').should('not.be.visible');
|
||||
if ($body.find(spinner).length) {
|
||||
cy.get(spinner).should('not.be.visible');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -142,7 +148,7 @@ function selectItem(selector, option, ariaControl, hasWrite = true) {
|
|||
function getItems(ariaControl, startTime = Cypress._.now(), timeout = 2500) {
|
||||
// Se intenta obtener la lista de opciones del desplegable de manera recursiva
|
||||
return cy
|
||||
.get('#' + ariaControl, { timeout })
|
||||
.get(`#${ariaControl}`, { timeout })
|
||||
.should('exist')
|
||||
.find('.q-item')
|
||||
.should('exist')
|
||||
|
@ -352,11 +358,21 @@ Cypress.Commands.add('openListSummary', (row) => {
|
|||
cy.get('.card-list-body .actions .q-btn:nth-child(2)').eq(row).click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add('openRightMenu', (element) => {
|
||||
if (element) cy.waitForElement(element);
|
||||
cy.get('[data-cy="toggle-right-drawer"]').click();
|
||||
Cypress.Commands.add('openRightMenu', (element = 'toggle-right-drawer') => {
|
||||
if (element) cy.waitForElement(`[data-cy="${element}"]`);
|
||||
cy.dataCy(element).click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add('cleanFilterPanel', (element = 'clearFilters') => {
|
||||
cy.get('#filterPanelForm').scrollIntoView();
|
||||
if (element) cy.waitForElement(`[data-cy="${element}"]`);
|
||||
cy.dataCy(element).click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add('searchInFilterPanel', (element = 'vnFilterPanel_search') => {
|
||||
if (element) cy.waitForElement(`[data-cy="${element}"]`);
|
||||
cy.dataCy(element).click();
|
||||
});
|
||||
Cypress.Commands.add('openLeftMenu', (element) => {
|
||||
if (element) cy.waitForElement(element);
|
||||
cy.get('.q-toolbar > .q-btn--round.q-btn--dense > .q-btn__content > .q-icon').click();
|
||||
|
@ -454,9 +470,9 @@ Cypress.Commands.add('clickButtonWith', (type, value) => {
|
|||
|
||||
Cypress.Commands.add('clickButtonWithIcon', (iconClass) => {
|
||||
cy.waitForElement('[data-cy="descriptor_actions"]');
|
||||
cy.get('[data-cy="loading-spinner"]', { timeout: 10000 }).should('not.be.visible');
|
||||
cy.waitSpinner();
|
||||
cy.get('.q-btn')
|
||||
.filter((index, el) => Cypress.$(el).find('.q-icon.' + iconClass).length > 0)
|
||||
.filter((index, el) => Cypress.$(el).find(`.q-icon.${iconClass}`).length > 0)
|
||||
.then(($btn) => {
|
||||
cy.wrap($btn).click();
|
||||
});
|
||||
|
@ -591,7 +607,7 @@ Cypress.Commands.add('validatePdfDownload', (match, trigger) => {
|
|||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add('clicDescriptorAction', (index = 1) => {
|
||||
Cypress.Commands.add('clickDescriptorAction', (index = 1) => {
|
||||
cy.get(`[data-cy="descriptor_actions"] .q-btn:nth-of-type(${index})`).click();
|
||||
});
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@ const waitForApiReady = (url, maxRetries = 20, delay = 1000) => {
|
|||
};
|
||||
|
||||
before(() => {
|
||||
cy.viewport(1920, 1080);
|
||||
jsegarra marked this conversation as resolved
Outdated
jorgep
commented
Una resolución un poco rara no? Supongo que querías poner 1080 Una resolución un poco rara no? Supongo que querías poner 1080
jsegarra
commented
Lo debí copiar de algún sitio. Lo debí copiar de algún sitio.
Aprovecho para quitarlo
|
||||
waitForApiReady('/api/Applications/status');
|
||||
});
|
||||
|
||||
|
|
Estos dos tests que comprueban el título no le veo sentido.
Validan que las tablas tiene titulo de cabecera.
Me pareció interesante y es una validación que no ralentiza los tests.
Es cierto que no lo validamos pero creo que no hay mas casos como este.
Por darle más valor al test