Skip to content

Commit f431975

Browse files
authored
Merge pull request #21 from plotly/enable-integration
Enable Dash.jl integration tests and add startup message
2 parents 9a4c853 + bd8e893 commit f431975

File tree

3 files changed

+51
-10
lines changed

3 files changed

+51
-10
lines changed

.circleci/config.yml

+27-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ version: 2
33
jobs:
44

55
test:
6-
working_directory: /root/project/Dash
7-
6+
working_directory: ~/dashjl
87
docker:
9-
- image: julia:latest
8+
- image: plotly/julia:ci
9+
environment:
10+
PERCY_PARALLEL_TOTAL: '-1'
11+
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 'True'
1012

1113
steps:
1214
- checkout
@@ -26,7 +28,28 @@ jobs:
2628
- run:
2729
name: 🔎 Unit tests
2830
command: |
29-
julia -e 'using Pkg; Pkg.update(); Pkg.add(PackageSpec(path=pwd())); Pkg.build("Dash"); Pkg.test("Dash", coverage=true);'
31+
julia -e 'using Pkg; Pkg.update(); Pkg.add(PackageSpec(url="https://github.com/plotly/Dash.jl.git", rev="enable-integration")); Pkg.add(PackageSpec(url="https://github.com/waralex/dash-html-components.git", rev="jl_generator_test")); Pkg.add(PackageSpec(url="https://github.com/waralex/dash-core-components.git", rev="jl_generator_test")); Pkg.build("Dash"); Pkg.build("DashHtmlComponents"); Pkg.build("DashCoreComponents"); Pkg.test("Dash", coverage=true);'
32+
33+
- run:
34+
name: ⚙️ Integration tests
35+
command: |
36+
python -m venv venv
37+
. venv/bin/activate
38+
git clone --depth 1 https://github.com/plotly/dash.git -b add-julia-runner dash-main
39+
cd dash-main && pip install -e .[dev,testing] --progress-bar off && cd ~/dashjl
40+
export PATH=$PATH:/home/circleci/.local/bin/
41+
pytest -v --log-cli-level DEBUG --nopercyfinalize --junitxml=test-reports/dashjl.xml --percy-assets=test/assets/ test/integration/
42+
- store_artifacts:
43+
path: test-reports
44+
- store_test_results:
45+
path: test-reports
46+
- store_artifacts:
47+
path: /tmp/dash_artifacts
48+
49+
- run:
50+
name: 🦔 percy finalize
51+
command: npx percy finalize --all
52+
when: always
3053

3154
workflows:
3255
version: 2

src/Dash.jl

+6-6
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ callback!(app, callid"graphTitle.value => graph.figure") do value
5757
)
5858
end
5959
handle = make_handler(app, debug = true)
60-
run_server(handle, HTTP.Sockets.localhost, 8080)
60+
run_server(handle, HTTP.Sockets.localhost, 8050)
6161
```
6262
6363
""" Dashboards
6464

6565

6666
"""
67-
run_server(app::DashApp, host = HTTP.Sockets.localhost, port = 8080; debug::Bool = false)
67+
run_server(app::DashApp, host = HTTP.Sockets.localhost, port = 8050; debug::Bool = false)
6868
6969
Run Dash server
7070
@@ -82,11 +82,11 @@ julia> app = dash("Test") do
8282
end
8383
end
8484
julia>
85-
julia> run_server(handler, HTTP.Sockets.localhost, 8080)
85+
julia> run_server(handler, HTTP.Sockets.localhost, 8050)
8686
```
8787
8888
"""
89-
function run_server(app::DashApp, host = HTTP.Sockets.localhost, port = 8080;
89+
function run_server(app::DashApp, host = HTTP.Sockets.localhost, port = 8050;
9090
debug = nothing,
9191
dev_tools_ui = nothing,
9292
dev_tools_props_check = nothing,
@@ -112,9 +112,9 @@ function run_server(app::DashApp, host = HTTP.Sockets.localhost, port = 8080;
112112
dev_tools_prune_errors = dev_tools_prune_errors
113113
)
114114
handler = make_handler(app);
115-
@info "started"
115+
@info string("Running on http://", host, ":", port)
116116
HTTP.serve(handler, host, port)
117117
end
118118

119119

120-
end # module
120+
end # module

test/integration/test_sample_app.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
app = '''
2+
using Dash
3+
using DashHtmlComponents
4+
5+
app = dash("Test app")
6+
7+
app.layout = html_div() do
8+
html_div("Hello Dash.jl testing", id="container")
9+
end
10+
11+
run_server(app)
12+
'''
13+
14+
def test_jstr001_jl_with_string(dashjl):
15+
dashjl.start_server(app)
16+
dashjl.wait_for_text_to_equal(
17+
"#container", "Hello Dash.jl testing", timeout=10
18+
)

0 commit comments

Comments
 (0)