Skip to content

Commit

Permalink
refacto: create folders pages, fonctionnalites, recherche
Browse files Browse the repository at this point in the history
  • Loading branch information
rmonnier9 committed Jan 3, 2025
1 parent 00b20db commit dd4fbe7
Show file tree
Hide file tree
Showing 37 changed files with 255 additions and 45 deletions.
14 changes: 0 additions & 14 deletions cypress/e2e/etablissement-scolaire.cy.js

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import routes from '#clients/routes';

describe('Annonces BODACC', () => {
describe('Annonces et observations', () => {
beforeEach(() => {
cy.intercept('GET', `${routes.bodacc.ods.search}*`, {
fixture: '../fixtures/bodacc.json',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe('Conventions supprimées', () => {
describe('Conventions collectives', () => {
it('Should work for valid companies', () => {
cy.visit('/divers/356000000');
cy.contains("Convention d'entreprise La Poste - France Télécom");
Expand Down
6 changes: 6 additions & 0 deletions cypress/e2e/pages/dirigeants.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
describe('Dirigeants', () => {
it('No dirigeant in partial diffusible (protected)', () => {
cy.visit(`/dirigeants/908595879`);
cy.contains('Données privées').should('have.length', 1);
});
});
22 changes: 22 additions & 0 deletions cypress/e2e/pages/documents.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
describe('Documents ESSOR ENERGIES (SOLARSUD)', () => {
it('Bouton agent connect sur les données protégées', () => {
cy.visit('/documents/487444697');
cy.contains('Réservé aux agents publics').should('be.visible');
cy.contains('button', 'ProConnect').should('be.visible');
});

it('[LOGGED] Should display basic infos', () => {
cy.login();
cy.visit('/documents/487444697');
// Conformité
cy.contains('Conformité').should('be.visible');
cy.contains('DGFiP : conforme').should('be.visible');
cy.contains('URSSAF : conforme').should('be.visible');
cy.contains('MSA : conforme').should('be.visible');
// Carte professionnelle travaux publics
cy.contains('Carte professionnelle travaux publics').should('be.visible');
cy.contains(
'Cette entreprise possède une carte professionnelle d’entrepreneur de travaux publics,'
).should('be.visible');
});
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import routes from '#clients/routes';

describe('Bilans financiers', () => {
describe('Données financières', () => {
it('Should display Données financières section', () => {
cy.visit('/entreprise/487444697');
cy.contains('Données financières');
Expand Down
10 changes: 10 additions & 0 deletions cypress/e2e/pages/elus.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
describe('Élus VILLE DE PARIS', () => {
it('Should display basic infos', () => {
cy.visit(`/entreprise/2175000164`);
cy.contains('Élus').should('be.visible');
cy.contains(
'Cette collectivité possède 164 élus enregistrés au Répertoire National des Élus :'
).should('be.visible');
cy.contains(' Anne HIDALGO').should('be.visible');
});
});
13 changes: 13 additions & 0 deletions cypress/e2e/pages/etablissement-scolaire.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
describe('Établissement scolaire', () => {
it('Should display service public and Établissement scolaire section', () => {
cy.visit('/entreprise/198100125');
cy.contains('Service public');
cy.contains('Établissements scolaires');
});
it("Should display info from annuaire de l'éducation nationale", () => {
cy.visit('/etablissements-scolaires/198100125');
cy.contains('Annuaire de l’Education Nationale');
cy.contains('N° UAI');
cy.contains('0810012Y'); // UAI
});
});
58 changes: 58 additions & 0 deletions cypress/e2e/pages/fiche-resume.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
describe('Fiche résumé DANONE', () => {
it('Should display basic infos', () => {
cy.visit(`/entreprise/danone-552032534`);
cy.contains(
"Sa forme juridique est SA à conseil d'administration (s.a.i.)."
).should('be.visible');
cy.contains('Informations légales de DANONE').should('be.visible');
cy.contains(
'Son siège social est domicilié au 17 BOULEVARD HAUSSMANN 75009 PARIS.'
).should('be.visible');
// TVA number
cy.contains('N° TVA Intracommunautaire').should('be.visible');
cy.contains('FR12 345 678 901').should('be.visible');
// EORI number
cy.contains('N° EORI').should('be.visible');
cy.contains('FR 123 456 789 0').should('be.visible');
// Effectifs
cy.contains('Effectif salarié').should('be.visible');
cy.contains('1 000 à 1 999 salariés, en 2022').should('be.visible');
});
it('[LOGGED] Should display basic infos', () => {
cy.login();
cy.visit(`/entreprise/danone-552032534`);
// Effectifs
cy.contains('Effectif salarié').should('be.visible');
cy.contains('1 000 à 1 999 salariés, en 2022').should('be.visible');
// Résumé pour les agents publics
cy.contains('Résumé pour les agents publics').should('be.visible');
cy.contains('Documents juridiques').should('be.visible');
cy.contains('Consulter les Actes et les Statuts constitutifs').should(
'be.visible'
);
});
});

describe('Entreprises non-diffusibles', () => {
it('Should be non diffusible', () => {
cy.visit(`/entreprise/300025764`);
cy.contains('ne sont pas publiquement').should('have.length', 1);
});

it('Should be diffusible', () => {
cy.visit(`/entreprise/880878145`);
cy.contains('ne sont pas publiquement').should('have.length', 0);
});
});

describe('TVA number special cases', () => {
it('TVA Non-assujettie', () => {
cy.visit(`/entreprise/883010316`).then(() => {
cy.contains('Pas de n° TVA valide');
});
cy.visit(`/entreprise/423208180`).then(() => {
cy.contains('Pas de n° TVA valide connu');
cy.url().should('include', '/definitions/tva-intracommunautaire');
});
});
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe('Certifications', () => {
describe('Label et certificats', () => {
describe('QUALIBAT-RGE', () => {
it('Should display QUALIBAT-RGE', () => {
cy.visit(`/labels-certificats/843701079`);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 0 additions & 24 deletions cypress/e2e/tva.cy.js

This file was deleted.

8 changes: 8 additions & 0 deletions cypress/fixtures/carte-professionnelle-travaux-publics.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"data": {
"document_url": "https://storage.entreprise.api.gouv.fr/siade/1569139162-b99824d9c764aae19a862a0af-carte_professionnelle_fntp.pdf",
"expires_in": 7889238
},
"links": {},
"meta": {}
}
10 changes: 10 additions & 0 deletions cypress/fixtures/conformite-dgfip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"data": {
"document_url": "https://storage.entreprise.api.gouv.fr/siade/1569139162-b99824d9c764aae19a862a0af-attestation_fiscale_dgfip.pdf",
"document_url_expires_in": 86400,
"date_delivrance_attestation": "2023-04-11",
"date_periode_analysee": "2023-03-31"
},
"links": {},
"meta": {}
}
7 changes: 7 additions & 0 deletions cypress/fixtures/conformite-msa.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"data": {
"status": "up_to_date"
},
"links": {},
"meta": {}
}
16 changes: 16 additions & 0 deletions cypress/fixtures/conformite-urssaf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"data": {
"entity_status": {
"code": "ok",
"libelle": "Attestation délivrée par l'Urssaf",
"description": "La délivrance de l'attestation de vigilance a été refusée par l'Urssaf car l'entité n'est pas à jour de ses cotisations sociales."
},
"date_debut_validite": "2022-12-03",
"date_fin_validite": "2023-06-30",
"code_securite": "GB1QWERTYJJEX1O",
"document_url": "https://storage.entreprise.api.gouv.fr/siade/1569139162-b99824d9c764aae19a862a0af-attestation_vigilance_acoss.pdf",
"document_url_expires_in": 86400
},
"links": {},
"meta": {}
}
31 changes: 31 additions & 0 deletions cypress/fixtures/mandataires-rcs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"data": [
{
"data": {
"numero_identification": "784824153",
"type": "personne_morale",
"fonction": "COMMISSAIRE AUX COMPTES SUPPLEANT",
"nom": "Henri",
"prenom": "Martin",
"date_naissance": "1965-01-27",
"date_naissance_timestamp": -155523600,
"lieu_naissance": "ROUBAIX",
"pays_naissance": "FRANCE",
"code_pays_naissance": "FR",
"nationalite": "FRANCAISE",
"code_nationalite": "FR",
"raison_sociale": "BCRH & ASSOCIES - SOCIETE A RESPONSABILITE LIMITEE A ASSOCIE UNIQUE",
"code_greffe": "9201",
"libelle_greffe": "NANTERRE"
},
"links": {},
"meta": {}
}
],
"meta": {
"personnes_physiques_count": 10,
"personnes_morales_count": 2,
"count": 12
},
"links": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { HttpResponse, HttpResponseResolver } from 'msw';
import carteProfessionnelleTravauxPublics from '../../fixtures/carte-professionnelle-travaux-publics.json';

export const carteProfessionnelleTravauxPublicsHandler: HttpResponseResolver =
({ request }) => {
return HttpResponse.json(carteProfessionnelleTravauxPublics);
};
16 changes: 16 additions & 0 deletions cypress/mocks/handlers/conformite.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { HttpResponse, HttpResponseResolver } from 'msw';
import conformiteDgfip from '../../fixtures/conformite-dgfip.json';
import conformiteMsa from '../../fixtures/conformite-msa.json';
import conformiteUrssaf from '../../fixtures/conformite-urssaf.json';

export const conformiteHandler: HttpResponseResolver = ({ request }) => {
let response = {};
if (request.url.match('dgfip')) {
response = conformiteDgfip;
} else if (request.url.match('msa')) {
response = conformiteMsa;
} else if (request.url.match('urssaf')) {
response = conformiteUrssaf;
}
return HttpResponse.json(response);
};
6 changes: 6 additions & 0 deletions cypress/mocks/handlers/mandataires-rcs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { HttpResponse, HttpResponseResolver } from 'msw';
import mandatairesRcs from '../../fixtures/mandataires-rcs.json';

export const mandatairesRcsHandler: HttpResponseResolver = ({ request }) => {
return HttpResponse.json(mandatairesRcs);
};
41 changes: 40 additions & 1 deletion cypress/mocks/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import {
import { associationHandler } from './handlers/association';
import { baseAdresseNationaleHandler } from './handlers/base-adresse-nationale';
import { bodaccHandler } from './handlers/bodacc';
import { carteProfessionnelleTravauxPublicsHandler } from './handlers/carte-professionnelle-travaux-publics';
import { conformiteHandler } from './handlers/conformite';
import { dgefpHandler } from './handlers/dgefp';
import { donneesFinancieresHandler } from './handlers/donnees-financieres';
import { educationNationaleHandler } from './handlers/education-nationale';
Expand All @@ -30,6 +32,7 @@ import { entrepreneurSpectaclesHandler } from './handlers/entrepreneur-spectacle
import { eoriHandler } from './handlers/eori';
import { igHandler } from './handlers/ig';
import { journalOfficielAssociationsHandler } from './handlers/journal-officiel-associations';
import { mandatairesRcsHandler } from './handlers/mandataires-rcs';
import { odsMetadataHandler } from './handlers/ods-metadata';
import { effectifsHandler } from './handlers/rcd-effectifs-annuels';
import { rechercheEntrepriseHandler } from './handlers/recherche-entreprises';
Expand Down Expand Up @@ -107,5 +110,41 @@ export const routesHandlers = [
journalOfficielAssociationsHandler
),
http.get(routes.journalOfficielAssociations.ods.metadata, odsMetadataHandler),
http.get(routes.apiEntreprise.effectifs.annuels('*', '*'), effectifsHandler),
http.get(
`${process.env.API_ENTREPRISE_URL}${routes.apiEntreprise.effectifs.annuels(
'*',
'*'
)}`,
effectifsHandler
),
http.get(
`${process.env.API_ENTREPRISE_URL}${routes.apiEntreprise.conformite.fiscale(
'*'
)}`,
conformiteHandler
),
http.get(
`${
process.env.API_ENTREPRISE_URL
}${routes.apiEntreprise.conformite.vigilance('*')}`,
conformiteHandler
),
http.get(
`${process.env.API_ENTREPRISE_URL}${routes.apiEntreprise.conformite.msa(
'*'
)}`,
conformiteHandler
),
http.get(
`${
process.env.API_ENTREPRISE_URL
}${routes.apiEntreprise.carteProfessionnelleTravauxPublics('*')}`,
carteProfessionnelleTravauxPublicsHandler
),
http.get(
`${process.env.API_ENTREPRISE_URL}${routes.apiEntreprise.mandatairesRCS(
'*'
)}`,
mandatairesRcsHandler
),
];
1 change: 0 additions & 1 deletion cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ const generateSessionCookie = async () => {
'rne',
'pseudo_opendata',
'effectifs_annuels',
'dgfip',
],
userType: 'Super-agent connecté',
hasHabilitation: true,
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@
}
]
},
"exclude": ["node_modules", "stories"],
"exclude": ["node_modules", "cypress", "cypress.config.ts"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"]
}

0 comments on commit dd4fbe7

Please sign in to comment.