Skip to content

Commit

Permalink
Enable E2E tests on CircleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
wwerner committed Oct 11, 2019
1 parent ebcaa74 commit e484cf8
Show file tree
Hide file tree
Showing 8 changed files with 198 additions and 18 deletions.
42 changes: 30 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,53 @@ jobs:
- image: circleci/openjdk:8u151-jdk
steps:
- checkout
- restore_cache:
keys:
- v2-mvn-dependencies-{{ checksum "pom.xml" }}
- v2-mvn-dependencies-
- restore_cache:
keys:
- v1-dependencies-{{ checksum "src/main/frontend/package.json" }}
- v1-dependencies-
- run: mvn -B -Pfrontend package
- run: mvn -B clean package -Pfrontend
- persist_to_workspace:
root: ~/project
paths:
- target/
- src/main/frontend/
- src/test/e2e/
- store_test_results:
path: target/surefire-reports
- save_cache:
paths:
- target/node
- src/main/frontend/node_modules
key: v1-dependencies-{{ checksum "src/main/frontend/package.json" }}
- save_cache:
paths:
- ~/.m2
key: v2-mvn-dependencies-{{ checksum "pom.xml" }}
e2e-test:
docker:
- image: circleci/openjdk:8-jdk-node-browsers
steps:
- attach_workspace:
at: ~/project
- run: |
java -jar ~/project/target/vlingo-schemata-*-jar-with-dependencies.jar dev &
export CYPRESS_BASE_URL=http://localhost:9019/app
cd ~/project/src/test/e2e
npm install
npm run test-multiple
- store_test_results:
path: src/test/e2e/multiple-results
- store_artifacts:
path: src/test/e2e/cypress/videos
destination: videos
- store_artifacts:
path: src/test/e2e/cypress/screenshots
destination: screenshots
image:
docker:
- image: circleci/openjdk:8u151-jdk
- image: circleci/jdk:8
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: false
- run: docker build . -t vlingo/vlingo-schemata
- run: |
docker build . -t vlingo/vlingo-schemata
- run: |
echo "$DOCKER_TOKEN" | docker login --username $DOCKER_USER --password-stdin
docker push vlingo/vlingo-schemata
Expand All @@ -46,11 +60,15 @@ workflows:
default-workflow:
jobs:
- build
- image:
- e2e-test:
requires:
- build
- image:
requires:
- e2e-test
filters:
branches:
only:
- master


2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ FROM maven:3.6.2-jdk-8-slim as packager
# RUN cd /home/project && mvn dependency:go-offline -B

ADD . /home/project
RUN cd /home/project && mvn clean -Pfrontend package
RUN cd /home/project && mvn -B clean -Pfrontend package

# Second stage: Create runtime image
FROM openjdk:8-jdk-alpine
Expand Down
3 changes: 3 additions & 0 deletions src/test/e2e/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cypress/screenshots/
cypress/videos/
multiple-results/results.xml
6 changes: 6 additions & 0 deletions src/test/e2e/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"reporterEnabled": "spec, mocha-junit-reporter",
"mochaJunitReporterReporterOptions": {
"mochaFile": "multiple-results/results.xml"
}
}
7 changes: 6 additions & 1 deletion src/test/e2e/cypress.json
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
{}
{
"baseUrl": "http://localhost:9019/app",
"numTestsKeptInMemory": 1,
"chromeWebSecurity": false,
"video": true
}
4 changes: 2 additions & 2 deletions src/test/e2e/cypress/integration/entity-creation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ describe('Entity Creation Tests', function () {
cy.fillEditor('#description-editor', faker.lorem.sentence())
cy.fillEditor('#specification-editor', 'event SalutationHappened {\n' +
' type eventType')
cy.wait(250).contains('button', 'Create').click({force: true})
cy.contains('button', 'Create').click()

cy.wait(250).fieldContent('SchemaVersionID').should('not.be.empty')
cy.fieldContent('SchemaVersionID').should('not.be.empty')
});

});
144 changes: 144 additions & 0 deletions src/test/e2e/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions src/test/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@
"faker": "^4.1.0",
"ts-loader": "^6.1.2",
"typescript": "^3.6.3",
"webpack": "^4.41.0"
"webpack": "^4.41.0",
"mocha": "^4.0.1",
"mocha-junit-reporter": "^1.13.0",
"mocha-multi-reporters": "^1.1.4"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test-junit": "npx cypress run --reporter junit --reporter-options 'mochaFile=junit-results/my-test-output.xml' --spec \"cypress/integration/*.spec.ts\"",
"test-multiple": "npx cypress run --reporter mocha-multi-reporters --reporter-options configFile=config.json --spec \"cypress/integration/*.spec.ts\""
},
"keywords": [],
"author": "",
Expand Down

0 comments on commit e484cf8

Please sign in to comment.