@redhat-developer/page-objects
Version:
Page Object API implementation for a VS Code editor used by ExTester framework.
106 lines • 5.12 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.DebugView = void 0;
const compare_versions_1 = require("compare-versions");
const SideBarView_1 = require("../SideBarView");
const DebugBreakpointSection_1 = require("../tree/debug/DebugBreakpointSection");
const DebugCallStackSection_1 = require("../tree/debug/DebugCallStackSection");
const DebugVariablesSection_1 = require("../tree/debug/DebugVariablesSection");
const WatchSection_1 = require("../tree/debug/WatchSection");
/**
* Page object representing the Run/Debug view in the side bar
*/
class DebugView extends SideBarView_1.SideBarView {
/**
* Get the title of the selected launch configuration
* @returns Promise resolving to the title
* @deprecated For VS Code 1.88+ this method won't be working any more
*/
async getLaunchConfiguration() {
if ((0, compare_versions_1.satisfies)(DebugView.versionInfo.version, '>=1.87.0') && process.platform !== 'darwin') {
throw Error(`DEPRECATED METHOD! The 'DebugView.getLaunchConfiguration' method is broken! Read more information in 'Known Issues > Limitations in testing with VS Code 1.87+' - https://github.com/microsoft/vscode/issues/206897.`);
}
const action = await this.getTitlePart().findElement(DebugView.locators.DebugView.launchCombo);
const combo = await action.findElement(DebugView.locators.DebugView.launchSelect);
return await combo.getAttribute('title');
}
/**
* Get titles of all available launch configurations
* @returns Promise resolving to list of titles
*/
async getLaunchConfigurations() {
const action = await this.getTitlePart().findElement(DebugView.locators.DebugView.launchCombo);
const combo = await action.findElement(DebugView.locators.DebugView.launchSelect);
const configs = [];
const options = await combo.findElements(DebugView.locators.DebugView.launchOption);
for (const option of options) {
if (await option.isEnabled()) {
configs.push(await option.getAttribute('value'));
}
}
return configs;
}
async getVariablesSection() {
const content = this.getContent();
return content.getSection(DebugVariablesSection_1.DebugVariableSection.locators.DebugVariableSection.predicate, DebugVariablesSection_1.DebugVariableSection);
}
/**
* Get section which holds information about breakpoints.
* @returns DebugBreakpointSection page object
*/
async getBreakpointSection() {
const content = this.getContent();
return content.getSection(DebugBreakpointSection_1.DebugBreakpointSection.locators.DebugBreakpointSection.predicate, DebugBreakpointSection_1.DebugBreakpointSection);
}
/**
* Select a given launch configuration
* @param title title of the configuration to select
*/
async selectLaunchConfiguration(title) {
const action = await this.getTitlePart().findElement(DebugView.locators.DebugView.launchCombo);
const combo = await action.findElement(DebugView.locators.DebugView.launchSelect);
const option = await combo.findElement(DebugView.locators.DebugView.optionByName(title));
await option.click();
}
/**
* Start Debugging using the current launch configuration
*/
async start() {
const action = await this.getTitlePart().findElement(DebugView.locators.DebugView.launchCombo);
await action.findElement(DebugView.locators.DebugView.startButton).click();
}
/**
* Get Call Stack section
* @returns CallStackSection page object
*/
async getCallStackSection() {
const content = this.getContent();
return content.getSection(DebugCallStackSection_1.DebugCallStackSection.locators.DebugCallStackSection.predicate, DebugCallStackSection_1.DebugCallStackSection);
}
/**
* Get Watch section
* @returns WatchSection page object
*/
async getWatchSection() {
const content = this.getContent();
return content.getSection(WatchSection_1.WatchSection.locators.WatchSection.predicate, WatchSection_1.WatchSection);
}
}
exports.DebugView = DebugView;
//# sourceMappingURL=DebugView.js.map
;