From 4ff6971a07d20ba0261050c1eea480cda138e8fc Mon Sep 17 00:00:00 2001 From: provira Date: Fri, 21 Feb 2025 13:02:12 +0100 Subject: [PATCH] feat: refs #8612 added summary button & changed e2e tests --- src/pages/Shelving/ShelvingList.vue | 15 +++++++++++++++ .../shelving/shelvingBasicData.spec.js | 12 +++++++++--- .../integration/shelving/shelvingList.spec.js | 12 ++++++++++-- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/src/pages/Shelving/ShelvingList.vue b/src/pages/Shelving/ShelvingList.vue index 4af1e4e7d..b95d3915f 100644 --- a/src/pages/Shelving/ShelvingList.vue +++ b/src/pages/Shelving/ShelvingList.vue @@ -5,6 +5,7 @@ import { useI18n } from 'vue-i18n'; import VnTable from 'components/VnTable/VnTable.vue'; import VnSection from 'src/components/common/VnSection.vue'; import ShelvingFilter from 'pages/Shelving/Card/ShelvingFilter.vue'; +import ShelvingSummary from './Card/ShelvingSummary.vue'; import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import exprBuilder from './ShelvingExprBuilder.js'; import VnSelect from 'src/components/common/VnSelect.vue'; @@ -12,6 +13,7 @@ import { QCheckbox } from 'quasar'; const { t } = useI18n(); const router = useRouter(); +const { viewSummary } = useSummaryDialog(); const dataKey = 'ShelvingList'; const filter = { @@ -50,6 +52,19 @@ const columns = computed(() => [ label: t('shelving.summary.recyclable'), sortable: true, }, + { + align: 'right', + label: '', + name: 'tableActions', + actions: [ + { + title: t('components.smartCard.viewSummary'), + icon: 'preview', + action: (row) => viewSummary(row.id, ShelvingSummary), + isPrimary: true, + }, + ], + }, ]); const onDataSaved = ({ id }) => { diff --git a/test/cypress/integration/shelving/shelvingBasicData.spec.js b/test/cypress/integration/shelving/shelvingBasicData.spec.js index 54547463e..0e90d2350 100644 --- a/test/cypress/integration/shelving/shelvingBasicData.spec.js +++ b/test/cypress/integration/shelving/shelvingBasicData.spec.js @@ -8,13 +8,19 @@ describe('ShelvingList', () => { cy.visit(`/#/shelving/1/basic-data`); }); + it('should give an error if the code aldready exists', () => { + cy.dataCy('Code_input').should('exist').clear(); + cy.dataCy('Code_input').type('AA7'); + cy.saveCard(); + cy.get('.q-notification__message').should('have.text', 'The code already exists'); + }); it('should edit the data and save', () => { cy.selectOption(parking, 'P-01-1'); - cy.dataCy('Code_input').type('1'); + cy.dataCy('Code_input').clear(); + cy.dataCy('Code_input').type('AA1'); cy.dataCy('Priority_input').type('10'); cy.get(':nth-child(2) > .q-checkbox > .q-checkbox__inner').click(); cy.saveCard(); cy.get('.q-notification__message').should('have.text', 'Data saved'); - }); -}); \ No newline at end of file +}); diff --git a/test/cypress/integration/shelving/shelvingList.spec.js b/test/cypress/integration/shelving/shelvingList.spec.js index 1a792c3d1..86cbabf89 100644 --- a/test/cypress/integration/shelving/shelvingList.spec.js +++ b/test/cypress/integration/shelving/shelvingList.spec.js @@ -8,10 +8,18 @@ describe('ShelvingList', () => { it('should redirect on clicking a shelving', () => { cy.get('#searchbar input').type('{enter}'); - cy.get(':nth-child(2) > .q-card').click(); - cy.url().should('include', '/shelving/2/summary'); + cy.dataCy('cardBtn').eq(0).click(); + cy.get('.summaryHeader > .header > .q-icon').click(); + cy.url().should('include', '/shelving/1/summary'); }); + it('should redirect from preview to basic-data', () => { + cy.get('#searchbar input').type('{enter}'); + cy.dataCy('cardBtn').eq(0).click(); + cy.get('.q-card > .header').click(); + cy.url().should('include', '/shelving/1/basic-data'); + }) + it('should filter and redirect if only one result', () => { cy.selectOption('[data-cy="Parking_select"]', 'P-02-2'); cy.dataCy('Parking_select').type('{enter}');