Ajoute les tests end-to-end avec les github actions
parent
cd2af96bee
commit
d555f34cd3
|
@ -1,14 +1,17 @@
|
|||
name: Déploiement sur Netlify
|
||||
name: Déploiement
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
push:
|
||||
branches: [master, demo, next]
|
||||
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-18.04
|
||||
outputs:
|
||||
fr: ${{ env.FR_SITE }}
|
||||
en: ${{ env.EN_SITE }}
|
||||
publicodes: ${{ env.PUBLICODES_SITE }}
|
||||
steps:
|
||||
- name: Set branch name
|
||||
id: vars
|
||||
|
@ -16,18 +19,21 @@ jobs:
|
|||
- if: github.event_name == 'pull_request'
|
||||
name: 'Set site name for pull request deploy'
|
||||
run:
|
||||
echo "FR_SITE=deploy-preview-${{ github.event.number }}--syso.netlify.app/\${path}" >> $GITHUB_ENV;
|
||||
echo "EN_SITE=deploy-preview-${{ github.event.number }}--syso.netlify.app/\${path}?s%3Dm" >> $GITHUB_ENV;
|
||||
echo "FR_SITE=https://deploy-preview-${{ github.event.number }}--syso.netlify.app/\${path}" >> $GITHUB_ENV;
|
||||
echo "EN_SITE=https://deploy-preview-${{ github.event.number }}--syso.netlify.app/\${path}?s%3Dm" >> $GITHUB_ENV;
|
||||
echo "PUBLICODES_SITE=deploy-preview-${{ github.event.number }}--syso.netlify.app/\${path}?s%3Dp" >> $GITHUB_ENV;
|
||||
- if: github.event_name == 'push' && github.ref != 'refs/heads/master'
|
||||
name: 'Set site name for named branch deploy'
|
||||
run:
|
||||
echo "FR_SITE=https://${{ steps.vars.outputs.branch }}.mon-entreprise.fr/\${path}" >> $GITHUB_ENV;
|
||||
echo "EN_SITE=https://${{ steps.vars.outputs.branch }}.mon-entreprise.fr/\${path}?s%3Dm" >> $GITHUB_ENV;
|
||||
echo "PUBLICODES_SITE=https://${{ steps.vars.outputs.branch }}.mon-entreprise.fr/\${path}?s%3Dp" >> $GITHUB_ENV;
|
||||
- if: github.ref == 'refs/heads/master'
|
||||
name: 'Set site name for production deploy'
|
||||
run:
|
||||
echo "FR_SITE=https://mon-entreprise.fr/\${path}" >> $GITHUB_ENV;
|
||||
echo "EN_SITE=https://mycompanyinfrance.fr/\${path}" >> $GITHUB_ENV
|
||||
echo "PUBLICODES_SITE=https://publi.codes/\${path}" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
|
@ -59,7 +65,7 @@ jobs:
|
|||
production-branch: master
|
||||
production-deploy: ${{ github.ref == 'refs/heads/master' }}
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
enable-commit-comment: ${{ github.event_name == 'push' }}
|
||||
enable-commit-comment: false
|
||||
# Disabled because we create our own customized comment
|
||||
enable-pull-request-comment: false
|
||||
alias: ${{ github.event_name == 'push' && steps.vars.outputs.branch || format('deploy-preview-{0}', github.event.number) }}
|
||||
|
@ -67,6 +73,11 @@ jobs:
|
|||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
timeout-minutes: 1
|
||||
|
||||
post-comment:
|
||||
runs-on: ubuntu-18.04
|
||||
needs: build
|
||||
steps:
|
||||
- name: Find Comment
|
||||
if: github.event_name == 'pull_request'
|
||||
uses: peter-evans/find-comment@v1
|
||||
|
@ -84,3 +95,51 @@ jobs:
|
|||
🚀 La branche est déployée ! ${{ steps.deploy-netlify.outputs.deploy-url }}
|
||||
|
||||
_Voir aussi : [version anglaise](${{ steps.deploy-netlify.outputs.deploy-url }}?s=m) | [site publicodes](${{ steps.deploy-netlify.outputs.deploy-url }}?s=p)_
|
||||
|
||||
end-to-end-test:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
CYPRESS_RECORD_KEY: 21660df5-36a5-4c49-b23d-801799b0c759 #TODO put in secrets
|
||||
|
||||
runs-on: ubuntu-16.04
|
||||
needs: build
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
lang: ['fr', 'en']
|
||||
browser: ['firefox', 'chrome']
|
||||
containers: [1, 2]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Test mon-entreprise
|
||||
uses: cypress-io/github-action@v2
|
||||
with:
|
||||
working-directory: mon-entreprise
|
||||
browser: ${{ matrix.browser }}
|
||||
record: true
|
||||
parallel: true
|
||||
group: 'mon-entreprise'
|
||||
tag: mon-entreprise-${{ matrix.browser }}-${{ matrix.lang }}
|
||||
config: integrationFolder=cypress/integration/mon-entreprise
|
||||
env: site=${{ needs.build.outputs[matrix.lang] }},language=${{ matrix.lang }}
|
||||
|
||||
- name: Test publicodes
|
||||
if: matrix.lang == 'fr'
|
||||
uses: cypress-io/github-action@v2
|
||||
with:
|
||||
browser: ${{ matrix.browser }}
|
||||
record: true
|
||||
tag: publicodes-${{ matrix.browser }}
|
||||
config: integrationFolder=cypress/integration/publi.codes
|
||||
env: site=${{ needs.build.outputs.publicodes }}
|
||||
|
||||
- name: Test external integration
|
||||
if: matrix.lang == 'fr' && github.ref == 'refs/heads/master'
|
||||
uses: cypress-io/github-action@v2
|
||||
with:
|
||||
browser: ${{ matrix.browser }}
|
||||
record: true
|
||||
tag: external-integration-${{ matrix.browser }}
|
||||
config: integrationFolder=cypress/integration/external
|
||||
|
|
@ -10,7 +10,11 @@ describe('Page covid-19', function () {
|
|||
if (!fr) {
|
||||
return
|
||||
}
|
||||
before(() => cy.visit('/simulateurs/chômage-partiel'))
|
||||
before(() =>
|
||||
cy.visit(
|
||||
Cypress.env('site').replace('${path}', '/simulateurs/chômage-partiel')
|
||||
)
|
||||
)
|
||||
it('should not crash', () => {
|
||||
cy.contains('Salaire brut mensuel')
|
||||
})
|
||||
|
|
|
@ -4,7 +4,9 @@ describe('Formulaire demande mobilité', function () {
|
|||
if (!fr) {
|
||||
return
|
||||
}
|
||||
before(() => cy.visit('/gérer/demande-mobilité'))
|
||||
before(() =>
|
||||
cy.visit(Cypress.env('site').replace('${path}', '/gérer/demande-mobilité'))
|
||||
)
|
||||
it('should not crash', () => {
|
||||
cy.contains('Demande de mobilité internationale')
|
||||
})
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
describe('Manage page test', function () {
|
||||
const fr = Cypress.env('language') === 'fr'
|
||||
beforeEach(() => {
|
||||
cy.visit(fr ? '/gérer' : '/manage')
|
||||
cy.visit(Cypress.env('site').replace('${path}', fr ? '/gérer' : '/manage'))
|
||||
})
|
||||
it('should not crash', function () {
|
||||
cy.contains(fr ? 'Gérer mon activité' : 'Manage my business')
|
||||
|
|
|
@ -3,7 +3,7 @@ describe('Iframe integration test', function () {
|
|||
return
|
||||
}
|
||||
it('should display an iframe of the simulateur', function () {
|
||||
cy.visit('/dev/integration-test')
|
||||
cy.visit(Cypress.env('site').replace('${path}', '/dev/integration-test'))
|
||||
cy.contains('Visualiser').click()
|
||||
cy.wait(1000)
|
||||
cy.get('#simulateurEmbauche').iframe().contains('Salaire net')
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
describe('Landing test', function () {
|
||||
const fr = Cypress.env('language') === 'fr'
|
||||
it('should not crash', function () {
|
||||
cy.visit('/')
|
||||
cy.visit(Cypress.env('site').replace('${path}', '/'))
|
||||
cy.get('img[alt="logo mon-entreprise.fr"]').should('be.visible')
|
||||
})
|
||||
it('should display urssaf and marianne logo', function () {
|
||||
cy.visit('/')
|
||||
cy.visit(Cypress.env('site').replace('${path}', '/'))
|
||||
cy.get('img[alt="logo urssaf"]').should('be.visible')
|
||||
cy.get('img[alt="logo marianne"]').should('be.visible')
|
||||
})
|
||||
it('should display actionnable items', function () {
|
||||
cy.visit('/')
|
||||
cy.visit(Cypress.env('site').replace('${path}', '/'))
|
||||
cy.contains(fr ? 'Créer une entreprise' : 'Create a company')
|
||||
cy.contains(fr ? 'Gérer mon activité' : 'Manage my business')
|
||||
})
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
describe('Navigation', function () {
|
||||
const fr = Cypress.env('language') === 'fr'
|
||||
it('should enable switching site language', () => {
|
||||
cy.visit(fr ? '/créer/auto-entrepreneur' : '/create/auto-entrepreneur')
|
||||
cy.visit(
|
||||
Cypress.env('site').replace(
|
||||
'${path}',
|
||||
fr ? '/créer/auto-entrepreneur' : '/create/auto-entrepreneur'
|
||||
)
|
||||
)
|
||||
cy.contains(fr ? 'Switch to English' : 'Passer en français').click()
|
||||
cy.url().should(
|
||||
'include',
|
||||
|
@ -10,7 +15,9 @@ describe('Navigation', function () {
|
|||
})
|
||||
|
||||
it('should go back to home when clicking on logo', () => {
|
||||
cy.visit('/documentation/contrat-salarié')
|
||||
cy.visit(
|
||||
Cypress.env('site').replace('${path}', '/documentation/contrat-salarié')
|
||||
)
|
||||
cy.get('img[alt^="logo mon-entreprise"]').click()
|
||||
cy.url().should('be', Cypress.baseUrl)
|
||||
})
|
||||
|
|
|
@ -17,7 +17,11 @@ describe('Simulateurs', function () {
|
|||
'profession-liberale/chirurgien-dentiste',
|
||||
].forEach((simulateur) =>
|
||||
describe(simulateur, () => {
|
||||
before(() => cy.visit(`/simulateurs/${simulateur}`))
|
||||
before(() =>
|
||||
cy.visit(
|
||||
Cypress.env('site').replace('${path}', `/simulateurs/${simulateur}`)
|
||||
)
|
||||
)
|
||||
it('should not crash', function () {
|
||||
cy.get(inputSelector)
|
||||
})
|
||||
|
@ -80,7 +84,11 @@ describe('Simulateur auto-entrepreneur', () => {
|
|||
if (!fr) {
|
||||
return
|
||||
}
|
||||
before(() => cy.visit('/simulateurs/auto-entrepreneur'))
|
||||
before(() =>
|
||||
cy.visit(
|
||||
Cypress.env('site').replace('${path}', '/simulateurs/auto-entrepreneur')
|
||||
)
|
||||
)
|
||||
|
||||
it('should allow to enter the date of creation', () => {
|
||||
cy.get(inputSelector).first().type('{selectall}50000')
|
||||
|
@ -115,7 +123,7 @@ describe('Simulateur salarié mode partagé', () => {
|
|||
return
|
||||
}
|
||||
it('should set input value from URL', function () {
|
||||
cy.visit(urlWithState)
|
||||
cy.visit(Cypress.env('site').replace('${path}', urlWithState))
|
||||
cy.wait(800)
|
||||
cy.get(brutInputSelector).first().invoke('val').should('be', '1 539')
|
||||
|
||||
|
@ -123,7 +131,7 @@ describe('Simulateur salarié mode partagé', () => {
|
|||
cy.get('span.answerContent').first().contains('CDD')
|
||||
})
|
||||
it('should set URL from input value', function () {
|
||||
cy.visit(simulatorUrl)
|
||||
cy.visit(Cypress.env('site').replace('${path}', simulatorUrl))
|
||||
cy.get(brutInputSelector).first().type('{selectall}1539')
|
||||
cy.wait(1000)
|
||||
cy.get('.step').find('input[value="\'CDD\'"]').click({ force: true })
|
||||
|
@ -139,7 +147,9 @@ describe('Simulateur salarié', () => {
|
|||
if (!fr) {
|
||||
return
|
||||
}
|
||||
before(() => cy.visit('/simulateurs/salarié'))
|
||||
before(() =>
|
||||
cy.visit(Cypress.env('site').replace('${path}', '/simulateurs/salarié'))
|
||||
)
|
||||
|
||||
it('should persist the current simulation (persistSimulation)', function () {
|
||||
cy.get(inputSelector).first().type('{selectall}42')
|
||||
|
@ -147,13 +157,15 @@ describe('Simulateur salarié', () => {
|
|||
cy.contains('Passer').click()
|
||||
cy.contains('Passer').click()
|
||||
cy.wait(1600)
|
||||
cy.visit('/simulateurs/auto-entrepreneur')
|
||||
cy.visit(
|
||||
Cypress.env('site').replace('${path}', '/simulateurs/auto-entrepreneur')
|
||||
)
|
||||
cy.get(inputSelector).first().type('{selectall}007')
|
||||
cy.contains('Passer').click()
|
||||
cy.contains('Passer').click()
|
||||
cy.contains('Passer').click()
|
||||
cy.wait(1600)
|
||||
cy.visit('/simulateurs/salarié')
|
||||
cy.visit(Cypress.env('site').replace('${path}', '/simulateurs/salarié'))
|
||||
cy.contains('Retrouver ma simulation').click()
|
||||
cy.get(inputSelector).first().invoke('val').should('match', /42/)
|
||||
})
|
||||
|
@ -169,7 +181,7 @@ describe('Simulateur salarié', () => {
|
|||
|
||||
describe('part time contract', () => {
|
||||
before(() => {
|
||||
cy.visit('/simulateurs/salarié')
|
||||
cy.visit(Cypress.env('site').replace('${path}', '/simulateurs/salarié'))
|
||||
cy.get('input[name$="brut de base"]').click()
|
||||
cy.get('button').contains('SMIC').click()
|
||||
cy.contains('Voir mes paramètres').click()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
describe('Status guide', function () {
|
||||
const fr = Cypress.env('language') === 'fr'
|
||||
beforeEach(() => {
|
||||
cy.visit(fr ? '/créer' : '/create')
|
||||
cy.visit(Cypress.env('site').replace('${path}', fr ? '/créer' : '/create'))
|
||||
cy.get('.cta').click()
|
||||
})
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
describe('Navigation', function () {
|
||||
it('landing should not crash', function () {
|
||||
cy.visit('/')
|
||||
cy.visit(Cypress.env('site').replace('${path}', '/'))
|
||||
})
|
||||
it('liste des mécanismes should not crash', function () {
|
||||
cy.contains('Documentation').click()
|
||||
|
|
Loading…
Reference in New Issue