* WIP: Double-clicking on .kcl file on Windows redirects to the home page if the app is already open Fixes #5412 * Add deep link test case for linux * Add mac tests * Lint and win tests * Fix e2e tests * Logs everywhere * windows weird? yup * More logzzz maybe it's not windows * Remove :/// replacement. Add catch log * Fix and clean up * FIx lint * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * More lint * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * Clean up tests further --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
83 lines
2.5 KiB
TypeScript
83 lines
2.5 KiB
TypeScript
import { getPathOrUrlFromArgs, parseCLIArgs } from 'commandLineArgs'
|
|
|
|
const linuxDeepLinkArgv = [
|
|
'/tmp/.mount_Zoo Movq3t0x/zoo-modeling-app',
|
|
'--no-sandbox',
|
|
'--allow-file-access-from-files',
|
|
'zoo-studio://?create-file=true&name=deeplinks&code=cGxhbmUwMDEgPSBvZmZzZXRQbGFuZSgnWFonLCBvZmZzZXQgPSA1KQ%3D%3D',
|
|
]
|
|
|
|
const linuxNoPathArgv = [
|
|
'/tmp/.mount_Zoo MogQS2hd/zoo-modeling-app',
|
|
'--no-sandbox',
|
|
'--allow-file-access-from-files',
|
|
]
|
|
|
|
const linuxPathArgv = [
|
|
'/tmp/.mount_Zoo MogQS2hd/zoo-modeling-app',
|
|
'--no-sandbox',
|
|
'--allow-file-access-from-files',
|
|
'/home/pierremtb/Documents/zoo-modeling-app-projects/project-001/main.kcl',
|
|
]
|
|
|
|
const winDeepLinkArgv = [
|
|
'C:\\Program Files\\Zoo Modeling App\\Zoo Modeling App.exe',
|
|
'--allow-file-access-from-files',
|
|
'zoo-studio:///?create-file=true&name=deeplinkscopy&code=cGxhbmUwMDEgPSBvZmZzZXRQbGFuZSgnWFonLCBvZmZzZXQgPSA1KQo%3D',
|
|
]
|
|
|
|
const winNoPathArgv = [
|
|
'C:\\Program Files\\Zoo Modeling App\\Zoo Modeling App.exe',
|
|
'--allow-file-access-from-files',
|
|
]
|
|
|
|
const winPathArgv = [
|
|
'C:\\Program Files\\Zoo Modeling App\\Zoo Modeling App.exe',
|
|
'--allow-file-access-from-files',
|
|
'C:\\Users\\pierr\\Documents\\zoo-modeling-app-projects\\deeplink\\main.kcl',
|
|
]
|
|
|
|
// macos doesn't uses the open-url scheme so is different so no macDeepLinkArgv
|
|
|
|
const macNoPathArgv = [
|
|
'/Applications/Zoo Modeling App.app/Contents/MacOS/Zoo Modeling App',
|
|
]
|
|
|
|
const macPathArgv = [
|
|
'/Applications/Zoo Modeling App.app/Contents/MacOS/Zoo Modeling App',
|
|
'/Users/pierremtb/Documents/zoo-modeling-app-projects/loft/main.kcl',
|
|
]
|
|
|
|
describe('getPathOrUrlFromArgs', () => {
|
|
;[
|
|
['linux', linuxDeepLinkArgv],
|
|
['windows', winDeepLinkArgv],
|
|
// macos doesn't uses the open-url scheme so is different
|
|
].map(([os, argv]) => {
|
|
it(`should parse second-instance deep link argv on ${os}`, () => {
|
|
const args = parseCLIArgs(argv as string[])
|
|
expect(getPathOrUrlFromArgs(args)).toContain('zoo-studio://')
|
|
})
|
|
})
|
|
;[
|
|
['linux', linuxPathArgv],
|
|
['windows', winPathArgv],
|
|
['mac', macPathArgv],
|
|
].map(([os, argv]) => {
|
|
it(`should parse path argv on ${os}`, () => {
|
|
const args = parseCLIArgs(argv as string[])
|
|
expect(getPathOrUrlFromArgs(args)).toContain('main.kcl')
|
|
})
|
|
})
|
|
;[
|
|
['linux', linuxNoPathArgv],
|
|
['windows', winNoPathArgv],
|
|
['mac', macNoPathArgv],
|
|
].map(([os, argv]) => {
|
|
it(`should return undefined without path argv on ${os}`, () => {
|
|
const args = parseCLIArgs(argv as string[])
|
|
expect(getPathOrUrlFromArgs(args)).toBeUndefined()
|
|
})
|
|
})
|
|
})
|