-
Notifications
You must be signed in to change notification settings - Fork 2
Enhance test input documentation with conditional visibility feature. #101
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
Open
projkov
wants to merge
2
commits into
inferno-framework:main
Choose a base branch
from
projkov:enable-when-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| ruby 3.3.6 | ||
| ruby 3.3.6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -23,15 +23,16 @@ The `input` method defines an input. `input` can take several arguments, but | |||||
| only the identifier is required: | ||||||
| - `identifier` - (**required**) a name for this input. The input value is | ||||||
| available in the run block using this name. | ||||||
| - `title:` - a title which is displayed in the UI. | ||||||
| - `title:` - a title which is displayed in the UI. | ||||||
| - `description:` - a description which is displayed in the UI. | ||||||
| - `type:` - controls the type of HTML input element used in the UI. Currently | ||||||
| there are 5 possible values: | ||||||
| there are 6 possible values: | ||||||
| - `'text'` - (**default**) a regular input field. | ||||||
| - `'textarea'` - for a text area input field. | ||||||
| - `'radio'` - for a radio button singular selection field. | ||||||
| - `'checkbox` - for a checkbox field. In tests, a checkbox input is | ||||||
| - `'checkbox'` - for a checkbox field. In tests, a checkbox input is | ||||||
| represented as an array of the selected values. | ||||||
| - `'select'` - for a select input field. | ||||||
| - `'oauth_credentials'` - a complex type for storing OAuth2 credentials. When | ||||||
| used by a FHIR client, the access token will automatically refresh if | ||||||
| possible. | ||||||
|
|
@@ -47,6 +48,7 @@ only the identifier is required: | |||||
| Locking an input can force it to use a value from a previous test's output, or | ||||||
| the default value. | ||||||
| - `hidden:` - (**default: false**) hide the input from the UI. Must be used with either `optional: true` or `locked: true`. | ||||||
| - `enable_when` - (**optional**) adds conditional visibility for inputs. It's a hash with `input_name` and `value`. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| Here is a simple example: | ||||||
| ```ruby | ||||||
|
|
@@ -221,6 +223,37 @@ group do | |||||
| end | ||||||
| ``` | ||||||
|
|
||||||
| ### Conditional visibility for inputs | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| Inputs can be shown or hidden based on the value of another input using an `enable_when` condition. We recommend implementing conditional visibility based on **Radio** or **Select** inputs. | ||||||
|
projkov marked this conversation as resolved.
Outdated
|
||||||
|
|
||||||
| ```ruby | ||||||
| group do | ||||||
| id 'conditional_group' | ||||||
| title 'Conditional Inputs Group' | ||||||
| optional | ||||||
|
|
||||||
| test 'Conditional, optional, empty input test' do | ||||||
| input :get_type, title: 'How to get Bundle', type: 'radio', options: { | ||||||
| list_options: [ | ||||||
| { value: 'copy_paste', label: 'Paste JSON' }, | ||||||
| { value: 'url', label: 'URL to FHIR Bundle' }, | ||||||
| { value: 'summary_op', label: '$summary Operation' } | ||||||
| ] | ||||||
| }, default: 'copy_paste' | ||||||
| input :bundle_copy_paste, title: 'Paste JSON', type: 'textarea', optional: true, | ||||||
| enable_when: { input_name: 'get_type', value: 'copy_paste' } | ||||||
| input :bundle_url, title: 'URL to FHIR Bundle', type: 'text', optional: true, | ||||||
| enable_when: { input_name: 'get_type', value: 'url' } | ||||||
| input :fhir_server_url, title: 'FHIR Server URL', type: 'text', optional: true, | ||||||
| enable_when: { input_name: 'get_type', value: 'summary_op' } | ||||||
| input :patient_id, title: 'Patient ID', type: 'text', optional: true, | ||||||
| enable_when: { input_name: 'get_type', value: 'summary_op' } | ||||||
|
|
||||||
| run { pass } | ||||||
| end | ||||||
| end | ||||||
| ``` | ||||||
|
|
||||||
| ## Outputs | ||||||
|
|
||||||
| ### Defining Outputs | ||||||
|
|
@@ -311,7 +344,7 @@ input :backend_services_auth_info, | |||||
| } | ||||||
| ] | ||||||
| } | ||||||
|
|
||||||
| # Limit the auth types to those in SMART App Launch v1 | ||||||
| input :smart_v1_auth_info, | ||||||
| options: { | ||||||
|
|
@@ -325,7 +358,7 @@ input :smart_v1_auth_info, | |||||
| } | ||||||
| ] | ||||||
| } | ||||||
|
|
||||||
| input :smart_auth_info, | ||||||
| options: { | ||||||
| components: [ | ||||||
|
|
@@ -366,7 +399,7 @@ input :auth_info1, | |||||
| options: { | ||||||
| mode: 'auth' | ||||||
| } | ||||||
|
|
||||||
| # Use this to make authorized requests | ||||||
| input :auth_info2, | ||||||
| options: { | ||||||
|
|
@@ -380,9 +413,9 @@ input :auth_info2, | |||||
| Inputs and outputs work as a single key-value store scoped to a test session. | ||||||
| The main differences between them are: | ||||||
| - An input's value can not be changed | ||||||
| during a test | ||||||
| during a test | ||||||
| - Inputs support additional metadata for display in the UI | ||||||
| (title, description, etc.) | ||||||
| (title, description, etc.) | ||||||
|
|
||||||
| Since inputs and outputs form a single key-value | ||||||
| store, a value will be overwritten if multiple tests write to the same output. | ||||||
|
|
||||||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 like the count was off before