Skip to content

Commit 0f50957

Browse files
authored
chore: cypress config
1 parent fe7841c commit 0f50957

6 files changed

+6827
-1970
lines changed

cypress.config.js

+43-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,56 @@
1+
import taskCoverage from '@cypress/code-coverage/task';
12
import { defineConfig } from 'cypress';
3+
import mergeReport from 'cypress-sonarqube-reporter/mergeReports';
24

3-
const REQUEST_TIMEOUT = 10000;
5+
const REQUEST_TIMEOUT = 15_000;
46

57
export default defineConfig({
8+
env: {
9+
codeCoverage: {
10+
exclude: ['cypress/**/*', 'src/**/*.cy.*'],
11+
},
12+
},
13+
video: false,
14+
15+
retries: {
16+
runMode: 3,
17+
openMode: 0,
18+
},
19+
20+
viewportWidth: 2014,
21+
viewportHeight: 844,
22+
defaultCommandTimeout: 30000,
23+
24+
projectId: '4f6tz2',
25+
26+
reporter: 'cypress-multi-reporters',
27+
reporterOptions: {
28+
reporterEnabled: 'cypress-sonarqube-reporter',
29+
mergeFileName: 'test-reports.xml',
30+
cypressSonarqubeReporterReporterOptions: {
31+
overwrite: true,
32+
},
33+
},
634
e2e: {
7-
setupNodeEvents(_on, _config) {
8-
// implement node event listeners here
35+
setupNodeEvents(on, config) {
36+
taskCoverage(on, config);
37+
on('after:run', (result) => {
38+
mergeReport(result, { mergeFileName: 'test-reports.xml' });
39+
});
40+
return config;
941
},
1042
baseUrl: 'http://localhost:5173/#',
1143
requestTimeout: REQUEST_TIMEOUT,
1244
},
13-
1445
component: {
46+
setupNodeEvents(on, config) {
47+
taskCoverage(on, config);
48+
on('after:run', (result) => {
49+
mergeReport(result, { mergeFileName: 'test-reports.xml' });
50+
});
51+
return config;
52+
},
53+
specPattern: 'src/**/*.cy.{js,ts,jsx,tsx}',
1554
devServer: {
1655
framework: 'react',
1756
bundler: 'vite',

cypress/e2e/patrimoine.cy.tsx

+12-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,18 @@ describe('patrimoine', () => {
1010
).as('getPatrimoines');
1111
});
1212

13-
it('patrimoine.list', () => {
13+
// it('patrimoine.list', () => {
14+
// cy.visit('/patrimoines');
15+
// cy.wait('@getPatrimoines');
16+
// cy.get('tbody tr').should('have.length', patrimoineMocks.length);
17+
// cy.contains(patrimoineMocks[0].nom!, {timeout: 5_000});
18+
// });
19+
20+
it('patrimoines.create: cannot create if some fields are missing', () => {
1421
cy.visit('/patrimoines');
15-
cy.wait('@getPatrimoines');
16-
cy.get('tbody tr').should('have.length', patrimoineMocks.length);
17-
cy.contains(patrimoineMocks[0].nom!, { timeout: 5_000 });
22+
cy.get('.RaList-actions > .MuiToolbar-root').click();
23+
cy.getByTestId('nom-input').type('new');
24+
cy.get('.RaToolbar-defaultToolbar > .MuiButtonBase-root').click();
25+
cy.contains('This field is required !');
1826
});
1927
});

0 commit comments

Comments
 (0)