This wait command is your universal weapon if you want to wait on something. It expects a condition and waits until that condition is fulfilled with a truthy value. If you use the WDIO testrunner the commands within the condition are getting executed synchronously like in your test.
A common example is to wait until a certain element contains a certain text (see example).
|condition||condition to wait on|
|timeout in ms (default: 5000)|
|error message to throw when waitUntil times out|
|interval between condition checks (default: 500)|