Quite a few tests have sync_dbus or magic 'expect's to make sure all the contact list channels have been announced, so that the test can expect NewChannels without risking picking up the wrong channel. There should be a "bring me online, send this roster and these vcards, and make sure everything's happened" helper.
Also, I just found a race where, after calling CreateChannel for a MUC, the test doesn't wait for Gabble to send the "I want to join" presence before sending back presences for the other MUC users. This code is copy-pasted all over the place, and should be abstracted.
Filing this as a general "we should improve this" ticket.
The second point is fixed in a branch:
Author: Will Thompson <email@example.com>
Date: Sun Mar 1 16:03:05 2009 +0000
Add helper functions to join a MUC in tests.
In passing, fixes a race in tubes/offer-muc-dbus-tube.py, which didn't
wait for Gabble to ask to join the MUC before sending presences for the
References fd.o #20405
Retitling, and downgrading priority.