From 39ac3b3a2322faeb1bf44397146b3545d2c995c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Tue, 13 Jun 2023 15:40:43 -0400 Subject: [PATCH 01/18] add newline at EOF --- gen_resources/generate.jl | 2 +- gen_resources/generator/components.jl | 2 +- gen_resources/generator/dash.jl | 2 +- gen_resources/generator/deploy.jl | 2 +- gen_resources/generator/generator.jl | 2 +- gen_resources/generator/github.jl | 2 +- gen_resources/generator/gitutils.jl | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gen_resources/generate.jl b/gen_resources/generate.jl index d659ca7..937ff16 100644 --- a/gen_resources/generate.jl +++ b/gen_resources/generate.jl @@ -18,4 +18,4 @@ build_dir = joinpath(@__DIR__, "build") artifact_file = joinpath(@__DIR__, "..", "Artifacts.toml") -generate(ARGS, sources, build_dir, artifact_file) \ No newline at end of file +generate(ARGS, sources, build_dir, artifact_file) diff --git a/gen_resources/generator/components.jl b/gen_resources/generator/components.jl index cb9f1ac..b33edda 100644 --- a/gen_resources/generator/components.jl +++ b/gen_resources/generator/components.jl @@ -185,4 +185,4 @@ function arg_docstring(prop_name, type_object, required, description, indent_num ")", isempty(description) ? "" : string(": ", description) ) -end \ No newline at end of file +end diff --git a/gen_resources/generator/dash.jl b/gen_resources/generator/dash.jl index 220b710..4fcc538 100644 --- a/gen_resources/generator/dash.jl +++ b/gen_resources/generator/dash.jl @@ -157,4 +157,4 @@ function components_module_resources(module_name; name, prefix, metadata_file) ) return meta -end \ No newline at end of file +end diff --git a/gen_resources/generator/deploy.jl b/gen_resources/generator/deploy.jl index 98e04b8..9bcb024 100644 --- a/gen_resources/generator/deploy.jl +++ b/gen_resources/generator/deploy.jl @@ -152,4 +152,4 @@ function upload_to_releases(repo_name, tag, tarball_path; attempts = 3) end end error("Unable to upload $(tarball_path) to GitHub repo $(repo_name) on tag $(tag)") -end \ No newline at end of file +end diff --git a/gen_resources/generator/generator.jl b/gen_resources/generator/generator.jl index 5e31125..f8397f9 100644 --- a/gen_resources/generator/generator.jl +++ b/gen_resources/generator/generator.jl @@ -83,4 +83,4 @@ function generate(ARGS, sources, build_dir, artifact_file) end @info "resource generation done!" -end \ No newline at end of file +end diff --git a/gen_resources/generator/github.jl b/gen_resources/generator/github.jl index d061731..df14ed1 100644 --- a/gen_resources/generator/github.jl +++ b/gen_resources/generator/github.jl @@ -112,4 +112,4 @@ function obtain_token(; outs=stdout, github_api=GitHub.DEFAULT_API) return token end -end \ No newline at end of file +end diff --git a/gen_resources/generator/gitutils.jl b/gen_resources/generator/gitutils.jl index 305de88..826c636 100644 --- a/gen_resources/generator/gitutils.jl +++ b/gen_resources/generator/gitutils.jl @@ -66,4 +66,4 @@ function with_gitcreds(f, username::AbstractString, password::AbstractString) finally Base.shred!(creds) end -end \ No newline at end of file +end From 81e5efe6f3d3aafbedace2cdb09eb0c9d3f11767 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Tue, 13 Jun 2023 16:58:01 -0400 Subject: [PATCH 02/18] fix typo in docstring --- gen_resources/generator/dash.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gen_resources/generator/dash.jl b/gen_resources/generator/dash.jl index 4fcc538..fe006fc 100644 --- a/gen_resources/generator/dash.jl +++ b/gen_resources/generator/dash.jl @@ -1,7 +1,7 @@ """ install_dash(url, tag) -Clone python dash into `dash` folder and install (reinstall) it to current python enviroment +Clone python dash into `dash` folder and install (reinstall) it to current python environment """ function install_dash(url, tag) Conda.pip_interop(true) From 2a0333a548c4fc39072f2bb8fcae371e68c94a74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Tue, 13 Jun 2023 16:58:16 -0400 Subject: [PATCH 03/18] add missing `gen_resources` dep --- gen_resources/Project.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/gen_resources/Project.toml b/gen_resources/Project.toml index f1667b5..1fdfc5a 100644 --- a/gen_resources/Project.toml +++ b/gen_resources/Project.toml @@ -5,6 +5,7 @@ HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3" JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1" LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433" +OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca" PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0" From a791cbca34ac6f0b82080c7f537ce4177c596cc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Tue, 13 Jun 2023 16:58:37 -0400 Subject: [PATCH 04/18] be less string about github token length --- gen_resources/generator/github.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gen_resources/generator/github.jl b/gen_resources/generator/github.jl index df14ed1..1fe38a5 100644 --- a/gen_resources/generator/github.jl +++ b/gen_resources/generator/github.jl @@ -10,7 +10,7 @@ const _github_auth = Ref{GitHub.Authorization}() function github_auth(;allow_anonymous::Bool=true) if !isassigned(_github_auth) || !allow_anonymous && isa(_github_auth[], GitHub.AnonymousAuth) # If the user is feeding us a GITHUB_TOKEN token, use it! - if length(get(ENV, "GITHUB_TOKEN", "")) == 40 + if length(get(ENV, "GITHUB_TOKEN", "")) >= 40 _github_auth[] = GitHub.authenticate(ENV["GITHUB_TOKEN"]) else if allow_anonymous From a8f15a2ba597c4a33e34c1dbce391599ce8b67df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Tue, 13 Jun 2023 16:59:42 -0400 Subject: [PATCH 05/18] adapt for new-ish version of dash which include `dash_renderer` onto the "main" `dash` module --- gen_resources/Sources.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gen_resources/Sources.toml b/gen_resources/Sources.toml index d52ac9e..e993607 100644 --- a/gen_resources/Sources.toml +++ b/gen_resources/Sources.toml @@ -2,9 +2,9 @@ repo = "plotly/DashCoreResources" [dash] url = "https://github.com/plotly/dash.git" - tag = "v2.0.0" + tag = "v2.10.2" [dash_renderer] - module = "dash_renderer" + module = "dash._dash_renderer" resources_path = "." [components] [components.dash_html_components] From 536f3ccc6320de94972f7dd40b9788938fdcd932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Tue, 13 Jun 2023 17:00:20 -0400 Subject: [PATCH 06/18] add `gen_resources` instructions --- gen_resources/README.md | 88 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 gen_resources/README.md diff --git a/gen_resources/README.md b/gen_resources/README.md new file mode 100644 index 0000000..5167b55 --- /dev/null +++ b/gen_resources/README.md @@ -0,0 +1,88 @@ +# Generate Dash.jl artifacts + +Dash.jl uses Julia +[Artifacts](https://docs.julialang.org/en/v1/stdlib/Artifacts/) to load +front-end resources that Dash.jl shares with the python version of +[dash](https://github.com/plotly/dash). + +The [Artifacts.toml](../Artifacts.toml) file lists the location of the +publicly-available tarball containing all the required resources. + +The tarballs are hosted on the +[DashCoreResources](https://github.com/plotly/DashCoreResources) repo, under +_Releases_. They are generated and deployed using the `generate.jl` script in +this directory. + +## How to run `generate.jl` ? + +### Step 0: get push rights to `DashCoreResources` + +### Step 1: get GitHub personal access token + +See [GitHub docs](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token) +for more info. + +If using a fine-grained token, make sure to enable _Read and Write access to code_. + +### Step 2: expose your token into your shell + +``` +# for example: +export GITHUB_TOKEN="" +``` + +### Step 3: run `generate.jl` + +``` +cd Dash.jl/gen_resources + +# install `generate.jl` deps +julia --project -e 'import Pkg; Pkg.instantiate()' + +# generate `gen_resources/build/deploy/` content, +# but do not deploy! +julia --project generate.jl + +# if everything looks fine, +# generate `gen_resources/build/deploy/` content (again) and +# deploy to the `DashCoreResource` releases with: +julia --project generate.jl --deploy +``` + +#### If `generate.jl` errors + +
+with a PyError / PyImport error + +that is an error like: + +``` +ERROR: LoadError: PyError (PyImport_ImportModule + +The Python package dash could not be imported by pyimport. Usually this means +that you did not install dash in the Python version being used by PyCall. + +PyCall is currently configured to use the Python version at: + +/usr/bin/python3 +``` + +try + +```jl +using PyCall +ENV["PYTHON"] = joinpath(homedir(), ".julia/conda/3/x86_64/bin") +import Pkg +Pkg.build("PyCall") +# check that it matches with +PyCall.pyprogramname +``` + +and then re-run `generate.jl`. + +
+ +### Step 4: Commit the changes to `Artifacts.toml` + +and push to [plotly/Dash.jl](https://github.com/plotly/Dash.jl) +(preferably on a new branch) to get a CI test run started. From 7d0389ec6864e7f83a5ce9ff0f8f0ef9ccd8b7ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Tue, 13 Jun 2023 17:00:34 -0400 Subject: [PATCH 07/18] [tmp] use `etpinard/DashCoreResources` temporary, until I have access to `plotly/DashCoreResources` --- gen_resources/Sources.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gen_resources/Sources.toml b/gen_resources/Sources.toml index e993607..89f544f 100644 --- a/gen_resources/Sources.toml +++ b/gen_resources/Sources.toml @@ -1,5 +1,5 @@ [deploy] - repo = "plotly/DashCoreResources" + repo = "etpinard/DashCoreResources" [dash] url = "https://github.com/plotly/dash.git" tag = "v2.10.2" From c550f24cbabd4393df0fea79b6aede7a3c8cff01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Tue, 13 Jun 2023 17:01:02 -0400 Subject: [PATCH 08/18] update Artifacts.toml with `v2.10.2` tarball --- Artifacts.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Artifacts.toml b/Artifacts.toml index 17ffe66..7593363 100644 --- a/Artifacts.toml +++ b/Artifacts.toml @@ -1,6 +1,6 @@ [dash_resources] -git-tree-sha1 = "c857e355d2c21dfc458fb315371431dda2506109" +git-tree-sha1 = "4b4e8cbd2109dbb0f653f4a74bcc533cd28a4e69" [[dash_resources.download]] - sha256 = "4ff3910a8ff1f5420784397cfc6ad80341bbe03f1010eab38dcb9b8ce2423310" - url = "https://github.com/plotly/DashCoreResources/releases/download/v2.0.0+0/DashCoreResources.v2.0.0.tar.gz" + sha256 = "e3dd93831951d2b1047ed02a049c960b5e38c406a4650689e48d4d95ca4a7203" + url = "https://github.com/etpinard/DashCoreResources/releases/download/v2.10.2+1/DashCoreResources.v2.10.2.tar.gz" From afacbc4a899b09f14ad0e8fec3e97b6c2bd67c2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Wed, 14 Jun 2023 11:44:32 -0400 Subject: [PATCH 09/18] add newline at EOF --- src/init/resources.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/init/resources.jl b/src/init/resources.jl index 3ca38e9..86b8bbd 100644 --- a/src/init/resources.jl +++ b/src/init/resources.jl @@ -79,4 +79,4 @@ function setup_dash_resources() ) ) end -end \ No newline at end of file +end From 56a0ae2e49ff6daf521ff4652210227e2fb58141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Wed, 14 Jun 2023 11:48:39 -0400 Subject: [PATCH 10/18] tweak `dash_renderer` entry in `main_registry` we need to override the `namespace` value with `"dash_renderer" to fetch from the correct URL we do something similar for the renderer deps just above. --- src/init/resources.jl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/init/resources.jl b/src/init/resources.jl index 86b8bbd..5a84ee3 100644 --- a/src/init/resources.jl +++ b/src/init/resources.jl @@ -45,11 +45,12 @@ function setup_renderer_resources() ) ) - DashBase.main_registry().dash_renderer = dash_module_resource_pkg( - renderer_meta["deps"][1], - resource_path = renderer_resource_path, - version = renderer_meta["version"] - ) + renderer_renderer_meta = renderer_meta["deps"][1] + DashBase.main_registry().dash_renderer = ResourcePkg( + "dash_renderer", + renderer_resource_path, version = renderer_meta["version"], + dash_module_resource.(renderer_renderer_meta["resources"]) + ) end function load_all_metadata() From 9ad366f3c17e5fa823062dc3c82c2d73f6899611 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Wed, 14 Jun 2023 11:51:49 -0400 Subject: [PATCH 11/18] clean up calls to `ResourcePkg` --- src/init/resources.jl | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/init/resources.jl b/src/init/resources.jl index 5a84ee3..028c532 100644 --- a/src/init/resources.jl +++ b/src/init/resources.jl @@ -23,32 +23,26 @@ dash_module_resource(meta) = Resource( async = haskey(meta, "async") ? string(meta["async"]) : nothing ) -dash_module_resource_pkg(meta; resource_path, version) = ResourcePkg( - meta["namespace"], - resource_path, version = version, - dash_module_resource.(meta["resources"]) -) - function setup_renderer_resources() renderer_meta = _metadata.dash_renderer renderer_resource_path = joinpath(artifact"dash_resources", "dash_renderer_deps") + renderer_version = renderer_meta["version"] DashBase.main_registry().dash_dependency = ( dev = ResourcePkg( "dash_renderer", - renderer_resource_path, version = renderer_meta["version"], + renderer_resource_path, version = renderer_version, dash_dependency_resource.(renderer_meta["js_dist_dependencies"]["dev"]) ), prod = ResourcePkg( "dash_renderer", - renderer_resource_path, version = renderer_meta["version"], + renderer_resource_path, version = renderer_version, dash_dependency_resource.(renderer_meta["js_dist_dependencies"]["prod"]) ) ) - renderer_renderer_meta = renderer_meta["deps"][1] DashBase.main_registry().dash_renderer = ResourcePkg( "dash_renderer", - renderer_resource_path, version = renderer_meta["version"], + renderer_resource_path, version = renderer_version, dash_module_resource.(renderer_renderer_meta["resources"]) ) end @@ -73,10 +67,11 @@ function setup_dash_resources() version = meta["version"] for dep in meta["deps"] DashBase.register_package( - dash_module_resource_pkg( - dep, - resource_path = path, - version = version + ResourcePkg( + dep["namespace"], + path, + version = version, + dash_module_resource.(dep["resources"]) ) ) end From f2b3c9d8c0c6e051d848412641ba4a6809237cb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Wed, 14 Jun 2023 12:01:25 -0400 Subject: [PATCH 12/18] fixup markdownlint --- .markdownlint.yml | 3 +++ gen_resources/README.md | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.markdownlint.yml b/.markdownlint.yml index 541ac8e..aa6206e 100644 --- a/.markdownlint.yml +++ b/.markdownlint.yml @@ -12,3 +12,6 @@ MD026: false # MD032 Lists should be surrounded by blank lines MD032: false + +# MD033 Inline HTML +MD033: false diff --git a/gen_resources/README.md b/gen_resources/README.md index 5167b55..5ab47a7 100644 --- a/gen_resources/README.md +++ b/gen_resources/README.md @@ -26,14 +26,14 @@ If using a fine-grained token, make sure to enable _Read and Write access to cod ### Step 2: expose your token into your shell -``` +```sh # for example: export GITHUB_TOKEN="" ``` ### Step 3: run `generate.jl` -``` +```sh cd Dash.jl/gen_resources # install `generate.jl` deps @@ -56,7 +56,7 @@ julia --project generate.jl --deploy that is an error like: -``` +```sh ERROR: LoadError: PyError (PyImport_ImportModule The Python package dash could not be imported by pyimport. Usually this means From a4b6b414c819f65248d14e5dc65ceef3ca3b0229 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Wed, 21 Jun 2023 15:15:49 -0400 Subject: [PATCH 13/18] add newline at EOF --- .gitignore | 2 +- test/integration/clientside/test_clientside.py | 2 +- test/integration/devtools/test_props_check.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 11cc5cd..6c1cf3c 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,4 @@ docs/build venv *.pyc tmp -gen_resources/build \ No newline at end of file +gen_resources/build diff --git a/test/integration/clientside/test_clientside.py b/test/integration/clientside/test_clientside.py index dab4b18..91a9992 100644 --- a/test/integration/clientside/test_clientside.py +++ b/test/integration/clientside/test_clientside.py @@ -151,4 +151,4 @@ def test_jlclsd008_clientside_inline_source(dashjl): dashjl.find_element("#input").send_keys("hello world") dashjl.wait_for_text_to_equal("#output-serverside", 'Server says "hello world"', timeout=10) - dashjl.wait_for_text_to_equal("#output-clientside", 'Client says "hello world"') \ No newline at end of file + dashjl.wait_for_text_to_equal("#output-clientside", 'Client says "hello world"') diff --git a/test/integration/devtools/test_props_check.py b/test/integration/devtools/test_props_check.py index 8610109..d6342d3 100644 --- a/test/integration/devtools/test_props_check.py +++ b/test/integration/devtools/test_props_check.py @@ -101,4 +101,4 @@ def test_jldvpc001_prop_check_errors_with_path(dashjl): dashjl.wait_for_element(".test-devtools-error-toggle", timeout=10).click() dashjl.wait_for_element(".dash-error-card") else: - dashjl.wait_for_element("#new-component", timeout=2) \ No newline at end of file + dashjl.wait_for_element("#new-component", timeout=2) From 6eb9c061eabe7ae7045931f18ffce3d80f2d05b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Wed, 21 Jun 2023 15:18:38 -0400 Subject: [PATCH 14/18] adapt clientside callback with Promise test clientside callbacks with Promises are now supported by dash since v2.4.0 --- test/integration/clientside/test_clientside.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/integration/clientside/test_clientside.py b/test/integration/clientside/test_clientside.py index 91a9992..2dd62de 100644 --- a/test/integration/clientside/test_clientside.py +++ b/test/integration/clientside/test_clientside.py @@ -95,13 +95,13 @@ def test_jlclsd004_clientside_multiple_outputs(dashjl): ]: dashjl.wait_for_text_to_equal(selector, expected, timeout=10) -def test_jlclsd005_clientside_fails_when_returning_a_promise(dashjl): +def test_jlclsd005_clientside_when_returning_a_promise(dashjl): fp = jl_test_file_path("jlclsd005_clientside_fails_when_returning_a_promise.jl") dashjl.start_server(fp) dashjl.wait_for_text_to_equal("#input", "hello", timeout=10) dashjl.wait_for_text_to_equal("#side-effect", "side effect") - dashjl.wait_for_text_to_equal("#output", "output") + dashjl.wait_for_text_to_equal("#output", "foo") def test_jlclsd006_PreventUpdate(dashjl): fp = jl_test_file_path("jlclsd006_PreventUpdate.jl") From 95d05619387a80c6fdcfb19ae881cd2c8804176f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Wed, 21 Jun 2023 15:35:55 -0400 Subject: [PATCH 15/18] adapt devtools `test_prop_check` suite `invalid-nested-prop` became `allow-nested-prop` in dash 2.1.0 moreover, use same css query as in the python version of the `test_props_check.py` suite --- .../jldvpc001_prop_check_errors_with_path.jl | 12 ++++++------ test/integration/devtools/test_props_check.py | 11 ++++++----- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/test/integration/devtools/jl_props_check/jldvpc001_prop_check_errors_with_path.jl b/test/integration/devtools/jl_props_check/jldvpc001_prop_check_errors_with_path.jl index 8b98907..2643779 100644 --- a/test/integration/devtools/jl_props_check/jldvpc001_prop_check_errors_with_path.jl +++ b/test/integration/devtools/jl_props_check/jldvpc001_prop_check_errors_with_path.jl @@ -13,12 +13,6 @@ test_cases = Dict( "component"=> dcc_checklist, "props"=> (options = [Dict("label" => "hello")], value = ["test"]), ), - "invalid-nested-prop"=> Dict( - "fail"=> true, - "name"=> "invalid nested prop", - "component"=> dcc_checklist, - "props"=> (options = [Dict("label"=> "hello", "value"=> true)], value = ["test"]), - ), "invalid-arrayOf"=> Dict( "fail"=> true, "name"=> "invalid arrayOf", @@ -73,6 +67,12 @@ test_cases = Dict( "component"=> html_div, "props"=> (children = Dict("hello" => "world"),), ), + "allow-nested-prop"=> Dict( + "fail"=> false, + "name"=> "allow nested prop", + "component"=> dcc_checklist, + "props"=> (options = [Dict("label"=> "hello", "value"=> true)], value = ["test"]), + ), "allow-null-2"=> Dict( "fail"=> false, "name"=> "allow null as value", diff --git a/test/integration/devtools/test_props_check.py b/test/integration/devtools/test_props_check.py index d6342d3..2099a70 100644 --- a/test/integration/devtools/test_props_check.py +++ b/test/integration/devtools/test_props_check.py @@ -16,10 +16,6 @@ def jl_test_file_path(filename): "fail": True, "name": 'missing required "value" inside options', }, - "invalid-nested-prop": { - "fail": True, - "name": "invalid nested prop", - }, "invalid-arrayOf": { "fail": True, "name": "invalid arrayOf", @@ -56,6 +52,10 @@ def jl_test_file_path(filename): "fail": True, "name": "returning a dictionary", }, + "allow-nested-prop": { + "fail": False, + "name": "allow nested prop", + }, "allow-null-2": { "fail": False, "name": "allow null as value", @@ -99,6 +99,7 @@ def test_jldvpc001_prop_check_errors_with_path(dashjl): if test_cases[tc]["fail"]: dashjl.wait_for_element(".test-devtools-error-toggle", timeout=10).click() - dashjl.wait_for_element(".dash-error-card") + dashjl.wait_for_element(".dash-fe-error__info") else: dashjl.wait_for_element("#new-component", timeout=2) + dashjl.wait_for_no_elements(".test-devtools-error-toggle") From 50fe3d4bee80730204e9c39abc9bda895ff7b333 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Wed, 21 Jun 2023 15:36:39 -0400 Subject: [PATCH 16/18] add instructions on how to run the integration tests in the same docker container as on CI --- test/integration/README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 test/integration/README.md diff --git a/test/integration/README.md b/test/integration/README.md new file mode 100644 index 0000000..98e7222 --- /dev/null +++ b/test/integration/README.md @@ -0,0 +1,31 @@ +# Dash.jl integration tests + +## How to tun integration tests locally inside test container + +``` +git clone --depth 1 https://github.com/plotly/dash.git -b dev dash-main + +docker run -t -d --name dashjl-tests -v .:/home/circleci/project etpinard/dashjl-tests +docker exec -u 0 -it dashjl-tests bash + +# [on 1st run] install pip deps +cd /home/circleci/project/dash-main +pip install --upgrade pip wheel +pip install -e .[ci,dev,testing] --progress-bar off + +# [on 1st run] install chrome +cd /home/circleci +wget https://raw.githubusercontent.com/CircleCI-Public/browser-tools-orb/main/src/scripts/install-chrome.sh +chmod +x install-chrome.sh +ORB_PARAM_CHANNEL="stable" ORB_PARAM_CHROME_VERSION="latest" ./install-chrome.sh + +# [on 1st run] install chromedriver +wget https://raw.githubusercontent.com/CircleCI-Public/browser-tools-orb/main/src/scripts/install-chromedriver.sh +chmod +x ./install-chromedriver.sh +ORB_PARAM_DRIVER_INSTALL_DIR=/usr/local/bin/ ./install-chromedriver.sh + +# run integration tests +cd /home/circleci/project/ +julia --project -e 'import Pkg; Pkg.instantiate()' +pytest --headless --nopercyfinalize --percy-assets=test/assets/ test/integration/ +``` From 6de0bd54c275ac1bb2c162c15efc0b7372daa2b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Wed, 21 Jun 2023 15:38:55 -0400 Subject: [PATCH 17/18] add `dash-main` to gitignore the `dash-main` folder the repo root is used during the integration tests to install the python testing deps --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 6c1cf3c..faf99d4 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ venv *.pyc tmp gen_resources/build +dash-main From dc326108c50ce0efdc06f00862938abfe509b344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Wed, 21 Jun 2023 15:51:53 -0400 Subject: [PATCH 18/18] lint and improve integration test README --- test/integration/README.md | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/test/integration/README.md b/test/integration/README.md index 98e7222..e7f01e1 100644 --- a/test/integration/README.md +++ b/test/integration/README.md @@ -1,31 +1,38 @@ # Dash.jl integration tests -## How to tun integration tests locally inside test container +## How to run the integration tests locally inside the `dashjl-tests` container -``` +```sh +# grab a copy of the python (main) dash repo git clone --depth 1 https://github.com/plotly/dash.git -b dev dash-main -docker run -t -d --name dashjl-tests -v .:/home/circleci/project etpinard/dashjl-tests +# start `dashjl-tests` +docker run -t -d --name dashjl-tests -v .:/home/circleci/project etpinard/dashjl-tests:0.3.0 +# ssh into it as root (some python deps need that) docker exec -u 0 -it dashjl-tests bash -# [on 1st run] install pip deps +# [on 1st session] install pip deps cd /home/circleci/project/dash-main pip install --upgrade pip wheel pip install -e .[ci,dev,testing] --progress-bar off -# [on 1st run] install chrome +# [on 1st session] install chrome cd /home/circleci wget https://raw.githubusercontent.com/CircleCI-Public/browser-tools-orb/main/src/scripts/install-chrome.sh chmod +x install-chrome.sh ORB_PARAM_CHANNEL="stable" ORB_PARAM_CHROME_VERSION="latest" ./install-chrome.sh -# [on 1st run] install chromedriver +# [on 1st session] install chromedriver wget https://raw.githubusercontent.com/CircleCI-Public/browser-tools-orb/main/src/scripts/install-chromedriver.sh chmod +x ./install-chromedriver.sh ORB_PARAM_DRIVER_INSTALL_DIR=/usr/local/bin/ ./install-chromedriver.sh -# run integration tests +# [on 1st session] instantiate julia deps cd /home/circleci/project/ julia --project -e 'import Pkg; Pkg.instantiate()' + +# update julia deps then run integration tests +cd /home/circleci/project/ +julia --project -e 'import Pkg; Pkg.update()' pytest --headless --nopercyfinalize --percy-assets=test/assets/ test/integration/ ```