Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split cypress tests #6241

Merged
merged 2 commits into from
Nov 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,33 @@ jobs:
include:
- language: python
python: 3.6
env: TOXENV=cypress
env: TOXENV=cypress-dashboard
cache:
pip: true
yarn: true
directories:
- ~/.npm
- ~/.cache
services:
- redis-server
before_install:
- nvm install 8.9
- language: python
python: 3.6
env: TOXENV=cypress-explore
cache:
pip: true
yarn: true
directories:
- ~/.npm
- ~/.cache
services:
- redis-server
before_install:
- nvm install 8.9
- language: python
python: 3.6
env: TOXENV=cypress-sqllab
cache:
pip: true
yarn: true
Expand Down
Empty file added cypress.json
Empty file.
2 changes: 2 additions & 0 deletions superset/assets/cypress.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"baseUrl": "http://localhost:8081",
"videoUploadOnPasses": false,
"video": false,
"ignoreTestFiles": ["**/!(*.test.js)"],
"projectId": "fbf96q",
"defaultCommandTimeout": 10000,
"viewportWidth": 1280,
"viewportHeight": 800
}
18 changes: 9 additions & 9 deletions superset/assets/cypress_build.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/bin/bash
set -e

superset/bin/superset db upgrade
superset/bin/superset load_test_users
superset/bin/superset load_examples
superset/bin/superset init
flask run -p 8081 --with-threads --reload --debugger &

cd "$(dirname "$0")"

yarn install --frozen-lockfile
npm run build
npm run cypress run
#run all the python steps in a background process
(time /home/travis/build/apache/incubator-superset/superset/bin/superset db upgrade; time /home/travis/build/apache/incubator-superset/superset/bin/superset load_test_users; /home/travis/build/apache/incubator-superset/superset/bin/superset load_examples; time /home/travis/build/apache/incubator-superset/superset/bin/superset init; echo "[completed python build steps]"; flask run -p 8081 --with-threads --reload --debugger) &
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you mean to leave the time statements in here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I left it there so we can see how long each subpart takes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be using && rather than ; here per this?

Copy link
Contributor Author

@timifasubaa timifasubaa Nov 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think either way is fine. They will both lead to a failed build if something goes wrong in the middle


#block on the longer running javascript process
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like we should have flask run run after we've run npm run build as then there's no need to background the task above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

npm run build takes a really long time esp when it freezes on 92%. So I decided to put in as much as possible in the background while it is running so as to save the time it will take to run if it were to run after npm run build

(time yarn install --frozen-lockfile; time npm run build; echo "[completed js build steps]")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See note ^^.


CYPRESS_PATH='cypress/integration/'${1}'/*'
time npm run cypress run -- --spec "$CYPRESS_PATH" --record false --config video=false

kill %1
30 changes: 27 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,31 @@ setenv =
whitelist_externals =
npm

[testenv:cypress]
[testenv:cypress-dashboard]
commands =
{toxinidir}/superset/assets/cypress_build.sh
{toxinidir}/superset/assets/cypress_build.sh dashboard
setenv =
PYTHONPATH = {toxinidir}
SUPERSET_CONFIG = tests.superset_test_config
SUPERSET_HOME = {envtmpdir}
deps =
-rrequirements.txt
-rrequirements-dev.txt

[testenv:cypress-explore]
commands =
{toxinidir}/superset/assets/cypress_build.sh explore
setenv =
PYTHONPATH = {toxinidir}
SUPERSET_CONFIG = tests.superset_test_config
SUPERSET_HOME = {envtmpdir}
deps =
-rrequirements.txt
-rrequirements-dev.txt

[testenv:cypress-sqllab]
commands =
{toxinidir}/superset/assets/cypress_build.sh sqllab
setenv =
PYTHONPATH = {toxinidir}
SUPERSET_CONFIG = tests.superset_test_config
Expand Down Expand Up @@ -83,7 +105,9 @@ deps =

[tox]
envlist =
cypress
cypress-dashboard
cypress-explore
cypress-sqllab
eslint
flake8
javascript
Expand Down