How do I make the editor Simulate the game before running automation tests?

Hi,

I have an automation test written which works fine, but it requires the editor to be already simulating (with the play button) and also with number of players set to 2.

It works if I press the play button then run the automation test, however I would love it if I was able to have the test do this for me, wait for it to launch the game clients and then continue with the test, also shutting it down at the end of the test too.

I can’t figure out how I might be able to do this?

Ive seen the FStartPIECommand from AutomationEditorCommon and assume this is the key, but can’t do it. I referenced AutomationEditorCommon.h and wrote ADD_LATENT_AUTOMATION_COMMAND(FStartPIECommand(true)); atht eh beginning of my test, but no luck.

The followng works for me, I was having a major headache with this, turns out I had a "ADD_LATENT_AUTOMATION_COMMAND(FWaitForMapToLoadCommand());" at the start of my test, which will never return in an editor context.

   #if WITH_EDITOR
	if(TestWorld->IsEditorWorld())
	{
		UE_LOG(LOGMYTESTS, Log, TEXT("Looks like we are running in editor"));		 
        ADD_LATENT_AUTOMATION_COMMAND(FEditorLoadMap(expectedLevelName));
		ADD_LATENT_AUTOMATION_COMMAND(FStartPIECommand(true));
	}