test: Fix TestActivePages races and bugs
test: Fix TestActivePages races and bugs

With full chromium instead of chromium-headless, the `focus(".terminal")`
focused *away from* the actual element that receives the input, so that
typing the sleep command went into Nirvana. Just drop that, it's
unnecessary -- we want the Terminal page to automatically focus the
input. (check-system-terminal also does not focus explicitly).

Drop the weird `line_text()` helper, and wait until the terminal shows a
full prompt (with `$`), instead of just "anything". This does the same
as check-system-terminal (albeit a bit simplified).

Wait for the default selection of the "delete frame" dialog to happen.
Previously the clickery started too early before the dialog got fully
initialized, and then missed to actually stop the terminal frame.

Fix the waiting for "sleep command goes away"; before it waited for the
command to be present, thus was a no-op.

Replace the broken `ps | grep` with `pgrep -x`, which avoids catching
itself. Despite the effort with using a regexp, the grep command still
found itself. Also, `sleep` is a bad program to use, as on Debian/Ubuntu
that just gets reparented to pid 1 after its parent (the terminal shell)
dies, so it never gets killed (this was hidden by the previous bug where
the second wait loop was the wrong way around). Replace this with `cat`,
which will properly exit on SIGPIPE, and rename it to `kitten` to
ensure that our pgrep does not catch some unrelated cat.

Use a single shell commmand to the VM instead of a heavy polling loop.

Finally, wait for the killed frames to actually go away before reopening
the dialog; this is asynchronous, so sometimes the dialog opened too
fast and still saw the terminal frame.

cockpit-project/cockpit,cockpit-project/cockpit,garrett/cockpit,garrett/cockpit,garrett/cockpit,martinpitt/cockpit,mvollmer/cockpit,garrett/cockpit,martinpitt/cockpit,mvollmer/cockpit,garrett/cockpit,mvollmer/cockpit,mvollmer/cockpit,cockpit-project/cockpit,cockpit-project/cockpit,mvollmer/cockpit,cockpit-project/cockpit,martinpitt/cockpit,martinpitt/cockpit,martinpitt/cockpit