DevTools: E2E test covering going from perf to sources

Simple test in the existing workflow_tests.ts file to make sure
this user flow works.
A similar CL was landed and then reverted before, as this test is just
a tad slow and will often timeout.
This new CL removes a single waitFor in the performance-helpers.ts file
in an attempt to make the test run a little faster.
It also increases the timeout for this test suite to 5s instead of 3s.
Indeed, moving from panel to panel takes time in DevTools and 3s was
just not enough for the test to pass every time.

Bug: 1079076
Change-Id: Ib6e31e943ccbddc9d82aea5da394c371499c1aab
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2230774
Commit-Queue: Patrick Brosset <[email protected]>
Reviewed-by: Tim van der Lippe <[email protected]>
Reviewed-by: Jan Scheffler <[email protected]>
diff --git a/test/e2e/helpers/performance-helpers.ts b/test/e2e/helpers/performance-helpers.ts
index b07fdc8..56e50a0 100644
--- a/test/e2e/helpers/performance-helpers.ts
+++ b/test/e2e/helpers/performance-helpers.ts
@@ -2,15 +2,16 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-import * as puppeteer from 'puppeteer';
-
-import {$, click, resourcesPath, waitFor} from '../../shared/helper.js';
+import {$, click, getBrowserAndPages, resourcesPath, waitFor} from '../../shared/helper.js';
 
 const RECORD_BUTTON_SELECTOR = '[aria-label="Record"]';
 const STOP_BUTTON_SELECTOR = '[aria-label="Stop"]';
 
-export async function navigateToPerformanceTab(target: puppeteer.Page, testName: string) {
-  await target.goto(`${resourcesPath}/performance/${testName}.html`);
+export async function navigateToPerformanceTab(testName?: string) {
+  if (testName) {
+    const {target} = getBrowserAndPages();
+    await target.goto(`${resourcesPath}/performance/${testName}.html`);
+  }
 
   // Click on the tab.
   await click('#tab-timeline');
@@ -22,11 +23,8 @@
 export async function startRecording() {
   await click(RECORD_BUTTON_SELECTOR);
 
-  // Wait for the button to turn to its stop state and for the status dialog to appear.
-  await Promise.all([
-    waitFor(STOP_BUTTON_SELECTOR),
-    waitFor('.timeline-status-dialog'),
-  ]);
+  // Wait for the button to turn to its stop state.
+  await waitFor(STOP_BUTTON_SELECTOR);
 }
 
 export async function stopRecording() {
@@ -43,3 +41,13 @@
   const totalText = await pieChartTotal.evaluate(node => node.textContent);
   return parseInt(totalText, 10);
 }
+
+export async function navigateToPerformanceSidebarTab(tabName: string) {
+  await click(`[aria-label="${tabName}"]`);
+}
+
+export async function waitForSourceLinkAndFollowIt() {
+  const link = await waitFor('.devtools-link');
+  await click(link);
+  await waitFor('.panel[aria-label="sources"]');
+}