Files
react-native-devtools-frontend/test/e2e/sources/breakpoint-javascript_test.ts
T
Al Muthanna Athamina e31dbc126d Add helper functions for adding breakpoints in sources
In this CL we add and improve the helper functions that
allow us to test the breakpoint scenarios. In order to
do so we have improved the waiting conditions for loading
a file in the sources panel by adding an event that fires
when the file finishes loading or reloading and listening
to that event in the tests.

Bug: chromium:1169599, chromium:1112692, chromium:1178804
Change-Id: I315c722c0e5efdea747ba55b729995f5aee7376c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2698249
Commit-Queue: Almothana Athamneh <almuthanna@chromium.org>
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
2021-03-03 12:53:33 +00:00

30 lines
1.2 KiB
TypeScript

// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import {assert} from 'chai';
import {$, click, getBrowserAndPages, waitFor} from '../../shared/helper.js';
import {describe, it} from '../../shared/mocha-extensions.js';
import {addBreakpointForLine, openSourceCodeEditorForFile, RESUME_BUTTON, retrieveTopCallFrameWithoutResuming} from '../helpers/sources-helpers.js';
describe('The Sources Tab', async () => {
it('sets and hits breakpoints in JavaScript', async () => {
const {target, frontend} = getBrowserAndPages();
await openSourceCodeEditorForFile('click-breakpoint.js', 'click-breakpoint.html');
await addBreakpointForLine(frontend, 4);
const scriptEvaluation = target.evaluate('f2();');
const scriptLocation = await retrieveTopCallFrameWithoutResuming();
assert.deepEqual(scriptLocation, 'click-breakpoint.js:4');
const breakpointHandle = await $('label', await waitFor('.breakpoint-hit'));
const breakpointLocation = await breakpointHandle?.evaluate(label => label.textContent);
assert.deepEqual(breakpointLocation, scriptLocation);
await click(RESUME_BUTTON);
await scriptEvaluation;
});
});