Skip to content

Commit

Permalink
Release 1.1.3
Browse files Browse the repository at this point in the history
Changelog : 

- Ajoute un paragraphe sur notre page mentions légales #314
- New new matomo à brancher [NGC-420] #313
- Retours aide à la saisie trajets [NGC-250] #312
- Corrige l'affichage des issues créées dans la page /modele [NGC-167] #309
- Fix: use the order of the sum to sort sub categories - [NGC-372] #308
- Fix(publicodes-state): correctly collect mosaic questions from all mosaic questions #307
- Harmonise le style des titres [NGC-419] #303
- Trad manquantes (NGC-399) #302
- Ajoute le module de suppression / de quittage de groupe [NGC-219] #300
- Modifie le style des champs détail de trajets [NGC-387] #299
- Améliorations sur la page de fin [NGC-358, NGC-322] #298
- Modifie le taux d'échantillonnage de Sentry #297
- Remplace avec le bon composant "Comment agir" [NGC-322] #295
- Investiguer erreur sentry transport.deuxroues [NGC-360] #293
- Corrige les redirections erronées [NGC-254] #291
- feat: import local persona for local dev #292
- Ré-ajoute le total barré dans le composant Total [NGC-59] #290
  • Loading branch information
florianpanchout authored Dec 20, 2023
1 parent 22cbaf4 commit 7fef512
Show file tree
Hide file tree
Showing 200 changed files with 2,733 additions and 1,737 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ node_modules/
/cypress/screenshots/*
/cypress/snapshots/__all/__diff_output__/**/*
# They are automatically generated when running cypress in CI
/cypress/e2e/test-completion/persona-*.cy.js
/cypress/e2e/integration/test-completion/persona-*.cy.js
dist

# Sentry Config File
Expand Down
28 changes: 27 additions & 1 deletion config/redirects.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,29 @@ const redirects = [
destination: '/fin/:path*',
permanent: true,
},
{
source: '/nouveaut%C3%A9s/Guadeloupe',
destination: '/nouveautes/guadeloupe',
permanent: true,
},
{
source: '/nouveaut%C3%A9s/Vatnaj%C3%B6kull',
destination: '/nouveautes/vatnajokull',
permanent: true,
},
{
source: '/nouveaut%C3%A9s/:path*',
destination: '/nouveautes/:path*',
permanent: true,
},
{
source: '/vie-priv%C3%A9e',
destination: '/vie-privee',
destination: '/politique-de-confidentialite',
permanent: true,
},
{
source: '/vie-privee',
destination: '/politique-de-confidentialite',
permanent: true,
},
{
Expand Down Expand Up @@ -59,6 +74,17 @@ const redirects = [
destination: 'https://sondages.nosgestesclimat.fr/',
permanent: true,
},

{
source: '/guide/services-soci%C3%A9taux',
destination: '/guide/services-societaux',
permanent: true,
},
{
source: '/guide/num%C3%A9rique',
destination: '/guide/numerique',
permanent: true,
},
]

module.exports = redirects
5 changes: 5 additions & 0 deletions cypress/constants/elements-ids.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ export const SEE_RESULTS_LINK = 'see-results-link'
export const DO_THE_TEST_LINK = 'do-the-test-link'
export const CATEGORY_TITLE = 'category-title'
export const AMIS_LINK = 'amis-link'
export const DOCUMENTATION_TITLE = 'documentation-title'
export const DOCUMENTATION_LAUNCH_BUTTON = 'documentation-launch-button'
export const BLOG_ARTICLE_LIST = 'blog-list'
export const PLAN_OUTILS_TITLE = 'plan-outils-title'
export const PLAN_ACTIONS_TITLE = 'plan-actions-title'
4 changes: 2 additions & 2 deletions cypress/e2e/integration/pages/about.cy.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { visit } from '../../../helpers/interactions/visit'

