patch 8.2.2648: terminal resize test sometimes hangs

Problem:    Terminal resize test sometimes hangs.
Solution:   Wait for the shell to display a prompt and other output.
diff --git a/src/testdir/test_terminal2.vim b/src/testdir/test_terminal2.vim
index 4dc8350..0f8dcb6 100644
--- a/src/testdir/test_terminal2.vim
+++ b/src/testdir/test_terminal2.vim
@@ -246,6 +246,10 @@
   set statusline=x
   terminal
   call assert_equal(2, winnr('$'))
+  let buf = bufnr()
+
+  " Wait for the shell to display a prompt
+  call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))})
 
   " Fill the terminal with text.
   if has('win32')
@@ -253,6 +257,9 @@
   else
     call feedkeys("ls\<CR>", 'xt')
   endif
+  " Wait for some output
+  call WaitForAssert({-> assert_notequal('', term_getline(buf, 3))})
+
   " Go to Terminal-Normal mode for a moment.
   call feedkeys("\<C-W>N", 'xt')
   " Open a new window
@@ -263,6 +270,7 @@
   close
   call assert_equal(2, winnr('$'))
   call feedkeys("exit\<CR>", 'xt')
+  call TermWait(buf)
   set statusline&
 endfunc