#8074: Modify spinner size #1521

Merged
jon merged 8 commits from 8074-AddLoaderInPaginate into dev 2025-03-06 09:02:29 +00:00
49 changed files with 1808 additions and 817 deletions
Showing only changes of commit fce8ae4508 - Show all commits

1
.gitignore vendored
View File

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

7
Jenkinsfile vendored
View File

@ -114,15 +114,16 @@ pipeline {
} }
steps { steps {
script { script {
sh 'rm junit/e2e-*.xml || true' sh 'rm -f junit/e2e-*.xml'
env.COMPOSE_TAG = PROTECTED_BRANCH.contains(env.CHANGE_TARGET) ? env.CHANGE_TARGET : 'dev' 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 login --username $CREDS_USR --password $CREDS_PSW $REGISTRY'
sh "docker-compose ${env.COMPOSE_PARAMS} up -d" 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") { image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ") {
sh 'cypress run --browser chromium || true' sh 'sh test/cypress/cypressParallel.sh 2'
} }
} }
} }

View File

@ -1,13 +1,18 @@
import { defineConfig } from 'cypress'; import { defineConfig } from 'cypress';
let urlHost, reporter, reporterOptions; let urlHost, reporter, reporterOptions, timeouts;
if (process.env.CI) { if (process.env.CI) {
urlHost = 'front'; urlHost = 'front';
reporter = 'junit'; reporter = 'junit';
reporterOptions = { reporterOptions = {
mochaFile: 'junit/e2e-[hash].xml', mochaFile: 'junit/e2e-[hash].xml',
toConsole: false, };
timeouts = {
defaultCommandTimeout: 30000,
requestTimeout: 30000,
responseTimeout: 60000,
pageLoadTimeout: 60000,
}; };
} else { } else {
urlHost = 'localhost'; urlHost = 'localhost';
@ -20,17 +25,19 @@ if (process.env.CI) {
reportDir: 'test/cypress/reports', reportDir: 'test/cypress/reports',
inlineAssets: true, inlineAssets: true,
}; };
timeouts = {
defaultCommandTimeout: 10000,
requestTimeout: 10000,
responseTimeout: 30000,
pageLoadTimeout: 60000,
};
} }
export default defineConfig({ export default defineConfig({
e2e: { e2e: {
baseUrl: `http://${urlHost}:9000`, baseUrl: `http://${urlHost}:9000`,
experimentalStudio: false, experimentalStudio: false,
defaultCommandTimeout: 10000,
trashAssetsBeforeRuns: false, trashAssetsBeforeRuns: false,
requestTimeout: 10000,
responseTimeout: 30000,
pageLoadTimeout: 60000,
defaultBrowser: 'chromium', defaultBrowser: 'chromium',
fixturesFolder: 'test/cypress/fixtures', fixturesFolder: 'test/cypress/fixtures',
screenshotsFolder: 'test/cypress/screenshots', screenshotsFolder: 'test/cypress/screenshots',
@ -50,8 +57,8 @@ export default defineConfig({
}, },
viewportWidth: 1280, viewportWidth: 1280,
viewportHeight: 720, 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" ENV PATH="$PNPM_HOME:$PATH"
RUN pnpm setup \ RUN pnpm setup \
&& pnpm install --global cypress@13.6.6 \ && pnpm install --global cypress@14.1.0 \
&& cypress install && cypress install
WORKDIR /app WORKDIR /app

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -245,7 +245,7 @@ export function useArrayData(key, userOptions) {
async function loadMore() { async function loadMore() {
if (!store.hasMoreData) return; if (!store.hasMoreData) return;
store.skip = store.limit * store.page; store.skip = (store?.filter?.limit ?? store.limit) * store.page;
store.page += 1; store.page += 1;
await fetch({ append: true }); await fetch({ append: true });

View File

@ -17,7 +17,21 @@ describe('getAddresses', () => {
expect(axios.get).toHaveBeenCalledWith(`Clients/${clientId}/addresses`, { expect(axios.get).toHaveBeenCalledWith(`Clients/${clientId}/addresses`, {
params: { params: {
filter: JSON.stringify({ filter: JSON.stringify({
fields: ['nickname', 'street', 'city', 'id', 'isActive'], include: [
{
relation: 'client',
scope: {
fields: ['defaultAddressFk'],
include: {
relation: 'defaultAddress',
scope: {
fields: ['id', 'agencyModeFk'],
},
},
},
},
],
fields: ['nickname', 'street', 'city', 'id', 'isActive', 'clientFk'],
where: { isActive: true }, where: { isActive: true },
order: ['isDefaultAddress DESC', 'isActive DESC', 'nickname ASC'], order: ['isDefaultAddress DESC', 'isActive DESC', 'nickname ASC'],
}), }),

View File

@ -4,7 +4,21 @@ export async function getAddresses(clientId, _filter = {}) {
if (!clientId) return; if (!clientId) return;
const filter = { const filter = {
..._filter, ..._filter,
fields: ['nickname', 'street', 'city', 'id', 'isActive'], include: [
{
relation: 'client',
scope: {
fields: ['defaultAddressFk'],
include: {
relation: 'defaultAddress',
scope: {
fields: ['id', 'agencyModeFk'],
},
},
},
},
],
fields: ['nickname', 'street', 'city', 'id', 'isActive', 'clientFk'],
where: { isActive: true }, where: { isActive: true },
order: ['isDefaultAddress DESC', 'isActive DESC', 'nickname ASC'], order: ['isDefaultAddress DESC', 'isActive DESC', 'nickname ASC'],
}; };

View File

@ -94,6 +94,7 @@ const submit = async (rows) => {
icon="add_circle" icon="add_circle"
v-shortcut="'+'" v-shortcut="'+'"
flat flat
data-cy="addBarcode_input"
> >
<QTooltip> <QTooltip>
{{ t('Add barcode') }} {{ t('Add barcode') }}

View File

@ -226,7 +226,6 @@ const onDenyAccept = (_, responseData) => {
order="shipped ASC, isOk ASC" order="shipped ASC, isOk ASC"
:columns="columns" :columns="columns"
:user-params="userParams" :user-params="userParams"
:is-editable="true"
:right-search="false" :right-search="false"
auto-load auto-load
:disable-option="{ card: true }" :disable-option="{ card: true }"

View File

@ -1,6 +1,6 @@
<script setup> <script setup>
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { computed, ref, onMounted } from 'vue'; import { computed, ref, onMounted, watch } from 'vue';
import { dashIfEmpty, toCurrency, toDate } from 'src/filters'; import { dashIfEmpty, toCurrency, toDate } from 'src/filters';
import { toDateTimeFormat } from 'src/filters/date'; import { toDateTimeFormat } from 'src/filters/date';
import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { useSummaryDialog } from 'src/composables/useSummaryDialog';
@ -16,6 +16,7 @@ import VnTable from 'src/components/VnTable/VnTable.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue'; import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import VnSection from 'src/components/common/VnSection.vue'; import VnSection from 'src/components/common/VnSection.vue';
import { getAddresses } from '../Customer/composables/getAddresses';
const { t } = useI18n(); const { t } = useI18n();
const { viewSummary } = useSummaryDialog(); const { viewSummary } = useSummaryDialog();
@ -24,6 +25,11 @@ const agencyList = ref([]);
const route = useRoute(); const route = useRoute();
const addressOptions = ref([]); const addressOptions = ref([]);
const dataKey = 'OrderList'; const dataKey = 'OrderList';
const formInitialData = ref({
active: true,
addressId: null,
clientFk: null,
});
const columns = computed(() => [ const columns = computed(() => [
{ {
@ -147,32 +153,47 @@ const columns = computed(() => [
], ],
}, },
]); ]);
onMounted(() => { onMounted(async () => {
if (!route.query.createForm) return; if (!route.query) return;
const clientId = route.query.createForm; if (route.query?.createForm) {
const id = JSON.parse(clientId); const query = JSON.parse(route.query?.createForm);
fetchClientAddress(id.clientFk); formInitialData.value = query;
await onClientSelected({ ...formInitialData.value, clientFk: query?.clientFk });
} else if (route.query?.table) {
const query = JSON.parse(route.query?.table);
const clientFk = query?.clientFk;
if (clientFk) await onClientSelected({ clientFk });
}
if (tableRef.value) tableRef.value.create.formInitialData = formInitialData.value;
}); });
async function fetchClientAddress(id, formData = {}) { watch(
const { data } = await axios.get(`Clients/${id}/addresses`, { () => route.query.table,
params: { async (newValue) => {
filter: JSON.stringify({ if (newValue) {
include: [ const clientFk = +JSON.parse(newValue)?.clientFk;
{ if (clientFk) await onClientSelected({ clientFk });
relation: 'client', if (tableRef.value)
scope: { tableRef.value.create.formInitialData = formInitialData.value;
fields: ['defaultAddressFk'], }
}, },
}, { immediate: true },
], );
order: ['isActive DESC'],
}), async function onClientSelected({ clientFk }, formData = {}) {
}, if (!clientFk) {
}); addressOptions.value = [];
formData.defaultAddressFk = null;
formData.addressId = null;
return;
}
const { data } = await getAddresses(clientFk);
addressOptions.value = data; addressOptions.value = data;
formData.addressId = data[0].client.defaultAddressFk; formData.defaultAddressFk = data[0].client.defaultAddressFk;
fetchAgencies(formData); formData.addressId = formData.defaultAddressFk;
formInitialData.value = { addressId: formData.addressId, clientFk };
await fetchAgencies(formData);
} }
async function fetchAgencies({ landed, addressId }) { async function fetchAgencies({ landed, addressId }) {
@ -181,7 +202,7 @@ async function fetchAgencies({ landed, addressId }) {
const { data } = await axios.get('Agencies/landsThatDay', { const { data } = await axios.get('Agencies/landsThatDay', {
params: { params: {
filter: JSON.stringify({ filter: JSON.stringify({
order: ['agencyMode DESC', 'agencyModeFk ASC'], order: ['name ASC', 'agencyMode DESC', 'agencyModeFk ASC'],
}), }),
addressFk: addressId, addressFk: addressId,
landed, landed,
@ -224,11 +245,7 @@ const getDateColor = (date) => {
onDataSaved: (url) => { onDataSaved: (url) => {
tableRef.redirect(`${url}/catalog`); tableRef.redirect(`${url}/catalog`);
}, },
formInitialData: { formInitialData,
active: true,
addressId: null,
clientFk: null,
},
}" }"
:user-params="{ showEmpty: false }" :user-params="{ showEmpty: false }"
:columns="columns" :columns="columns"
@ -260,7 +277,9 @@ const getDateColor = (date) => {
:include="{ relation: 'addresses' }" :include="{ relation: 'addresses' }"
v-model="data.clientFk" v-model="data.clientFk"
:label="t('module.customer')" :label="t('module.customer')"
@update:model-value="(id) => fetchClientAddress(id, data)" @update:model-value="
(id) => onClientSelected({ clientFk: id }, data)
"
> >
<template #option="scope"> <template #option="scope">
<QItem v-bind="scope.itemProps"> <QItem v-bind="scope.itemProps">
@ -285,7 +304,22 @@ const getDateColor = (date) => {
@update:model-value="() => fetchAgencies(data)" @update:model-value="() => fetchAgencies(data)"
> >
<template #option="scope"> <template #option="scope">
<QItem v-bind="scope.itemProps"> <QItem
v-bind="scope.itemProps"
:class="{ disabled: !scope.opt.isActive }"
>
<QItemSection style="min-width: min-content" avatar>
<QIcon
v-if="
scope.opt.isActive &&
data.defaultAddressFk === scope.opt.id
"
size="sm"
color="grey"
name="star"
class="fill-icon"
/>
</QItemSection>
<QItemSection> <QItemSection>
<QItemLabel <QItemLabel
:class="{ :class="{
@ -313,6 +347,7 @@ const getDateColor = (date) => {
<VnInputDate <VnInputDate
v-model="data.landed" v-model="data.landed"
:label="t('module.landed')" :label="t('module.landed')"
data-cy="landedDate"
@update:model-value="() => fetchAgencies(data)" @update:model-value="() => fetchAgencies(data)"
/> />
<VnSelect <VnSelect

View File

@ -751,7 +751,7 @@ watch(
{{ row?.item?.subName.toUpperCase() }} {{ row?.item?.subName.toUpperCase() }}
</div> </div>
</div> </div>
<FetchedTags :item="row" :max-length="6" /> <FetchedTags :item="row.item" :max-length="6" />
<QPopupProxy v-if="row.id && isTicketEditable"> <QPopupProxy v-if="row.id && isTicketEditable">
<VnInput <VnInput
v-model="row.concept" v-model="row.concept"

View File

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

View File

@ -1,6 +1,6 @@
<script setup> <script setup>
import axios from 'axios'; import axios from 'axios';
import { computed, ref, onBeforeMount, watch } from 'vue'; import { computed, ref, onBeforeMount, watch, onMounted } from 'vue';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
@ -22,7 +22,6 @@ import { toTimeFormat } from 'src/filters/date';
import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue'; import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
import TicketProblems from 'src/components/TicketProblems.vue'; import TicketProblems from 'src/components/TicketProblems.vue';
import VnSection from 'src/components/common/VnSection.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 { getAddresses } from 'src/pages/Customer/composables/getAddresses';
import { getAgencies } from 'src/pages/Route/Agency/composables/getAgencies'; import { getAgencies } from 'src/pages/Route/Agency/composables/getAgencies';
@ -51,10 +50,21 @@ const userParams = {
onBeforeMount(() => { onBeforeMount(() => {
initializeFromQuery(); initializeFromQuery();
stateStore.rightDrawer = true; stateStore.rightDrawer = true;
if (!route.query.createForm) return; });
onClientSelected(JSON.parse(route.query.createForm)); onMounted(async () => {
if (!route.query) return;
if (route.query?.createForm) {
formInitialData.value = JSON.parse(route.query?.createForm);
await onClientSelected(formInitialData.value);
} else if (route.query?.table) {
const query = route.query?.table;
const clientId = +JSON.parse(query)?.clientFk;
if (clientId) await onClientSelected({ clientId });
}
if (tableRef.value) tableRef.value.create.formInitialData = formInitialData.value;
}); });
const initializeFromQuery = () => { const initializeFromQuery = () => {
if (!route) return;
const query = route.query.table ? JSON.parse(route.query.table) : {}; const query = route.query.table ? JSON.parse(route.query.table) : {};
from.value = query.from || from.toISOString(); from.value = query.from || from.toISOString();
to.value = query.to || to.toISOString(); to.value = query.to || to.toISOString();
@ -69,7 +79,6 @@ const companiesOptions = ref([]);
const accountingOptions = ref([]); const accountingOptions = ref([]);
const amountToReturn = ref(); const amountToReturn = ref();
const dataKey = 'TicketList'; const dataKey = 'TicketList';
const filterPanelRef = ref(null);
const formInitialData = ref({}); const formInitialData = ref({});
const columns = computed(() => [ const columns = computed(() => [
@ -251,7 +260,38 @@ const columns = computed(() => [
], ],
}, },
]); ]);
const onClientSelected = async (formData) => {
resetAgenciesSelector(formData);
await fetchAddresses(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;
addressesOptions.value = data;
selectedClient.value = data[0].client;
formData.addressId = selectedClient.value.defaultAddressFk;
formInitialData.value.addressId = formData.addressId;
};
watch(
() => route.query.table,
async (newValue) => {
if (newValue) {
const clientId = +JSON.parse(newValue)?.clientFk;
if (clientId) await onClientSelected({ clientId });
if (tableRef.value)
tableRef.value.create.formInitialData = formInitialData.value;
}
},
{ immediate: true },
);
function resetAgenciesSelector(formData) { function resetAgenciesSelector(formData) {
agenciesOptions.value = []; agenciesOptions.value = [];
if (formData) formData.agencyModeId = null; if (formData) formData.agencyModeId = null;
@ -262,12 +302,6 @@ function redirectToLines(id) {
window.open(url, '_blank'); window.open(url, '_blank');
} }
const onClientSelected = async (formData) => {
resetAgenciesSelector(formData);
await fetchClient(formData);
await fetchAddresses(formData);
};
const fetchAvailableAgencies = async (formData) => { const fetchAvailableAgencies = async (formData) => {
resetAgenciesSelector(formData); resetAgenciesSelector(formData);
const response = await getAgencies(formData, selectedClient.value); const response = await getAgencies(formData, selectedClient.value);
@ -278,22 +312,6 @@ const fetchAvailableAgencies = async (formData) => {
if (agency) formData.agencyModeId = agency.agencyModeFk; if (agency) formData.agencyModeId = agency.agencyModeFk;
}; };
const fetchClient = async (formData) => {
const response = await getClient(formData.clientId);
if (!response) return;
const [client] = response.data;
selectedClient.value = client;
};
const fetchAddresses = async (formData) => {
const response = await getAddresses(formData.clientId);
if (!response) return;
addressesOptions.value = response.data;
const { defaultAddress } = selectedClient.value;
formData.addressId = defaultAddress.id;
};
const getColor = (row) => { const getColor = (row) => {
if (row.alertLevelCode === 'OK') return 'bg-success'; if (row.alertLevelCode === 'OK') return 'bg-success';
else if (row.alertLevelCode === 'FREE') return 'bg-notice'; else if (row.alertLevelCode === 'FREE') return 'bg-notice';
@ -445,22 +463,6 @@ function setReference(data) {
dialogData.value.value.description = newDescription; dialogData.value.value.description = newDescription;
} }
watch(
() => route.query.table,
(newValue) => {
if (newValue) {
const clientId = +JSON.parse(newValue)?.clientFk;
if (!clientId) return;
formInitialData.value = {
clientId,
};
if (tableRef.value) tableRef.value.create.formInitialData = { clientId };
onClientSelected({ clientId });
}
},
{ immediate: true },
);
</script> </script>
<template> <template>

View File

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

View File

@ -5,3 +5,4 @@ downloads/*
storage/* storage/*
reports/* reports/*
docker/logs/* 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.viewport(1920, 1080);
cy.login('developer'); cy.login('developer');
cy.visit(`/#/claim/${claimId}/development`); cy.visit(`/#/claim/${claimId}/development`);
cy.intercept('GET', /\/api\/Workers\/search/).as('workers');
cy.intercept('GET', /\/api\/Workers\/search/).as('workers');
cy.waitForElement('tbody'); cy.waitForElement('tbody');
}); });
@ -36,7 +34,6 @@ describe('ClaimDevelopment', () => {
}); });
it('should add and remove new line', () => { it('should add and remove new line', () => {
cy.wait(['@workers', '@workers']);
cy.addCard(); cy.addCard();
cy.waitForElement(thirdRow); 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 saveBtn = '.q-field__append > .q-btn > .q-btn__content > .q-icon';
const firstNote = '.q-infinite-scroll :nth-child(1) > .q-card__section--vert'; const firstNote = '.q-infinite-scroll :nth-child(1) > .q-card__section--vert';
beforeEach(() => { beforeEach(() => {
@ -8,7 +8,10 @@ describe.skip('ClaimNotes', () => {
it('should add a new note', () => { it('should add a new note', () => {
const message = 'This is a new message.'; 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(saveBtn).click();
cy.get(firstNote).should('have.text', message); cy.get(firstNote).should('have.text', message);

View File

@ -1,6 +1,7 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('ClaimPhoto', () => { 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(() => { beforeEach(() => {
const claimId = 1; const claimId = 1;
cy.login('developer'); cy.login('developer');
@ -12,7 +13,7 @@ describe('ClaimPhoto', () => {
cy.get('label > .q-btn input').selectFile('test/cypress/fixtures/image.jpg', { cy.get('label > .q-btn input').selectFile('test/cypress/fixtures/image.jpg', {
force: true, 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', () => { it('should add new file with drag and drop', () => {
@ -20,7 +21,7 @@ describe('ClaimPhoto', () => {
cy.get('.container').selectFile('test/cypress/fixtures/image.jpg', { cy.get('.container').selectFile('test/cypress/fixtures/image.jpg', {
action: 'drag-drop', 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', () => { it('should open first image dialog change to second and close', () => {
@ -38,12 +39,12 @@ describe('ClaimPhoto', () => {
cy.get( cy.get(
'.q-card__actions > .q-btn--unelevated > .q-btn__content > .block', '.q-card__actions > .q-btn--unelevated > .q-btn__content > .block',
).click(); ).click();
cy.get('.q-notification__message').should('have.text', 'Data deleted'); cy.checkNotification('Data deleted');
cy.dataCy('delete-button-3').click(); cy.dataCy('delete-button-3').click();
cy.get( cy.get(
'.q-card__actions > .q-btn--unelevated > .q-btn__content > .block', '.q-card__actions > .q-btn--unelevated > .q-btn__content > .block',
).click(); ).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.waitForElement('.q-form');
cy.checkValueForm(1, search); cy.checkValueForm(1, search);
cy.checkValueForm(2, 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', () => { it('Client founded create order', () => {
const search = 'Jessica Jones'; 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.clickButtonWith('icon', 'icon-basketadd');
cy.url().should('include', `/customer/1110/summary`);
cy.waitForElement('#formModel'); cy.waitForElement('#formModel');
cy.waitForElement('.q-form'); cy.waitForElement('.q-form');
cy.checkValueForm(1, search); 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-btn-group > :nth-child(1)').should('not.be.disabled');
cy.get('.q-checkbox__inner').click(); cy.get('.q-checkbox__inner').click();
cy.get('.q-btn-group > .q-btn--standard.q-btn--actionable').should( 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 > .q-btn--flat').should('not.be.disabled');
cy.get('.q-btn-group > :nth-child(1)').click(); 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(); createEntryAndBuy();
cy.get('a[data-cy="EntryBasicData-menu-item"]').click(); cy.get('a[data-cy="EntryBasicData-menu-item"]').click();
selectTravel('two'); selectTravel('two');

View File

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

View File

@ -1,5 +1,5 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('InvoiceOut manual invoice', () => { describe.skip('InvoiceOut manual invoice', () => {
beforeEach(() => { beforeEach(() => {
cy.viewport(1920, 1080); cy.viewport(1920, 1080);
cy.login('developer'); cy.login('developer');
@ -10,7 +10,7 @@ describe('InvoiceOut manual invoice', () => {
it('should create an invoice from a ticket and go to that invoice', () => { it('should create an invoice from a ticket and go to that invoice', () => {
cy.searchByLabel('Customer ID', '1101'); cy.searchByLabel('Customer ID', '1101');
cy.get( 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(); ).click();
cy.dataCy('ticketListMakeInvoiceBtn').click(); cy.dataCy('ticketListMakeInvoiceBtn').click();
cy.checkNotification('Data saved'); cy.checkNotification('Data saved');

View File

@ -9,7 +9,7 @@ describe('InvoiceOut negative bases', () => {
cy.visit(`/#/invoice-out/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(getDescriptors('clientId')).click();
cy.get('.descriptor').should('be.visible'); cy.get('.descriptor').should('be.visible');
cy.get('.q-item > .q-item__label').should('include.text', '1101'); cy.get('.q-item > .q-item__label').should('include.text', '1101');

View File

@ -13,7 +13,6 @@ describe('InvoiceOut summary', () => {
const confirmSend = '.q-btn--unelevated'; const confirmSend = '.q-btn--unelevated';
beforeEach(() => { beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer'); cy.login('developer');
cy.visit(`/#/invoice-out/1/summary`); cy.visit(`/#/invoice-out/1/summary`);
}); });
@ -34,7 +33,9 @@ describe('InvoiceOut summary', () => {
it('should open the ticket list', () => { it('should open the ticket list', () => {
cy.get(toTicketList).click(); 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 ', () => { it('should transfer the invoice ', () => {

View File

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

View File

@ -3,23 +3,22 @@ describe('ItemBarcodes', () => {
beforeEach(() => { beforeEach(() => {
cy.viewport(1920, 1080); cy.viewport(1920, 1080);
cy.login('developer'); cy.login('developer');
cy.visit(`/#/item/list`); cy.visit(`/#/item/1/barcode`);
cy.typeSearchbar('1{enter}');
}); });
it('should throw an error if the barcode exists', () => { it('should throw an error if the barcode exists', () => {
cy.get('[href="#/item/1/barcode"]').click(); newBarcode('1111111111');
cy.get('.q-card > .q-btn > .q-btn__content > .q-icon').click();
cy.dataCy('Code_input').eq(3).type('1111111111');
cy.dataCy('crudModelDefaultSaveBtn').click();
cy.checkNotification('Codes can not be repeated'); cy.checkNotification('Codes can not be repeated');
}); });
it('should create a new barcode', () => { it('should create a new barcode', () => {
cy.get('[href="#/item/1/barcode"]').click(); newBarcode('1231231231');
cy.get('.q-card > .q-btn > .q-btn__content > .q-icon').click();
cy.dataCy('Code_input').eq(3).type('1231231231');
cy.dataCy('crudModelDefaultSaveBtn').click();
cy.checkNotification('Data saved'); cy.checkNotification('Data saved');
}); });
function newBarcode(text) {
cy.dataCy('addBarcode_input').click();
cy.dataCy('Code_input').eq(3).should('exist').type(text);
cy.dataCy('crudModelDefaultSaveBtn').click();
}
}); });

View File

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

View File

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

View File

@ -0,0 +1,71 @@
/// <reference types="cypress" />
describe('OrderList', () => {
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit('/#/order/list');
});
it('create order', () => {
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.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.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('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('.q-card [data-cy="Agency_select"]').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('[data-cy="Client_select"]').should('have.value', 'Bruce Wayne');
cy.get('[data-cy="Address_select"]').should('have.value', 'Bruce Wayne');
cy.dataCy('landedDate').find('input').type('06/01/2001');
cy.get('.q-card [data-cy="Agency_select"]').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`);
});
});

View File

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

View File

@ -6,13 +6,16 @@ describe('ParkingBasicData', () => {
beforeEach(() => { beforeEach(() => {
cy.login('developer'); cy.login('developer');
cy.visit(`/#/shelving/parking/1/basic-data`); 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', () => { 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).should('have.value', '700-01').clear();
cy.get(codeInput).eq(0).type('700-02'); cy.get(codeInput).eq(0).type('700-02');
cy.saveCard(); 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', () => { it('should edit the code and sector', () => {
@ -24,7 +27,8 @@ describe('ParkingBasicData', () => {
cy.dataCy('Picking order_input').clear().type(80230); cy.dataCy('Picking order_input').clear().type(80230);
cy.saveCard(); 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(sectorSelect).should('have.value', 'First sector');
cy.get(codeInput).should('have.value', '700-01'); cy.get(codeInput).should('have.value', '700-01');
cy.dataCy('Picking order_input').should('have.value', 80230); cy.dataCy('Picking order_input').should('have.value', 80230);

View File

@ -37,11 +37,11 @@ describe('Ticket Lack detail', () => {
], ],
}).as('getItemLack'); }).as('getItemLack');
cy.visit('/#/ticket/negative/5'); cy.visit('/#/ticket/negative/5', false);
cy.wait('@getItemLack'); cy.wait('@getItemLack');
}); });
describe('Table actions', () => { 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.location('href').should('contain', '#/ticket/negative/5');
cy.get('[data-cy="changeItem"]').should('be.disabled'); cy.get('[data-cy="changeItem"]').should('be.disabled');
@ -139,7 +139,7 @@ describe('Ticket Lack detail', () => {
cy.wait('@getItemGetSimilar'); cy.wait('@getItemGetSimilar');
}); });
describe('Replace item if', () => { 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(); 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', () => { it('should clone the ticket without warehouse', () => {
cy.visit('/#/ticket/1/summary'); cy.visit('/#/ticket/1/summary');
cy.intercept('GET', /\/api\/Tickets\/\d/).as('ticket');
cy.wait('@ticket');
cy.openActionsDescriptor(); cy.openActionsDescriptor();
cy.contains(listItem, toCloneOpt).click(); cy.contains(listItem, toCloneOpt).click();
cy.clickConfirm(); cy.clickConfirm();

View File

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

View File

@ -5,18 +5,16 @@ describe('TicketList', () => {
beforeEach(() => { beforeEach(() => {
cy.login('developer'); cy.login('developer');
cy.viewport(1920, 1080); cy.viewport(1920, 1080);
cy.visit('/#/ticket/list'); cy.visit('/#/ticket/list', false);
}); });
const searchResults = (search) => { const searchResults = (search) => {
if (search) cy.typeSearchbar().type(search); if (search) cy.typeSearchbar().type(search);
cy.dataCy('vn-searchbar').find('input').type('{enter}'); cy.dataCy('vn-searchbar').find('input').type('{enter}');
// cy.dataCy('ticketListTable').should('exist');
cy.get(firstRow).should('exist'); cy.get(firstRow).should('exist');
}; };
it('should search results', () => { it('should search results', () => {
// cy.dataCy('ticketListTable').should('not.exist');
cy.get('.q-field__control').should('exist'); cy.get('.q-field__control').should('exist');
searchResults(); searchResults();
}); });
@ -52,7 +50,7 @@ describe('TicketList', () => {
cy.getOption().click(); cy.getOption().click();
cy.dataCy('Address_select').should('have.value', 'Bruce Wayne'); 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').should('exist');
cy.dataCy('vnTableCreateBtn').click(); cy.dataCy('vnTableCreateBtn').click();
const data = { const data = {
@ -68,7 +66,7 @@ describe('TicketList', () => {
cy.url().should('match', /\/ticket\/\d+\/summary/); cy.url().should('match', /\/ticket\/\d+\/summary/);
}); });
it('should show the corerct problems', () => { it('should show the correct problems', () => {
cy.intercept('GET', '**/api/Tickets/filter*', (req) => { cy.intercept('GET', '**/api/Tickets/filter*', (req) => {
req.headers['cache-control'] = 'no-cache'; req.headers['cache-control'] = 'no-cache';
req.headers['pragma'] = 'no-cache'; req.headers['pragma'] = 'no-cache';

View File

@ -182,14 +182,17 @@ describe('TicketSale', () => {
it('change quantity ', () => { it('change quantity ', () => {
const quantity = Math.floor(Math.random() * 100) + 1; const quantity = Math.floor(Math.random() * 100) + 1;
cy.waitForElement(firstRow); cy.waitForElement(firstRow);
cy.dataCy('ticketSaleQuantityInput').clear(); cy.dataCy('ticketSaleQuantityInput').find('input').clear();
cy.dataCy('ticketSaleQuantityInput').type(quantity).trigger('tab'); cy.dataCy('ticketSaleQuantityInput')
.find('input')
.type(quantity)
.trigger('tab');
cy.get('.q-page > :nth-child(6)').click(); cy.get('.q-page > :nth-child(6)').click();
handleVnConfirm(); handleVnConfirm();
cy.get('[data-cy="ticketSaleQuantityInput"]') cy.get('[data-cy="ticketSaleQuantityInput"]')
.find('[data-cy="undefined_input"]') .find('input')
.should('have.value', `${quantity}`); .should('have.value', `${quantity}`);
}); });
}); });

View File

@ -1,4 +1,4 @@
describe('WagonCreate', () => { describe.skip('WagonCreate', () => {
beforeEach(() => { beforeEach(() => {
cy.viewport(1280, 720); cy.viewport(1280, 720);
cy.login('developer'); cy.login('developer');
@ -16,7 +16,7 @@ describe('WagonCreate', () => {
cy.get( cy.get(
'.grid-create > [label="Volume"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="Volume_input"]', '.grid-create > [label="Volume"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="Volume_input"]',
).type('100'); ).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(); 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 externalRadio = '.q-radio:nth-child(2)';
const developerBossId = 120; const developerBossId = 120;
const payMethodCross = 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.login('developer');
cy.visit(`/#/worker/${developerId}/notifications`); cy.visit(`/#/worker/${developerId}/notifications`);
cy.waitForElement(activeList); cy.waitForElement(activeList);

View File

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

View File

@ -1,4 +1,4 @@
describe('ZoneWarehouse', () => { describe.skip('ZoneWarehouse', () => {
const data = { const data = {
Warehouse: { val: 'Warehouse One', type: 'select' }, Warehouse: { val: 'Warehouse One', type: 'select' },
}; };

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 // DO NOT REMOVE
// Imports Quasar Cypress AE predefined commands // Imports Quasar Cypress AE predefined commands
// import { registerCommands } from '@quasar/quasar-app-extension-testing-e2e-cypress'; // import { registerCommands } from '@quasar/quasar-app-extension-testing-e2e-cypress';
import waitUntil from './waitUntil'; import waitUntil from './waitUntil';
Cypress.Commands.add('waitUntil', { prevSubject: 'optional' }, 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); originalFn(url, options);
cy.waitUntil(() => cy.document().then((doc) => doc.readyState === 'complete')); cy.waitUntil(() => cy.document().then((doc) => doc.readyState === 'complete'));
cy.waitUntil(() => cy.get('main').should('exist')); 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) => { Cypress.Commands.add('waitForElement', (element) => {
cy.get(element, { timeout }).should('be.visible').and('not.be.disabled'); cy.get(element).should('be.visible').and('not.be.disabled');
}); });
Cypress.Commands.add('getValue', (selector) => { Cypress.Commands.add('getValue', (selector) => {
@ -331,7 +338,7 @@ Cypress.Commands.add('openUserPanel', () => {
}); });
Cypress.Commands.add('checkNotification', (text) => { Cypress.Commands.add('checkNotification', (text) => {
cy.get('.q-notification', { timeout: 10000 }) cy.get('.q-notification')
.should('be.visible') .should('be.visible')
.should('have.length.greaterThan', 0) .should('have.length.greaterThan', 0)
.should(($elements) => { .should(($elements) => {
@ -341,7 +348,6 @@ Cypress.Commands.add('checkNotification', (text) => {
expect(found).to.be.true; expect(found).to.be.true;
}); });
}); });
Cypress.Commands.add('openActions', (row) => { Cypress.Commands.add('openActions', (row) => {
cy.get('tbody > tr').eq(row).find('.actions > .q-btn').click(); cy.get('tbody > tr').eq(row).find('.actions > .q-btn').click();
}); });

View File

@ -40,4 +40,30 @@ style.innerHTML = `
`; `;
document.head.appendChild(style); 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 }; export { randomString, randomNumber, randomizeValue };