🐛 Corrige la page blanche sur publi.codes

Ajoute également des test E2E sur https://publi.codes
Fix #1004
pull/1006/head
Johan Girod 2020-04-27 15:13:58 +02:00
parent be696e24dd
commit 983ad40f2c
10 changed files with 1893 additions and 2486 deletions

View File

@ -21,7 +21,7 @@ commands:
default: fr
integration_folder:
type: enum
enum: [mon-entreprise, external]
enum: [mon-entreprise, external, publi.codes]
default: mon-entreprise
base_url:
type: string
@ -70,6 +70,9 @@ jobs:
- cypress:
base_url: http://localhost:5001
language: en
- cypress:
base_url: http://localhost:5002
integration_folder: publi.codes
bundlesize-test:
docker:
@ -97,6 +100,9 @@ jobs:
language: en
- cypress:
integration_folder: external
- cypress:
base_url: https://publi.codes
integration_folder: publi.codes
- run:
name: Send email if test failed
when: on_fail

View File

@ -6,4 +6,4 @@
},
"integrationFolder": "cypress/integration/mon-entreprise",
"chromeWebSecurity": false
}
}

View File

@ -0,0 +1,15 @@
describe('Navigation', function() {
it('landing should not crash', function() {
cy.visit('/')
})
it('liste des mécanismes should not crash', function() {
cy.contains('Liste des mécanismes').click()
cy.contains('barème')
})
it('bac à sable should work', function() {
cy.contains('Bac à sable').click()
cy.contains('dépenses primeur')
cy.contains('Résultats')
cy.contains('11,50')
})
})

View File

@ -99,11 +99,12 @@
"i18n:ui:check": "yarn run i18next && node source/scripts/i18n/check-missing-UI-translation",
"i18n:ui:translate": "rm -rf source/locales/static-analysis-fr.json && yarn run i18next && node source/scripts/i18n/translate-ui.js",
"publicodes:serve": "PORT=5002 serve --config serve.publicodes.json --no-clipboard",
"publicodes:test-dev": "cypress open --browser chromium --config baseUrl=http://localhost:8080/publicodes,integrationFolder=cypress/integration/publi.codes",
"mon-entreprise:serve": "PORT=5000 serve --config serve.mon-entreprise.json --no-clipboard",
"mon-entreprise:test": "cypress open --browser chromium",
"mon-entreprise:test-dev": "cypress open --browser chromium",
"mycompanyinfrance:serve": "PORT=5001 serve --config serve.infrance.json --no-clipboard",
"mycompanyinfrance:test": "cypress open --browser chromium --config baseUrl=http://localhost:8080/infrance",
"serve-dev": "yarn run mon-entreprise:serve & yarn run mycompanyinfrance:serve"
"mycompanyinfrance:test-dev": "cypress open --browser chromium --config baseUrl=http://localhost:8080/infrance",
"serve-dev": "yarn run mon-entreprise:serve & yarn run mycompanyinfrance:serve & yarn run publicodes:serve"
},
"devDependencies": {
"@babel/core": "^7.6.4",

View File

@ -90,7 +90,6 @@ export default function Provider({
)
)
if (language && initialStore) initialStore.lang = language
const store = createStore(reducers, initialStore, storeEnhancer)
onStoreCreated?.(store)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -56,18 +56,6 @@ function activeTargetInput(state: DottedName | null = null, action: Action) {
}
}
function lang(
state = i18n.language as AvailableLangs,
{ type, lang }
): AvailableLangs {
switch (type) {
case 'SWITCH_LANG':
return lang
default:
return state
}
}
type QuestionsKind =
| "à l'affiche"
| 'non prioritaires'
@ -206,7 +194,6 @@ const existingCompanyReducer = (state, action: Action) => {
}
const mainReducer = (state, action: Action) =>
combineReducers({
lang,
explainedVariable,
// We need to access the `rules` in the simulation reducer
simulation: (a: Simulation | null = null, b: Action): Simulation | null =>

View File

@ -1,6 +1,9 @@
import React from 'react'
import { Link } from 'react-router-dom'
import { Link, NavLink } from 'react-router-dom'
const activeStyle = {
fontWeight: 'bold',
textDecoration: 'underline'
} as React.CSSProperties
export const Header = ({ noSubtitle = false, sectionName = '' }) => (
<header css="text-align: center; a {text-decoration: none}">
<Link to="/">
@ -23,5 +26,15 @@ export const Header = ({ noSubtitle = false, sectionName = '' }) => (
Le langage pour les algorithmes d'intérêt public.
</p>
)}
<br />
<nav css="display">
<NavLink activeStyle={activeStyle} to="/studio">
Bac à sable
</NavLink>{' '}
{' '}
<NavLink activeStyle={activeStyle} to="/mécanismes">
Liste des mécanismes
</NavLink>
</nav>
</header>
)

View File

@ -3,6 +3,7 @@ import { ScrollToTop } from 'Components/utils/Scroll'
import publicodeReadme from 'Engine/README.md'
import React, { useEffect } from 'react'
import { Header } from './Header'
import { NavLink } from 'react-router-dom'
export default function Landing() {
useEffect(() => {
@ -23,7 +24,6 @@ export default function Landing() {
<ScrollToTop />
<Header />
<br />
<br />
<MarkdownWithAnchorLinks source={publicodeReadme} />
</div>
)