Commit graph

36 commits

Author SHA1 Message Date
Pavel Dostál
9c4184de6f Address review feedback on echo mode polling
- Rename echo_test_{linux,darwin}.go to echo_{linux,darwin}_test.go so
  they are only compiled during tests
- Narrow build tag from !windows to linux || darwin to avoid compile
  failures on other Unix platforms
- Return error from waitForEchoDisabled instead of calling t.Fatal,
  since the function is called from goroutines where FailNow would only
  terminate the calling goroutine
2026-05-07 20:20:39 +02:00
Pavel Dostál
c48bc1a7d1 Poll TTY echo mode instead of sleeping in password tests
Replace the fixed-duration sleep with a polling loop that checks the
actual TTY echo flag before sending password input. This eliminates the
race condition where huh has not yet disabled echo mode, which caused
flaky test failures in slow environments.

Follow-up to #13304.
2026-05-07 20:20:39 +02:00
Pavel Dostál
6d6ea5f371 Fix flaky Password test by increasing echo mode setup timeout
The beforePasswordSendTimeout was set to 100 microseconds, which is
insufficient for huh to disable echo mode on the PTY in slow or
constrained environments (e.g. network-isolated build containers).
Increase to 100 milliseconds to avoid the race condition.
2026-04-28 18:25:51 +02:00
Kynan Ware
95a59f4431 fix(accessible prompter): update test expectations for huh v2
Fix accessible prompter tests that broke with the huh v2 upgrade:
- Replace 'Input a number' with 'Enter a number' (huh v2 changed text)
- Remove trailing CRLF from ExpectString calls that now fail due to
  ANSI color codes wrapping the title text
- Allow ANSI escape codes in password masking regex assertions

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-26 14:26:16 +01:00
Kynan Ware
af124cd5d2 Add test for MultiSelectWithSearch error propagation
Introduces a test case to verify that errors returned from the MultiSelectWithSearch search function are properly propagated to the caller.
2026-01-26 13:56:47 -07:00
Kynan Ware
07dfdf97ae Update edit tests
Updated test mocks and logic to consistently use lowercase 'monalisa' for login names and display names for user assignees. Improved handling of dynamic assignee fetching in interactive flows by relying on searchFunc and metadata population, and clarified logic in FetchOptions to fetch assignees only when necessary. These changes ensure more accurate simulation of interactive assignment and better test coverage for actor assignee features.
2026-01-26 13:29:22 -07:00
Kynan Ware
d46f42a752 Refactor MultiSelectWithSearch to use result struct
Refactored the MultiSelectWithSearch function and related interfaces to use a MultiSelectSearchResult struct instead of multiple return values. This change improves clarity and extensibility of the search function signature, and updates all usages, mocks, and tests accordingly.
2026-01-26 13:29:22 -07:00
Kynan Ware
38578f7991 Add comment describing logger
Added a comment explaining how to enable logging in expect-based tests by using expect.WithLogger. This helps developers debug by printing characters read to stdout.
2026-01-26 13:29:22 -07:00
Kynan Ware
0beb74bf72 MultiSelectWithSearch initial implementation
Initial implementation of MultiSelectWithSearch:

