Permalink
Browse files

Adding simple frontend test system and scripts.

  • Loading branch information...
grugnog committed Jul 7, 2015
1 parent 0410bed commit 8dddf63b05be0712fbcaed36f90c471215128bb7
View
@@ -3,3 +3,5 @@ docker-compose-frontend.yml
docker-compose-backend.yml
.env
.DS_Store
frontend/tests/chrome.log
frontend/tests/firefox.log
View
@@ -1,3 +1,6 @@
#!/bin/sh
cd "$(git rev-parse --show-toplevel)/backend"
docker-compose run testing /usr/src/nebula/vendor/bin/phpunit --log-junit /usr/src/nebula/report.xml $@ /usr/src/nebula/tests/
cd "$(git rev-parse --show-toplevel)"
# Only run frontend tests if backend succeeds.
./bin/test-backend && ./bin/test-frontend
# Preserve exit status
exit $?
View
@@ -0,0 +1,3 @@
#!/bin/sh
cd "$(git rev-parse --show-toplevel)/backend"
docker-compose run testing /usr/src/nebula/vendor/bin/phpunit --log-junit /usr/src/nebula/report.xml $@ /usr/src/nebula/tests/
View
@@ -0,0 +1,14 @@
#!/bin/sh
cd "$(git rev-parse --show-toplevel)/frontend/tests"
docker-compose build
docker-compose up -d seleniumchrome seleniumfirefox
sleep 5
# Run tests in Chrome and Firefox.
docker-compose run --no-deps --rm seinterpreter se-interpreter --driver-host=seleniumchrome:4444 --browser-browserName="chrome" /usr/src/tests/selenium2-core-tests.json | tee chrome.log
docker-compose run --no-deps --rm seinterpreter se-interpreter --driver-host=seleniumfirefox:4444 --browser-browserName="firefox" /usr/src/tests/selenium2-core-tests.json | tee firefox.log
docker-compose stop
# Check for errors and return useful exit code.
if fgrep -q 'Failed' chrome.log firefox.log; then
exit 1
fi
exit 0
@@ -0,0 +1,15 @@
seleniumchrome:
image: selenium/standalone-chrome
external_links:
- frontend_web_1:web
seleniumfirefox:
image: selenium/standalone-firefox
external_links:
- frontend_web_1:web
seinterpreter:
build: se-interpreter
volumes:
- .:/usr/src/tests
links:
- seleniumchrome
- seleniumfirefox
@@ -0,0 +1,2 @@
FROM node
RUN npm install -g se-interpreter
@@ -0,0 +1,142 @@
{
"type": "script",
"seleniumVersion": "2",
"formatVersion": 2,
"steps": [
{
"type": "get",
"url": "http://web/"
},
{
"type": "setElementText",
"locator": {
"type": "id",
"value": "drug"
},
"text": "TYLENOL"
},
{
"type": "clickElement",
"locator": {
"type": "id",
"value": "add-to-list"
}
},
{
"type": "verifyElementPresent",
"locator": {
"type": "id",
"value": "TYLENOL"
}
},
{
"type": "verifyElementPresent",
"locator": {
"type": "css selector",
"value": "#pie-chart > div:nth-child(1) > div:nth-child(2)"
}
},
{
"type": "verifyElementPresent",
"locator": {
"type": "css selector",
"value": "#drug-chart > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > table:nth-child(1) > tbody:nth-child(2) > tr:nth-child(1) > td:nth-child(2)"
}
},
{
"type": "setElementText",
"locator": {
"type": "id",
"value": "drug"
},
"text": "IBUPROFEN"
},
{
"type": "clickElement",
"locator": {
"type": "id",
"value": "add-to-list"
}
},
{
"type": "verifyElementPresent",
"locator": {
"type": "id",
"value": "TYLENOL"
}
},
{
"type": "verifyElementPresent",
"locator": {
"type": "id",
"value": "IBUPROFEN"
}
},
{
"type": "verifyElementPresent",
"locator": {
"type": "css selector",
"value": "#pie-chart > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > table:nth-child(1) > tbody:nth-child(2) > tr:nth-child(1) > td:nth-child(2)"
}
},
{
"type": "verifyElementPresent",
"locator": {
"type": "css selector",
"value": "#pie-chart > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > table:nth-child(1) > tbody:nth-child(2) > tr:nth-child(2) > td:nth-child(2)"
}
},
{
"type": "clickElement",
"locator": {
"type": "id",
"value": "clear-all"
}
},
{
"type": "verifyTextPresent",
"text": "https://www.sideeffect.io?saved="
},
{
"type": "verifyTextPresent",
"text": "911"
},
{
"type": "verifyTextPresent",
"text": "(800) 222-1222"
},
{
"type": "verifyTextPresent",
"text": "Report »"
},
{
"type": "verifyTextPresent",
"text": "Our website contains general information about the adverse effects reported for certain drugs. The medical information is not advice and should not be treated as such."
},
{
"type": "verifyTextPresent",
"text": "privacy policy"
},
{
"type": "verifyTextPresent",
"text": "The medical information on our website is provided without any representations or warranties, express or implied. We do not warrant or represent that the medical information on this website:"
},
{
"type": "verifyTextPresent",
"text": "You must not rely on the information on our website as an alternative to medical advice from your doctor or other professional healthcare provider. If you have any specific questions about any medical"
},
{
"type": "verifyElementPresent",
"locator": {
"type": "css selector",
"value": "a.btn"
}
}
],
"data": {
"configs": {},
"source": "none"
},
"inputs": [],
"timeoutSeconds": 60
}

0 comments on commit 8dddf63

Please sign in to comment.