Repository navigation
TEST: Wait for rendered estimates in scenario launch tests - #4646
Open
Richard Lundeen (richlundeen) wants to merge 1 commit into
Open
Richard Lundeen (richlundeen) wants to merge 1 commit into
Richard Lundeen (richlundeen) wants to merge 1 commit into
Conversation
The catalog-to-run flow test and the Jailbreak defaults test waited only until the mocked estimate request was sent, then read values that render after it resolves. On a loaded runner the render lags and the assertions see "Calculating..." or "Not set". Wait for the rendered values instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the test changes that wait for rendered run estimates.
No open issues 🎉
What changed in this PR
Reduces timing-related CI failures in frontend scenario launch tests by waiting for run estimates to render, rather than only for requests to be sent. Production behavior is unchanged.
Changes:
- Wraps the total attack count and effective
num_jailbreaksassertions inwaitFor. - Preserves existing expected values and request assertions.
| File | Description |
|---|---|
| frontend/src/components/Scenarios/ScenarioFlow.test.tsx | Waits for “Total atomic attacks” to display 2. |
| frontend/src/components/Scenarios/ScenarioDetail.test.tsx | Waits for the effective num_jailbreaks value to display 2. |
Review effort: Balanced
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Two scenario launch tests could fail on a busy CI runner because they checked the run estimate before it had rendered. The frontend unit test job for #4226 failed this way: the catalog-to-run test expected the total attack count
2but gotCalculating....useScenarioRunEstimatesends the estimate request after a debounce and updates the UI only when the request resolves. Both tests waited until the mocked request had been sent, then checked the rendered value right away. If rendering was slow, the check saw the loading text.ScenarioFlow.test.tsx: wait for the "Total atomic attacks" value to become2.ScenarioDetail.test.tsx("uses effective Jailbreak defaults and sends only prompt_sending"): wait fornum_jailbreaksto show the backend's effective value2. Before the response arrives it showsNot set.estimateRuncheck request arguments, control resolution withact(), or already wait for rendered output.A delayed estimate mock (50, 200, and 500 ms) reproduces the CI failure in the original tests every time: they receive
Calculating...andnum_jailbreaksNot set. The updated tests pass under the same delays.The Microsoft package mirror does not yet have some locked releases (
pyyaml==6.0.4,av==18.1.1,types-pyyaml==6.0.12.20261122), so pre-commit could not run locally. This PR's CI is the check for those hooks. The change touches only two frontend test files, which pass ESLint andtsc --noEmit.