test: refs #8162 more tests and change data-testid for data-cy
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
28bfda869a
commit
8e411125bf
|
@ -394,7 +394,7 @@ watch(formUrl, async () => {
|
|||
@click="onSubmit"
|
||||
:disable="!hasChanges"
|
||||
:title="t('globals.save')"
|
||||
data-testid="crudModelDefaultSaveBtn"
|
||||
data-cy="crudModelDefaultSaveBtn"
|
||||
/>
|
||||
<slot name="moreAfterActions" />
|
||||
</QBtnGroup>
|
||||
|
|
|
@ -737,7 +737,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
|||
fab
|
||||
icon="add"
|
||||
shortcut="+"
|
||||
data-testid="vnTableCreateBtn"
|
||||
data-cy="vnTableCreateBtn"
|
||||
/>
|
||||
<QTooltip self="top right">
|
||||
{{ createForm?.title }}
|
||||
|
|
|
@ -86,7 +86,7 @@ async function send() {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<QDialog ref="dialogRef" data-testid="vnSmsDialog">
|
||||
<QDialog ref="dialogRef" data-cy="vnSmsDialog">
|
||||
<QCard class="q-pa-sm">
|
||||
<QCardSection class="row items-center q-pb-none">
|
||||
<span class="text-h6 text-grey">
|
||||
|
@ -161,7 +161,7 @@ async function send() {
|
|||
:loading="isLoading"
|
||||
color="primary"
|
||||
unelevated
|
||||
data-testid="sendSmsBtn"
|
||||
data-cy="sendSmsBtn"
|
||||
/>
|
||||
</QCardActions>
|
||||
</QCard>
|
||||
|
|
|
@ -104,7 +104,6 @@ function cancel() {
|
|||
unelevated
|
||||
autofocus
|
||||
data-cy="VnConfirm_confirm"
|
||||
data-testid="vnConfirmConfirmBtn"
|
||||
/>
|
||||
</QCardActions>
|
||||
</QCard>
|
||||
|
|
|
@ -130,7 +130,7 @@ async function search() {
|
|||
dense
|
||||
standout
|
||||
autofocus
|
||||
data-testid="vnSearchBar"
|
||||
data-cy="vnSearchBar"
|
||||
>
|
||||
<template #prepend>
|
||||
<QIcon
|
||||
|
|
|
@ -100,7 +100,7 @@ async function remove() {
|
|||
</QMenu>
|
||||
</QItem>
|
||||
<QSeparator />
|
||||
<QItem @click="confirmRemove()" v-ripple clickable>
|
||||
<QItem @click="confirmRemove()" v-ripple clickable data-cy="deleteClaim">
|
||||
<QItemSection avatar>
|
||||
<QIcon name="delete" />
|
||||
</QItemSection>
|
||||
|
|
|
@ -130,7 +130,7 @@ function ticketFilter(ticket) {
|
|||
<QBadge
|
||||
text-color="black"
|
||||
:color="entity.ticketState.state.classColor"
|
||||
data-testid="ticketDescriptorStateBadge"
|
||||
data-cy="ticketDescriptorStateBadge"
|
||||
>
|
||||
{{ entity.ticketState.state.name }}
|
||||
</QBadge>
|
||||
|
|
|
@ -75,7 +75,7 @@ const cancel = () => {
|
|||
dense
|
||||
style="width: 50%"
|
||||
@click="save()"
|
||||
data-testid="saveManaBtn"
|
||||
data-cy="saveManaBtn"
|
||||
>
|
||||
{{ t('globals.save') }}
|
||||
</QBtn>
|
||||
|
|
|
@ -86,14 +86,14 @@ async function handleSave() {
|
|||
option-value="id"
|
||||
v-model="row.observationTypeFk"
|
||||
:disable="!!row.id"
|
||||
data-testid="ticketNotesObservationType"
|
||||
data-cy="ticketNotesObservationType"
|
||||
/>
|
||||
<VnInput
|
||||
:label="t('basicData.description')"
|
||||
v-model="row.description"
|
||||
class="col"
|
||||
@keyup.enter="handleSave"
|
||||
data-testid="ticketNotesDescription"
|
||||
data-cy="ticketNotesDescription"
|
||||
/>
|
||||
<QIcon
|
||||
name="delete"
|
||||
|
@ -101,7 +101,7 @@ async function handleSave() {
|
|||
class="cursor-pointer"
|
||||
color="primary"
|
||||
@click="handleDelete(row)"
|
||||
data-testid="ticketNotesRemoveNoteBtn"
|
||||
data-cy="ticketNotesRemoveNoteBtn"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('ticketNotes.removeNote') }}
|
||||
|
@ -116,7 +116,7 @@ async function handleSave() {
|
|||
class="fill-icon-on-hover q-ml-md"
|
||||
color="primary"
|
||||
@click="ticketNotesCrudRef.insert()"
|
||||
data-testid="ticketNotesAddNoteBtn"
|
||||
data-cy="ticketNotesAddNoteBtn"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('ticketNotes.addNote') }}
|
||||
|
|
|
@ -577,7 +577,7 @@ watch(
|
|||
color="primary"
|
||||
:disable="!isTicketEditable || ticketState === 'OK'"
|
||||
@click="changeTicketState('OK')"
|
||||
data-testid="ticketSaleOkStateBtn"
|
||||
data-cy="ticketSaleOkStateBtn"
|
||||
>
|
||||
<QTooltip>{{ t(`Change ticket state to 'Ok'`) }}</QTooltip>
|
||||
</QBtn>
|
||||
|
@ -586,7 +586,7 @@ watch(
|
|||
color="primary"
|
||||
:label="t('ticketList.state')"
|
||||
:disable="!isTicketEditable"
|
||||
data-testid="ticketSaleStateDropdown"
|
||||
data-cy="ticketSaleStateDropdown"
|
||||
>
|
||||
<VnSelect
|
||||
:options="editableStatesOptions"
|
||||
|
@ -596,7 +596,7 @@ watch(
|
|||
hide-dropdown-icon
|
||||
focus-on-mount
|
||||
@update:model-value="changeTicketState"
|
||||
data-testid="ticketSaleStateSelect"
|
||||
data-cy="ticketSaleStateSelect"
|
||||
/>
|
||||
</QBtnDropdown>
|
||||
<TicketSaleMoreActions
|
||||
|
@ -629,6 +629,7 @@ watch(
|
|||
icon="vn:splitline"
|
||||
:disable="!isTicketEditable || !hasSelectedRows"
|
||||
@click="setTransferParams()"
|
||||
data-cy="ticketSaleTransferBtn"
|
||||
>
|
||||
<QTooltip>{{ t('Transfer lines') }}</QTooltip>
|
||||
<TicketTransfer
|
||||
|
@ -708,7 +709,13 @@ watch(
|
|||
{{ t('ticketSale.visible') }}: {{ row.visible || 0 }}
|
||||
</QTooltip>
|
||||
</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>
|
||||
{{ t('ticketSale.reserved') }}
|
||||
</QTooltip>
|
||||
|
@ -867,7 +874,7 @@ watch(
|
|||
fab
|
||||
icon="add"
|
||||
shortcut="+"
|
||||
data-testid="ticketSaleAddToBasketBtn"
|
||||
data-cy="ticketSaleAddToBasketBtn"
|
||||
/>
|
||||
<QTooltip class="text-no-wrap">
|
||||
{{ t('Add item to basket') }}
|
||||
|
|
|
@ -179,7 +179,7 @@ const createRefund = async (withWarehouse) => {
|
|||
color="primary"
|
||||
:label="t('ticketSale.more')"
|
||||
:disable="disable"
|
||||
data-testid="ticketSaleMoreActionsDropdown"
|
||||
data-cy="ticketSaleMoreActionsDropdown"
|
||||
>
|
||||
<template #label>
|
||||
<QTooltip>{{ t('Select lines to see the options') }}</QTooltip>
|
||||
|
@ -191,7 +191,7 @@ const createRefund = async (withWarehouse) => {
|
|||
v-close-popup
|
||||
v-ripple
|
||||
@click="showSmsDialog('productNotAvailable')"
|
||||
data-testid="sendShortageSMSItem"
|
||||
data-cy="sendShortageSMSItem"
|
||||
>
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ t('Send shortage SMS') }}</QItemLabel>
|
||||
|
@ -203,7 +203,7 @@ const createRefund = async (withWarehouse) => {
|
|||
v-close-popup
|
||||
v-ripple
|
||||
@click="calculateSalePrice()"
|
||||
data-testid="recalculatePriceItem"
|
||||
data-cy="recalculatePriceItem"
|
||||
>
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ t('Recalculate price') }}</QItemLabel>
|
||||
|
@ -213,7 +213,7 @@ const createRefund = async (withWarehouse) => {
|
|||
clickable
|
||||
v-ripple
|
||||
@click="emit('getMana')"
|
||||
data-testid="updateDiscountItem"
|
||||
data-cy="updateDiscountItem"
|
||||
>
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ t('Update discount') }}</QItemLabel>
|
||||
|
@ -223,7 +223,7 @@ const createRefund = async (withWarehouse) => {
|
|||
v-model.number="newDiscount"
|
||||
:label="t('ticketSale.discount')"
|
||||
type="number"
|
||||
data-testid="ticketSaleDiscountInput"
|
||||
data-cy="ticketSaleDiscountInput"
|
||||
/>
|
||||
</TicketEditManaProxy>
|
||||
</QItem>
|
||||
|
@ -233,7 +233,7 @@ const createRefund = async (withWarehouse) => {
|
|||
v-close-popup
|
||||
v-ripple
|
||||
@click="createClaim()"
|
||||
data-testid="createClaimItem"
|
||||
data-cy="createClaimItem"
|
||||
>
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ t('Add claim') }}</QItemLabel>
|
||||
|
@ -245,6 +245,7 @@ const createRefund = async (withWarehouse) => {
|
|||
v-close-popup
|
||||
v-ripple
|
||||
@click="setReserved(true)"
|
||||
data-cy="markAsReservedItem"
|
||||
>
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ t('Mark as reserved') }}</QItemLabel>
|
||||
|
@ -256,12 +257,13 @@ const createRefund = async (withWarehouse) => {
|
|||
v-close-popup
|
||||
v-ripple
|
||||
@click="setReserved(false)"
|
||||
data-cy="unmarkAsReservedItem"
|
||||
>
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ t('Unmark as reserved') }}</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem clickable v-ripple>
|
||||
<QItem clickable v-ripple data-cy="ticketSaleRefundItem">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ t('Refund') }}</QItemLabel>
|
||||
</QItemSection>
|
||||
|
@ -270,12 +272,22 @@ const createRefund = async (withWarehouse) => {
|
|||
</QItemSection>
|
||||
<QMenu anchor="top end" self="top start" auto-close bordered>
|
||||
<QList>
|
||||
<QItem v-ripple clickable @click="createRefund(true)">
|
||||
<QItem
|
||||
v-ripple
|
||||
clickable
|
||||
@click="createRefund(true)"
|
||||
data-cy="ticketSaleRefundWithWarehouse"
|
||||
>
|
||||
<QItemSection>
|
||||
{{ t('with warehouse') }}
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem v-ripple clickable @click="createRefund(false)">
|
||||
<QItem
|
||||
v-ripple
|
||||
clickable
|
||||
@click="createRefund(false)"
|
||||
data-cy="ticketSaleRefundWithoutWarehouse"
|
||||
>
|
||||
<QItemSection>
|
||||
{{ t('without warehouse') }}
|
||||
</QItemSection>
|
||||
|
|
|
@ -100,7 +100,7 @@ function toTicketUrl(section) {
|
|||
ref="summaryRef"
|
||||
:url="`Tickets/${entityId}/summary`"
|
||||
data-key="TicketSummary"
|
||||
data-testid="ticketSummary"
|
||||
data-cy="ticketSummary"
|
||||
>
|
||||
<template #header-left>
|
||||
<VnToSummary
|
||||
|
|
|
@ -91,7 +91,7 @@ onMounted(() => (_transfer.value = $props.transfer));
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<QPopupProxy ref="QPopupProxyRef">
|
||||
<QPopupProxy ref="QPopupProxyRef" data-cy="ticketTransferPopup">
|
||||
<QCard class="q-px-md" style="display: flex; width: 80vw">
|
||||
<QTable
|
||||
:rows="transfer.sales"
|
||||
|
|
|
@ -57,6 +57,7 @@ defineExpose({ transferSales });
|
|||
v-model.number="_transfer.ticketId"
|
||||
:label="t('Transfer to ticket')"
|
||||
:clearable="false"
|
||||
data-cy="ticketTransferDestinationTicketInput"
|
||||
>
|
||||
<template #append>
|
||||
<QBtn
|
||||
|
@ -64,6 +65,7 @@ defineExpose({ transferSales });
|
|||
color="primary"
|
||||
@click="transferSales(_transfer.ticketId)"
|
||||
style="width: 30px"
|
||||
data-cy="ticketTransferTransferBtn"
|
||||
/>
|
||||
</template>
|
||||
</VnInput>
|
||||
|
@ -72,6 +74,7 @@ defineExpose({ transferSales });
|
|||
color="primary"
|
||||
class="full-width q-my-lg"
|
||||
@click="transferSales()"
|
||||
data-cy="ticketTransferNewTicketBtn"
|
||||
/>
|
||||
</QForm>
|
||||
</template>
|
||||
|
|
|
@ -461,7 +461,7 @@ function setReference(data) {
|
|||
data-key="TicketList"
|
||||
:label="t('Search ticket')"
|
||||
:info="t('You can search by ticket id or alias')"
|
||||
data-testid="ticketListSearchBar"
|
||||
data-cy="ticketListSearchBar"
|
||||
/>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
|
@ -489,7 +489,7 @@ function setReference(data) {
|
|||
'row-key': 'id',
|
||||
selection: 'multiple',
|
||||
}"
|
||||
data-testid="ticketListTable"
|
||||
data-cy="ticketListTable"
|
||||
>
|
||||
<template #column-statusIcons="{ row }">
|
||||
<div class="q-gutter-x-xs">
|
||||
|
|
|
@ -10,16 +10,16 @@ describe('TicketRequest', () => {
|
|||
cy.dataCy('ticketNotesAddNoteBtn').should('exist');
|
||||
cy.dataCy('ticketNotesAddNoteBtn').click();
|
||||
cy.dataCy('ticketNotesObservationType').should('exist');
|
||||
cy.selectOption('[data-testid="ticketNotesObservationType"]:last', 'Weight');
|
||||
cy.selectOption('[data-cy="ticketNotesObservationType"]:last', 'Weight');
|
||||
cy.dataCy('ticketNotesDescription').should('exist');
|
||||
cy.get('[data-testid="ticketNotesDescription"]:last').type(
|
||||
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('vnConfirmConfirmBtn').click();
|
||||
cy.dataCy('VnConfirm_confirm').click();
|
||||
cy.checkNotification('Data saved');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
/// <reference types="cypress" />
|
||||
|
||||
const c = require('croppie');
|
||||
|
||||
describe('TicketSale', () => {
|
||||
beforeEach(() => {
|
||||
cy.login('developer');
|
||||
|
@ -26,7 +28,7 @@ describe('TicketSale', () => {
|
|||
it('should send SMS', () => {
|
||||
selectFirstRow();
|
||||
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
||||
cy.waitForElement('[data-testid="sendShortageSMSItem"]');
|
||||
cy.waitForElement('[data-cy="sendShortageSMSItem"]');
|
||||
cy.dataCy('sendShortageSMSItem').should('exist');
|
||||
cy.dataCy('sendShortageSMSItem').click();
|
||||
cy.dataCy('vnSmsDialog').should('exist');
|
||||
|
@ -38,7 +40,7 @@ describe('TicketSale', () => {
|
|||
cy.intercept('POST', '**/recalculatePrice').as('recalculatePrice');
|
||||
selectFirstRow();
|
||||
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
||||
cy.waitForElement('[data-testid="recalculatePriceItem"]');
|
||||
cy.waitForElement('[data-cy="recalculatePriceItem"]');
|
||||
cy.dataCy('recalculatePriceItem').should('exist');
|
||||
cy.dataCy('recalculatePriceItem').click();
|
||||
cy.wait('@recalculatePrice').its('response.statusCode').should('eq', 200);
|
||||
|
@ -48,14 +50,82 @@ describe('TicketSale', () => {
|
|||
it('should update discount when "Update discount" is clicked', () => {
|
||||
selectFirstRow();
|
||||
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
||||
cy.waitForElement('[data-testid="updateDiscountItem"]');
|
||||
cy.waitForElement('[data-cy="updateDiscountItem"]');
|
||||
cy.dataCy('updateDiscountItem').should('exist');
|
||||
cy.dataCy('updateDiscountItem').click();
|
||||
cy.waitForElement('[data-testid="ticketSaleDiscountInput"]');
|
||||
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/);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -312,6 +312,6 @@ Cypress.Commands.add('searchByLabel', (label, value) => {
|
|||
cy.get(`[label="${label}"] > .q-field > .q-field__inner`).type(`${value}{enter}`);
|
||||
});
|
||||
|
||||
Cypress.Commands.add('dataCy', (dataTestId, attr = 'data-testid') => {
|
||||
Cypress.Commands.add('dataCy', (dataTestId, attr = 'data-cy') => {
|
||||
return cy.get(`[${attr}="${dataTestId}"]`);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue