Repository navigation
test(webview): wait for the new default where it is read - #151
Merged
Merged
Conversation
The switcher test waited for the association to reach the user's settings file before closing and reopening the file. *Set Default* writes that file first and applies it afterwards, so the wait returns at the earliest possible moment: in both recorded failures the backend's own file-type change landed 402ms and 672ms after the test had already reopened the file, and the client, which decides from its own copy of the setup, was still holding the old association. Wait for the client to be holding the new one instead, which is what the reopen depends on. 306e178 gave it that as soon as the backend takes the change, so this is the first moment the reopen can be relied on. The accessor is test-only: the client's associations are not worth exposing otherwise. Refs #141
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.
What this changes
Closes #141, which #142 narrowed but did not close — see the
reopening comment
for the full timelines.
SplitModeCustomEditorTest > the editor switcher … sets the defaultwaits for the association toreach the user's settings file, then closes and reopens the file:
CustomEditorDefaults.setDefaultwrites that file first and callsapply()afterwards, so thewait returns at the earliest moment in the whole operation — before anything has been applied
anywhere. In both recorded failures the backend's own
File types changedarrived after thereopen (402 ms after in
42692783765, 672 ms after
in 42520388173), so
setDefaultEditorhad not returned either time and the client was still holding the oldassociation when it decided which editor to show.
The test now waits for the client to hold the new association, which is what the reopen actually
depends on:
CodeBridgeCustomEditors.defaultTypeOfreadssetup.associations, and that is whatdecides whether a newly opened file is swapped into the custom editor. 306e178 made the client
take the association as soon as the backend has, so this is the first moment at which the reopen
can be relied on at all.
defaultForTestis a test-only accessor, in keeping with the…ForTestmembers elsewhere in theruntime; the client's associations are not worth exposing more widely. The UI test reaches it the
way the other tests reach internal services, with a
@Remoteon the module that owns it.Nothing about the product's behaviour changes.
Why not wait on the file type instead
CustomEditorFileTypeOverrideronly overrides a file whose own typeis INativeFileType.example.probetextis a text file, so it never gets aCodeBridge.CustomEditor.*type — thecustom editor is put in front of it by the client, not by the backend's typing. Reading the file
type would therefore have observed nothing for this scenario.
How it was tested
:webview.frontend:compileKotlinand:ui-test:compileTestKotlinpass.(
exit value 127under NixOS), and the failure has only been seen on Windows CI. It hasreproduced twice there, most recently on
ci-flake/escape-04.Checklist
A new feature has a UI test.A fix to an existing UI test, plus the accessor it reads.No behaviour change.docs/is updated where behaviour changed,docs/status.mdespecially.Third-party material keeps its notice and is listed inNone added.NOTICE.md.