Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Commit

Permalink
Add integration tests, run locally. fixes #93
Browse files Browse the repository at this point in the history
disable urth-viz-cloud test, which was failing intermittently. refs #116
(c) Copyright IBM Corp. 2015
  • Loading branch information
Adam Peller and Angel Luu authored and peller committed Nov 24, 2015
1 parent 218cd58 commit d80ebba
Show file tree
Hide file tree
Showing 10 changed files with 610 additions and 52 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,4 @@ node_modules/
npm-debug.*
.watch
project/
SELENIUM_PID
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ before_script:
- sh -e /etc/init.d/xvfb start

script:
- make all
- BASEURL=http://127.0.0.1:9500 make all

deploy:
skip_cleanup: true
Expand All @@ -35,4 +35,4 @@ notifications:
branches:
only:
- master
- TestingSauseSystemTest
- TestingSauseSystemTest
39 changes: 27 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -242,28 +242,43 @@ _dev:
-v `pwd`/notebooks:/home/jovyan/work \
$(REPO) bash -c '$(SETUP_CMD) $(CMD)'

start-selenium:
@echo "Installing and starting Selenium Server..."
@node_modules/selenium-standalone/bin/selenium-standalone install
@node_modules/selenium-standalone/bin/selenium-standalone start & echo $$! > SELENIUM_PID

run-test: SERVER_NAME?=urth_widgets_integration_test_server
run-test:
-@docker rm -f $(SERVER_NAME)
@OPTIONS=-d SERVER_NAME=$(SERVER_NAME) $(MAKE) server
@echo 'Waiting for server to start...'
@LIMIT=60; while [ $$LIMIT -gt 0 ] && ! docker logs $(SERVER_NAME) 2>&1 | grep 'Notebook is running'; do echo waiting $$LIMIT...; sleep 1; LIMIT=$$(expr $$LIMIT - 1); done
@echo 'Running system integration tests...'
@npm run system-test -- --baseurl $(BASEURL) --server $(TEST_SERVER)

system-test: BASEURL?=http://192.168.99.100:9500
system-test: TEST_SERVER?=ondemand.saucelabs.com
system-test: SERVER_NAME?=urth_widgets_integration_test_server
system-test:
ifdef SAUCE_USER_NAME
@echo 'Running system tests on Sauce Labs...'
-@docker rm -f $(SERVER_NAME)
@OPTIONS=-d SERVER_NAME=$(SERVER_NAME) $(MAKE) server
@echo 'Waiting 20 seconds for server to start...'
@sleep 20
@echo 'Running system integration tests...'
@npm run system-test -- --baseurl $(BASEURL) --server $(TEST_SERVER)
-@docker rm -f $(SERVER_NAME)
BASEURL=$(BASEURL) TEST_SERVER=ondemand.saucelabs.com $(MAKE) run-test
else
@echo 'Skipping system tests...'
$(MAKE) start-selenium
$(MAKE) sdist
@echo 'Starting system integration tests locally...'
BASEURL=$(BASEURL) TEST_SERVER=localhost:4444 $(MAKE) run-test || (docker rm -f $(SERVER_NAME); -kill `cat SELENIUM_PID`; rm SELENIUM_PID; exit 1)
-@kill `cat SELENIUM_PID`
-@rm SELENIUM_PID
endif
@echo 'System integration tests complete.'
-@docker rm -f $(SERVER_NAME)

docs: DOC_PORT?=4001
docs: .watch dist/docs
@echo "Serving docs at http://127.0.0.1:$(DOC_PORT)"
@bash -c "trap 'make clean-watch' INT TERM ; npm run http-server -- dist/docs/site -p $(DOC_PORT)"

all: BASEURL?=http://192.168.99.100:9500
all:
$(MAKE) test-js-remote
$(MAKE) test-py
Expand All @@ -272,10 +287,10 @@ all:
$(MAKE) sdist
$(MAKE) install
PYTHON=python2 $(MAKE) install
BASEURL=http://127.0.0.1:9500 $(MAKE) system-test
BASEURL=http://127.0.0.1:9500 PYTHON=python2 $(MAKE) system-test
@BASEURL=$(BASEURL) $(MAKE) system-test
@BASEURL=$(BASEURL) PYTHON=python2 $(MAKE) system-test

release: EXTRA_OPTIONS=-e PYPI_USER=$(PYPI_USER) -e PYPI_PASSWORD=$(PYPI_PASSWORD)
release: SETUP_CMD=echo "[server-login]" > ~/.pypirc; echo "username:" ${PYPI_USER} >> ~/.pypirc; echo "password:" ${PYPI_PASSWORD} >> ~/.pypirc;
release: POST_SDIST=register upload
release: sdist
release: sdist
6 changes: 3 additions & 3 deletions elements/urth-viz-cloud/test/urth-viz-cloud.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,18 @@
afterEach(function() {
});

/*
// STEP 5: Define suite(s) and tests.
describe('render cloud', function() {
it('should contain a top-level <div> element id=container with an <svg>', function() {
expect(cloud/*.shadowRoot*/.querySelector('#container svg')).to.exist;
expect(cloud//.shadowRoot//.querySelector('#container svg')).to.exist;
});
it('should contain six <text> elements', function() {
expect(cloud/*.shadowRoot*/.querySelectorAll('#container svg g text').length).to.equal(6);
expect(cloud//.shadowRoot//.querySelectorAll('#container svg g text').length).to.equal(6);
});
});
/*
describe('update cloud data', function() {
beforeEach(function(done) {
function listener() {
Expand Down
Loading

0 comments on commit d80ebba

Please sign in to comment.