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
Implement JS Client tests #8109
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-builds.s3.amazonaws.com/f9395788452e6354aeed0ad4b06368989e705dde/gradio-4.28.3-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@f9395788452e6354aeed0ad4b06368989e705dde#subdirectory=client/python" |
🦄 change detectedThis Pull Request includes changes to the following packages.
With the following changelog entry.
Maintainers or the PR author can modify the PR title to modify this entry.
|
…into js-client-tests
…into js-client-tests
…into js-client-tests
…into js-client-tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me! Just left a small question.
Thanks so much for taking care of this @hannahblair! Writing this many tests at once is not much fun!
We can add some e2e tests in a follow up and maybe think about a node/ happy-dom matrix.
* add msw setup and initialisation tests * add changeset * add walk_and_store_blobs improvements and add tests * add changeset * api_info tests * add direct space URL link tests * fix tests * add view_api tests * add post_message test * tweak * add spaces tests * jwt and protocol tests * add post_data tests * test tweaks --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Description
Adds tests for
@gradio/client
client
duplicate
init_helpers.ts
(resolve_root
,get_jwt
,map_names_to_ids
,determine_protocol
)data.ts
(walk_and_store_blobs
,update_object
,skip_queue
,post_message
)api_info.ts
(handle_message
,get_description
,get_type
,process_endpoint
)view_api.ts
spaces.ts
(set_space_timeout
,get_space_hardware
,check_space_status
,discussions_enabled
)upload_files.ts
post_data.ts
Tests new and deprecated syntax:
await Client.connect()
await client()
Client.duplicate()
duplicate
To test separately:
stream.ts
submit.ts
predict.ts
I'd like to write tests in a separate PR for these because 1) there are lots of tests to write for
submit()
2) testing SSE events is a little complicated (but doable) 3) I'd also like to see if we can test with a local spun up demo as we do in the Python client in that PRImplicitly tested and could do with unit tests:
resolve_config
handle_blob.ts
Closes: #4658
🎯 PRs Should Target Issues
Before your create a PR, please check to see if there is an existing issue for this change. If not, please create an issue before you create this PR, unless the fix is very small.
Not adhering to this guideline will result in the PR being closed.
Tests
PRs will only be merged if tests pass on CI. To run the tests locally, please set up your Gradio environment locally and run the tests:
bash scripts/run_all_tests.sh
You may need to run the linters:
bash scripts/format_backend.sh
andbash scripts/format_frontend.sh