US president expresses hope for a trade deal with Beijing despite ‘testy’ relations