diff --git a/site/cypress/integration/mon-entreprise/english/gérer.js b/site/cypress/integration/mon-entreprise/english/gérer.js deleted file mode 100644 index 66c6c8615..000000000 --- a/site/cypress/integration/mon-entreprise/english/gérer.js +++ /dev/null @@ -1,65 +0,0 @@ -const fr = Cypress.env('language') === 'fr' - -const FIXTURES_FOLDER = 'cypress/fixtures' -const GERER_FIXTURES_FOLDER = `${FIXTURES_FOLDER}/gérer` - -const writeFixtures = Cypress.env('record_http') !== undefined - -describe(`Manage page test (${ - writeFixtures ? 'record mode' : 'stubbed mode' -})`, function () { - let pendingRequests = new Set() - let responses = {} - const hostnamesToRecord = ['entreprise.data.gouv.fr', 'geo.api.gouv.fr'] - beforeEach(() => { - cy.clearLocalStorage() // Try to avoid flaky tests - - pendingRequests = new Set() - responses = {} - cy.setInterceptResponses( - pendingRequests, - responses, - hostnamesToRecord, - GERER_FIXTURES_FOLDER - ) - cy.visit(fr ? encodeURI('/gérer') : '/manage') - }) - afterEach(() => { - cy.writeInterceptResponses( - pendingRequests, - responses, - GERER_FIXTURES_FOLDER - ) - }) - it('should not crash', function () { - cy.contains(fr ? 'Gérer mon activité' : 'Manage my business') - }) - it('should allow to retrieve company and show link corresponding to the legal status', function () { - cy.contains(fr ? 'Renseigner mon entreprise' : 'Find my company').click() - cy.get('input').first().type('menoz') - cy.contains('834364291').click() - cy.contains( - fr ? 'Calculer mon revenu net' : 'Calculate my net income' - ).click() - cy.location().should((loc) => { - expect(loc.pathname).to.match(/sasu$/) - }) - }) - it('should allow auto entrepreneur to access the corresponding income simulator', function () { - cy.contains(fr ? 'Renseigner mon entreprise' : 'Find my company').click() - - cy.get('input').first().type('johan girod') - cy.contains('MONSIEUR').click() - // ask if auto-entrepreneur - cy.contains( - fr ? 'Êtes-vous auto-entrepreneur ?' : 'Are you an auto-entrepreneur?' - ) - cy.contains(fr ? 'Oui' : 'Yes').click() - cy.contains( - fr ? 'simulateur auto-entrepreneur' : 'Calculate my net income' - ).click() - cy.location().should((loc) => { - expect(loc.pathname).to.match(/auto-entrepreneur$/) - }) - }) -}) diff --git a/site/cypress/integration/mon-entreprise/english/navigation.js b/site/cypress/integration/mon-entreprise/english/navigation.js index 57ea4f8c3..6cf48f538 100644 --- a/site/cypress/integration/mon-entreprise/english/navigation.js +++ b/site/cypress/integration/mon-entreprise/english/navigation.js @@ -1,5 +1,11 @@ -describe('Navigation', function () { - const fr = Cypress.env('language') === 'fr' +const fr = Cypress.env('language') === 'fr' + +const FIXTURES_FOLDER = 'cypress/fixtures' +const GERER_FIXTURES_FOLDER = `${FIXTURES_FOLDER}/gérer` + +const writeFixtures = Cypress.env('record_http') !== undefined + +describe('General navigation', function () { it('should enable switching site language', () => { cy.visit( fr ? encodeURI('/créer/auto-entrepreneur') : '/create/auto-entrepreneur' @@ -17,3 +23,58 @@ describe('Navigation', function () { cy.url().should('match', new RegExp(`${Cypress.config().baseUrl}/?`)) }) }) + +describe(`Navigation to income simulator using company name (${ + writeFixtures ? 'record mode' : 'stubbed mode' +})`, function () { + let pendingRequests = new Set() + let responses = {} + const hostnamesToRecord = ['entreprise.data.gouv.fr', 'geo.api.gouv.fr'] + beforeEach(() => { + cy.clearLocalStorage() // Try to avoid flaky tests + + pendingRequests = new Set() + responses = {} + cy.setInterceptResponses( + pendingRequests, + responses, + hostnamesToRecord, + GERER_FIXTURES_FOLDER + ) + cy.visit('/') + }) + afterEach(() => { + cy.writeInterceptResponses( + pendingRequests, + responses, + GERER_FIXTURES_FOLDER + ) + }) + it('should allow to retrieve company and show link corresponding to the legal status', function () { + cy.contains( + fr ? 'Rechercher une entreprise ' : 'Search for a company ' + ).click() + cy.get('input').first().type('menoz') + cy.contains('834364291').click() + cy.contains('SASU').click() + cy.location().should((loc) => { + expect(loc.pathname).to.match(/sasu$/) + }) + }) + it('should allow auto entrepreneur to access the corresponding income simulator', function () { + cy.contains( + fr ? 'Rechercher une entreprise ' : 'Search for a company ' + ).click() + cy.get('input').first().type('johan girod') + cy.contains('MONSIEUR').click() + // ask if auto-entrepreneur + cy.contains( + fr ? 'Êtes-vous auto-entrepreneur ?' : 'Are you an auto-entrepreneur?' + ) + cy.contains(fr ? 'Oui' : 'Yes').click() + cy.contains('Auto-entrepreneur').click() + cy.location().should((loc) => { + expect(loc.pathname).to.match(/auto-entrepreneur$/) + }) + }) +})