Add circle CI check on our partner integration (pole-emploi)

pull/339/head
Johan Girod 2018-09-06 16:37:27 +02:00
parent c84fa88759
commit ea2b9435e0
7 changed files with 85 additions and 38 deletions

View File

@ -1,42 +1,75 @@
version: 2
jobs:
build:
unit-test:
docker:
- image: cypress/base:8
steps:
- checkout
- restore_cache:
keys:
- v1-deps-{{ .Branch }}-{{ checksum "package.json" }}
- v1-deps-{{ .Branch }}
- v1-deps
- run: yarn install --frozen-lockfile
- save_cache:
key: v1-deps-{{ .Branch }}-{{ checksum "package.json" }}
paths:
- ~/.cache
- run: |
yarn run flow-typed install
git config --global core.quotepath false
yarn test
end-to-end-test:
docker:
- image: cypress/base:8
environment:
## this enables colors in the output
TERM: xterm
CYPRESS_baseUrl: http://localhost:5000
working_directory: ~/app
steps:
- checkout
- restore_cache:
name: Restore Yarn and Cypress Cache
keys:
- v1-deps-{{ .Branch }}-{{ checksum "package.json" }}
- v1-deps-{{ .Branch }}
- v1-deps
- run:
name: Install Dependencies
command: |
yarn install --frozen-lockfile
- run: yarn install --frozen-lockfile
- save_cache:
name: Save Yarn and Cypress Cache
key: v1-deps-{{ .Branch }}-{{ checksum "package.json" }}
paths:
- ~/.cache
- run:
name: Install flow-typed
command: yarn run flow-typed install
- run:
name: Change git config to support UTF8 filename
command: git config --global core.quotepath false
- run:
name: Linting and unit test
command: yarn test
- run:
name: End to end test
command: |
yarn run compile
yarn run serve:embauche &
yarn run cypress run --record --key 21660df5-36a5-4c49-b23d-801799b0c759
- run: |
yarn run compile
yarn run serve:embauche &
yarn run cypress run --record --key 21660df5-36a5-4c49-b23d-801799b0c759 --spec 'cypress/integration/**/!(external-integrations.js)'
production-test:
docker:
- image: cypress/base:8
environment:
## this enables colors in the output
TERM: xterm
CYPRESS_baseUrl: http://embauche.beta.gouv.fr
steps:
- run: npm install --save-dev cypress
# We wait an arbitrary 4 min for the deploy (TODO: use netlify hook for triggering a this job)
- run: sleep 4 * 60 * 60
- run: yarn run cypress run --record --key 21660df5-36a5-4c49-b23d-801799b0c759
workflows:
version: 2
test:
jobs:
- unit-test
- end-to-end-test
- test-prod:
filters:
branches:
only: master
experimental:
notify:
branches:
only:
- master

View File

@ -1,4 +1,5 @@
{
"projectId": "jxcngh",
"baseUrl": "http://localhost:8080/embauche"
"baseUrl": "http://localhost:8080/embauche",
"chromeWebSecurity": false
}

View File

@ -6,6 +6,7 @@ const salaryInput = inputTitle => {
inputContainer.click()
return inputContainer.find('input')
}
describe('Landing basic test', function() {
it('should not crash', function() {
cy.visit('/')
@ -20,3 +21,13 @@ describe('Landing basic test', function() {
cy.get('.distribution-chart__container')
})
})
describe('Iframe integration test', function() {
it('should display an iframe of the simulateur', function() {
cy.visit('/integration-test')
cy.get('#simulateurEmbauche')
.iframe()
.contains('Entrez un salaire mensuel')
cy.debug()
})
})

View File

@ -0,0 +1,11 @@
describe('Pole emploi test', function() {
it('should display an iframe of the simulateur', function() {
cy.on('uncaught:exception', err => {
return !err.message.contains('Unexpected token <')
})
cy.visit('https://entreprise.pole-emploi.fr/cout-salarie/')
cy.get('#simulateurEmbauche')
.iframe()
.contains('Entrez un salaire mensuel')
})
})

View File

@ -1,14 +0,0 @@
Cypress.Commands.add('iframe', { prevSubject: 'element' }, $iframe => {
return new Cypress.Promise(resolve => {
setTimeout(() => resolve($iframe.contents().find('body')), 5000)
})
})
describe('Iframe integration test', function() {
it('should display an iframe of the simulateur', function() {
cy.visit('/integration-test')
cy.get('iframe')
.iframe()
.contains('Entrez un salaire mensuel')
})
})

View File

@ -23,3 +23,8 @@
//
// -- This is will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
Cypress.Commands.add('iframe', { prevSubject: 'element' }, $iframe => {
return new Cypress.Promise(resolve => {
setTimeout(() => resolve($iframe.contents().find('body')), 5000)
})
})