@redhat-developer/page-objects
v1.24.0
Published
Page Object API implementation for a VS Code editor used by ExTester framework.
Downloads
124,095
Readme
What it is
Page objects wrap the parts of the VS Code workbench in classes with meaningful methods, so a test can say new ActivityBar().getViewControl('Explorer') instead of searching the DOM. This package contains:
- Page object classes for the activity bar, side bar views and tree sections, editors (text, diff, settings, custom and web view), the bottom panel (problems, output, terminal and debug console), the status bar, title bar and menus, dialogs, notifications and the debug views.
AbstractElement, the base class every page object extends, including your own custom ones.LocatorLoaderandmergeLocators, which assemble the locator set for the VS Code version under test from@redhat-developer/locatorsand an optional custom contribution.WaitHelper, timeout constants and a re-export ofselenium-webdriver, so one import gives youWebDriver,By,Keyand the rest.
Installation
vscode-extension-tester depends on this package and re-exports everything from it. In an ExTester project you import page objects from vscode-extension-tester and never install this package directly:
import { ActivityBar, EditorView, TextEditor } from "vscode-extension-tester";Install it on its own only if you drive a VS Code instance with your own WebDriver setup:
npm install --save-dev @redhat-developer/page-objects @redhat-developer/locators selenium-webdriverPeer dependencies: selenium-webdriver ^4.48.0 and typescript >= 4.6.2.
Standalone usage
The page objects must be initialised once before the first one is created. ExTester does this for you when VSBrowser starts; without ExTester, call initPageObjects yourself:
import { getLocatorsPath } from "@redhat-developer/locators";
import { initPageObjects } from "@redhat-developer/page-objects";
initPageObjects(
"1.134.0", // VS Code version under test
"1.37.0", // version of the base locator set
getLocatorsPath(), // folder with the compiled locators
driver, // your selenium-webdriver WebDriver attached to VS Code
browserName, // name of the browser the page objects run in
"./out/test/pageObjects/locators.js", // optional custom locator contribution
);Documentation
- Page Object Reference — every page object with examples
- Custom Page Objects — extend the API for your own extension's UI
Feedback
- Bugs and feature requests: open an issue
- Questions: GitHub Discussions
