Add selenium test to travis

This commit is contained in:
Aviv Palivoda committed 2019-03-15 17:24:34 +02:00
1 parent f281aab721
commit abb4d41e5b
4 files changed
+53 -9

No files matched your search

+20
View File
@@ -115,6 +115,26 @@ matrix:
- TRAVIS_RUST_VERSION=nightly
- REGULAR_TEST=false
- CODE_COVERAGE=true
- name: test WASM
language: python
python: 3.6
cache:
pip: true
# Because we're using the Python Travis environment, we can't use
# the built-in cargo cacher
directories:
- /home/travis/.cargo
- target
addons:
firefox: latest
install:
- nvm install node
- pip install pipenv
script:
- wasm/tests/.travis-runner.sh
env:
- REGULAR_TEST=true
- TRAVIS_RUST_VERSION=stable
allow_failures:
- rust: nightly
env: REGULAR_TEST=true
+5 -2
View File
@@ -16,12 +16,15 @@
"raw-loader": "^1.0.0",
"webpack": "^4.16.3",
"webpack-cli": "^3.1.0",
"webpack-dev-server": "^3.1.5"
"webpack-dev-server": "^3.1.5",
"start-server-and-test": "^1.7.11"
},
"scripts": {
"dev": "webpack-dev-server -d",
"build": "webpack",
"dist": "webpack --mode production"
"dist": "webpack --mode production",
"test": "cd ../tests; pipenv run pytest",
"ci": "start-server-and-test dev http-get://localhost:8080 test"
},
"repository": {
"type": "git",
+23
View File
@@ -0,0 +1,23 @@
#!/bin/sh -eux
# This script is intended to be run in Travis from the root of the repository
# Install Rust
curl -sSf https://build.travis-ci.org/files/rustup-init.sh | sh -s -- --default-toolchain=$TRAVIS_RUST_VERSION -y
export PATH=$HOME/.cargo/bin:$PATH
# install wasm-pack
if [ ! -f $HOME/.cargo/bin/wasm-pack ]; then
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
fi
# install geckodriver
wget https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux32.tar.gz
mkdir geckodriver
tar -xzf geckodriver-v0.24.0-linux32.tar.gz -C geckodriver
export PATH=$PATH:$PWD/geckodriver
# Install pipenv
pip install pipenv
(cd wasm/tests; pipenv install)
(cd wasm/demo; npm install; npm run ci)
+5 -7
View File
@@ -1,7 +1,7 @@
import time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.firefox.options import Options
import pytest
RUN_CODE_TEMPLATE = """
@@ -19,15 +19,13 @@ return output;
@pytest.fixture(scope="module")
def driver(request):
options = Options()
options.headless = True
options.add_argument('--disable-gpu')
driver = webdriver.Chrome(options=options)
options.add_argument('-headless')
driver = webdriver.Firefox(options=options)
driver.get("http://localhost:8080")
assert "RustPython" in driver.title
time.sleep(5)
yield driver
driver.close()
driver.close()
@pytest.mark.parametrize("script, output",
[