describe('check for about page status', () => {
describe('The À propos page', () => {
beforeEach(() => {
visit('a-propos')
})

it('has a title', () => {
it('should render without breaking the app', () => {
cy.contains(
Cypress.env('testLangURL') === 'en' ? 'About us' : 'À propos'
).should('be.visible')
Expand Down
6 changes: 2 additions & 4 deletions cypress/e2e/integration/pages/accessibilite.cy.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { visit } from '../../../helpers/interactions/visit'

describe('check for about page status', () => {
beforeEach(() => {
describe('The Accessibilité page', () => {
it('should render without breaking the app', () => {
visit('accessibilite')
})

it('has a title', () => {
cy.contains(
Cypress.env('testLangURL') === 'en' ? 'Accessibility' : 'Accessibilité'
).should('be.visible')
Expand Down
11 changes: 11 additions & 0 deletions cypress/e2e/integration/pages/actions.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { visit } from '../../../helpers/interactions/visit'

describe('The Action page', { testIsolation: false }, () => {
it('should render without breaking the app', () => {
visit('actions')

cy.get('h1')
.contains(Cypress.env('testLangURL') === 'en' ? 'Act' : 'Agir')
.should('be.visible')
})
})
13 changes: 13 additions & 0 deletions cypress/e2e/integration/pages/ambassadeurs.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { visit } from '../../../helpers/interactions/visit'

describe('The Ambassadeurs page', () => {
it('should render without breaking the app', () => {
visit('ambassadeurs')

cy.get('h1')
.contains(
Cypress.env('testLangURL') === 'en' ? 'Ambassadors' : 'Ambassadeurs'
)
.should('be.visible')
})
})
19 changes: 19 additions & 0 deletions cypress/e2e/integration/pages/blog.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { visit } from '../../../helpers/interactions/visit'

describe('The Blog page', { testIsolation: false }, () => {
it('should render without breaking the app', () => {
visit('blog')

cy.get('h1').contains('Blog').should('be.visible')
})

it('displays a list of articles, which are themselves displayed correctly', () => {
cy.get('ul[data-cypress-id="blog-list"]').should('be.visible')

cy.get('ul[data-cypress-id="blog-list"] > a').first().click()

cy.wait(1000)

cy.get('h1').should('be.visible')
})
})
9 changes: 9 additions & 0 deletions cypress/e2e/integration/pages/diffuser.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { visit } from '../../../helpers/interactions/visit'

describe('The Diffuser NGC page', { testIsolation: false }, () => {
it('should render without breaking the app', () => {
visit('diffuser')

cy.get('h1').contains('Diffuser Nos Gestes Climat').should('be.visible')
})
})
9 changes: 9 additions & 0 deletions cypress/e2e/integration/pages/documentation-landing.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { visit } from '../../../helpers/interactions/visit'

describe('The Documentation landing page', () => {
it('should render without breaking the app', () => {
visit('documentation')

cy.get('h1').contains('Documentation').should('be.visible')
})
})
19 changes: 19 additions & 0 deletions cypress/e2e/integration/pages/documentation.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import {
DOCUMENTATION_LAUNCH_BUTTON,
DOCUMENTATION_TITLE,
} from '../../../constants/elements-ids'
import { visit } from '../../../helpers/interactions/visit'

describe('The Documentation page', { testIsolation: false }, () => {
it('should render without breaking the app (server side rendered)', () => {
visit('documentation/bilan')

cy.get(`h1[data-cypress-id="${DOCUMENTATION_TITLE}"]`).should('be.visible')
})

it('should render the client side documentation upon click on the launch button', () => {
cy.get(`button[data-cypress-id="${DOCUMENTATION_LAUNCH_BUTTON}"]`).click()

cy.get('div[id="documentation-rule-root"]').should('be.visible')
})
})
9 changes: 9 additions & 0 deletions cypress/e2e/integration/pages/fin.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { visit } from '../../../helpers/interactions/visit'

describe('The Fin page', () => {
it('should render without breaking the app', () => {
visit('fin')

cy.get('h1[data-cypress-id="fin-title"]').should('be.visible')
})
})
2 changes: 1 addition & 1 deletion cypress/e2e/integration/pages/homepage.cy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { visit } from '../../../helpers/interactions/visit'

describe('check for homepage status', () => {
describe('The Homepage', () => {
beforeEach(() => {
visit('/')
})
Expand Down
15 changes: 15 additions & 0 deletions cypress/e2e/integration/pages/international.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { visit } from '../../../helpers/interactions/visit'

describe('The International page', { testIsolation: false }, () => {
it('should render without breaking the app', () => {
visit('international')

cy.get('h1')
.contains(
Cypress.env('testLangURL') === 'en'
? 'The international climate footprint calculator'
: 'Le calculateur d’empreinte climat international'
)
.should('be.visible')
})
})
4 changes: 1 addition & 3 deletions cypress/e2e/integration/pages/news.cy.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { visit } from '../../../helpers/interactions/visit'

describe('check for about page status', () => {
beforeEach(() => {
it('displays at least one news title', () => {
visit('nouveautes')
})

it('displays at least one news title', () => {
cy.get('[data-cypress-id="news-title"]').should('be.visible')
})
})
10 changes: 3 additions & 7 deletions cypress/e2e/integration/pages/personas.cy.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import { visit } from '../../../helpers/interactions/visit'

describe('check for personas page status', () => {
beforeEach(() => {
visit('/')
cy.wait(1000)
visit('/personas')
})

describe('The Personas page', () => {
it('has a title', () => {
visit('personas')

cy.get('[data-cypress-id="personas-title"]').should('be.visible')
})
})
23 changes: 23 additions & 0 deletions cypress/e2e/integration/pages/plan.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import {
PLAN_ACTIONS_TITLE,
PLAN_OUTILS_TITLE,
} from '../../../constants/elements-ids'
import { visit } from '../../../helpers/interactions/visit'

describe('The Plan du site page', { testIsolation: false }, () => {
it('should render without breaking the app', () => {
visit('plan-du-site')

cy.get('h1')
.contains(
Cypress.env('testLangURL') === 'en' ? 'Site map' : 'Plan du site'
)
.should('be.visible')
})

it('should display hardcoded elements and dynamically generated elements (the actions list)', () => {
cy.get(`h2[data-cypress-id="${PLAN_OUTILS_TITLE}"`).should('be.visible')

cy.get(`h2[data-cypress-id="${PLAN_ACTIONS_TITLE}"`).should('be.visible')
})
})
13 changes: 13 additions & 0 deletions cypress/e2e/integration/pages/profil.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { visit } from '../../../helpers/interactions/visit'

describe('The Profil page', { testIsolation: false }, () => {
it('should render without breaking the app', () => {
visit('profil')

cy.get('h1')
.contains(
Cypress.env('testLangURL') === 'en' ? 'My profile' : 'Mon profil'
)
.should('be.visible')
})
})
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { clickNextButton } from '../../../helpers/elements/buttons'
import { setupSimulation } from '../../../helpers/simulation/setupSimulation'

const thirdQuestion = 'transport.voiture.motorisation'
const thirdQuestion = 'transport.avion.usager'

describe('Simulation page', () => {
it(`should redirect to the last question answered when the "bilan" root is defined`, () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { CATEGORIES } from '../../constants/categories'
import getNamespace from '../../utils/getNamespace'

const categoriesOrderArray = CATEGORIES.map((category) => ({
key: category,
Expand All @@ -7,7 +8,7 @@ const categoriesOrderArray = CATEGORIES.map((category) => ({

export function checkIfCategoryOrderIsRespected(questionId) {
const indexCurrentCategory = categoriesOrderArray.findIndex(
(category) => category.key === questionId.split(' . ')[0]
(category) => category.key === getNamespace(questionId)
)
cy.log(
'indexCurrentCategory',
Expand Down
8 changes: 2 additions & 6 deletions cypress/scripts/generateSpecsFromPersonas.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { writeFileSync } from 'fs'
import { parse } from 'yaml'

const personas = await fetch(
'https://raw.githubusercontent.com/incubateur-ademe/nosgestesclimat/preprod/personas/personas-fr.yaml'
)
.then((r) => r.text())
.then(parse)
`https://nosgestesclimat-api.osc-fr1.scalingo.io/latest/fr/personas`
).then((r) => r.json())

const getFileContent = (name, data) => `
import { recursivelyFillSimulation } from '../../../helpers/simulation/recursivelyFillSimulation'
Expand All @@ -30,6 +27,5 @@ Object.entries(personas).map(([dottedName, data]) => {
`./cypress/e2e/integration/test-completion/persona-${name}.cy.js`,
getFileContent(name, data)
)
console.log(JSON.stringify(data))
console.log(`[OK] persona-${name}.cy.js`)
})
3 changes: 3 additions & 0 deletions cypress/utils/getNamespace.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function getNamespace(ruleName) {
return !ruleName ? undefined : ruleName.split(' . ')[0]
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"ramda": "^0.29.1",
"react": "18.2.0",
"react-color": "^2.19.3",
"react-debounce-input": "^3.3.0",
"react-dom": "18.2.0",
"react-easy-emoji": "^1.8.1",
"react-flip-toolkit": "^7.1.0",
Expand Down
2 changes: 1 addition & 1 deletion public/iframeSimulation.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const optionFragments = possibleOptions.map(({ key, legacy }) => {
const lang = script.dataset.lang

const src = `${hostname}/${
lang && lang + '/'
lang ? lang + '/' : ''
}simulateur/bilan/?iframe&integratorUrl=${integratorUrl}${optionFragments.join(
''
)}`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export async function generateMetadata() {
return getMetadataObject({
title: 'À propos - Nos Gestes Climat',
description: 'Informations relatives à Nos Gestes Climat.',
alternates: {
canonical: '/a-propos',
},
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export async function generateMetadata() {
title: 'Accessibilité - Nos Gestes Climat',
description:
"Informations relatives à l'accessibilité de Nos Gestes Climat.",
alternates: {
canonical: '/accessibilite',
},
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ export async function generateMetadata() {
title: 'Ambassadeurs - Nos Gestes Climat',
description:
'Découvrez les ambassadeurs de Nos Gestes Climat : organisations, collectivités, médias, influenceurs, etc.',
alternates: {
canonical: '/ambassadeurs',
},
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ export async function generateMetadata() {
return getMetadataObject({
title: 'Budget - Nos Gestes Climat',
description: 'Informations relatives au budget de Nos Gestes Climat.',
alternates: {
canonical: '/budget',
},
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export async function generateMetadata() {
return getMetadataObject({
title: 'CGU - Nos Gestes Climat',
description: "Conditions générales d'utilisation du site.",
alternates: {
canonical: '/cgu',
},
})
}

Expand Down
Loading

0 comments on commit 7fef512

Please sign in to comment.