Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 8664-refactorCmrList

This commit is contained in:
Jose Antonio Tubau 2025-03-07 10:59:28 +01:00
commit cf1cb9ccdd
61 changed files with 1893 additions and 802 deletions

1
.gitignore vendored
View File

@ -31,6 +31,7 @@ yarn-error.log*
# Cypress directories and files
/test/cypress/videos
/test/cypress/screenshots
/junit
# VitePress directories and files
/docs/.vitepress/cache

7
Jenkinsfile vendored
View File

@ -117,12 +117,13 @@ pipeline {
sh 'rm -f junit/e2e-*.xml'
env.COMPOSE_TAG = PROTECTED_BRANCH.contains(env.CHANGE_TARGET) ? env.CHANGE_TARGET : 'dev'
def image = docker.build('lilium-dev', '-f docs/Dockerfile.dev docs')
sh 'docker login --username $CREDS_USR --password $CREDS_PSW $REGISTRY'
sh "docker-compose ${env.COMPOSE_PARAMS} up -d"
def image = docker.build('lilium-dev', '-f docs/Dockerfile.dev docs')
image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ") {
sh 'cypress run --browser chromium || true'
image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ --init") {
sh 'sh test/cypress/cypressParallel.sh 3'
}
}
}

View File

@ -1,13 +1,18 @@
import { defineConfig } from 'cypress';
let urlHost, reporter, reporterOptions;
let urlHost, reporter, reporterOptions, timeouts;
if (process.env.CI) {
urlHost = 'front';
reporter = 'junit';
reporterOptions = {
mochaFile: 'junit/e2e-[hash].xml',
toConsole: false,
};
timeouts = {
defaultCommandTimeout: 30000,
requestTimeout: 30000,
responseTimeout: 60000,
pageLoadTimeout: 60000,
};
} else {
urlHost = 'localhost';
@ -20,17 +25,19 @@ if (process.env.CI) {
reportDir: 'test/cypress/reports',
inlineAssets: true,
};
timeouts = {
defaultCommandTimeout: 10000,
requestTimeout: 10000,
responseTimeout: 30000,
pageLoadTimeout: 60000,
};
}
export default defineConfig({
e2e: {
baseUrl: `http://${urlHost}:9000`,
experimentalStudio: false,
defaultCommandTimeout: 10000,
trashAssetsBeforeRuns: false,
requestTimeout: 10000,
responseTimeout: 30000,
pageLoadTimeout: 60000,
defaultBrowser: 'chromium',
fixturesFolder: 'test/cypress/fixtures',
screenshotsFolder: 'test/cypress/screenshots',
@ -50,8 +57,8 @@ export default defineConfig({
},
viewportWidth: 1280,
viewportHeight: 720,
...timeouts,
includeShadowDom: true,
waitForAnimations: true,
},
experimentalMemoryManagement: true,
defaultCommandTimeout: 10000,
numTestsKeptInMemory: 2,
});

View File

@ -39,7 +39,7 @@ ENV PNPM_HOME="/home/app/.local/share/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN pnpm setup \
&& pnpm install --global cypress@13.6.6 \
&& pnpm install --global cypress@14.1.0 \
&& cypress install
WORKDIR /app

View File

@ -13,6 +13,8 @@
"format": "prettier --write \"**/*.{js,vue,scss,html,md,json}\" --ignore-path .gitignore",
"test:e2e": "cypress open",
"test:e2e:ci": "npm run resetDatabase && cd ../salix-front && cypress run",
"test:e2e:parallel": "bash ./test/cypress/cypressParallel.sh",
"test:e2e:summary": "bash ./test/cypress/summary.sh",
"test": "echo \"See package.json => scripts for available tests.\" && exit 0",
"test:front": "vitest",
"test:front:ci": "vitest run",
@ -47,18 +49,20 @@
"@quasar/quasar-app-extension-testing-unit-vitest": "^0.4.0",
"@vue/test-utils": "^2.4.4",
"autoprefixer": "^10.4.14",
"cypress": "^13.6.6",
"cypress": "^14.1.0",
"cypress-mochawesome-reporter": "^3.8.2",
"eslint": "^9.18.0",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-cypress": "^4.1.0",
"eslint-plugin-vue": "^9.32.0",
"husky": "^8.0.0",
"mocha": "^11.1.0",
"postcss": "^8.4.23",
"prettier": "^3.4.2",
"sass": "^1.83.4",
"vitepress": "^1.6.3",
"vitest": "^0.34.0"
"vitest": "^0.34.0",
"xunit-viewer": "^10.6.1"
},
"engines": {
"node": "^20 || ^18 || ^16",

File diff suppressed because it is too large Load Diff

View File

@ -57,7 +57,7 @@ const refresh = () => window.location.reload();
:class="{
'no-visible': !stateQuery.isLoading().value,
}"
size="xs"
size="sm"
data-cy="loading-spinner"
/>
<QSpace />

View File

@ -56,7 +56,12 @@ async function confirm() {
{{ t('The notification will be sent to the following address') }}
</QCardSection>
<QCardSection class="q-pt-none">
<VnInput v-model="address" is-outlined autofocus />
<VnInput
v-model="address"
is-outlined
autofocus
data-cy="SendEmailNotifiactionDialogInput"
/>
</QCardSection>
<QCardActions align="right">
<QBtn :label="t('globals.cancel')" color="primary" flat v-close-popup />

View File

@ -22,6 +22,12 @@ describe('getAddresses', () => {
relation: 'client',
scope: {
fields: ['defaultAddressFk'],
include: {
relation: 'defaultAddress',
scope: {
fields: ['id', 'agencyModeFk'],
},
},
},
},
],

View File

@ -9,6 +9,12 @@ export async function getAddresses(clientId, _filter = {}) {
relation: 'client',
scope: {
fields: ['defaultAddressFk'],
include: {
relation: 'defaultAddress',
scope: {
fields: ['id', 'agencyModeFk'],
},
},
},
},
],

View File

