Skip to content

Commit

Permalink
Run test suites
Browse files Browse the repository at this point in the history
  • Loading branch information
Kmaschta committed Apr 7, 2020
1 parent bf1801c commit fb5aa8b
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 12 deletions.
30 changes: 19 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,37 @@
os: linux
dist: trusty

language: node_js
sudo: required
node_js:
- 'lts/*'

addons:
chrome: stable
firefox: stable
firefox: latest

env:
jobs:
- E2E_BROWSER=chrome
- E2E_BROWSER=firefox
- TEST_SUITE=unit
- TEST_SUITE=e2e-chrome
- TEST_SUITE=e2e-firefox
global:
- DISPLAY=:99.0
- NODE_ENV=test
dist: trusty

cache:
yarn: true
directories:
- ~/.cache

before_install:
- "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16"
- curl -o- -L https://yarnpkg.com/install.sh | bash
- source ~/.bashrc
- sh -e /etc/init.d/xvfb start
- sleep 3
script: make test
- '/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16'
- curl -o- -L https://yarnpkg.com/install.sh | bash
- source ~/.bashrc
- sh -e /etc/init.d/xvfb start
- sleep 3

script: make test-on-travis

branches:
only:
- master
Expand Down
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,19 @@ prettier: ## prettify the source code using prettier

test: build test-unit lint test-e2e ## launch all tests

test-on-travis: build
ifeq ($(TEST_SUITE),unit)
$(MAKE) test-unit lint
else ifeq ($(TEST_SUITE),e2e-chrome)
BROWSER=chrome $(MAKE) test-e2e
else ifeq ($(TEST_SUITE),e2e-firefox)
BROWSER=firefox $(MAKE) test-e2e
else
@echo "Invalid test suite, please check your TEST_SUITE env var"
exit 1
endif


test-unit: ## launch unit tests
@if [ "$(CI)" != "true" ]; then \
echo "Running unit tests..."; \
Expand Down
5 changes: 4 additions & 1 deletion cypress/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ return server.start().then(listeningServer => {
// kick off a cypress run
return cypress
.run({
browser: process.env.E2E_BROWSER || 'chrome',
browser: process.env.BROWSER || 'chrome',
config: {
baseUrl: 'http://localhost:8080',
video: false,
Expand All @@ -17,5 +17,8 @@ return server.start().then(listeningServer => {
if (results.totalFailed > 0) {
process.exit(1);
}
})
.catch(() => {
process.exit(1);
});
});

0 comments on commit fb5aa8b

Please sign in to comment.