test: refs #6695 e2e better checkNotification
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2025-02-06 09:15:13 +01:00
parent b532047516
commit 02fc8fce52
4 changed files with 26 additions and 28 deletions

View File

@ -38,9 +38,9 @@ COPY \
# pnpm install cypress && \
# npx cypress install
RUN pnpm install --prefer-offline && \
pnpm install cypress && \
pnpx cypress install
RUN pnpm install --frozen-lockfile --prefer-offline && \
pnpx cypress install && \
pnpm store prune
COPY \
quasar.config.js \

View File

@ -1,5 +1,5 @@
import { defineConfig } from 'cypress';
import vitePreprocessor from 'cypress-vite';
// import vitePreprocessor from 'cypress-vite';
// https://docs.cypress.io/app/tooling/reporters
// https://docs.cypress.io/app/references/configuration
// https://www.npmjs.com/package/cypress-mochawesome-reporter
@ -19,16 +19,16 @@ export default defineConfig({
downloadsFolder: 'test/cypress/downloads',
video: false,
specPattern: [
'test/cypress/integration/entry/stockBought.spec.js',
'test/cypress/integration/invoiceOut/invoiceOutNegativeBases.js',
'test/cypress/integration/invoiceOut/invoiceOutMakeInvoice.spec.js',
// 'test/cypress/integration/entry/stockBought.spec.js',
// 'test/cypress/integration/invoiceOut/invoiceOutNegativeBases.js',
// 'test/cypress/integration/invoiceOut/invoiceOutMakeInvoice.spec.js',
'test/cypress/integration/item/itemTag.spec.js',
'test/cypress/integration/route/routeList.spec.js',
'test/cypress/integration/ticket/ticketList.spec.js',
'test/cypress/integration/ticket/ticketSale.spec.js',
'test/cypress/integration/vnComponent/UserPanel.spec.js',
'test/cypress/integration/vnComponent/VnLocation.spec.js',
'test/cypress/integration/worker/workerNotificationsManager.spec.js',
// 'test/cypress/integration/route/routeList.spec.js',
// 'test/cypress/integration/ticket/ticketList.spec.js',
// 'test/cypress/integration/ticket/ticketSale.spec.js',
// 'test/cypress/integration/vnComponent/UserPanel.spec.js',
// 'test/cypress/integration/vnComponent/VnLocation.spec.js',
// 'test/cypress/integration/worker/workerNotificationsManager.spec.js',
],
experimentalRunAllSpecs: true,
watchForFileChanges: true,
@ -47,7 +47,7 @@ export default defineConfig({
supportFile: 'test/cypress/support/unit.js',
},
setupNodeEvents: async (on, config) => {
on('file:preprocessor', vitePreprocessor());
// on('file:preprocessor', vitePreprocessor());
const plugin = await import('cypress-mochawesome-reporter/plugin');
plugin.default(on);
return config;

View File

@ -4,30 +4,31 @@ describe('Item tag', () => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/item/1/tags`);
cy.get('.q-page').should('be.visible');
cy.waitForElement('[data-cy="itemTags"]');
});
it('should throw an error adding an existent tag', () => {
cy.get('.q-page').should('be.visible');
cy.get('.q-page-sticky > div').click();
cy.get('.q-page-sticky > div').click();
cy.dataCy('Tag_select').eq(7).type('Tallos');
cy.get('.q-menu .q-item').contains('Tallos').click();
cy.selectOption(':nth-child(8) > .q-select', 'Tallos');
cy.get(':nth-child(8) > [label="Value"]').type('1');
+cy.dataCy('crudModelDefaultSaveBtn').click();
cy.dataCy('crudModelDefaultSaveBtn').click();
cy.checkNotification("The tag or priority can't be repeated for an item");
});
it('should add a new tag', () => {
cy.get('.q-page').should('be.visible');
cy.get('.q-page-sticky > div').click();
cy.get('.q-page-sticky > div').click();
cy.dataCy('Tag_select').eq(7).click();
cy.get('.q-menu .q-item').contains('Ancho de la base').type('{enter}');
cy.selectOption(':nth-child(8) > .q-select', 'Ancho de la base');
cy.get(':nth-child(8) > [label="Value"]').type('50');
cy.dataCy('crudModelDefaultSaveBtn').click();
cy.checkNotification('Data saved');
cy.dataCy('itemTags').children(':nth-child(8)').find('.justify-center > .q-icon').click();
cy.dataCy('itemTags')
.children(':nth-child(8)')
.find('.justify-center > .q-icon')
.click();
cy.dataCy('VnConfirm_confirm').click();
cy.checkNotification('Data saved');
});
});
});

View File

@ -331,11 +331,8 @@ Cypress.Commands.add('openUserPanel', () => {
Cypress.Commands.add('checkNotification', (text) => {
cy.get('.q-notification')
.should('be.visible')
.last()
.then(($lastNotification) => {
if (!Cypress.$($lastNotification).text().includes(text))
throw new Error(`Notification not found: "${text}"`);
});
.contains(text, { timeout: 5000 })
.should('be.visible');
});
Cypress.Commands.add('openActions', (row) => {