Merge pull request 'fix: #8593 fixed parking e2e tests' (!1392) from 8593-parkingTestsE2e into dev
gitea/salix-front/pipeline/head This commit looks good
Details
gitea/salix-front/pipeline/head This commit looks good
Details
Reviewed-on: #1392 Reviewed-by: Javier Segarra <jsegarra@verdnatura.es>
This commit is contained in:
commit
7ab161b7f1
|
@ -45,8 +45,6 @@ const filter = {
|
||||||
:label="t('parking.sector')"
|
:label="t('parking.sector')"
|
||||||
:value="entity.sector?.description"
|
:value="entity.sector?.description"
|
||||||
/>
|
/>
|
||||||
<VnLv :label="t('parking.row')" :value="entity.row" />
|
|
||||||
<VnLv :label="t('parking.column')" :value="entity.column" />
|
|
||||||
</QCard>
|
</QCard>
|
||||||
</template>
|
</template>
|
||||||
</CardSummary>
|
</CardSummary>
|
||||||
|
|
|
@ -1,19 +1,15 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, onUnmounted } from 'vue';
|
import { computed, onMounted, onUnmounted } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
import CardList from 'components/ui/CardList.vue';
|
|
||||||
import VnLv from 'components/ui/VnLv.vue';
|
|
||||||
import ParkingFilter from './ParkingFilter.vue';
|
|
||||||
import ParkingSummary from './Card/ParkingSummary.vue';
|
|
||||||
import exprBuilder from './ParkingExprBuilder.js';
|
|
||||||
import VnSection from 'src/components/common/VnSection.vue';
|
import VnSection from 'src/components/common/VnSection.vue';
|
||||||
|
import ParkingFilter from './ParkingFilter.vue';
|
||||||
|
import exprBuilder from './ParkingExprBuilder.js';
|
||||||
|
import ParkingSummary from './Card/ParkingSummary.vue';
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const { push } = useRouter();
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
const dataKey = 'ParkingList';
|
const dataKey = 'ParkingList';
|
||||||
|
@ -24,7 +20,48 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
const filter = {
|
const filter = {
|
||||||
fields: ['id', 'sectorFk', 'code', 'pickingOrder'],
|
fields: ['id', 'sectorFk', 'code', 'pickingOrder'],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const columns = computed(() => [
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'code',
|
||||||
|
label: t('globals.code'),
|
||||||
|
isId: true,
|
||||||
|
isTitle: true,
|
||||||
|
columnFilter: false,
|
||||||
|
sortable: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'sector',
|
||||||
|
label: t('parking.sector'),
|
||||||
|
format: (val) => val.sector.description ?? '',
|
||||||
|
sortable: true,
|
||||||
|
cardVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'pickingOrder',
|
||||||
|
label: t('parking.pickingOrder'),
|
||||||
|
sortable: true,
|
||||||
|
cardVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'right',
|
||||||
|
label: '',
|
||||||
|
name: 'tableActions',
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
title: t('components.smartCard.viewSummary'),
|
||||||
|
icon: 'preview',
|
||||||
|
action: (row) => viewSummary(row.id, ParkingSummary),
|
||||||
|
isPrimary: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnSection
|
<VnSection
|
||||||
:data-key="dataKey"
|
:data-key="dataKey"
|
||||||
|
@ -40,41 +77,24 @@ const filter = {
|
||||||
<ParkingFilter data-key="ParkingList" />
|
<ParkingFilter data-key="ParkingList" />
|
||||||
</template>
|
</template>
|
||||||
<template #body>
|
<template #body>
|
||||||
<QPage class="column items-center q-pa-md">
|
<VnTable
|
||||||
<div class="vn-card-list">
|
:data-key="dataKey"
|
||||||
<VnPaginate :data-key="dataKey">
|
:columns="columns"
|
||||||
<template #body="{ rows }">
|
is-editable="false"
|
||||||
<CardList
|
:right-search="false"
|
||||||
v-for="row of rows"
|
:use-model="true"
|
||||||
:key="row.id"
|
:disable-option="{ table: true }"
|
||||||
:id="row.id"
|
redirect="shelving/parking"
|
||||||
:title="row.code"
|
default-mode="card"
|
||||||
@click="
|
|
||||||
push({ path: `/shelving/parking/${row.id}/summary` })
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<template #list-items>
|
<template #actions="{ row }">
|
||||||
<VnLv
|
|
||||||
label="Sector"
|
|
||||||
:value="row.sector?.description"
|
|
||||||
/>
|
|
||||||
<VnLv
|
|
||||||
:label="t('parking.pickingOrder')"
|
|
||||||
:value="row.pickingOrder"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<template #actions>
|
|
||||||
<QBtn
|
<QBtn
|
||||||
:label="t('components.smartCard.openSummary')"
|
:label="t('components.smartCard.openSummary')"
|
||||||
@click.stop="viewSummary(row.id, ParkingSummary)"
|
@click.stop="viewSummary(row.id, ParkingSummary)"
|
||||||
color="primary"
|
color="primary"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</CardList>
|
</VnTable>
|
||||||
</template>
|
|
||||||
</VnPaginate>
|
|
||||||
</div>
|
|
||||||
</QPage>
|
|
||||||
</template>
|
</template>
|
||||||
</VnSection>
|
</VnSection>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
/// <reference types="cypress" />
|
|
||||||
describe('ParkingBasicData', () => {
|
|
||||||
const codeInput = 'form .q-card .q-input input';
|
|
||||||
const sectorSelect = 'form .q-card .q-select input';
|
|
||||||
const sectorOpt = '.q-menu .q-item';
|
|
||||||
beforeEach(() => {
|
|
||||||
cy.login('developer');
|
|
||||||
cy.visit(`/#/shelving/parking/1/basic-data`);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should edit the code and sector', () => {
|
|
||||||
cy.get(sectorSelect).type('Second');
|
|
||||||
cy.get(sectorOpt).click();
|
|
||||||
|
|
||||||
cy.get(codeInput).eq(0).clear();
|
|
||||||
cy.get(codeInput).eq(0).type('900-001');
|
|
||||||
|
|
||||||
cy.saveCard();
|
|
||||||
|
|
||||||
cy.get(sectorSelect).should('have.value', 'Second sector');
|
|
||||||
cy.get(codeInput).should('have.value', '900-001');
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,33 +0,0 @@
|
||||||
/// <reference types="cypress" />
|
|
||||||
describe('ParkingList', () => {
|
|
||||||
const searchbar = '#searchbar input';
|
|
||||||
const firstCard = '.q-card:nth-child(1)';
|
|
||||||
const firstChipId =
|
|
||||||
':nth-child(1) > :nth-child(1) > .justify-between > .flex > .q-chip > .q-chip__content';
|
|
||||||
const firstDetailBtn =
|
|
||||||
':nth-child(1) > :nth-child(1) > .card-list-body > .actions > .q-btn';
|
|
||||||
const summaryHeader = '.summaryBody .header';
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
cy.viewport(1920, 1080);
|
|
||||||
cy.login('developer');
|
|
||||||
cy.visit(`/#/shelving/parking/list`);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should redirect on clicking a parking', () => {
|
|
||||||
cy.get(searchbar).type('{enter}');
|
|
||||||
cy.get(firstChipId)
|
|
||||||
.invoke('text')
|
|
||||||
.then((content) => {
|
|
||||||
const id = content.substring(4);
|
|
||||||
cy.get(firstCard).click();
|
|
||||||
cy.url().should('include', `/parking/${id}/summary`);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should open the details', () => {
|
|
||||||
cy.get(searchbar).type('{enter}');
|
|
||||||
cy.get(firstDetailBtn).click();
|
|
||||||
cy.get(summaryHeader).contains('Basic data');
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('ParkingBasicData', () => {
|
||||||
|
const codeInput = 'form .q-card .q-input input';
|
||||||
|
const sectorSelect = 'form .q-card .q-select input';
|
||||||
|
const sectorOpt = '.q-menu .q-item';
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit(`/#/shelving/parking/1/basic-data`);
|
||||||
|
});
|
||||||
|
|
||||||
|
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');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should edit the code and sector', () => {
|
||||||
|
cy.get(sectorSelect).type('First');
|
||||||
|
cy.get(sectorOpt).click();
|
||||||
|
|
||||||
|
cy.get(codeInput).eq(0).clear();
|
||||||
|
cy.get(codeInput).eq(0).type('700-01');
|
||||||
|
cy.dataCy('Picking order_input').clear().type(80230);
|
||||||
|
|
||||||
|
cy.saveCard();
|
||||||
|
cy.get('.q-notification__message').should('have.text', '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);
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,30 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('ParkingList', () => {
|
||||||
|
const searchbar = '#searchbar input';
|
||||||
|
const firstCard = ':nth-child(1) > .q-card > .no-margin > .q-py-none';
|
||||||
|
const summaryHeader = '.summaryBody .header';
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit(`/#/shelving/parking/list`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should redirect on clicking a parking', () => {
|
||||||
|
cy.get(searchbar).type('{enter}');
|
||||||
|
cy.get(firstCard).click();
|
||||||
|
cy.get(summaryHeader).contains('Basic data');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should filter and redirect if there is only one result', () => {
|
||||||
|
cy.dataCy('Code_input').type('1{enter}');
|
||||||
|
cy.dataCy('Sector_select').type('Normal{enter}');
|
||||||
|
cy.get(summaryHeader).contains('Basic data');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should filter and redirect to summary if only one result', () => {
|
||||||
|
cy.dataCy('Code_input').type('A{enter}');
|
||||||
|
cy.dataCy('Sector_select').type('First Sector{enter}');
|
||||||
|
cy.url().should('match', /\/shelving\/parking\/\d+\/summary/);
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue