snapshot of https://github.com/tauri-apps/plugins-workspace.git (v2, 2026-09-23; blobs > 131072B omitted)
Some checks failed
integration tests / run-integration-tests (windows-latest) (push) Has been cancelled
Test Rust / test (push) Has been cancelled
test plugins e2e (mobile) / ios (push) Has been cancelled
test plugins e2e / test (map[name:Windows os:windows-latest]) (push) Has been cancelled
test plugins e2e / test (map[name:macOS os:macos-latest]) (push) Has been cancelled
integration tests / run-integration-tests (macos-latest) (push) Has been cancelled
version or publish / version-or-publish (push) Failing after 0s
integration tests / run-integration-tests (ubuntu-22.04) (push) Failing after 0s
Lint JavaScript / eslint (push) Failing after 0s
Sync / sync-to-mirrors (push) Failing after 0s
test plugins e2e (mobile) / android (push) Failing after 0s
test plugins e2e / test (map[name:Linux os:ubuntu-latest]) (push) Failing after 0s
Test Rust / changes (push) Failing after 0s
Lint Rust / changes (push) Failing after 0s
Lint Rust / clippy (push) Has been skipped
Audit Rust / audit-rust (push) Failing after 1s
Audit JavaScript / audit-js (push) Failing after 1s

This commit is contained in:
upstream-mirror
2026-09-23 17:17:10 +05:00
commit 9ad64ec987
1469 changed files with 115067 additions and 0 deletions

View File

@@ -0,0 +1,92 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
import { expect } from '@wdio/globals'
import { tauri, tauriError, describePlugin, itOn } from '../helpers/index.js'
// The suite launches the app without a URL, so there is no current deep link,
// and it cannot open one through the OS either. `onOpenUrl` is exercised by
// emitting the event the plugin itself emits when the app is opened with one.
//
// Registering a scheme at runtime is only implemented on Linux (a `.desktop`
// handler plus `xdg-mime`) and Windows (the registry); macOS and mobile read
// the schemes from the bundle and report the runtime APIs as unsupported.
/** A scheme no real app handles, so registering it cannot clobber anything. */
const scheme = 'tauri-plugins-e2e'
describePlugin('deep-link', () => {
it('getCurrent is null when the app was not opened with a URL', async () => {
expect(await tauri((api) => api.deepLink.getCurrent())).toBeNull()
})
it('onOpenUrl delivers the opened URLs until unlistened', async () => {
const received = await tauri(
async (api, urls) => {
const received: string[][] = []
const unlisten = await api.deepLink.onOpenUrl((urls) =>
received.push(urls)
)
await api.event.emit('deep-link://new-url', urls)
await new Promise((resolve) => setTimeout(resolve, 500))
unlisten()
await api.event.emit('deep-link://new-url', ['ignored://'])
await new Promise((resolve) => setTimeout(resolve, 500))
return received
},
[`${scheme}://open/path?query=1`]
)
expect(received).toEqual([[`${scheme}://open/path?query=1`]])
})
itOn(
['linux', 'win32'],
'register and unregister toggle the scheme handler',
async () => {
const result = await tauri(async (api, scheme) => {
await api.deepLink.register(scheme)
const registered = await api.deepLink.isRegistered(scheme)
await api.deepLink.unregister(scheme)
return {
registered,
afterUnregister: await api.deepLink.isRegistered(scheme)
}
}, scheme)
expect(result).toEqual({ registered: true, afterUnregister: false })
}
)
itOn(
['linux', 'win32'],
'isRegistered is false for an unknown scheme',
async () => {
expect(
await tauri(
(api, scheme) => api.deepLink.isRegistered(scheme),
`${scheme}-unknown`
)
).toBe(false)
}
)
itOn(
['darwin', 'android', 'ios'],
'runtime registration is unsupported',
async () => {
for (const command of [
'register',
'unregister',
'isRegistered'
] as const) {
const error = await tauriError(
// eslint-disable-next-line security/detect-object-injection
(api, command, scheme) => api.deepLink[command](scheme),
command,
scheme
)
expect(error).toMatch(/unsupported platform/i)
}
}
)
})