@openfin/automation-helpers
Version:
Helper methods for automation testing in the OpenFin ecosystem
374 lines (247 loc) • 14.2 kB
Markdown
# Changelog
## 1.2.0
* Update dependencies
* Use @openfin/node-adapter instead of openfin-adapter for proxy
* Always pass localhost to WebDriver startup to avoid ipv6 name resolution using 0.0.0.0
## 1.1.11
* Fixed - WebDriver.executeAsync correctly returns value using callback
## 1.1.10
* Fixed - Export setUrl on the static wrapper
## 1.1.9
* Added - WebDriver.setUrl to navigate to a new location
* Added - WebDriver.executeAsync now accepts params arg
## 1.1.8
* Change - OpenFinHome searchResultSelectedDetails updated to support WS15 HTML layout
* Change - WebDriver.switchToWindow has additional optional parameter `activateNativeWindow` which defaults to true, can be set to false if you don't want to active the native window
* Change - WebDriver.waitForWindow has additional optional parameter `activateNativeWindow` which defaults to true, can be set to false if you don't want to active the native window
## 1.1.7
* Fix Use home and store identities for lookup instead of window title as they have changed in 14.1
## 1.1.6
* Change - Remove node-fetch usage
## 1.1.5
* Version alignment
## 1.1.4
* Version alignment
## 1.1.3
* Add - Types property to root export of package.json
## 1.1.2
* Change - Package exports `types` instead of `typings`
## 1.1.1
* Change - Widen range for `@openfin/core` `peerDependency`
## 1.1.0
* Change - `@openfin/core` has moved from `dependencies` to `peerDependency` so it can be overridden
## 1.0.13
* Fixed - window identity lookup could get stuck in infinite loop
## 1.0.12
* Breaking Change - Removed `OpenFinSystem.launchManifestInSecurityRealm``
* Added - `OpenFinSystem.launchManifest` which allows you to specify optional `realm` and `runtimeVersion` overrides
* Added - `OpenFinSystem.launchManifestAdvanced` which allows you to override all manifest content and runtime args
* Breaking Change - Removed `OpenFinNotifications.launchManifestInSecurityRealm`
* Added - `OpenFinNotifications.launch` which allows you to specify optional `realm` and `runtimeVersion` overrides
## 1.0.11
* Version alignment
## 1.0.10
* Fixed notifications stable version
## 1.0.9
* Add `OpenFinSystem.launchManifest` to open a manifest.
* Fixed `OpenFinSystem` manifest launching adds correct dev tools port
## 1.0.8
* Dependency Update
## 1.0.7
* Improved window lookup efficiency
## 1.0.6
* Dependency Update
## 1.0.5
* Additional error handling during `WebDriver`.`getWindows`
## 1.0.4
* Added `WebDriver.info` to get the information for the current window position, width, height, isShowing, state [maximized,minimized,normal]
## 1.0.3
* Improved the speed for window location.
* waitFor methods now skip sleeping if interval is set to 0.
## 1.0.2
* Added `WebDriver`.`waitForCondition`
```js
// Wait for element to be removed
const conditionWasMet = await WebDriver.waitForCondition(async () => {
const elem = await WebDriver.waitForElementById("result-list");
return elem === undefined;
});
```
* Added `intervalMs` param for all methods with `timeoutMs` to specify the polling interval, defaults to 200ms as before
* Added `OpenFinNotifications`.`show`
* Added `OpenFinNotifications`.`hide`
* Dependency Update
## 1.0.1
* Doc fixes
## 1.0.0
* First public release
## 0.3.10
* Version alignment
## 0.3.9
* Version alignment
## 0.3.8
* Added `globalVars` to the `globalThis.automation` object, for variables that can be access throughout the tests from global setup/teardown
## 0.3.7
* Dependency Update
## 0.3.6
* `OpenFinSystem`.`waitForReady` now looks at all platform windows to find one with `fin` runtime available
* Change `WebDriver`.`getWindows` don't skip windows with no title or url
* Fix `NodeWebDriverWindow`.`switchTo` add native window logic
* Fix `SeleniumWebDriverWindow`.`switchTo` add native window logic
* Change all `WebDriver` polling has reduced interval between requests from 1000ms to 200ms
## 0.3.5
* Reduce window switching when enumerating windows
* MacOS launch manifest directly
## 0.3.4
* `WebDriver`.`switchToWindow` now also gets the fin window and calls `bringToFront` and `setAsForeground` so that native operations can interact with it. This replaces the need for `NativeDriver`.`switchToWindow` in the `@openfin/automation-native` package.
* `OpenFinProxy` has improved conversion of array and iterable objects.
## 0.3.3
* Version alignment
## 0.3.2
* Fixed edge case in proxy when quitting platform returned null from proxy methods
## 0.3.1
* The matching for `switchToWindow`, `waitForWindow` is now stricter, if you pass a `string` it matches exactly, but you can still use a `RegExp` for partial matches. The previous behavior was to construct a RegExp from the string, but this caused issues when strings were not escape properly.
## 0.3.0
* Added `OpenFinProxy` which supports create a proxy to properties and methods of an object in the current (or identified) window instance, using WebDriver async calls. Methods which can not be access through the proxy will throw `The method '...' is not supported through the proxy`.
* `OpenFinProxy`.`fin()` can be used to access the `fin` object, it is strongly typed with the `@openfin/core` types as `FinApi<"window" | "view">`. It does not currently support listeners/event callbacks.
```js
const fin = await OpenFinProxy.fin();
const version = await fin.System.getVersion();
```
* `OpenFinProxy`.`finConnection()` can be used to access the `fin` object, the connection uses the `openfin-adapter` to create a websocket connection, the API is typed as `FinApi<"external connection">` so some of the window/view operations are not possible.
```js
const fin = await OpenFinProxy.finConnection();
const version = await fin.System.getVersion();
```
* Removed `OpenFinMe` - this class only contained wrapper fin methods
* Removed `OpenFinInterApplicationBus` - this class only contained wrapper fin methods
* Removed `OpenFinSystem`.`getVersion` - this method was only a wrapper
* Removed `OpenFinSystem`.`exit` - this method was only a wrapper
* Removed `OpenFinSystem`.`getApplicationsInfo` - this method was only a wrapper
* Removed `OpenFinSystem`.`getAllWindows` - this method was only a wrapper
* Removed `OpenFinSystem`.`getWindowsInfo` - this method was only a wrapper
* Removed `OpenFinSystem`.`getWindowDetail` - this method was only a wrapper
* Removed `OpenFinSystem`.`waitForWindow` - this method was only a wrapper
* Removed `OpenFinSystem`.`launchManifest` - this method was only a wrapper
## 0.2.11
* Added `IWebDriverElement`.`callMethod` to call methods directly on an element
* Added `IWebDriverElement`.`getStyle` to get the CSS style properties of an element
* Added `IWebDriverElement`.`setStyle` to set the CSS style properties of an element
* Added `IWebDriverElement`.`removeStyle` to remove the CSS style properties of an element
## 0.2.10
* Version alignment
## 0.2.9
* Version alignment
## 0.2.8
* `OpenFinMe`.`getIdentity` improved error handling
* `OpenFinMe`.`getIdentity` accepts optional timeout
## 0.2.7
* Refactored web drivers to share common base with improved exception handling
* `getTitle` and `getUrl` now return undefined if window is not available
* `actions` returns true if all the actions were carried out
## 0.2.6
* Fix additional exception handling in switch to window
* Fix fin method call for closeWindow
## 0.2.5
* Fix timeouts in `waitForWindow`, `callMethodUntilCondition`, `waitForObjectExisting`, `waitForElementByLocator`
* Fix `switchToWindow` no longer fails if the current window is not available.
## 0.2.4
* Version alignment
## 0.2.3
* Added `OpenFinSystem`.`launchManifestInSecurityRealm` which loads the passed manifest in a given security-realm, you can leave realm blank for no security-realm.
* Added `OpenFinNotifications`.`launchInSecurityRealm` which loads the notification center manifest and substitutes the security realm you specify, you can leave realm blank for no security-realm.
* Added `IWebDriverElement`.`setText` sets the `textContent` property of an element.
## 0.2.2
* Added `WebDriver`.`saveScreenshot` to grab current active window as image and save it, you provide folder and filename parameters, but it defaults to the `screenshotFolder` options from the CLI. The filename defaults to `YYYYMMDD - HHMMSS.MICRO - TESTNAME.png`.
## 0.2.1
* Export `IRect` and `MouseButton` type.
* Fix `WebDriver`.`waitForWindow` locatorValue type.
* Fix `WindowLocator` with RegExp fails on jest as it doesn't support `instanceof RegExp`.
* Change `WebDriver`.`getTitle` if title is empty returns `identity.name`
## 0.2.0
* Added missing selenium debug logging.
* Added `IWebElement`.`rect` to get an elements size and position.
* Added `IWebElement`.`focus` to set the keyboard focus to an element.
* Added `IWebElement`.`nativeElement` that returns the underlying native web driver element.
* Added `WebDriverKeys` for common control key enumeration.
* Added `IWebDriver`.`actions` that support sending mouse and keyboard events.
Supported WebDriverAction types are:
* `pause` - `{ duration?: number }` - Performs a pause in the actions
* `keyDown` - `{ key: string, duration?: number }` - Simulate key down to the current focused element.
* `keyUp`- `{ key: string, duration?: number }` - Simulate key up to the current focused element.
* `keyPress` `{ keys: string | string[], duration?: number }` - Shortcut combination of keyDown and keyUp to the current focused element, accepts single or multiple keys.
* `mouseMove` `{ x?: number, y?: number, origin: "pointer" | "viewport" | IWebElement, duration?: number }` - Move mouse to position on screen, relative to current position or relative to element (for element it defaults to center if no position provided, or offset from top left if position provided)
* `mouseDown` `{ button?: MouseButton }` - Simulate button down to the current mouse position.
* `mouseUp` `{ button?: MouseButton }` - Simulate button up to the current mouse position.
* `mouseClick` `{ button?: MouseButton }` - Shortcut combination of mouseDown and mouseUp for simulate click.
```javascript
const elem = await WebDriver.findElementById("my-element");
await WebDriver.actions([
// Enter some text
{ type: "keyPress", key: "tt" },
{ type: "pause", duration: 1000 },
// Correct mistake
{ type: "keyPress", key: WebDriverKeys.Backspace },
{ type: "keyPress", key: "h" },
{ type: "keyPress", key: "i" },
{ type: "keyPress", key: "s" },
{ type: "pause", duration: 1000 },
// Move to start of input
{ type: "mouseMove", origin: elem, x: 100 },
{ type: "mouseDown", button: MouseButton.Left },
// Drag highlight the content
{ type: "mouseMove", origin: elem, x: 0},
{ type: "mouseUp", button: MouseButton.Left },
{ type: "pause", duration: 1000 },
// Delete the content
{ type: "keyPress", key: WebDriverKeys.Delete },
{ type: "pause", duration: 1000 }
]);
```
## 0.1.9
* Fixed xpaths containing quotes need to be escaped for use with document.evaluate
## 0.1.8
* Version alignment
## v0.1.7
* Added `WindowLocatorTypes`.`identityString` which supports `(string | RegExp)[2]` as input to match identity name and uuid
* Change `WindowLocatorTypes`.`identity` only supports `OpenFin.Identity` as input type
* Change `WindowLocatorTypes`.`*` all other types now support `string | RegExp | (string | RegExp)[]` as input, to allow for matching multiple possibilities
* Added `OpenFinSystem`.`launchManifest` which will launch a secondary app
* Added `OpenFinNotifications`.`toggle` to show/hide notification center
## v0.1.6
* Changed dependencies to be pinned to specific versions.
* Added support for new Apply button in Home filters
* Added filters ids excludes entry called "select-all" if it is the first for new WS8 layout.
* Fixed setAttribute invalid JavaScript
* Fixed indexed elements with locators always using first element.
* Added `IWebDriverElement`.`removeAttribute`
* Added `IWebDriverElement`.`removeProperty`
* Added InterApplicationBus helper
* Updated Store helper to show home
## v0.1.5
* Change `WebDriver` `switchToWindow` removes `name` and `uuid` lookups and replaces with combined `identity` which is `uuid` and `name` combined with a comma between
* You can use exact lookups such as `internal-id-6092a291-a379-44fe-bbf8-0334c74db800,register-with-home`
* Or regex such as `.*,register-with-home` to perform a partial match
## v0.1.4
* Change `WebDriver` `switchToWindow`, now has locator parameter or `title`, `url`, `handle`, `name` or `uuid`
* Change `WebDriver` `switchToWindow` can match by string or regex for the value
* Removed `WebDriver` `switchToWindowByUrl`, use `switchToWindow` with locator
* Added `WebDriver` `getWindows` to get a list of application windows
* Added `WebDriver` `getWindow` to get the current window details
## v0.1.3
* Removed `WebDriver` `setElementAttributeByPath`, use find element and use methods on that
* Removed `WebDriver` `getElementAttributeByPath`, use find element and use methods on that
* Added `getAttribute` to `IWebDriverElement`
* Added `setAttribute` to `IWebDriverElement`
* Added `getProperty` to `IWebDriverElement`
* Added `setProperty` to `IWebDriverElement`
* Added `setHTML` to `IWebDriverElement`
## v0.1.2
* Add `getText` to `IWebDriverElement` and implementations to `NodeWebDriverElement` and `SeleniumWebDriverElement`
* Add `getHTML` to `IWebDriverElement` and implementations to `NodeWebDriverElement` and `SeleniumWebDriverElement`
* Add `isEnabled` to `IWebDriverElement` and implementations to `NodeWebDriverElement` and `SeleniumWebDriverElement`
* Add `isDisplayed` to `IWebDriverElement` and implementations to `NodeWebDriverElement` and `SeleniumWebDriverElement`
* Add `isSelected` to `IWebDriverElement` and implementations to `NodeWebDriverElement` and `SeleniumWebDriverElement`
* Add `screenshot` to `IWebDriverElement` and implementations to `NodeWebDriverElement` and `SeleniumWebDriverElement`
* Add `screenshot` to `IWebDriver` and implementations to `NodeWebDriver` and `SeleniumWebDriver`
* Add `screenshot` to `WebDriver`