Skip to content

Fix React UI test assertion error#15

Merged
rnarciso merged 2 commits intomainfrom
fix-react-ui-test-assertion-error
Aug 18, 2025
Merged

Fix React UI test assertion error#15
rnarciso merged 2 commits intomainfrom
fix-react-ui-test-assertion-error

Conversation

@google-labs-jules
Copy link
Copy Markdown

This change fixes a React UI test assertion error.

The tests were failing with the error "AssertionError: expected false to be true". This was caused by a bug in the isLmConfigured function in archon-ui-main/src/utils/onboarding.ts.

The hasValidCredential helper function was not correctly handling encrypted credentials. It was checking for the presence of cred.encrypted_value, but it should have been checking if cred.is_encrypted is true.

This change updates the hasValidCredential function to correctly handle encrypted credentials.

The React UI tests were failing with the error "AssertionError: expected false to be true". This was caused by a bug in the `isLmConfigured` function in `archon-ui-main/src/utils/onboarding.ts`.

The `hasValidCredential` helper function was not correctly handling encrypted credentials. It was checking for the presence of `cred.encrypted_value`, but it should have been checking if `cred.is_encrypted` is `true`.

This change updates the `hasValidCredential` function to correctly handle encrypted credentials.
A test in `test/errors.test.tsx` was failing with the error `TestingLibraryElementError: Unable to find an accessible element with the role "alert"`.

This was caused by a flawed test that was not correctly handling asynchronous operations. The test was using `setTimeout` to simulate a delay, but it was not waiting for the delayed code to execute before trying to find the "alert" element.

This change fixes the test by using `vitest`'s fake timers (`vi.useFakeTimers()` and `vi.advanceTimersByTimeAsync()`) and `async/await` with `screen.findByRole('alert')`. This makes the test more robust and reliable.
@rnarciso rnarciso marked this pull request as ready for review August 18, 2025 17:52
@rnarciso rnarciso merged commit 78d7084 into main Aug 18, 2025
@rnarciso rnarciso deleted the fix-react-ui-test-assertion-error branch August 18, 2025 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant