message: Better waiting
diff: @@ -36,9 +36,16 @@ async function main() {
  print('Backstage loaded correctly, creating plugin');
  const createPlugin = spawnPiped(['yarn', 'create-plugin']);
  +
  + let stdout = '';
  + createPlugin.stdout.on('data', data => {
  + stdout = stdout + data.toString('utf8');
  + });
  +
  + await waitFor(() => stdout.includes('Enter an ID for the plugin'));
  createPlugin.stdin.write('test-plugin\n');
  - // TODO: Add code to await the right prompts from create-plugin stdout instead
  - await new Promise(resolve => setTimeout(resolve, 5000));
  +
  + await waitFor(() => stdout.includes('Enter the owner(s) of the plugin'));
  createPlugin.stdin.write('@someuser\n');
  print('Waiting for plugin create script to be done');
  @@ -60,6 +67,18 @@ async function main() {
  process.exit(0);
  }
  +function waitFor(fn) {
  + return new Promise(resolve => {
  + const handle = setInterval(() => {
  + if (fn()) {
  + clearInterval(handle);
  + resolve();
  + return;
  + }
  + }, 100);
  + });
  +}
  +
  function print(msg) {
  return process.stdout.write(`${msg}\n`);
  }
  @@ -118,7 +137,7 @@ async function waitForPageWithText(
  browser,
  path,
  text,
  - { intervalMs = 1000, maxAttempts = 60 } = {},
  + { intervalMs = 1000, maxAttempts = 120 } = {},
  ) {
  let attempts = 0;
  for (;;) {
  