Repository navigation
test: share version-read, stop and audit-denial helpers and name pasted console sentences - #3743
Merged
Merged
Conversation
…; name pasted console sentences Move denyRevisionRead (two local copies, three inline restriction pushes), the Stop Agent button locator and the authorization-denial audit filter into console-agents-browser-helpers. Six console sentences pasted in tests now come from refusal-text.mjs; the workspace refusal and plugin rejection checks match the whole sentence instead of a fragment.
A mutant that appended text to the heading survived: getByRole name matching is a substring match unless exact. The absence checks keep the substring match.
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
This was referenced Oct 26, 2026
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.
Problem
#3731, #3733, #3737, #3740 and #3741 added console browser tests in parallel. Some of them repeat helpers that other files already define, or paste product sentences instead of reading them from
tests/helpers/refusal-text.mjs:denyRevisionReadwas defined twice, inconsole-agent-stateandconsole-agent-overview. The same AgentRevision read restriction was also written out inline three more times, inconsole-agent-deploy-againand twice inconsole-next-steps.console-next-stepsand written out inline inconsole-agent-state.console-agent-deploy-again(twice),console-namespace-createand the new D45 test inconsole-agent-state./^Not authorized: this needs Agent read on Agent /;/credential was rejected or cannot access plugins/.Change
Test-only. 11 files, +96/−129. No product file changes.
console-agents-browser-helpers.mjsgets three shared helpers:denyRevisionReadreplaces 2 local copies and 3 inline restriction pushes.stopAgentButtonreplaces 1 local copy and 1 inline locator.authorizationDenials(auditSink, action)takes an exact action or a RegExp and replaces 4 inline filters.refusal-text.mjsgets six constants, added at the end of the file:VERSION_READ_DENIED_HEADINGREAD_ONLY_DRAFT_NOTICEandPLUGINS_READ_ONLY, moved from local constants inconsole-agent-detailNO_TEST_REQUESTGRANT_EXCEEDS_CEILINGPLUGIN_CREDENTIALS_REJECTEDexact: true. The checks that the heading is absent still use substring matching, so they stay broad.callerDenied("Agent read", "Agent <id>")sentence.console-next-steps, the read-only draft notice check now matches the whole sentence instead of a prefix regex.Left as they are:
redeployUnreadablecases. One has paged versions and the other does not, which are different setups.console.test.mjs. The setups are different: a reader with Agent read on the Access tab with an audit sink, against a Namespace-read-only account that carries an administrator's stale cached answer.I found no fixed waits in the new tests. The slowest new case takes 2.2 s, and none of them builds a fixture it could share.
Verification
All runs were on a remote test VM.
console-agent-deploy-again,-detail,-detail-2,-overview,console-namespace-create. 20/20 passed.console-agent-draft-guards,-presets,-state,console-next-steps. 20/20 passed.exact, and now fail.console-next-stepsfails.denyRevisionReaddoes nothing: the state, overview, deploy-again and next-steps tests fail.authorizationDenialsmatches no event kind: the deploy-again and namespace-create tests fail.tsc --build tsconfig.json tests/tsconfig.jsonpasses, as do the suite audit and eslint and prettier on the touched files.Risks
Low. The change is test-only.
console-next-steps.test.mjsandconsole-agent-detail-2.test.mjs, and appends torefusal-text.mjs. Whichever PR lands second gets a small conflict in the import lines and at the end of that file.