test: refs #6695 run all e2e (try use cypress-vite && retries)
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2025-02-03 14:16:32 +01:00
parent d0ba2f41e1
commit b8761d3e4c
5 changed files with 35 additions and 6 deletions

View File

@ -1,4 +1,5 @@
import { defineConfig } from 'cypress'; import { defineConfig } from 'cypress';
import vitePreprocessor from 'cypress-vite';
// https://docs.cypress.io/app/tooling/reporters // https://docs.cypress.io/app/tooling/reporters
// https://docs.cypress.io/app/references/configuration // https://docs.cypress.io/app/references/configuration
// https://www.npmjs.com/package/cypress-mochawesome-reporter // https://www.npmjs.com/package/cypress-mochawesome-reporter
@ -35,6 +36,7 @@ export default defineConfig({
supportFile: 'test/cypress/support/unit.js', supportFile: 'test/cypress/support/unit.js',
}, },
setupNodeEvents: async (on, config) => { setupNodeEvents: async (on, config) => {
on('file:preprocessor', vitePreprocessor());
const plugin = await import('cypress-mochawesome-reporter/plugin'); const plugin = await import('cypress-mochawesome-reporter/plugin');
plugin.default(on); plugin.default(on);
return config; return config;
@ -42,4 +44,13 @@ export default defineConfig({
viewportWidth: 1280, viewportWidth: 1280,
viewportHeight: 720, viewportHeight: 720,
}, },
retries: {
experimentalStrategy: 'detect-flake-and-pass-on-threshold',
experimentalOptions: {
maxRetries: 1,
passesRequired: 1,
},
openMode: false,
runMode: true,
},
}); });

View File

@ -49,6 +49,7 @@
"autoprefixer": "^10.4.14", "autoprefixer": "^10.4.14",
"cypress": "^13.6.6", "cypress": "^13.6.6",
"cypress-mochawesome-reporter": "^3.8.2", "cypress-mochawesome-reporter": "^3.8.2",
"cypress-vite": "^1.6.0",
"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",

View File

@ -76,6 +76,9 @@ devDependencies:
cypress-mochawesome-reporter: cypress-mochawesome-reporter:
specifier: ^3.8.2 specifier: ^3.8.2
version: 3.8.2(cypress@13.17.0)(mocha@11.0.1) version: 3.8.2(cypress@13.17.0)(mocha@11.0.1)
cypress-vite:
specifier: ^1.6.0
version: 1.6.0(vite@6.0.11)
eslint: eslint:
specifier: ^9.18.0 specifier: ^9.18.0
version: 9.18.0 version: 9.18.0
@ -3338,6 +3341,18 @@ packages:
- mocha - mocha
dev: true dev: true
/cypress-vite@1.6.0(vite@6.0.11):
resolution: {integrity: sha512-6oZPDvHgLEZjuFgoejtRuyph369zbVn7fjh4hzhMar3XvKT5YhTEoA+KixksMuxNEaLn9uqA4HJVz6l7BybwBQ==}
peerDependencies:
vite: ^2.9.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0
dependencies:
chokidar: 3.6.0
debug: 4.4.0(supports-color@8.1.1)
vite: 6.0.11(@types/node@22.10.7)(sass-embedded@1.83.4)(sass@1.83.4)
transitivePeerDependencies:
- supports-color
dev: true
/cypress@13.17.0: /cypress@13.17.0:
resolution: {integrity: sha512-5xWkaPurwkIljojFidhw8lFScyxhtiFHl/i/3zov+1Z5CmY4t9tjIdvSXfu82Y3w7wt0uR9KkucbhkVvJZLQSA==} resolution: {integrity: sha512-5xWkaPurwkIljojFidhw8lFScyxhtiFHl/i/3zov+1Z5CmY4t9tjIdvSXfu82Y3w7wt0uR9KkucbhkVvJZLQSA==}
engines: {node: ^16.0.0 || ^18.0.0 || >=20.0.0} engines: {node: ^16.0.0 || ^18.0.0 || >=20.0.0}

View File

@ -1,4 +1,4 @@
const { randomNumber, randomString } = require('../../support'); import { randomNumber, randomString } from 'test/cypress/support/index.js';
describe('VnLocation', () => { describe('VnLocation', () => {
const locationOptions = '[role="listbox"] > div.q-virtual-scroll__content > .q-item'; const locationOptions = '[role="listbox"] > div.q-virtual-scroll__content > .q-item';
@ -40,7 +40,7 @@ describe('VnLocation', () => {
cy.selectOption(countrySelector, country); cy.selectOption(countrySelector, country);
cy.dataCy('locationProvince').type(`${province}{enter}`); cy.dataCy('locationProvince').type(`${province}{enter}`);
cy.get( cy.get(
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix} > :nth-child(3) ` `${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix} > :nth-child(3) `,
).click(); ).click();
cy.dataCy('locationProvince').should('have.value', province); cy.dataCy('locationProvince').should('have.value', province);
}); });
@ -87,7 +87,7 @@ describe('VnLocation', () => {
.get(':nth-child(1)') .get(':nth-child(1)')
.should('have.length.at.least', 2); .should('have.length.at.least', 2);
cy.get( cy.get(
firstOption.concat(' > .q-item__section > .q-item__label--caption') firstOption.concat(' > .q-item__section > .q-item__label--caption'),
).should('have.text', postCodeLabel); ).should('have.text', postCodeLabel);
cy.get(firstOption).click(); cy.get(firstOption).click();
cy.get('.q-btn-group > .q-btn--standard > .q-btn__content > .q-icon').click(); cy.get('.q-btn-group > .q-btn--standard > .q-btn__content > .q-icon').click();
@ -103,7 +103,7 @@ describe('VnLocation', () => {
cy.get('.q-card > h1').should('have.text', 'New postcode'); cy.get('.q-card > h1').should('have.text', 'New postcode');
cy.selectOption( cy.selectOption(
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix}`, `${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix}`,
province province,
); );
cy.get(dialogInputs).eq(0).clear(); cy.get(dialogInputs).eq(0).clear();
cy.get(dialogInputs).eq(0).type(postCode); cy.get(dialogInputs).eq(0).type(postCode);
@ -156,7 +156,7 @@ describe('VnLocation', () => {
cy.get(createLocationButton).click(); cy.get(createLocationButton).click();
cy.selectOption( cy.selectOption(
`${createForm.prefix} > :nth-child(5) > :nth-child(3) `, `${createForm.prefix} > :nth-child(5) > :nth-child(3) `,
'España' 'España',
); );
cy.dataCy('Province_icon').click(); cy.dataCy('Province_icon').click();

View File

@ -27,7 +27,9 @@
// 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';
Cypress.Commands.add('waitUntil', { prevSubject: 'optional' }, require('./waitUntil')); import waitUntil from './waitUntil';
Cypress.Commands.add('waitUntil', { prevSubject: 'optional' }, waitUntil);
Cypress.Commands.add('resetDB', () => { Cypress.Commands.add('resetDB', () => {
cy.exec('pnpm run resetDatabase'); cy.exec('pnpm run resetDatabase');
}); });