e2e tests: init

and package.json files fix
This commit is contained in:
SamR1 2018-01-07 11:44:56 +01:00
parent 7c3ffa46bd
commit 3a94f9a1b2
7 changed files with 1960 additions and 118 deletions

View File

@ -2,13 +2,21 @@ include Makefile.config
-include Makefile.custom.config
.SILENT:
init-db:
$(FLASK) init_db
make-p:
# Launch all P targets in parallel and exit as soon as one exits.
set -m; (for p in $(P); do ($(MAKE) $$p || kill 0)& done; wait)
init-db:
$(FLASK) init_db
install: install-client install-python
install-client:
$(NPM) install
install-python:
$(PIP) install -r $(REQUIREMENTS)
serve-python:
$(FLASK) run --with-threads -h $(HOST) -p $(API_PORT)
@ -18,5 +26,8 @@ serve-react:
serve:
$(MAKE) P="serve-react serve-python" make-p
test-e2e:
$(NPM) test
test-python:
$(FLASK) test

View File

@ -1,13 +1,17 @@
HOST = 0.0.0.0
API_PORT = 5000
CLIENT_PORT = 3000
export REACT_APP_API_URL ?= http://$(HOST):$(API_PORT)/api/
export FLASK_APP ?= $(PWD)/mpwo_api/server.py
export TEST_URL ?= http://$(HOST):$(CLIENT_PORT)
export REQUIREMENTS ?= $(PWD)/mpwo_api/requirements.txt
# Python env
PYTHON_VERSION ?= python
VENV = $(PWD)/mpwo_api/venv
PYTHON = $(VENV)/bin/python
PIP = $(VENV)/bin/pip
FLASK = $(VENV)/bin/flask
# Node env

View File

@ -0,0 +1,14 @@
import { Selector } from 'testcafe'
const TEST_URL = process.env.TEST_URL
fixture('/').page(`${TEST_URL}/`)
test('users should be able to view the \'/\' page', async t => {
await t
.navigateTo(TEST_URL)
.expect(Selector('A').withText('Dashboard').exists).ok()
})

View File

@ -1,32 +1,4 @@
{
"name": "mpwo_client",
"version": "0.1.0",
"private": true,
"dependencies": {
"date-fns": "^1.29.0",
"history": "^4.7.2",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-helmet": "^5.2.0",
"react-key-index": "^0.1.1",
"react-redux": "^5.0.6",
"react-router-dom": "^4.2.2",
"react-router-redux": "^5.0.0-alpha.9",
"react-scripts": "1.0.17",
"redux": "^3.7.2",
"redux-thunk": "^2.2.0"
},
"scripts": {
"start": "cd mpwo_client && react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"lint": "eslint --cache --ext .jsx --ext .js src"
},
"devDependencies": {
"babel-eslint": "^8.0.3",
"eslint": "^4.13.1",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-react": "^7.5.1"
}
"version": "0.1.0"
}

1049
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -19,7 +19,7 @@
"scripts": {
"start": "cd mpwo_client && react-scripts start",
"build": "cd mpwo_client && react-scripts build",
"test": "cd mpwo_client && react-scripts test --env=jsdom",
"test": "cd mpwo_client && testcafe firefox e2e",
"eject": "cd mpwo_client && react-scripts eject",
"lint": "cd mpwo_client && eslint --cache --ext .jsx --ext .js src"
},
@ -27,6 +27,8 @@
"babel-eslint": "^8.0.3",
"eslint": "^4.13.1",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-react": "^7.5.1"
"eslint-plugin-react": "^7.5.1",
"eslint-plugin-testcafe": "^0.2.1",
"testcafe": "^0.18.6"
}
}

File diff suppressed because it is too large Load Diff