@ -70,6 +70,7 @@ function ticketFilter(invoice) {
icon="vn:client"
color="primary"
:to="{ name: 'CustomerCard', params: { id: entity.client.id } }"
data-cy="invoiceOutDescriptorCustomerCard"
>
<QTooltip>{{ t('invoiceOut.card.customerCard') }}</QTooltip>
</QBtn>
@ -81,6 +82,7 @@ function ticketFilter(invoice) {
name: 'TicketList',
query: { table: ticketFilter(entity) },
}"
data-cy="invoiceOutDescriptorTicketList"
>
<QTooltip>{{ t('invoiceOut.card.ticketList') }}</QTooltip>
</QBtn>

View File

@ -158,11 +158,11 @@ onMounted(async () => {
if (route.query?.createForm) {
const query = JSON.parse(route.query?.createForm);
formInitialData.value = query;
await onClientSelected({ ...formInitialData.value, clientId: query?.clientFk });
await onClientSelected({ ...formInitialData.value, clientFk: query?.clientFk });
} else if (route.query?.table) {
const query = JSON.parse(route.query?.table);
const clientId = query?.clientFk;
if (clientId) await onClientSelected({ clientId });
const clientFk = query?.clientFk;
if (clientFk) await onClientSelected({ clientFk });
}
if (tableRef.value) tableRef.value.create.formInitialData = formInitialData.value;
});
@ -171,8 +171,8 @@ watch(
() => route.query.table,
async (newValue) => {
if (newValue) {
const clientId = +JSON.parse(newValue)?.clientFk;
if (clientId) await onClientSelected({ clientId });
const clientFk = +JSON.parse(newValue)?.clientFk;
if (clientFk) await onClientSelected({ clientFk });
if (tableRef.value)
tableRef.value.create.formInitialData = formInitialData.value;
}
@ -180,13 +180,19 @@ watch(
{ immediate: true },
);
async function onClientSelected({ clientId: id }, formData = {}) {
const { data } = await getAddresses(id);
async function onClientSelected({ clientFk }, formData = {}) {
if (!clientFk) {
addressOptions.value = [];
formData.defaultAddressFk = null;
formData.addressId = null;
return;
}
const { data } = await getAddresses(clientFk);
addressOptions.value = data;
formData.defaultAddressFk = data[0].client.defaultAddressFk;
formData.addressId = formData.defaultAddressFk;
formInitialData.value = { addressId: formData.addressId, clientFk: id };
formInitialData.value = { addressId: formData.addressId, clientFk };
await fetchAgencies(formData);
}
@ -271,7 +277,9 @@ const getDateColor = (date) => {
:include="{ relation: 'addresses' }"
v-model="data.clientFk"
:label="t('module.customer')"
@update:model-value="(id) => onClientSelected(id, data)"
@update:model-value="
(id) => onClientSelected({ clientFk: id }, data)
"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">

View File

@ -123,7 +123,7 @@ async function handleSave() {
}
function validateFields(item) {
// Only validate fields that are being updated
const shouldExist = (field) => !isUpdate || field in item;
const shouldExist = (field) => field in item;
if (!shouldExist('ticketServiceTypeFk') && !item.ticketServiceTypeFk) {
notify('Description is required', 'negative');

View File

@ -81,6 +81,7 @@ const openCreateModal = () => createTrackingDialogRef.value.show();
ref="paginateRef"
data-key="TicketTracking"
:user-filter="paginateFilter"
search-url="table"
url="TicketTrackings"
auto-load
order="created DESC"

View File

@ -22,7 +22,6 @@ import { toTimeFormat } from 'src/filters/date';
import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
import TicketProblems from 'src/components/TicketProblems.vue';
import VnSection from 'src/components/common/VnSection.vue';
import { getClient } from 'src/pages/Customer/composables/getClient';
import { getAddresses } from 'src/pages/Customer/composables/getAddresses';
import { getAgencies } from 'src/pages/Route/Agency/composables/getAgencies';
@ -267,6 +266,12 @@ const onClientSelected = async (formData) => {
};
const fetchAddresses = async (formData) => {
if (!formData.clientId) {
addressesOptions.value = [];
formData.defaultAddressFk = null;
formData.addressId = null;
return;
}
const { data } = await getAddresses(formData.clientId);
formInitialData.value = { clientId: formData.clientId };
if (!data) return;

View File

@ -279,7 +279,11 @@ async function autofillBic(worker) {
/>
</VnRow>
<VnRow>
<VnInput v-model="data.fi" :label="t('worker.create.fi')" />
<VnInput
v-model="data.fi"
:label="t('worker.create.fi')"
required
/>
<VnInputDate
v-model="data.birth"
:label="t('worker.create.birth')"

View File

@ -29,10 +29,10 @@ const setFilteredAddresses = (data) => {
<template #form="{ data, validate }">
<VnRow>
<VnInput
data-cy="zone-basic-data-name"
:label="t('Name')"
clearable
v-model="data.name"
data-cy="ZoneBasicDataName"
:required="true"
/>
</VnRow>
@ -75,7 +75,6 @@ const setFilteredAddresses = (data) => {
min="0"
/>
</VnRow>
<VnRow>
<VnInput
v-model="data.travelingDays"
@ -86,7 +85,6 @@ const setFilteredAddresses = (data) => {
/>
<VnInputTime v-model="data.hour" :label="t('Closing')" :required="true" />
</VnRow>
<VnRow>
<VnInput
v-model="data.price"
@ -95,6 +93,7 @@ const setFilteredAddresses = (data) => {
min="0"
:required="true"
clearable
data-cy="ZoneBasicDataPrice"
/>
<VnInput
v-model="data.priceOptimum"

View File

@ -36,13 +36,13 @@ function openConfirmDialog(callback) {
}
</script>
<template>
<QItem @click="openConfirmDialog('remove')" v-ripple clickable>
<QItem @click="openConfirmDialog('remove')" v-ripple clickable data-cy="Delete_button">
<QItemSection avatar>
<QIcon name="delete" />
</QItemSection>
<QItemSection>{{ t('deleteZone') }}</QItemSection>
</QItem>
<QItem @click="openConfirmDialog('clone')" v-ripple clickable>
<QItem @click="openConfirmDialog('clone')" v-ripple clickable data-cy="Clone_button">
<QItemSection avatar>
<QIcon name="content_copy" />
</QItemSection>

View File

@ -58,7 +58,7 @@ const arrayData = useArrayData('ZoneEvents');
const createEvent = async () => {
eventInclusionFormData.value.weekDays = weekdayStore.toSet(
eventInclusionFormData.value.wdays
eventInclusionFormData.value.wdays,
);
if (inclusionType.value == 'day') eventInclusionFormData.value.weekDays = '';
@ -74,7 +74,7 @@ const createEvent = async () => {
else
await axios.put(
`Zones/${route.params.id}/events/${props.event?.id}`,
eventInclusionFormData.value
eventInclusionFormData.value,
);
await refetchEvents();
@ -123,12 +123,14 @@ onMounted(() => {
dense
val="day"
:label="t('eventsInclusionForm.oneDay')"
data-cy="ZoneEventInclusionDayRadio"
/>
<QRadio
v-model="inclusionType"
dense
val="indefinitely"
:label="t('eventsInclusionForm.indefinitely')"
data-cy="ZoneEventInclusionIndefinitelyRadio"
/>
<QRadio
v-model="inclusionType"
@ -136,6 +138,7 @@ onMounted(() => {
val="range"
:label="t('eventsInclusionForm.rangeOfDates')"
class="q-mb-sm"
data-cy="ZoneEventInclusionRangeRadio"
/>
</div>
<VnRow>
@ -156,10 +159,12 @@ onMounted(() => {
<VnInputDate
:label="t('eventsInclusionForm.from')"
v-model="eventInclusionFormData.started"
data-cy="ZoneEventsFromDate"
/>
<VnInputDate
:label="t('eventsInclusionForm.to')"
v-model="eventInclusionFormData.ended"
data-cy="ZoneEventsToDate"
/>
</VnRow>
<VnRow>
@ -221,7 +226,7 @@ onMounted(() => {
openConfirmationModal(
t('zone.deleteTitle'),
t('zone.deleteSubtitle'),
() => deleteEvent()
() => deleteEvent(),
)
"
/>

View File

@ -185,6 +185,7 @@ const handleDateClick = (timestamp) => {
:class="{
'--today': isToday(timestamp),
}"
data-cy="ZoneCalendarDay"
>
<QPopupProxy v-if="isZoneDeliveryView">
<ZoneClosingTable

View File

@ -46,7 +46,7 @@ watch(
inq.value = {
deliveryMethodFk: { inq: deliveryMethods.value[deliveryMethodFk.value] },
};
}
},
);
</script>
@ -98,6 +98,7 @@ watch(
outlined
rounded
map-key="geoFk"
data-cy="ZoneDeliveryDaysPostcodeSelect"
>
<template #option="{ itemProps, opt }">
<QItem v-bind="itemProps">
@ -129,6 +130,7 @@ watch(
dense
outlined
rounded
data-cy="ZoneDeliveryDaysAgencySelect"
/>
<VnSelect
v-else

View File

@ -1,10 +1,15 @@
import { RouterView } from 'vue-router';
import { setRectificative } from 'src/pages/InvoiceIn/composables/setRectificative';
const invoiceInCard = {
name: 'InvoiceInCard',
path: ':id',
component: () => import('src/pages/InvoiceIn/Card/InvoiceInCard.vue'),
redirect: { name: 'InvoiceInSummary' },
beforeEnter: async (to, from, next) => {
await setRectificative(to);
next();
},
meta: {
menu: [
'InvoiceInBasicData',
@ -32,8 +37,7 @@ const invoiceInCard = {
title: 'basicData',
icon: 'vn:settings',
},
component: () =>
import('src/pages/InvoiceIn/Card/InvoiceInBasicData.vue'),
component: () => import('src/pages/InvoiceIn/Card/InvoiceInBasicData.vue'),
},
{
name: 'InvoiceInVat',
@ -51,8 +55,7 @@ const invoiceInCard = {
title: 'dueDay',
icon: 'vn:calendar',
},
component: () =>
import('src/pages/InvoiceIn/Card/InvoiceInDueDay.vue'),
component: () => import('src/pages/InvoiceIn/Card/InvoiceInDueDay.vue'),
},
{
name: 'InvoiceInIntrastat',
@ -61,8 +64,7 @@ const invoiceInCard = {
title: 'intrastat',
icon: 'vn:lines',
},
component: () =>
import('src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue'),
component: () => import('src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue'),
},
{
name: 'InvoiceInCorrective',
@ -71,8 +73,7 @@ const invoiceInCard = {
title: 'corrective',
icon: 'attachment',
},
component: () =>
import('src/pages/InvoiceIn/Card/InvoiceInCorrective.vue'),
component: () => import('src/pages/InvoiceIn/Card/InvoiceInCorrective.vue'),
},
{
name: 'InvoiceInLog',
@ -86,7 +87,7 @@ const invoiceInCard = {
],
};
export default {
export default {
name: 'InvoiceIn',
path: '/invoice-in',
meta: {
@ -98,7 +99,7 @@ export default {
component: RouterView,
redirect: { name: 'InvoiceInMain' },
children: [
{
{
name: 'InvoiceInMain',
path: '',
component: () => import('src/components/common/VnModule.vue'),
@ -111,7 +112,7 @@ export default {
component: () => import('src/pages/InvoiceIn/InvoiceInList.vue'),
children: [
{
name: 'InvoiceInList',
name: 'InvoiceInList',
path: 'list',
meta: {
title: 'list',
@ -137,9 +138,10 @@ export default {
title: 'serial',
icon: 'view_list',
},
component: () => import('src/pages/InvoiceIn/Serial/InvoiceInSerial.vue'),
component: () =>
import('src/pages/InvoiceIn/Serial/InvoiceInSerial.vue'),
},
],
},
],
};
};

View File

@ -5,3 +5,4 @@ downloads/*
storage/*
reports/*
docker/logs/*
results/*

View File

@ -0,0 +1,15 @@
#!/bin/bash
find 'test/cypress/integration' \
-mindepth 1 \
-maxdepth 1 \
-type d | \
xargs -P "$1" -I {} sh -c '
echo "🔷 {}" &&
xvfb-run -a cypress run \
--headless \
--spec "{}" \
--quiet \
> /dev/null
'
wait

View File

@ -10,8 +10,6 @@ describe('ClaimDevelopment', () => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/claim/${claimId}/development`);
cy.intercept('GET', /\/api\/Workers\/search/).as('workers');
cy.intercept('GET', /\/api\/Workers\/search/).as('workers');
cy.waitForElement('tbody');
});
@ -36,7 +34,6 @@ describe('ClaimDevelopment', () => {
});
it('should add and remove new line', () => {
cy.wait(['@workers', '@workers']);
cy.addCard();
cy.waitForElement(thirdRow);

View File

@ -1,4 +1,4 @@
describe.skip('ClaimNotes', () => {
describe('ClaimNotes', () => {
const saveBtn = '.q-field__append > .q-btn > .q-btn__content > .q-icon';
const firstNote = '.q-infinite-scroll :nth-child(1) > .q-card__section--vert';
beforeEach(() => {
@ -8,7 +8,10 @@ describe.skip('ClaimNotes', () => {
it('should add a new note', () => {
const message = 'This is a new message.';
cy.get('.q-textarea').should('not.be.disabled').type(message);
cy.get('.q-textarea')
.should('be.visible')
.should('not.be.disabled')
.type(message);
cy.get(saveBtn).click();
cy.get(firstNote).should('have.text', message);

View File

@ -1,6 +1,7 @@
/// <reference types="cypress" />
describe('ClaimPhoto', () => {
const carrouselClose = '.q-dialog__inner > .q-toolbar > .q-btn > .q-btn__content > .q-icon';
const carrouselClose =
'.q-dialog__inner > .q-toolbar > .q-btn > .q-btn__content > .q-icon';
beforeEach(() => {
const claimId = 1;
cy.login('developer');
@ -12,7 +13,7 @@ describe('ClaimPhoto', () => {
cy.get('label > .q-btn input').selectFile('test/cypress/fixtures/image.jpg', {
force: true,
});
cy.get('.q-notification__message').should('have.text', 'Data saved');
cy.checkNotification('Data saved');
});
it('should add new file with drag and drop', () => {
@ -20,7 +21,7 @@ describe('ClaimPhoto', () => {
cy.get('.container').selectFile('test/cypress/fixtures/image.jpg', {
action: 'drag-drop',
});
cy.get('.q-notification__message').should('have.text', 'Data saved');
cy.checkNotification('Data saved');
});
it('should open first image dialog change to second and close', () => {
@ -38,12 +39,12 @@ describe('ClaimPhoto', () => {
cy.get(
'.q-card__actions > .q-btn--unelevated > .q-btn__content > .block',
).click();
cy.get('.q-notification__message').should('have.text', 'Data deleted');
cy.checkNotification('Data deleted');
cy.dataCy('delete-button-3').click();
cy.get(
'.q-card__actions > .q-btn--unelevated > .q-btn__content > .block',
).click();
cy.get('.q-notification__message').should('have.text', 'Data deleted');
cy.checkNotification('Data deleted');
});
});

View File

@ -58,14 +58,23 @@ describe('Client list', () => {
cy.waitForElement('.q-form');
cy.checkValueForm(1, search);
cy.checkValueForm(2, search);
cy.dataCy('Customer_select').should('have.value', search);
cy.dataCy('Address_select').should('have.value', search);
});
it('Client founded create order', () => {
const search = 'Jessica Jones';
cy.searchByLabel('Name', search);
cy.intercept('GET', /\/api\/Clients\/1110\/summary/).as('customer');
cy.dataCy('Name_input').type(`${search}{enter}`);
cy.wait('@customer');
cy.get('.actions > .q-card__actions').should('exist');
cy.clickButtonWith('icon', 'icon-basketadd');
cy.url().should('include', `/customer/1110/summary`);
cy.waitForElement('#formModel');
cy.waitForElement('.q-form');
cy.checkValueForm(1, search);
cy.dataCy('Client_select').should('have.value', search);
cy.dataCy('Address_select').should('have.value', search);
});
});

View File

@ -12,7 +12,7 @@ describe('Client web-access', () => {
cy.get('.q-btn-group > :nth-child(1)').should('not.be.disabled');
cy.get('.q-checkbox__inner').click();
cy.get('.q-btn-group > .q-btn--standard.q-btn--actionable').should(
'not.be.disabled'
'not.be.disabled',
);
cy.get('.q-btn-group > .q-btn--flat').should('not.be.disabled');
cy.get('.q-btn-group > :nth-child(1)').click();

View File

@ -20,7 +20,7 @@ describe('Entry', () => {
);
});
it('Create entry, modify travel and add buys', () => {
it.skip('Create entry, modify travel and add buys', () => {
createEntryAndBuy();
cy.get('a[data-cy="EntryBasicData-menu-item"]').click();
selectTravel('two');

View File

@ -10,8 +10,6 @@ describe('InvoiceInVat', () => {
beforeEach(() => {
cy.login('developer');
cy.visit(`/#/invoice-in/1/vat`);
cy.intercept('GET', '/api/InvoiceIns/1/getTotals').as('lastCall');
cy.wait('@lastCall');
});
it('should edit the sage iva', () => {

View File

@ -1,5 +1,5 @@
/// <reference types="cypress" />
describe('InvoiceOut manual invoice', () => {
describe.skip('InvoiceOut manual invoice', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
@ -10,12 +10,17 @@ describe('InvoiceOut manual invoice', () => {
it('should create an invoice from a ticket and go to that invoice', () => {
cy.searchByLabel('Customer ID', '1101');
cy.get(
'[data-q-vs-anchor=""] > :nth-child(1) > .q-checkbox > .q-checkbox__inner'
'[data-q-vs-anchor=""] > :nth-child(1) > .q-checkbox > .q-checkbox__inner',
).click();
cy.dataCy('ticketListMakeInvoiceBtn').click();
cy.checkNotification('Data saved');
cy.get('.q-virtual-scroll__content > :nth-child(1) > :nth-child(3)').click();
cy.get(':nth-child(8) > .value > .link').click();
cy.get('.header > :nth-child(3) > .q-btn__content').click();
cy.get('.q-menu > .descriptor > .header').should('be.visible');
cy.get(
'.q-menu > .descriptor > .header > [data-cy="descriptor-more-opts"] > .q-btn__content',
).click();
cy.get('[data-cy="descriptor-more-opts-menu"] > .q-list > :nth-child(4)').click();
cy.dataCy('VnConfirm_confirm').click();
});
});

View File

@ -9,7 +9,7 @@ describe('InvoiceOut negative bases', () => {
cy.visit(`/#/invoice-out/negative-bases`);
});
it('should open the posible descriptors', () => {
it.skip('should open the posible descriptors', () => {
cy.get(getDescriptors('clientId')).click();
cy.get('.descriptor').should('be.visible');
cy.get('.q-item > .q-item__label').should('include.text', '1101');

View File

@ -7,13 +7,11 @@ describe('InvoiceOut summary', () => {
const firstRowDescriptors = (opt) =>
`tbody > :nth-child(1) > :nth-child(${opt}) > .q-btn`;
const toCustomerSummary = '[href="#/customer/1101"]';
const toTicketList = '[href="#/ticket/list?table={%22refFk%22:%22T1111111%22}"]';
const selectMenuOption = (opt) => `.q-menu > .q-list > :nth-child(${opt})`;
const confirmSend = '.q-btn--unelevated';
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/invoice-out/1/summary`);
});
@ -26,15 +24,17 @@ describe('InvoiceOut summary', () => {
cy.get('.q-item > .q-item__label').should('include.text', '1101');
});
it('should open the client summary and the ticket list', () => {
cy.get(toCustomerSummary).click();
it('should open the client summary', () => {
cy.dataCy('invoiceOutDescriptorCustomerCard').click();
cy.get('.descriptor').should('be.visible');
cy.get('.q-item > .q-item__label').should('include.text', '1101');
});
it('should open the ticket list', () => {
cy.get(toTicketList).click();
cy.dataCy('vnFilterPanelChip').should('include.text', 'T1111111');
cy.get('[data-col-field="stateFk"]').each(($el) => {
cy.wrap($el).contains('T1111111');
});
});
it('should transfer the invoice ', () => {
@ -50,6 +50,7 @@ describe('InvoiceOut summary', () => {
cy.dataCy('descriptor-more-opts').click();
cy.get(selectMenuOption(3)).click();
cy.dataCy('InvoiceOutDescriptorMenuSendPdfOption').click();
cy.dataCy('SendEmailNotifiactionDialogInput').should('be.visible');
cy.get(confirmSend).click();
cy.checkNotification('Notification sent');
});
@ -58,18 +59,11 @@ describe('InvoiceOut summary', () => {
cy.dataCy('descriptor-more-opts').click();
cy.get(selectMenuOption(3)).click();
cy.dataCy('InvoiceOutDescriptorMenuSendCsvOption').click();
cy.dataCy('SendEmailNotifiactionDialogInput').should('be.visible');
cy.get(confirmSend).click();
cy.checkNotification('Notification sent');
});
it('should delete an invoice ', () => {
cy.typeSearchbar('T2222222{enter}');
cy.dataCy('descriptor-more-opts').click();
cy.get(selectMenuOption(4)).click();
cy.dataCy('VnConfirm_confirm').click();
cy.checkNotification('InvoiceOut deleted');
});
it('should book the invoice', () => {
cy.dataCy('descriptor-more-opts').click();
cy.get(selectMenuOption(5)).click();

View File

@ -3,7 +3,6 @@ function goTo(n = 1) {
return `.q-virtual-scroll__content > :nth-child(${n})`;
}
const firstRow = goTo();
`.q-virtual-scroll__content > :nth-child(2)`;
describe('Handle Items FixedPrice', () => {
beforeEach(() => {
cy.viewport(1280, 720);

View File

@ -7,11 +7,9 @@ describe('Item botanical', () => {
});
it('should modify the botanical', () => {
cy.dataCy('AddGenusSelectDialog').type('Abies');
cy.get('.q-menu .q-item').contains('Abies').click();
cy.dataCy('AddSpeciesSelectDialog').type('dealbata');
cy.get('.q-menu .q-item').contains('dealbata').click();
cy.get('.q-btn-group > .q-btn--standard').click();
cy.selectOption('[data-cy="AddGenusSelectDialog"]', 'Abies');
cy.selectOption('[data-cy="AddSpeciesSelectDialog"]', 'dealbata');
cy.saveCard();
cy.checkNotification('Data saved');
});

View File

@ -1,6 +1,6 @@
/// <reference types="cypress" />
describe('Item list', () => {
describe.skip('Item list', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
@ -16,8 +16,7 @@ describe('Item list', () => {
cy.get('.q-virtual-scroll__content > :nth-child(4) > :nth-child(4)').click();
});
// https://redmine.verdnatura.es/issues/8421
it.skip('should create an item', () => {
it('should create an item', () => {
const data = {
Description: { val: `Test item` },
Type: { val: `Crisantemo`, type: 'select' },

View File

@ -1,5 +1,9 @@
/// <reference types="cypress" />
describe('OrderList', () => {
const clientCreateSelect = '#formModel [data-cy="Client_select"]';
const addressCreateSelect = '#formModel [data-cy="Address_select"]';
const agencyCreateSelect = '#formModel [data-cy="Agency_select"]';
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
@ -7,17 +11,56 @@ describe('OrderList', () => {
});
it('create order', () => {
/* ==== Generated with Cypress Studio ==== */
cy.get('[data-cy="vnTableCreateBtn"]').click();
cy.get('[data-cy="Client_select"]').type('1101');
cy.get('.q-menu').contains('Bruce Wayne').click();
cy.get('[data-cy="Address_select"]').click();
cy.selectOption(clientCreateSelect, 1101);
cy.get(addressCreateSelect).click();
cy.get(
'.q-menu > div> div.q-item:nth-child(1) >div.q-item__section--avatar > i',
).should('have.text', 'star');
cy.get('.q-menu > div> .q-item:nth-child(1)').click();
cy.dataCy('landedDate').find('input').type('06/01/2001');
cy.get('.q-card [data-cy="Agency_select"]').click();
cy.selectOption(agencyCreateSelect, 1);
cy.intercept('GET', /\/api\/Orders\/\d/).as('orderSale');
cy.get('[data-cy="FormModelPopup_save"] > .q-btn__content > .block').click();
cy.wait('@orderSale');
cy.get('.q-item > .q-item__label.subtitle').then((text) => {
const id = text.text().trim().split('#')[1];
cy.get('.q-item > .q-item__label').should('have.text', ` #${id}`);
});
cy.url().should('include', `/order`);
});
it('filter list and create order', () => {
cy.dataCy('Customer ID_input').type('1101{enter}');
cy.dataCy('vnTableCreateBtn').click();
cy.dataCy('landedDate').find('input').type('06/01/2001');
cy.get(agencyCreateSelect).click();
cy.get('.q-menu > div> .q-item:nth-child(1)').click();
cy.intercept('GET', /\/api\/Orders\/\d/).as('orderSale');
cy.get('[data-cy="FormModelPopup_save"] > .q-btn__content > .block').click();
cy.wait('@orderSale');
cy.get('.q-item > .q-item__label.subtitle').then((text) => {
const id = text.text().trim().split('#')[1];
cy.get('.q-item > .q-item__label').should('have.text', ` #${id}`);
});
cy.url().should('include', `/order`);
});
it('create order from customer summary', function () {
const clientId = 1101;
cy.dataCy('Customer ID_input').type(`${clientId}{enter}`);
cy.get(
':nth-child(1) > [data-col-field="clientFk"] > .no-padding > .link',
).click();
cy.get(
`[href="#/order/list?createForm={%22clientFk%22:${clientId},%22addressId%22:1}"] > .q-btn__content > .q-icon`,
).click();
cy.dataCy('vnTableCreateBtn').click();
cy.get(clientCreateSelect).should('have.value', 'Bruce Wayne');
cy.get(addressCreateSelect).should('have.value', 'Bruce Wayne');
cy.dataCy('landedDate').find('input').type('06/01/2001');
cy.get(agencyCreateSelect).click();
cy.get('.q-menu > div> .q-item:nth-child(1)').click();
cy.intercept('GET', /\/api\/Orders\/\d/).as('orderSale');
cy.get('[data-cy="FormModelPopup_save"] > .q-btn__content > .block').click();

View File

@ -2,7 +2,7 @@
describe('Logout', () => {
beforeEach(() => {
cy.login('developer');
cy.visit(`/#/dashboard`);
cy.visit(`/#/dashboard`, false);
cy.waitForElement('.q-page', 6000);
});
describe('by user', () => {

View File

@ -6,13 +6,16 @@ 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',
);
});
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');
cy.checkNotification('The code already exists');
});
it('should edit the code and sector', () => {
@ -24,7 +27,8 @@ describe('ParkingBasicData', () => {
cy.dataCy('Picking order_input').clear().type(80230);
cy.saveCard();
cy.get('.q-notification__message').should('have.text', 'Data saved');
cy.checkNotification('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

@ -1,5 +1,5 @@
/// <reference types="cypress" />
describe('Ticket Lack detail', () => {
describe.skip('Ticket Lack detail', () => {
beforeEach(() => {
cy.login('developer');
cy.intercept('GET', /\/api\/Tickets\/itemLack\/5.*$/, {
@ -37,11 +37,11 @@ describe('Ticket Lack detail', () => {
],
}).as('getItemLack');
cy.visit('/#/ticket/negative/5');
cy.visit('/#/ticket/negative/5', false);
cy.wait('@getItemLack');
});
describe('Table actions', () => {
it.skip('should display only one row in the lack list', () => {
it('should display only one row in the lack list', () => {
cy.location('href').should('contain', '#/ticket/negative/5');
cy.get('[data-cy="changeItem"]').should('be.disabled');
@ -139,7 +139,7 @@ describe('Ticket Lack detail', () => {
cy.wait('@getItemGetSimilar');
});
describe('Replace item if', () => {
it.only('Quantity is less than available', () => {
it('Quantity is less than available', () => {
cy.get(':nth-child(1) > .text-right > .q-btn').click();
});
});

View File

@ -14,8 +14,6 @@ describe('Ticket descriptor', () => {
it('should clone the ticket without warehouse', () => {
cy.visit('/#/ticket/1/summary');
cy.intercept('GET', /\/api\/Tickets\/\d/).as('ticket');
cy.wait('@ticket');
cy.openActionsDescriptor();
cy.contains(listItem, toCloneOpt).click();
cy.clickConfirm();

View File

@ -10,10 +10,8 @@ describe('Ticket expedtion', () => {
it('should change the state', () => {
cy.visit('#/ticket/1/expedition');
cy.intercept('GET', /\/api\/Expeditions\/filter/).as('show');
cy.intercept('POST', /\/api\/ExpeditionStates\/addExpeditionState/).as('add');
cy.wait('@show');
cy.selectRows([1, 2]);
cy.dataCy('change-state').click();

View File

@ -1,22 +1,20 @@
/// <reference types="cypress" />
describe.only('TicketList', () => {
describe('TicketList', () => {
const firstRow = 'tbody.q-virtual-scroll__content tr:nth-child(1)';
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit('/#/ticket/list');
cy.visit('/#/ticket/list', false);
});
const searchResults = (search) => {
if (search) cy.typeSearchbar().type(search);
cy.dataCy('vn-searchbar').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();
});
@ -52,7 +50,7 @@ describe.only('TicketList', () => {
cy.getOption().click();
cy.dataCy('Address_select').should('have.value', 'Bruce Wayne');
});
it('Client list create new client', () => {
it('Client list create new ticket', () => {
cy.dataCy('vnTableCreateBtn').should('exist');
cy.dataCy('vnTableCreateBtn').click();
const data = {

View File

@ -27,7 +27,7 @@ describe('VnSearchBar', () => {
const searchAndCheck = (searchTerm, expectedText) => {
cy.clearSearchbar();
cy.typeSearchbar(`${searchTerm}{enter}`);
cy.get(idGap).should('have.text', expectedText);
cy.get(idGap).should('include.text', expectedText);
};
const checkTableLength = (expectedLength) => {

View File

@ -1,4 +1,4 @@
describe('WagonCreate', () => {
describe.skip('WagonCreate', () => {
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
@ -16,7 +16,7 @@ describe('WagonCreate', () => {
cy.get(
'.grid-create > [label="Volume"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="Volume_input"]',
).type('100');
cy.dataCy('Type_select').type('{downarrow}{enter}');
cy.selectOption('[data-cy="Type_select"]', '1');
cy.get('[title="Remove"] > .q-btn__content > .q-icon').first().click();
});

View File

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

View File

@ -22,7 +22,7 @@ describe('WorkerNotificationsManager', () => {
);
});
it.skip('should active a notification that is yours', () => {
it('should active a notification that is yours', () => {
cy.login('developer');
cy.visit(`/#/worker/${developerId}/notifications`);
cy.waitForElement(activeList);

View File

@ -1,5 +1,5 @@
describe('ZoneBasicData', () => {
const priceBasicData = '[data-cy="Price_input"]';
const priceBasicData = '[data-cy="ZoneBasicDataPrice"]';
const saveBtn = '.q-btn-group > .q-btn--standard';
beforeEach(() => {
@ -8,20 +8,13 @@ describe('ZoneBasicData', () => {
cy.visit('/#/zone/4/basic-data');
});
it('should throw an error if the name is empty', () => {
cy.get('[data-cy="zone-basic-data-name"] input').type('{selectall}{backspace}');
cy.get(saveBtn).click();
cy.checkNotification("can't be blank");
});
it('should throw an error if the price is empty', () => {
cy.get(priceBasicData).clear();
cy.get(saveBtn).click();
cy.checkNotification('cannot be blank');
cy.get('.q-field__messages > div').should('have.text', 'Field required');
});
it("should edit the basicData's zone", () => {
it("should edit the basicData's zone name", () => {
cy.get('.q-card > :nth-child(1)').type(' modified');
cy.get(saveBtn).click();
cy.checkNotification('Data saved');

View File

@ -0,0 +1,53 @@
describe('ZoneCalendar', () => {
const addEventBtn = '.q-page-sticky > div > .q-btn';
const submitBtn = '.q-mt-lg > .q-btn--standard';
const deleteBtn = '.q-item__section--side > .q-btn';
const from = '.q-field__control-container > [data-cy="ZoneEventsFromDate"]';
const to = '.q-field__control-container > [data-cy="ZoneEventsToDate"]';
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit(`/#/zone/11/events`);
});
it('should include a one day event, then delete it', () => {
cy.get(addEventBtn).click();
cy.dataCy('ZoneEventInclusionDayRadio').click();
cy.get('.q-card > :nth-child(5)').type('02/04/2001');
cy.get(submitBtn).click();
cy.get(deleteBtn).click();
cy.dataCy('VnConfirm_confirm').click();
});
it('should include an indefinitely event for monday and tuesday', () => {
cy.get(addEventBtn).click();
cy.get('.flex > .q-gutter-x-sm > :nth-child(1)').click();
cy.get('.flex > .q-gutter-x-sm > :nth-child(2)').click();
cy.get(submitBtn).click();
cy.get(deleteBtn).click();
cy.dataCy('VnConfirm_confirm').click();
});
it('should include a range of dates event', () => {
cy.get(addEventBtn).click();
cy.dataCy('ZoneEventInclusionRangeRadio').click();
cy.get('.flex > .q-gutter-x-sm > :nth-child(1)').click();
cy.dataCy('From_inputDate').type('01/01/2001');
cy.dataCy('To_inputDate').type('31/01/2001');
cy.get(submitBtn).click();
cy.get(deleteBtn).click();
cy.dataCy('VnConfirm_confirm').click();
});
it('should exclude an event', () => {
cy.get('.q-mb-sm > .q-radio__inner').click();
cy.get('.q-current-day > .q-calendar-month__day--label__wrapper').click();
cy.get('.q-mt-lg > .q-btn--standard').click();
cy.get(
'.q-current-day > .q-calendar-month__day--content > [data-cy="ZoneCalendarDay"]',
).click();
cy.get('.q-mt-lg > :nth-child(2)').click();
cy.dataCy('VnConfirm_confirm').click();
});
});

View File

@ -1,4 +1,4 @@
describe('ZoneCreate', () => {
describe.skip('ZoneCreate', () => {
const data = {
Name: { val: 'Zone pickup D' },
Price: { val: '3' },
@ -9,7 +9,6 @@ describe('ZoneCreate', () => {
};
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit('/#/zone/list');
cy.get('.q-page-sticky > div > .q-btn').click();

View File

@ -1,15 +1,61 @@
describe('ZoneDeliveryDays', () => {
const postcode = '46680';
const agency = 'Gotham247Expensive';
const submitForm = '.q-form > .q-btn > .q-btn__content';
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit(`/#/zone/delivery-days`);
});
it('should query for the day', () => {
it('should return no data when querying without params', () => {
cy.get('.q-form > .q-btn > .q-btn__content').click();
cy.get('.q-notification__message').should(
'have.text',
'No service for the specified zone'
'No service for the specified zone',
);
});
it('should query for delivery', () => {
cy.intercept('GET', /\/api\/Zones\/getEvents/, (req) => {
req.headers['cache-control'] = 'no-cache';
req.headers['pragma'] = 'no-cache';
req.headers['expires'] = '0';
req.on('response', (res) => {
delete res.headers['if-none-match'];
delete res.headers['if-modified-since'];
});
}).as('events');
cy.dataCy('ZoneDeliveryDaysPostcodeSelect').type(postcode);
cy.get('.q-menu .q-item').contains(postcode).click();
cy.get('.q-menu').then(($menu) => {
if ($menu.is(':visible')) {
cy.get('[data-cy="ZoneDeliveryDaysPostcodeSelect"]')
.as('focusedElement')
.focus();
cy.get('@focusedElement').blur();
}
});
cy.get('.q-menu').should('not.exist');
cy.dataCy('ZoneDeliveryDaysAgencySelect').type(agency);
cy.get('.q-menu .q-item').contains(agency).click();
cy.get('.q-menu').then(($menu) => {
if ($menu.is(':visible')) {
cy.get('[data-cy="ZoneDeliveryDaysAgencySelect"]')
.as('focusedElement')
.focus();
cy.get('@focusedElement').blur();
}
});
cy.get('.q-menu').should('not.exist');
cy.get(submitForm).click();
cy.wait('@events').then((interception) => {
cy.log('interception: ', interception);
const data = interception.response.body.events;
expect(data.length).to.be.greaterThan(0);
});
});
});

View File

@ -7,10 +7,6 @@ describe('ZoneList', () => {
});
it('should filter by agency', () => {
cy.dataCy('zoneFilterPanelNameInput').type('{downArrow}{enter}');
});
it('should open the zone summary', () => {
cy.dataCy('zoneFilterPanelAgencySelect').type(agency);
cy.get('.q-menu .q-item').contains(agency).click();
cy.get(':nth-child(1) > [data-col-field="agencyModeFk"]').should(
@ -18,4 +14,22 @@ describe('ZoneList', () => {
agency,
);
});
it('should open the zone summary', () => {
cy.dataCy('zoneFilterPanelAgencySelect').type(agency);
cy.get('.q-menu .q-item').contains(agency).click();
cy.dataCy('tableAction-0').eq(1).click();
cy.get('.header > .q-icon').click();
cy.url().should('include', 'zone/2/summary');
});
it('should clone the zone', () => {
cy.get('.router-link-active > .q-icon').click();
cy.dataCy('tableAction-1').eq(1).click();
cy.dataCy('VnConfirm_confirm').click();
cy.url().should('not.include', 'zone/2/');
cy.url().should('match', /zone\/\d+\/basic-data/);
cy.get('.list-box > :nth-child(1)').should('include.text', agency);
cy.get('.title > span').should('include.text', 'Zone pickup B');
});
});

View File

@ -0,0 +1,23 @@
describe('ZoneLocations', () => {
const data = {
Warehouse: { val: 'Warehouse One', type: 'select' },
};
const postalCode = '[style=""] > :nth-child(1) > :nth-child(1) > :nth-child(2) > :nth-child(1) > :nth-child(1) > :nth-child(2) > :nth-child(1) > .q-tree__node--parent > .q-tree__node-collapsible > .q-tree__children'
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit(`/#/zone/2/location`);
});
it('should show all locations on entry', () => {
cy.get('.q-tree > :nth-child(1) > :nth-child(2) > :nth-child(1)').children().should('have.length', 9);
});
it('should be able to search by postal code', () => {
cy.get('#searchbarForm').type('46680');
cy.get('.router-link-active > .q-icon').click();
cy.get(postalCode).should('include.text', '46680')
});
});

View File

@ -0,0 +1,22 @@
describe('ZoneSummary', () => {
const agency = 'inhouse pickup';
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit('/#/zone/2/summary');
});
it('should clone the zone, then delete it', () => {
cy.dataCy('descriptor-more-opts').click();
cy.dataCy('Clone_button').click();
cy.dataCy('VnConfirm_confirm').click();
cy.url().should('not.include', 'zone/2/');
cy.url().should('match', /zone\/\d+\/basic-data/);
cy.get('.list-box > :nth-child(1)').should('include.text', agency);
cy.get('.title > span').should('include.text', 'Zone pickup B');
cy.get('.q-page').should('exist');
cy.dataCy('descriptor-more-opts').click();
cy.dataCy('Delete_button').click();
cy.dataCy('VnConfirm_confirm').click();
});
});

View File

@ -1,9 +1,17 @@
describe('ZoneUpcomingDeliveries', () => {
const tableFields = (opt) =>
`:nth-child(1) > .q-table__container > .q-table__middle > .q-table > thead > tr > :nth-child(${opt})`;
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit(`/#/zone/upcoming-deliveries`);
});
it('should show the page', () => {});
it('should show the page', () => {
cy.get('.q-card').should('be.visible');
cy.get(tableFields(1)).should('be.visible').should('have.text', 'Province');
cy.get(tableFields(2)).should('be.visible').should('have.text', 'Closing');
cy.get(tableFields(3)).should('be.visible').should('have.text', 'Id');
});
});

View File

@ -1,20 +1,19 @@
describe('ZoneWarehouse', () => {
describe.skip('ZoneWarehouse', () => {
const data = {
Warehouse: { val: 'Warehouse One', type: 'select' },
Warehouse: { val: 'Warehouse Two', type: 'select' },
};
const dataError = 'The introduced warehouse already exists';
const saveBtn = '.q-btn--standard > .q-btn__content > .block';
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit(`/#/zone/2/warehouses`);
cy.visit(`/#/zone/1/warehouses`);
});
it('should throw an error if the warehouse chosen is already put in the zone', () => {
cy.addBtnClick();
cy.dataCy('Warehouse_select').type('Warehouse Two{enter}');
cy.dataCy('Warehouse_select').type('Warehouse One{enter}');
cy.get(saveBtn).click();
cy.checkNotification(dataError);
});
@ -26,7 +25,5 @@ describe('ZoneWarehouse', () => {
cy.get('.q-mt-lg > .q-btn--standard').click();
cy.get('tbody > :nth-child(2) > :nth-child(2) > .q-icon').click();
cy.get('[title="Confirm"]').click();
cy.reload();
});
});

32
test/cypress/run.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash
cleanup() {
if [[ -z "$ended" ]]; then
ended=true
docker-compose -p e2e --project-directory . -f test/cypress/docker-compose.yml down -v
fi
}
trap cleanup SIGINT
#CLEAN
rm -rf test/cypress/screenshots
rm -f test/cypress/results/*
rm -f test/cypress/reports/*
rm -f junit/e2e-*.xml
#RUN
export CI=true
export TZ=Europe/Madrid
docker-compose -p e2e --project-directory . -f test/cypress/docker-compose.yml up -d
docker run -it --rm \
-v "$(pwd)":/app \
--network e2e_default \
-e CI \
-e TZ \
lilium-dev \
bash -c 'sh test/cypress/cypressParallel.sh 2'
cleanup

3
test/cypress/summary.sh Normal file
View File

@ -0,0 +1,3 @@
pnpm exec junit-merge --dir junit --out junit/junit-final.xml
pnpm exec xunit-viewer -r junit/junit-final.xml -o junit/report.html
xdg-open junit/report.html

View File

@ -27,6 +27,7 @@
// DO NOT REMOVE
// Imports Quasar Cypress AE predefined commands
// import { registerCommands } from '@quasar/quasar-app-extension-testing-e2e-cypress';
import waitUntil from './waitUntil';
Cypress.Commands.add('waitUntil', { prevSubject: 'optional' }, waitUntil);
@ -57,14 +58,20 @@ Cypress.Commands.add('login', (user = 'developer') => {
});
});
Cypress.Commands.overwrite('visit', (originalFn, url, options) => {
Cypress.Commands.overwrite('visit', (originalFn, url, options, waitRequest = true) => {
originalFn(url, options);
cy.waitUntil(() => cy.document().then((doc) => doc.readyState === 'complete'));
cy.waitUntil(() => cy.get('main').should('exist'));
if (waitRequest)
cy.get('body').then(($body) => {
if ($body.find('[data-cy="loading-spinner"]').length) {
cy.get('[data-cy="loading-spinner"]').should('not.be.visible');
}
});
});
Cypress.Commands.add('waitForElement', (element, timeout = 10000) => {
cy.get(element, { timeout }).should('be.visible').and('not.be.disabled');
Cypress.Commands.add('waitForElement', (element) => {
cy.get(element).should('be.visible').and('not.be.disabled');
});
Cypress.Commands.add('getValue', (selector) => {
@ -331,7 +338,7 @@ Cypress.Commands.add('openUserPanel', () => {
});
Cypress.Commands.add('checkNotification', (text) => {
cy.get('.q-notification', { timeout: 10000 })
cy.get('.q-notification')
.should('be.visible')
.should('have.length.greaterThan', 0)
.should(($elements) => {
@ -341,7 +348,6 @@ Cypress.Commands.add('checkNotification', (text) => {
expect(found).to.be.true;
});
});
Cypress.Commands.add('openActions', (row) => {
cy.get('tbody > tr').eq(row).find('.actions > .q-btn').click();
});

View File

@ -40,4 +40,30 @@ style.innerHTML = `
`;
document.head.appendChild(style);
const waitForApiReady = (url, maxRetries = 20, delay = 1000) => {
let retries = 0;
function checkApi() {
return cy
.request({
url,
failOnStatusCode: false,
})
.then((response) => {
if (response.status !== 200 && retries < maxRetries) {
retries++;
cy.wait(delay);
return checkApi();
}
expect(response.status).to.eq(200);
});
}
return checkApi();
};
before(() => {
waitForApiReady('/api/Applications/status');
});
export { randomString, randomNumber, randomizeValue };