Add cross-mode UI parity tests

This commit is contained in:
Joe Julian
2026-04-06 21:00:29 -07:00
parent 3afe9871e7
commit e4e64504b8
+87
View File
@@ -5828,6 +5828,57 @@ func TestUIShouldShowDirectRemoteSyncShortcutForSavedBinding(t *testing.T) {
}
}
func TestUIRemoteSyncShortcutsHaveParityAcrossModes(t *testing.T) {
t.Parallel()
for _, mode := range []string{"desktop", "phone"} {
mode := mode
t.Run(mode, func(t *testing.T) {
t.Parallel()
u := newUIWithModel(mode, vault.Model{
Entries: []vault.Entry{{
ID: "remote-creds-1",
Title: "WebDAV Sign-In",
Username: "tjulian",
Path: []string{"Crew", "Internet"},
}},
RemoteProfiles: []vault.RemoteProfile{{
ID: "family-webdav",
Name: "Family Vault",
Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx",
}},
})
u.state.Section = appstate.SectionEntries
if !u.shouldShowDirectRemoteSyncShortcut() {
t.Fatal("shouldShowDirectRemoteSyncShortcut() = false, want true")
}
if !u.shouldShowRemoteSyncSettingsShortcut() {
t.Fatal("shouldShowRemoteSyncSettingsShortcut() = false, want true")
}
if !u.shouldShowRemoveRemoteSyncShortcut() {
t.Fatal("shouldShowRemoveRemoteSyncShortcut() = false, want true")
}
if u.shouldShowRemoteSyncSetupShortcut() {
t.Fatal("shouldShowRemoteSyncSetupShortcut() = true, want false when a binding exists")
}
if got := u.directRemoteSyncShortcutLabel(); got != "Use Remote Sync" {
t.Fatalf("directRemoteSyncShortcutLabel() = %q, want Use Remote Sync", got)
}
if got := u.remoteSyncSettingsShortcutLabel(); got != "Remote Sync Settings" {
t.Fatalf("remoteSyncSettingsShortcutLabel() = %q, want Remote Sync Settings", got)
}
if got := u.removeRemoteSyncShortcutLabel(); got != "Stop Using Remote Sync" {
t.Fatalf("removeRemoteSyncShortcutLabel() = %q, want Stop Using Remote Sync", got)
}
})
}
}
func TestUIShouldHideDirectRemoteSyncShortcutWithoutSavedBinding(t *testing.T) {
t.Parallel()
@@ -5866,6 +5917,42 @@ func TestUIShouldShowRemoteSyncSetupShortcutForOpenedLocalVaultWithoutSavedBindi
}
}
func TestUIRemoteSetupShortcutHasParityAcrossModes(t *testing.T) {
t.Parallel()
for _, mode := range []string{"desktop", "phone"} {
mode := mode
t.Run(mode, func(t *testing.T) {
t.Parallel()
u := newUIWithModel(mode, vault.Model{
Entries: []vault.Entry{{
ID: "entry-1",
Title: "Vault Console",
Path: []string{"Crew", "Internet"},
}},
})
u.state.Section = appstate.SectionEntries
if !u.shouldShowRemoteSyncSetupShortcut() {
t.Fatal("shouldShowRemoteSyncSetupShortcut() = false, want true")
}
if u.shouldShowDirectRemoteSyncShortcut() {
t.Fatal("shouldShowDirectRemoteSyncShortcut() = true, want false without a binding")
}
if u.shouldShowRemoteSyncSettingsShortcut() {
t.Fatal("shouldShowRemoteSyncSettingsShortcut() = true, want false without a binding")
}
if u.shouldShowRemoveRemoteSyncShortcut() {
t.Fatal("shouldShowRemoveRemoteSyncShortcut() = true, want false without a binding")
}
if got := u.remoteSyncSetupShortcutLabel(); got != "Set Up Remote Sync" {
t.Fatalf("remoteSyncSetupShortcutLabel() = %q, want Set Up Remote Sync", got)
}
})
}
}
func TestUIShouldHideRemoteSyncSetupShortcutWhenSavedBindingExists(t *testing.T) {
t.Parallel()