- Implement by survey and accessible prompters. They use the same internal func under the hood.
- Implement in `gh preview prompter` for initial testing and demonstration
- Implement interface changes across the codebase and mocks to satisfy compiler.
- Implement tests for new MultiSelectWithSearch prompter
2026-01-26 13:29:22 -07:00
William Martin
d88b4cb8ec Fix accessible prompter tests with huh 0.8.0 upgrade 2025-12-02 14:36:43 +01:00
Babak K. Shandiz
5db8cf7c1d
Increase beforePasswordSendTimeout to 100 us (#10977)
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-05-13 12:38:45 +01:00
Andy Feller
7ceca4534d
Merge pull request #10937 from cli/kw/accessible-prompter-prints-readable-defaults-in-prompt
Accessible prompter always displays defaults in speech synthesis readable format
2025-05-09 08:48:10 -04:00
Babak K. Shandiz
90532e8377
Improve assertion for disabled echo mode (#10927)
* Improve assertion for disabled echo

Signed-off-by: Babak K. Shandiz <babakks@github.com>

* Use `expect.RegExpPattern`

Signed-off-by: Babak K. Shandiz <babakks@github.com>

---------

Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-05-08 21:26:02 +01:00
Kynan Ware
9b89a0ac0e fix(a11y prompter): remove invalid defaults 2025-05-08 07:41:36 -06:00
Kynan Ware
3594f6357b fix(a11y prompter): confirm prompt default is readable 2025-05-06 15:50:57 -06:00
Kynan Ware
04aaaea142 fix(a11y prompter): multi select defaults are readable 2025-05-06 15:43:26 -06:00
Kynan Ware
cab906151f fix(a11y prompter): select prompt default value is readable 2025-05-06 15:33:15 -06:00
Kynan Ware
ab4cfb84d2 refactor(a11yprompter): shared method for prompt defaults 2025-05-06 15:33:15 -06:00
Kynan Ware
2ee68411a7 fix(a11y prompter): Select prompt respects defaults 2025-05-06 15:33:15 -06:00
Kynan Ware
9bc2c388da fix(a11y prompter): input prompt default value is readable 2025-05-06 14:34:05 -06:00
Kynan Ware
cc673cfaba test(prompter): add timeout before password input 2025-05-02 14:48:07 -06:00
Andy Feller
8130126ce5
Merge pull request #10901 from cli/kw/fix-accessible-multi-select-prompter-respects-defaults
Fix: Accessible multiselect prompt respects default selections
2025-04-30 09:46:56 -04:00
Kynan Ware
d8512a9066 fix(prompter): respect default MultiSelect a11y prompter 2025-04-29 16:35:04 -06:00
Andy Feller
88d52ebf97 Fix other disabled echo mode comments 2025-04-28 11:20:17 -04:00
Andy Feller
2d66877d6c
Update internal/prompter/accessible_prompter_test.go 2025-04-28 11:15:28 -04:00
Andy Feller
9fa00c350b Update accessible tests based on huh@0.7.0 changes 2025-04-28 10:17:23 -04:00
Andy Feller
a53b6c074c Assert password and auth token not displayed
This commit expands existing tests (thanks to @babakks) to assert whether the echo mode is actually disabled for password and auth token prompts.
2025-04-28 08:55:47 -04:00
Kynan Ware
9463b0ee61 test(prompter): correct typo in accessible prompter name 2025-04-22 17:12:07 -06:00
Kynan Ware
138bccd437 feat(config): add accessible prompter and spinner 2025-04-22 16:50:58 -06:00
Kynan Ware
8cd39923fe test(prompter): fix race condition
This test was trying to block on `expect`’ing a string at the same
time the prompt was completed.

This doesn't need to happen for this test. It should just check for
the output from the Input prompt invocation.
2025-04-10 17:09:22 -06:00
Kynan Ware
9eee77a2bf test(prompter): doc how accessible prompter tests work 2025-04-10 10:55:24 -06:00
Kynan Ware
8b70870f4f test(prompter): describe why echo is editorcmd 2025-04-10 10:39:59 -06:00
Kynan Ware
47d603221d test(prompter): use *testing.T instead 2025-04-10 10:37:36 -06:00
Kynan Ware
fab0de5583 fix(prompter): pass io to huh and refactor tests 2025-04-09 15:51:02 -06:00
Kynan Ware
2f5e896535 fix(prompter): update huh and fix tests 2025-04-09 15:18:53 -06:00
Kynan Ware
8fc8486af5 refactor(prompter): rename speechSynthesizerFriendlyPrompter to accessiblePrompter 2025-04-09 08:24:54 -06:00
Renamed from internal/prompter/speech_synthesizer_friendly_prompter_test.go (Browse further)