@redhat-developer/page-objects
Version:
Page Object API implementation for a VS Code editor used by ExTester framework.
109 lines • 3.61 kB
JavaScript
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License", destination); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.DebugToolbar = void 0;
const selenium_webdriver_1 = require("selenium-webdriver");
const AbstractElement_1 = require("../AbstractElement");
const Workbench_1 = require("./Workbench");
/**
* Page object for the Debugger Toolbar
*/
class DebugToolbar extends AbstractElement_1.AbstractElement {
constructor() {
super(DebugToolbar.locators.DebugToolbar.ctor, new Workbench_1.Workbench());
}
/**
* Wait for the debug toolbar to appear and instantiate it.
* Assumes that debug session is already starting and it is just
* a matter of waiting for the toolbar to appear.
*
* @param timeout max time to wait in milliseconds, default 5000
*/
static async create(timeout = 5000) {
await DebugToolbar.driver.wait(selenium_webdriver_1.until.elementLocated(DebugToolbar.locators.DebugToolbar.ctor), timeout);
return new DebugToolbar().wait(timeout);
}
/**
* Wait for the execution to pause at the next breakpoint
*/
async waitForBreakPoint(timeout = 10_000) {
let btn = await this.getDriver().wait(selenium_webdriver_1.until.elementLocated(DebugToolbar.locators.DebugToolbar.button('continue')));
await this.getDriver().wait(async () => {
try {
const enabled = await btn.isEnabled();
return enabled;
}
catch (err) {
btn = await this.findElement(DebugToolbar.locators.DebugToolbar.button('continue'));
}
}, timeout);
}
/**
* Click Continue
*/
async continue() {
await (await this.getButton('continue')).click();
}
/**
* Click Disconnect
*/
async disconnect() {
await (await this.getButton('disconnect')).click();
}
/**
* Click Pause
*/
async pause() {
await (await this.getButton('pause')).click();
}
/**
* Click Step Over
*/
async stepOver() {
await (await this.getButton('step-over')).click();
}
/**
* Click Step Into
*/
async stepInto() {
await (await this.getButton('step-into')).click();
}
/**
* Click Step Out
*/
async stepOut() {
await (await this.getButton('step-out')).click();
}
/**
* Click Restart
*/
async restart() {
await (await this.getButton('restart')).click();
}
/**
* Click Stop
*/
async stop() {
await (await this.getButton('stop')).click();
}
async getButton(name) {
return await this.findElement(DebugToolbar.locators.DebugToolbar.button(name));
}
}
exports.DebugToolbar = DebugToolbar;
//# sourceMappingURL=DebugToolbar.js.map
;