-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Motivation * Integrated GitPortable for Windows * Use clone or lfs to interact with git * Extended the installer to handle any amount of archives that need to be downloaded & extracted, so that git-portable doesn't need to be bundled with the installer ## Info * Some e2e tests are only working on localhost, that's why the TEST_ENV `local` was added. Tests marked as "local" will be skipped in ci. --------- Co-authored-by: Gregor Adams <[email protected]>
- Loading branch information
1 parent
61a3295
commit 2a5bbc9
Showing
19 changed files
with
718 additions
and
395 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
import process from "process"; | ||
|
||
import type { ElectronApplication, Page } from "@playwright/test"; | ||
import { test, expect } from "@playwright/test"; | ||
import { _electron as electron } from "playwright"; | ||
|
||
import { buildKey } from "#/build-key"; | ||
import { ID } from "#/enums"; | ||
import type { GitCloneCompleted } from "@/utils/git"; | ||
|
||
/** | ||
* For these tests to work, you need "portable-git" inside of "Captain_Data" | ||
*/ | ||
|
||
const isLocalEnvironment = process.env.TEST_ENV === "local"; | ||
let electronApp: ElectronApplication; | ||
let page: Page; | ||
|
||
test.beforeAll(async () => { | ||
electronApp = await electron.launch({ | ||
args: ["."], | ||
env: { | ||
...process.env, | ||
TEST_ENV: "test", | ||
TEST_VERSION: "upToDate", | ||
TEST_APP_STATUS: "DONE", | ||
}, | ||
}); | ||
const isPackaged = await electronApp.evaluate(async ({ app }) => app.isPackaged); | ||
expect(isPackaged).toBe(false); | ||
}); | ||
|
||
test.afterAll(async () => { | ||
await electronApp.close(); | ||
}); | ||
|
||
(isLocalEnvironment ? test : test.skip)("clone a repository until is is completed", async () => { | ||
page = await electronApp.firstWindow(); | ||
|
||
const clone = buildKey([ID.DOWNLOADS], { suffix: ":clone" }); | ||
const cloned = buildKey([ID.DOWNLOADS], { suffix: ":cloned" }); | ||
|
||
const result = await page.evaluate( | ||
([clone, cloned]) => | ||
new Promise(resolve => { | ||
window.ipc.send(clone, { | ||
repository: "blib-la/captain-test-model", | ||
destination: "stable-diffusion", | ||
}); | ||
|
||
const unsubscribe = window.ipc.on(cloned, result => { | ||
unsubscribe(); | ||
resolve(result); | ||
}); | ||
}), | ||
[clone, cloned] | ||
); | ||
|
||
await expect(result).toHaveProperty("path"); | ||
await expect((result as GitCloneCompleted).path).toContain("captain-test-model"); | ||
}); | ||
|
||
(isLocalEnvironment ? test : test.skip)("get the progress when cloning a repository", async () => { | ||
page = await electronApp.firstWindow(); | ||
|
||
const clone = buildKey([ID.DOWNLOADS], { suffix: ":clone" }); | ||
const progress = buildKey([ID.DOWNLOADS], { suffix: ":progress" }); | ||
|
||
const result = await page.evaluate( | ||
([channelKey, progress]) => | ||
new Promise(resolve => { | ||
window.ipc.send(channelKey, { | ||
repository: "blib-la/captain-test-model", | ||
destination: "stable-diffusion", | ||
}); | ||
|
||
const unsubscribe = window.ipc.on(progress, result => { | ||
unsubscribe(); | ||
resolve(result); | ||
}); | ||
}), | ||
[clone, progress] | ||
); | ||
|
||
await expect(result).toHaveProperty("percent"); | ||
}); | ||
|
||
(isLocalEnvironment ? test : test.skip)("clone a repository that doesn't exist", async () => { | ||
page = await electronApp.firstWindow(); | ||
|
||
const clone = buildKey([ID.DOWNLOADS], { suffix: ":clone" }); | ||
const error = buildKey([ID.DOWNLOADS], { suffix: ":error" }); | ||
|
||
const result = await page.evaluate( | ||
([clone, error]) => | ||
new Promise(resolve => { | ||
window.ipc.send(clone, { | ||
repository: "blib-la/captain-test-model-that-doesnt-exist", | ||
destination: "stable-diffusion", | ||
}); | ||
|
||
const unsubscribe = window.ipc.on(error, result => { | ||
unsubscribe(); | ||
resolve(result); | ||
}); | ||
}), | ||
[clone, error] | ||
); | ||
|
||
await expect(result).toContain("Repository not found"); | ||
}); |
This file contains 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
Binary file not shown.
This file contains 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
Oops, something went wrong.