Skip to content

Commit 3bc43a1

Browse files
committed
chore: create splash first
1 parent 67baf88 commit 3bc43a1

File tree

1 file changed

+29
-23
lines changed
  • fixtures/e2e-apps/tauri/src-tauri/src

1 file changed

+29
-23
lines changed

fixtures/e2e-apps/tauri/src-tauri/src/main.rs

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -249,24 +249,8 @@ fn main() {
249249
eprintln!("[Tauri-DEBUG] Setup called, is_splash={}", is_splash);
250250

251251
if is_splash {
252-
// STANDARD TAURI SPLASHSCREEN PATTERN:
253-
// Create both windows at startup - main hidden, splash visible
254-
255-
// Create main window (hidden initially)
256-
let main = tauri::WebviewWindowBuilder::new(
257-
app,
258-
"main",
259-
tauri::WebviewUrl::App("index.html".into())
260-
)
261-
.title("Tauri E2E Test App")
262-
.inner_size(600.0, 400.0)
263-
.visible(false) // Hidden initially
264-
.build()
265-
.expect("Failed to create main window");
266-
267-
eprintln!("[Tauri-DEBUG] Created main window (hidden)");
268-
269-
// Create splash window (visible)
252+
// 1. SPLASH FIRST - WebDriver MUST connect here (visible + focused)
253+
eprintln!("[Tauri-DEBUG] === Creating SPLASH window FIRST ===");
270254
let splash = tauri::WebviewWindowBuilder::new(
271255
app,
272256
"splash",
@@ -277,16 +261,33 @@ fn main() {
277261
.resizable(false)
278262
.decorations(false)
279263
.transparent(true)
280-
.focused(true)
264+
.focused(true) // CRITICAL: WebDriver attaches here
281265
.build()
282266
.expect("Failed to create splash window");
283267

284-
// Show and focus splash
285-
splash.show().expect("Failed to show splash window");
286-
splash.set_focus().expect("Failed to focus splash window");
268+
// Show/focus splash explicitly (ensures WebDriver session)
269+
splash.show().expect("Failed to show splash");
270+
splash.set_focus().expect("Failed to focus splash");
287271

288-
eprintln!("[Tauri-DEBUG] Created splash (visible) + main (hidden)");
272+
eprintln!("[Tauri-DEBUG] ✓ Splash created and focused");
273+
274+
// 2. MAIN SECOND - hidden until switch_to_main
275+
eprintln!("[Tauri-DEBUG] === Creating MAIN window SECOND (hidden) ===");
276+
let _main = tauri::WebviewWindowBuilder::new(
277+
app,
278+
"main",
279+
tauri::WebviewUrl::App("index.html".into())
280+
)
281+
.title("Tauri E2E Test App")
282+
.inner_size(600.0, 400.0)
283+
.visible(false) // HIDDEN until switch_to_main
284+
.build()
285+
.expect("Failed to create main window");
286+
287+
eprintln!("[Tauri-DEBUG] ✓ Main created (hidden). Ready for switch_to_main!");
289288
} else {
289+
// No splash - just main window (unchanged)
290+
eprintln!("[Tauri-DEBUG] No splash mode - creating main only");
290291
create_main_window(app.handle());
291292
}
292293
Ok::<(), Box<dyn std::error::Error>>(())
@@ -308,7 +309,12 @@ fn main() {
308309
write_clipboard,
309310
generate_test_logs,
310311
switch_to_main,
312+
// Service window management commands (add these):
313+
get_window_states, // <- Your service needs this
314+
get_window_handles, // <- Generic handles
315+
get_window_title, // <- Title lookup
311316
])
312317
.run(tauri::generate_context!())
313318
.expect("error while running tauri application");
314319
}
320+

0 commit comments

Comments
 (0)