Move the call to setupWPServerFiles to the app's ready event handler. This will ensure that the setup finishes before creating the main window and let the user interact with the app.
Add unit test to cover the case.
Small refactor in the index.test.ts file to address issues with async code.
Testing Instructions
[!NOTE]
This issue has been spotted when running E2E tests on Windows. It's unlikely that users have encountered this as it's produced by a combination of slow file disk operations and creating a site quickly after the app is launched.
Remove all site folders to ensure that the app starts on the onboarding screen.
Remove the folder $HOME/Library/Application Support/Studio/server-files.
Open the app and quickly add a site.
Observe the site is created successfully.
Pre-merge Checklist
[x] Have you checked for TypeScript, React or other console errors?
Related to https://github.com/Automattic/studio/pull/76#issuecomment-2149343524.
Proposed Changes
setupWPServerFiles
to the app's ready event handler. This will ensure that the setup finishes before creating the main window and let the user interact with the app.index.test.ts
file to address issues with async code.Testing Instructions
$HOME/Library/Application Support/Studio/server-files
.Pre-merge Checklist