* fix: prevent repeated Keychain prompts and isolate native tests * fix: make credential settings contextual and actionable * fix: refresh credential recovery state in open Settings * fix: allow retrying credential status checks * fix: recover credential access after backend panics * test: centralize native Tauri invocation * refactor: clarify credential preferences workflow path
53 lines
2 KiB
TypeScript
53 lines
2 KiB
TypeScript
import { strict as assert } from 'node:assert'
|
|
|
|
import { invokeNative } from '#tests/helpers/tauri/invoke'
|
|
|
|
function settingsOpen(): Promise<boolean> {
|
|
return browser.execute(() =>
|
|
Boolean(document.querySelector('[data-test-id="app-settings-dialog"]'))
|
|
)
|
|
}
|
|
|
|
describe('native preferences', () => {
|
|
it('opens Settings with the platform shortcut while an input is focused', async () => {
|
|
await browser.waitUntil(
|
|
async () => browser.execute(() => Boolean(window.openPencil?.getStore?.())),
|
|
{ timeout: 30_000, timeoutMsg: 'OpenPencil editor did not initialize' }
|
|
)
|
|
await browser.execute(() => {
|
|
const input = document.createElement('input')
|
|
input.setAttribute('data-test-id', 'native-settings-shortcut-input')
|
|
document.body.append(input)
|
|
})
|
|
const input = await $('[data-test-id="native-settings-shortcut-input"]')
|
|
await input.click()
|
|
await browser.keys([process.platform === 'darwin' ? 'Meta' : 'Control', ','])
|
|
await browser.waitUntil(settingsOpen, {
|
|
timeout: 10_000,
|
|
timeoutMsg: 'Native settings shortcut did not open Settings'
|
|
})
|
|
|
|
assert.equal(await settingsOpen(), true)
|
|
})
|
|
|
|
it('keeps native snapping checkmarks synchronized with preferences', async () => {
|
|
await browser.waitUntil(
|
|
async () => browser.execute(() => Boolean(window.openPencil?.getStore?.())),
|
|
{ timeout: 30_000, timeoutMsg: 'OpenPencil editor did not initialize' }
|
|
)
|
|
const initial = await invokeNative<boolean>('native_menu_checked', { id: 'snap-objects' })
|
|
assert.equal(initial, true)
|
|
|
|
await browser.executeAsync((done) => {
|
|
const toggle = document.querySelector<HTMLElement>('[data-test-id="app-settings-trigger"]')
|
|
toggle?.click()
|
|
requestAnimationFrame(() => {
|
|
document.querySelector<HTMLElement>('[data-test-id="settings-snap-objects"]')?.click()
|
|
setTimeout(done, 200)
|
|
})
|
|
})
|
|
const updated = await invokeNative<boolean>('native_menu_checked', { id: 'snap-objects' })
|
|
assert.equal(updated, false)
|
|
})
|
|
})
|