forked from verdnatura/salix-front
Merge pull request '#8162 - E2E Tickets' (!951) from wbuezas/salix-front-mindshore-fork2:8162-E2ETickets into dev
Reviewed-on: verdnatura/salix-front#951 Reviewed-by: Alex Moreno <alexm@verdnatura.es> Reviewed-by: Javier Segarra <jsegarra@verdnatura.es>
This commit is contained in:
commit
3bc5c9bd6a
|
@ -394,6 +394,7 @@ watch(formUrl, async () => {
|
||||||
@click="onSubmit"
|
@click="onSubmit"
|
||||||
:disable="!hasChanges"
|
:disable="!hasChanges"
|
||||||
:title="t('globals.save')"
|
:title="t('globals.save')"
|
||||||
|
data-cy="crudModelDefaultSaveBtn"
|
||||||
/>
|
/>
|
||||||
<slot name="moreAfterActions" />
|
<slot name="moreAfterActions" />
|
||||||
</QBtnGroup>
|
</QBtnGroup>
|
||||||
|
|
|
@ -737,6 +737,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
||||||
fab
|
fab
|
||||||
icon="add"
|
icon="add"
|
||||||
shortcut="+"
|
shortcut="+"
|
||||||
|
data-cy="vnTableCreateBtn"
|
||||||
/>
|
/>
|
||||||
<QTooltip self="top right">
|
<QTooltip self="top right">
|
||||||
{{ createForm?.title }}
|
{{ createForm?.title }}
|
||||||
|
|
|
@ -86,7 +86,7 @@ async function send() {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QDialog ref="dialogRef">
|
<QDialog ref="dialogRef" data-cy="vnSmsDialog">
|
||||||
<QCard class="q-pa-sm">
|
<QCard class="q-pa-sm">
|
||||||
<QCardSection class="row items-center q-pb-none">
|
<QCardSection class="row items-center q-pb-none">
|
||||||
<span class="text-h6 text-grey">
|
<span class="text-h6 text-grey">
|
||||||
|
@ -161,6 +161,7 @@ async function send() {
|
||||||
:loading="isLoading"
|
:loading="isLoading"
|
||||||
color="primary"
|
color="primary"
|
||||||
unelevated
|
unelevated
|
||||||
|
data-cy="sendSmsBtn"
|
||||||
/>
|
/>
|
||||||
</QCardActions>
|
</QCardActions>
|
||||||
</QCard>
|
</QCard>
|
||||||
|
|
|
@ -130,6 +130,7 @@ async function search() {
|
||||||
dense
|
dense
|
||||||
standout
|
standout
|
||||||
autofocus
|
autofocus
|
||||||
|
data-cy="vnSearchBar"
|
||||||
>
|
>
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<QIcon
|
<QIcon
|
||||||
|
|
|
@ -100,7 +100,7 @@ async function remove() {
|
||||||
</QMenu>
|
</QMenu>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QSeparator />
|
<QSeparator />
|
||||||
<QItem @click="confirmRemove()" v-ripple clickable>
|
<QItem @click="confirmRemove()" v-ripple clickable data-cy="deleteClaim">
|
||||||
<QItemSection avatar>
|
<QItemSection avatar>
|
||||||
<QIcon name="delete" />
|
<QIcon name="delete" />
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
|
|
@ -130,6 +130,7 @@ function ticketFilter(ticket) {
|
||||||
<QBadge
|
<QBadge
|
||||||
text-color="black"
|
text-color="black"
|
||||||
:color="entity.ticketState.state.classColor"
|
:color="entity.ticketState.state.classColor"
|
||||||
|
data-cy="ticketDescriptorStateBadge"
|
||||||
>
|
>
|
||||||
{{ entity.ticketState.state.name }}
|
{{ entity.ticketState.state.name }}
|
||||||
</QBadge>
|
</QBadge>
|
||||||
|
@ -174,7 +175,7 @@ function ticketFilter(ticket) {
|
||||||
<QTooltip>{{ t('Client Frozen') }}</QTooltip>
|
<QTooltip>{{ t('Client Frozen') }}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
<QIcon
|
<QIcon
|
||||||
v-if="entity.problem.includes('hasRisk')"
|
v-if="entity?.problem?.includes('hasRisk')"
|
||||||
name="vn:risk"
|
name="vn:risk"
|
||||||
size="xs"
|
size="xs"
|
||||||
color="primary"
|
color="primary"
|
||||||
|
|
|
@ -75,6 +75,7 @@ const cancel = () => {
|
||||||
dense
|
dense
|
||||||
style="width: 50%"
|
style="width: 50%"
|
||||||
@click="save()"
|
@click="save()"
|
||||||
|
data-cy="saveManaBtn"
|
||||||
>
|
>
|
||||||
{{ t('globals.save') }}
|
{{ t('globals.save') }}
|
||||||
</QBtn>
|
</QBtn>
|
||||||
|
|
|
@ -86,12 +86,14 @@ async function handleSave() {
|
||||||
option-value="id"
|
option-value="id"
|
||||||
v-model="row.observationTypeFk"
|
v-model="row.observationTypeFk"
|
||||||
:disable="!!row.id"
|
:disable="!!row.id"
|
||||||
|
data-cy="ticketNotesObservationType"
|
||||||
/>
|
/>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('basicData.description')"
|
:label="t('basicData.description')"
|
||||||
v-model="row.description"
|
v-model="row.description"
|
||||||
class="col"
|
class="col"
|
||||||
@keyup.enter="handleSave"
|
@keyup.enter="handleSave"
|
||||||
|
data-cy="ticketNotesDescription"
|
||||||
/>
|
/>
|
||||||
<QIcon
|
<QIcon
|
||||||
name="delete"
|
name="delete"
|
||||||
|
@ -99,6 +101,7 @@ async function handleSave() {
|
||||||
class="cursor-pointer"
|
class="cursor-pointer"
|
||||||
color="primary"
|
color="primary"
|
||||||
@click="handleDelete(row)"
|
@click="handleDelete(row)"
|
||||||
|
data-cy="ticketNotesRemoveNoteBtn"
|
||||||
>
|
>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ t('ticketNotes.removeNote') }}
|
{{ t('ticketNotes.removeNote') }}
|
||||||
|
@ -113,6 +116,7 @@ async function handleSave() {
|
||||||
class="fill-icon-on-hover q-ml-md"
|
class="fill-icon-on-hover q-ml-md"
|
||||||
color="primary"
|
color="primary"
|
||||||
@click="ticketNotesCrudRef.insert()"
|
@click="ticketNotesCrudRef.insert()"
|
||||||
|
data-cy="ticketNotesAddNoteBtn"
|
||||||
>
|
>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ t('ticketNotes.addNote') }}
|
{{ t('ticketNotes.addNote') }}
|
||||||
|
|
|
@ -584,6 +584,7 @@ watch(
|
||||||
color="primary"
|
color="primary"
|
||||||
:disable="!isTicketEditable || ticketState === 'OK'"
|
:disable="!isTicketEditable || ticketState === 'OK'"
|
||||||
@click="changeTicketState('OK')"
|
@click="changeTicketState('OK')"
|
||||||
|
data-cy="ticketSaleOkStateBtn"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t(`Change ticket state to 'Ok'`) }}</QTooltip>
|
<QTooltip>{{ t(`Change ticket state to 'Ok'`) }}</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
|
@ -592,6 +593,7 @@ watch(
|
||||||
color="primary"
|
color="primary"
|
||||||
:label="t('ticketList.state')"
|
:label="t('ticketList.state')"
|
||||||
:disable="!isTicketEditable"
|
:disable="!isTicketEditable"
|
||||||
|
data-cy="ticketSaleStateDropdown"
|
||||||
>
|
>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:options="editableStatesOptions"
|
:options="editableStatesOptions"
|
||||||
|
@ -601,6 +603,7 @@ watch(
|
||||||
hide-dropdown-icon
|
hide-dropdown-icon
|
||||||
focus-on-mount
|
focus-on-mount
|
||||||
@update:model-value="changeTicketState"
|
@update:model-value="changeTicketState"
|
||||||
|
data-cy="ticketSaleStateSelect"
|
||||||
/>
|
/>
|
||||||
</QBtnDropdown>
|
</QBtnDropdown>
|
||||||
<TicketSaleMoreActions
|
<TicketSaleMoreActions
|
||||||
|
@ -633,6 +636,7 @@ watch(
|
||||||
icon="vn:splitline"
|
icon="vn:splitline"
|
||||||
:disable="!isTicketEditable || !hasSelectedRows"
|
:disable="!isTicketEditable || !hasSelectedRows"
|
||||||
@click="setTransferParams()"
|
@click="setTransferParams()"
|
||||||
|
data-cy="ticketSaleTransferBtn"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('Transfer lines') }}</QTooltip>
|
<QTooltip>{{ t('Transfer lines') }}</QTooltip>
|
||||||
<TicketTransfer
|
<TicketTransfer
|
||||||
|
@ -712,7 +716,13 @@ watch(
|
||||||
{{ t('ticketSale.visible') }}: {{ row.visible || 0 }}
|
{{ t('ticketSale.visible') }}: {{ row.visible || 0 }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
<QIcon v-if="row.reserved" color="primary" name="vn:reserva" size="xs">
|
<QIcon
|
||||||
|
v-if="row.reserved"
|
||||||
|
color="primary"
|
||||||
|
name="vn:reserva"
|
||||||
|
size="xs"
|
||||||
|
data-cy="ticketSaleReservedIcon"
|
||||||
|
>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ t('ticketSale.reserved') }}
|
{{ t('ticketSale.reserved') }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
|
@ -865,7 +875,14 @@ watch(
|
||||||
</VnTable>
|
</VnTable>
|
||||||
|
|
||||||
<QPageSticky :offset="[20, 20]" style="z-index: 2">
|
<QPageSticky :offset="[20, 20]" style="z-index: 2">
|
||||||
<QBtn @click="newOrderFromTicket()" color="primary" fab icon="add" shortcut="+" />
|
<QBtn
|
||||||
|
@click="newOrderFromTicket()"
|
||||||
|
color="primary"
|
||||||
|
fab
|
||||||
|
icon="add"
|
||||||
|
shortcut="+"
|
||||||
|
data-cy="ticketSaleAddToBasketBtn"
|
||||||
|
/>
|
||||||
<QTooltip class="text-no-wrap">
|
<QTooltip class="text-no-wrap">
|
||||||
{{ t('Add item to basket') }}
|
{{ t('Add item to basket') }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
|
|
|
@ -179,6 +179,7 @@ const createRefund = async (withWarehouse) => {
|
||||||
color="primary"
|
color="primary"
|
||||||
:label="t('ticketSale.more')"
|
:label="t('ticketSale.more')"
|
||||||
:disable="disable"
|
:disable="disable"
|
||||||
|
data-cy="ticketSaleMoreActionsDropdown"
|
||||||
>
|
>
|
||||||
<template #label>
|
<template #label>
|
||||||
<QTooltip>{{ t('Select lines to see the options') }}</QTooltip>
|
<QTooltip>{{ t('Select lines to see the options') }}</QTooltip>
|
||||||
|
@ -190,6 +191,7 @@ const createRefund = async (withWarehouse) => {
|
||||||
v-close-popup
|
v-close-popup
|
||||||
v-ripple
|
v-ripple
|
||||||
@click="showSmsDialog('productNotAvailable')"
|
@click="showSmsDialog('productNotAvailable')"
|
||||||
|
data-cy="sendShortageSMSItem"
|
||||||
>
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ t('Send shortage SMS') }}</QItemLabel>
|
<QItemLabel>{{ t('Send shortage SMS') }}</QItemLabel>
|
||||||
|
@ -201,12 +203,18 @@ const createRefund = async (withWarehouse) => {
|
||||||
v-close-popup
|
v-close-popup
|
||||||
v-ripple
|
v-ripple
|
||||||
@click="calculateSalePrice()"
|
@click="calculateSalePrice()"
|
||||||
|
data-cy="recalculatePriceItem"
|
||||||
>
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ t('Recalculate price') }}</QItemLabel>
|
<QItemLabel>{{ t('Recalculate price') }}</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem clickable v-ripple @click="emit('getMana')">
|
<QItem
|
||||||
|
clickable
|
||||||
|
v-ripple
|
||||||
|
@click="emit('getMana')"
|
||||||
|
data-cy="updateDiscountItem"
|
||||||
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ t('Update discount') }}</QItemLabel>
|
<QItemLabel>{{ t('Update discount') }}</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
@ -215,6 +223,7 @@ const createRefund = async (withWarehouse) => {
|
||||||
v-model.number="newDiscount"
|
v-model.number="newDiscount"
|
||||||
:label="t('ticketSale.discount')"
|
:label="t('ticketSale.discount')"
|
||||||
type="number"
|
type="number"
|
||||||
|
data-cy="ticketSaleDiscountInput"
|
||||||
/>
|
/>
|
||||||
</TicketEditManaProxy>
|
</TicketEditManaProxy>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
@ -224,6 +233,7 @@ const createRefund = async (withWarehouse) => {
|
||||||
v-close-popup
|
v-close-popup
|
||||||
v-ripple
|
v-ripple
|
||||||
@click="createClaim()"
|
@click="createClaim()"
|
||||||
|
data-cy="createClaimItem"
|
||||||
>
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ t('Add claim') }}</QItemLabel>
|
<QItemLabel>{{ t('Add claim') }}</QItemLabel>
|
||||||
|
@ -235,6 +245,7 @@ const createRefund = async (withWarehouse) => {
|
||||||
v-close-popup
|
v-close-popup
|
||||||
v-ripple
|
v-ripple
|
||||||
@click="setReserved(true)"
|
@click="setReserved(true)"
|
||||||
|
data-cy="markAsReservedItem"
|
||||||
>
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ t('Mark as reserved') }}</QItemLabel>
|
<QItemLabel>{{ t('Mark as reserved') }}</QItemLabel>
|
||||||
|
@ -246,12 +257,13 @@ const createRefund = async (withWarehouse) => {
|
||||||
v-close-popup
|
v-close-popup
|
||||||
v-ripple
|
v-ripple
|
||||||
@click="setReserved(false)"
|
@click="setReserved(false)"
|
||||||
|
data-cy="unmarkAsReservedItem"
|
||||||
>
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ t('Unmark as reserved') }}</QItemLabel>
|
<QItemLabel>{{ t('Unmark as reserved') }}</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem clickable v-ripple>
|
<QItem clickable v-ripple data-cy="ticketSaleRefundItem">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ t('Refund') }}</QItemLabel>
|
<QItemLabel>{{ t('Refund') }}</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
@ -260,12 +272,22 @@ const createRefund = async (withWarehouse) => {
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
<QMenu anchor="top end" self="top start" auto-close bordered>
|
<QMenu anchor="top end" self="top start" auto-close bordered>
|
||||||
<QList>
|
<QList>
|
||||||
<QItem v-ripple clickable @click="createRefund(true)">
|
<QItem
|
||||||
|
v-ripple
|
||||||
|
clickable
|
||||||
|
@click="createRefund(true)"
|
||||||
|
data-cy="ticketSaleRefundWithWarehouse"
|
||||||
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
{{ t('with warehouse') }}
|
{{ t('with warehouse') }}
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem v-ripple clickable @click="createRefund(false)">
|
<QItem
|
||||||
|
v-ripple
|
||||||
|
clickable
|
||||||
|
@click="createRefund(false)"
|
||||||
|
data-cy="ticketSaleRefundWithoutWarehouse"
|
||||||
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
{{ t('without warehouse') }}
|
{{ t('without warehouse') }}
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
|
|
@ -100,6 +100,7 @@ function toTicketUrl(section) {
|
||||||
ref="summaryRef"
|
ref="summaryRef"
|
||||||
:url="`Tickets/${entityId}/summary`"
|
:url="`Tickets/${entityId}/summary`"
|
||||||
data-key="TicketSummary"
|
data-key="TicketSummary"
|
||||||
|
data-cy="ticketSummary"
|
||||||
>
|
>
|
||||||
<template #header-left>
|
<template #header-left>
|
||||||
<VnToSummary
|
<VnToSummary
|
||||||
|
|
|
@ -91,7 +91,7 @@ onMounted(() => (_transfer.value = $props.transfer));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QPopupProxy ref="QPopupProxyRef">
|
<QPopupProxy ref="QPopupProxyRef" data-cy="ticketTransferPopup">
|
||||||
<QCard class="q-px-md" style="display: flex; width: 80vw">
|
<QCard class="q-px-md" style="display: flex; width: 80vw">
|
||||||
<QTable
|
<QTable
|
||||||
:rows="transfer.sales"
|
:rows="transfer.sales"
|
||||||
|
|
|
@ -57,6 +57,7 @@ defineExpose({ transferSales });
|
||||||
v-model.number="_transfer.ticketId"
|
v-model.number="_transfer.ticketId"
|
||||||
:label="t('Transfer to ticket')"
|
:label="t('Transfer to ticket')"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
|
data-cy="ticketTransferDestinationTicketInput"
|
||||||
>
|
>
|
||||||
<template #append>
|
<template #append>
|
||||||
<QBtn
|
<QBtn
|
||||||
|
@ -64,6 +65,7 @@ defineExpose({ transferSales });
|
||||||
color="primary"
|
color="primary"
|
||||||
@click="transferSales(_transfer.ticketId)"
|
@click="transferSales(_transfer.ticketId)"
|
||||||
style="width: 30px"
|
style="width: 30px"
|
||||||
|
data-cy="ticketTransferTransferBtn"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</VnInput>
|
</VnInput>
|
||||||
|
@ -72,6 +74,7 @@ defineExpose({ transferSales });
|
||||||
color="primary"
|
color="primary"
|
||||||
class="full-width q-my-lg"
|
class="full-width q-my-lg"
|
||||||
@click="transferSales()"
|
@click="transferSales()"
|
||||||
|
data-cy="ticketTransferNewTicketBtn"
|
||||||
/>
|
/>
|
||||||
</QForm>
|
</QForm>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -462,6 +462,7 @@ function setReference(data) {
|
||||||
data-key="TicketList"
|
data-key="TicketList"
|
||||||
:label="t('Search ticket')"
|
:label="t('Search ticket')"
|
||||||
:info="t('You can search by ticket id or alias')"
|
:info="t('You can search by ticket id or alias')"
|
||||||
|
data-cy="ticketListSearchBar"
|
||||||
/>
|
/>
|
||||||
<RightMenu>
|
<RightMenu>
|
||||||
<template #right-panel>
|
<template #right-panel>
|
||||||
|
@ -489,6 +490,7 @@ function setReference(data) {
|
||||||
'row-key': 'id',
|
'row-key': 'id',
|
||||||
selection: 'multiple',
|
selection: 'multiple',
|
||||||
}"
|
}"
|
||||||
|
data-cy="ticketListTable"
|
||||||
>
|
>
|
||||||
<template #column-statusIcons="{ row }">
|
<template #column-statusIcons="{ row }">
|
||||||
<TicketProblems :row="row" />
|
<TicketProblems :row="row" />
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('TicketList', () => {
|
||||||
|
const firstRow = 'tbody > :nth-child(1)';
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.visit('/#/ticket/list');
|
||||||
|
});
|
||||||
|
|
||||||
|
const searchResults = (search) => {
|
||||||
|
cy.dataCy('vnSearchBar').find('input').focus();
|
||||||
|
if (search) cy.dataCy('vnSearchBar').find('input').type(search);
|
||||||
|
cy.dataCy('vnSearchBar').find('input').type('{enter}');
|
||||||
|
cy.dataCy('ticketListTable').should('exist');
|
||||||
|
cy.get(firstRow).should('exist');
|
||||||
|
};
|
||||||
|
|
||||||
|
it('should search results', () => {
|
||||||
|
cy.dataCy('ticketListTable').should('not.exist');
|
||||||
|
cy.get('.q-field__control').should('exist');
|
||||||
|
searchResults();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should open ticket sales', () => {
|
||||||
|
searchResults();
|
||||||
|
cy.window().then((win) => {
|
||||||
|
cy.stub(win, 'open').as('windowOpen');
|
||||||
|
});
|
||||||
|
cy.get(firstRow).find('.q-btn:first').click();
|
||||||
|
cy.get('@windowOpen').should('be.calledWithMatch', /\/ticket\/\d+\/sale/);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should open ticket summary', () => {
|
||||||
|
searchResults();
|
||||||
|
cy.get(firstRow).find('.q-btn:last').click();
|
||||||
|
cy.dataCy('ticketSummary').should('exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Client list create new client', () => {
|
||||||
|
cy.dataCy('vnTableCreateBtn').should('exist');
|
||||||
|
cy.dataCy('vnTableCreateBtn').click();
|
||||||
|
const data = {
|
||||||
|
Customer: { val: 1, type: 'select' },
|
||||||
|
Warehouse: { val: 'Warehouse One', type: 'select' },
|
||||||
|
Address: { val: 'employee', type: 'select' },
|
||||||
|
Landed: { val: '01-01-2024', type: 'date' },
|
||||||
|
};
|
||||||
|
cy.fillInForm(data);
|
||||||
|
cy.get('.q-mt-lg > .q-btn--standard').click();
|
||||||
|
cy.checkNotification('Data created');
|
||||||
|
cy.url().should('match', /\/ticket\/\d+\/summary/);
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,25 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('TicketRequest', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.visit('/#/ticket/31/observation');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Creates and deletes a note', () => {
|
||||||
|
cy.dataCy('ticketNotesAddNoteBtn').should('exist');
|
||||||
|
cy.dataCy('ticketNotesAddNoteBtn').click();
|
||||||
|
cy.dataCy('ticketNotesObservationType').should('exist');
|
||||||
|
cy.selectOption('[data-cy="ticketNotesObservationType"]:last', 'Weight');
|
||||||
|
cy.dataCy('ticketNotesDescription').should('exist');
|
||||||
|
cy.get('[data-cy="ticketNotesDescription"]:last').type(
|
||||||
|
'This is a note description'
|
||||||
|
);
|
||||||
|
cy.dataCy('crudModelDefaultSaveBtn').click();
|
||||||
|
cy.checkNotification('Data saved');
|
||||||
|
cy.dataCy('ticketNotesRemoveNoteBtn').should('exist');
|
||||||
|
cy.dataCy('ticketNotesRemoveNoteBtn').click();
|
||||||
|
cy.dataCy('VnConfirm_confirm').click();
|
||||||
|
cy.checkNotification('Data saved');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,22 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('TicketRequest', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.visit('/#/ticket/31/request');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Creates a new request', () => {
|
||||||
|
cy.dataCy('vnTableCreateBtn').should('exist');
|
||||||
|
cy.dataCy('vnTableCreateBtn').click();
|
||||||
|
const data = {
|
||||||
|
Description: { val: 'Purchase description' },
|
||||||
|
Atender: { val: 'buyerNick', type: 'select' },
|
||||||
|
Quantity: { val: 2 },
|
||||||
|
Price: { val: 123 },
|
||||||
|
};
|
||||||
|
cy.fillInForm(data);
|
||||||
|
cy.get('.q-mt-lg > .q-btn--standard').click();
|
||||||
|
cy.checkNotification('Data created');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,131 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
|
||||||
|
const c = require('croppie');
|
||||||
|
|
||||||
|
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');
|
||||||
|
});
|
||||||
|
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');
|
||||||
|
});
|
||||||
|
|
||||||
|
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('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('adds claim', () => {
|
||||||
|
selectFirstRow();
|
||||||
|
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
||||||
|
cy.dataCy('createClaimItem').click();
|
||||||
|
cy.dataCy('VnConfirm_confirm').click();
|
||||||
|
cy.url().should('match', /\/claim\/\d+\/basic-data/);
|
||||||
|
// 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('marks row as reserved', () => {
|
||||||
|
selectFirstRow();
|
||||||
|
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
||||||
|
cy.waitForElement('[data-cy="markAsReservedItem"]');
|
||||||
|
cy.dataCy('markAsReservedItem').click();
|
||||||
|
cy.dataCy('ticketSaleReservedIcon').should('exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
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('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('transfers ticket', () => {
|
||||||
|
cy.visit('/#/ticket/32/sale');
|
||||||
|
selectFirstRow();
|
||||||
|
cy.dataCy('ticketSaleTransferBtn').click();
|
||||||
|
cy.dataCy('ticketTransferPopup').should('exist');
|
||||||
|
cy.dataCy('ticketTransferNewTicketBtn').click();
|
||||||
|
// existen 3 elementos "tbody" necesito checkear que el segundo elemento tbody tenga una row sola
|
||||||
|
cy.get('tbody').eq(1).find('tr').should('have.length', 1);
|
||||||
|
selectFirstRow();
|
||||||
|
cy.dataCy('ticketSaleTransferBtn').click();
|
||||||
|
cy.dataCy('ticketTransferPopup').should('exist');
|
||||||
|
cy.dataCy('ticketTransferDestinationTicketInput').find('input').focus();
|
||||||
|
cy.dataCy('ticketTransferDestinationTicketInput').find('input').type('32');
|
||||||
|
cy.dataCy('ticketTransferTransferBtn').click();
|
||||||
|
// checkear que la url contenga /ticket/1000002/sale
|
||||||
|
cy.url().should('match', /\/ticket\/32\/sale/);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should redirect to ticket logs', () => {
|
||||||
|
cy.get(firstRow).find('.q-btn:last').click();
|
||||||
|
cy.url().should('match', /\/ticket\/31\/log/);
|
||||||
|
});
|
||||||
|
});
|
|
@ -310,3 +310,7 @@ Cypress.Commands.add('checkValueSelectForm', (id, search) => {
|
||||||
Cypress.Commands.add('searchByLabel', (label, value) => {
|
Cypress.Commands.add('searchByLabel', (label, value) => {
|
||||||
cy.get(`[label="${label}"] > .q-field > .q-field__inner`).type(`${value}{enter}`);
|
cy.get(`[label="${label}"] > .q-field > .q-field__inner`).type(`${value}{enter}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Cypress.Commands.add('dataCy', (dataTestId, attr = 'data-cy') => {
|
||||||
|
return cy.get(`[${attr}="${dataTestId}"]`);
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in New Issue