Skip to content

Commit fff69fe

Browse files
committed
Print tauri windows on startup
1 parent d6503a0 commit fff69fe

4 files changed

Lines changed: 19 additions & 4 deletions

File tree

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: Test Packages
33

44
on:
5-
push:
5+
#push:
66

77
jobs:
88
test:

packages/tauri/test-runner/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ version = "0.1.0"
44
edition = "2024"
55

66
[dependencies]
7+
env_logger = "0.11.10"
8+
log = "0.4.30"
79
tauri = { version = "2.10.3", features = ["dynamic-acl", "test"] }
810
tauri-plugin-powersync = { path = "../" }
911
url = "2.5"
Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,33 @@
11
use std::env;
2+
use tauri::Manager;
23
use url::Url;
34

5+
use log::info;
6+
47
/// A simple Tauri app that allows all commands.
58
///
69
/// We run this app through the Tauri web driver wrapper, which will make it load the vitest browser
710
/// UI through which we test the Tauri plugin.
811
fn main() {
12+
env_logger::init();
13+
914
// Use default options, but open window with URL from args.
1015
let mut context = tauri::generate_context!();
1116
if let Some(url) = env::args().skip(1).next() {
1217
let config = context.config_mut();
1318
config.build.dev_url = Some(Url::parse(&url).expect("Could not parse URL"));
1419
}
1520

16-
println!("Running test tauri application");
21+
info!("Running test tauri application");
1722
tauri::Builder::default()
1823
.plugin(tauri_plugin_powersync::init())
24+
.setup(|app| {
25+
for (name, window) in app.webview_windows() {
26+
info!("Found window {name} on {}", window.url()?);
27+
}
28+
29+
Ok(())
30+
})
1931
.run(context)
2032
.expect("error while running tauri application");
2133
}

packages/tauri/vitest.config.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,18 @@ class TauriBrowserProvider implements BrowserProvider {
2828
return {};
2929
}
3030

31-
async openPage(_sessionId: string, url: string, _options: { parallel: boolean }) {
31+
async openPage(_sessionId: string, url: string, options: { parallel: boolean }) {
3232
if (this.#tauriApp != null) {
3333
throw new Error('TODO: Calling openPage multiple times is not supported');
3434
}
3535

36+
console.log('openPage', url, options);
3637
// Ensure the target app spawning webviews is up-to-date.
3738
const buildResult = spawnSync('cargo', ['build', '-p', 'test-runner'], { stdio: 'inherit' });
3839
if (buildResult.status !== 0) {
3940
throw new Error(`cargo build failed with exit code ${buildResult.status}`);
4041
}
41-
const app = spawn(testRunnerExecutable, [url]);
42+
const app = spawn(testRunnerExecutable, [url], { env: { RUST_LOG: 'info', ...process.env } });
4243
this.#tauriApp = app;
4344

4445
app.on('exit', (code) => {

0 commit comments

Comments
 (0)