Skip to content

Commit

Permalink
refacto: create folders pages, fonctionnalites, recherche
Browse files Browse the repository at this point in the history
refacto: e2e tests organization
  • Loading branch information
rmonnier9 committed Jan 3, 2025
1 parent 18f919f commit 5b2c64f
Show file tree
Hide file tree
Showing 39 changed files with 320 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
43 changes: 43 additions & 0 deletions cypress/e2e/pages/dirigeants.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
describe('Dirigeants ESSOR ENERGIES (SOLARSUD)', () => {
it('Should display dirigeants from INPI', () => {
cy.login();
cy.visit(`/dirigeants/487444697`);
cy.contains(
'Cette entreprise possède 2 dirigeants enregistrés au Registre National des Entreprises (RNE) tenu par l’INPI.'
).should('be.visible');
cy.contains('David, Jean-Claude POUYANNE, né(e) en octobre 1965').should(
'be.visible'
);
});

it('[LOGGED] Should display comparison between INPI and IG', () => {
cy.login();
cy.visit(`/dirigeants/487444697`);
cy.contains(
'Ces informations proviennent du RNE et sont issues d‘une comparaison entre les données issues de l’INPI et celles d’Infogreffe'
).should('be.visible');
cy.contains(
'BCRH & ASSOCIES - SOCIETE A RESPONSABILITE LIMITEE A ASSOCIE UNIQUE - 784 824 153 (incohérence)'
).should('be.visible');
cy.contains(
'David, Jean-Claude POUYANNE, né(e) en octobre 1965 (incohérence)'
).should('be.visible');
});
});
describe('Dirigeants non-diffusible ', () => {
it('No dirigeant', () => {
cy.visit(`/dirigeants/908595879`);
cy.contains('▪︎ ▪︎ ▪︎ information non-diffusible ▪︎ ▪︎ ▪︎').should(
'be.visible'
);
cy.contains('Données privées').should('be.visible');
});
it('[LOGGED] Dirigeants appear', () => {
cy.login();
cy.visit(`/dirigeants/908595879`);
cy.contains('Dirigeant(s)').should('be.visible');
cy.contains(
'Cette entreprise possède 1 dirigeant enregistré au Registre National des Entreprises (RNE) tenu par l’INPI.'
).should('be.visible');
});
});
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 documents', () => {
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 élus', () => {
cy.visit(`/elus/217500016`);
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": {}
}
16 changes: 16 additions & 0 deletions cypress/fixtures/recherche-entreprise-last-modified.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"ess_france": "2023-11-20",
"rge": "2025-01-01",
"uai": "2025-01-01",
"collectivite_territoriale": "2024-10-31",
"collectivite_territoriale_elus": "2024-10-31",
"sirene": "2024-12-31",
"egapro": "2024-12-26",
"agence_bio": "2025-01-01",
"entrepreneur_spectacle": "2024-12-31",
"finess": "2024-11-12",
"bilan_financier": "2024-12-20",
"organisme_formation": "2025-01-01",
"convention_collective": "2024-12-23",
"rne": "2024-12-31"
}
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);
};
7 changes: 7 additions & 0 deletions cypress/mocks/handlers/recherche-entreprises-last-modified.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { HttpResponse, HttpResponseResolver } from 'msw';
import rechercheEntrepriseLastModified from '../../fixtures/recherche-entreprise-last-modified.json';

export const rechercheEntrepriseLastModifiedHandler: HttpResponseResolver =
async ({ request }) => {
return HttpResponse.json(rechercheEntrepriseLastModified);
};
Loading

0 comments on commit 5b2c64f

Please sign in to comment.