@oracle/oraclejet-webdriver 18.1.5 → 19.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/elements/oj-chart/OjChart.d.ts +1 -1
- package/elements/oj-chart/OjChart.js +1 -1
- package/elements/oj-chart/OjChartBase.d.ts +21 -0
- package/elements/oj-data-grid/OjDataGridBase.d.ts +27 -1
- package/elements/oj-data-grid/OjDataGridBase.js +18 -0
- package/elements/oj-data-grid/OjDataGridBase.js.map +1 -1
- package/elements/oj-input-time/OjInputTimeBase.d.ts +18 -7
- package/elements/oj-input-time/OjInputTimeBase.js +7 -7
- package/elements/oj-list-view/OjListView.d.ts +25 -0
- package/elements/oj-list-view/OjListView.js +28 -1
- package/elements/oj-list-view/OjListView.js.map +1 -1
- package/elements/oj-list-view/OjListViewBase.d.ts +23 -0
- package/elements/oj-n-box/OjNBoxBase.d.ts +3 -0
- package/elements/oj-spark-chart/OjSparkChartBase.d.ts +2 -2
- package/elements/oj-spark-chart/OjSparkChartBase.js +2 -2
- package/elements/oj-status-meter-gauge/OjStatusMeterGauge.d.ts +2 -2
- package/elements/oj-status-meter-gauge/OjStatusMeterGauge.js +2 -2
- package/elements/oj-stream-list/OjStreamListBase.d.ts +2 -2
- package/elements/oj-tab-bar/OjTabBar.d.ts +23 -0
- package/elements/oj-tab-bar/OjTabBar.js +41 -0
- package/elements/oj-tab-bar/OjTabBar.js.map +1 -1
- package/elements/oj-tab-bar/OjTabBarBase.d.ts +20 -0
- package/elements/oj-table/OjTableBase.d.ts +8 -0
- package/elements/oj-thematic-map/OjThematicMapBase.d.ts +11 -4
- package/elements/oj-timeline/OjTimelineBase.d.ts +3 -0
- package/elements/oj-waterfall-layout/OjWaterfallLayoutBase.d.ts +8 -1
- package/elements/oj-waterfall-layout/OjWaterfallLayoutBase.js +9 -0
- package/elements/oj-waterfall-layout/OjWaterfallLayoutBase.js.map +1 -1
- package/index.d.ts +4 -7
- package/index.js +37 -9
- package/index.js.map +1 -1
- package/lib/ScreenshotManager.js +35 -2
- package/lib/ScreenshotManager.js.map +1 -1
- package/lib/busy-context-utils.d.ts +1 -0
- package/lib/busy-context-utils.js +22 -2
- package/lib/busy-context-utils.js.map +1 -1
- package/lib/driver-manager.d.ts +1 -206
- package/lib/driver-manager.js +6 -314
- package/lib/driver-manager.js.map +1 -1
- package/lib/driver-override.js +38 -5
- package/lib/driver-override.js.map +1 -1
- package/lib/file-picker-utils.js +35 -2
- package/lib/file-picker-utils.js.map +1 -1
- package/package.json +36 -30
- package/src/elements/oj-chart/OjChart.ts +1 -1
- package/src/elements/oj-chart/OjChartBase.ts +21 -0
- package/src/elements/oj-data-grid/OjDataGridBase.ts +33 -1
- package/src/elements/oj-input-time/OjInputTimeBase.ts +18 -7
- package/src/elements/oj-list-view/OjListView.ts +40 -1
- package/src/elements/oj-list-view/OjListViewBase.ts +23 -0
- package/src/elements/oj-n-box/OjNBoxBase.ts +3 -0
- package/src/elements/oj-spark-chart/OjSparkChartBase.ts +2 -2
- package/src/elements/oj-status-meter-gauge/OjStatusMeterGauge.ts +2 -2
- package/src/elements/oj-stream-list/OjStreamListBase.ts +2 -2
- package/src/elements/oj-tab-bar/OjTabBar.ts +57 -1
- package/src/elements/oj-tab-bar/OjTabBarBase.ts +20 -0
- package/src/elements/oj-table/OjTableBase.ts +8 -0
- package/src/elements/oj-thematic-map/OjThematicMapBase.ts +11 -4
- package/src/elements/oj-timeline/OjTimelineBase.ts +3 -0
- package/src/elements/oj-waterfall-layout/OjWaterfallLayoutBase.ts +11 -1
- package/src/index.ts +5 -12
- package/src/lib/busy-context-utils.ts +34 -3
- package/src/lib/driver-manager.ts +9 -350
- package/src/lib/driver-override.ts +7 -4
- package/tsconfig.json +2 -2
- package/wdtsdoc/assets/navigation.js +1 -1
- package/wdtsdoc/assets/search.js +1 -1
- package/wdtsdoc/classes/elements.OjChart.html +1 -1
- package/wdtsdoc/classes/elements.OjDataGrid.html +11 -3
- package/wdtsdoc/classes/elements.OjInputTime.html +26 -19
- package/wdtsdoc/classes/elements.OjListView.html +13 -2
- package/wdtsdoc/classes/elements.OjSparkChart.html +7 -5
- package/wdtsdoc/classes/elements.OjStatusMeterGauge.html +2 -2
- package/wdtsdoc/classes/elements.OjTabBar.html +15 -2
- package/wdtsdoc/classes/elements.OjWaterfallLayout.html +6 -2
- package/wdtsdoc/classes/elements._internal_.OjDataGridBase.html +10 -2
- package/wdtsdoc/classes/elements._internal_.OjInputTimeBase.html +26 -19
- package/wdtsdoc/classes/elements._internal_.OjSparkChartBase.html +7 -5
- package/wdtsdoc/classes/elements._internal_.OjWaterfallLayoutBase.html +6 -2
- package/wdtsdoc/classes/index.DriverManager.html +19 -9
- package/wdtsdoc/interfaces/elements._internal_.Areas.html +7 -5
- package/wdtsdoc/interfaces/elements._internal_.DndDropRows-1.html +3 -1
- package/wdtsdoc/interfaces/elements._internal_.Item.html +5 -3
- package/wdtsdoc/interfaces/elements._internal_.Links.html +7 -5
- package/wdtsdoc/interfaces/elements._internal_.LinksEndLocation.html +2 -2
- package/wdtsdoc/interfaces/elements._internal_.LinksStartLocation.html +2 -2
- package/wdtsdoc/interfaces/elements._internal_.MajorAxis-1.html +4 -3
- package/wdtsdoc/interfaces/elements._internal_.Markers.html +7 -5
- package/wdtsdoc/interfaces/elements._internal_.MinorAxis-1.html +4 -3
- package/wdtsdoc/interfaces/elements._internal_.Overview-2.html +4 -3
- package/wdtsdoc/interfaces/elements._internal_.PickerAttributes-6.html +3 -2
- package/wdtsdoc/interfaces/elements._internal_.ScrollPosition-3.html +2 -2
- package/wdtsdoc/interfaces/elements._internal_.ScrollPosition-5.html +1 -1
- package/wdtsdoc/interfaces/elements._internal_.StyleDefaults-4.html +4 -3
- package/wdtsdoc/interfaces/elements._internal_.StyleDefaults.html +5 -1
- package/wdtsdoc/interfaces/elements._internal_.StyleDefaultsCellDefaults.html +11 -8
- package/wdtsdoc/interfaces/elements._internal_.TimePicker-2.html +7 -5
- package/wdtsdoc/interfaces/elements._internal_.Translations-20.html +27 -19
- package/wdtsdoc/interfaces/elements._internal_.Translations-24.html +58 -39
- package/wdtsdoc/interfaces/elements._internal_.Translations-48.html +13 -1
- package/wdtsdoc/interfaces/elements._internal_.Translations-49.html +3 -1
- package/wdtsdoc/interfaces/elements._internal_.Translations-7.html +8 -2
- package/wdtsdoc/interfaces/elements._internal_.Translations.html +5 -2
- package/wdtsdoc/interfaces/elements._internal_.ValueFormatsLabel.html +5 -1
- package/wdtsdoc/interfaces/{index._internal_.CapabilitiesConfiguration.html → index.DriverConfiguration.html} +4 -4
- package/wdtsdoc/interfaces/index._internal_.BufferConstructor.html +1 -1
- package/wdtsdoc/interfaces/index._internal_.ZlibOptions.html +1 -1
- package/wdtsdoc/modules/index._internal_.html +0 -1
- package/wdtsdoc/modules/index.html +2 -1
- package/lib/version-check.d.ts +0 -11
- package/lib/version-check.js +0 -32
- package/lib/version-check.js.map +0 -1
- package/src/lib/version-check.ts +0 -38
package/lib/driver-manager.d.ts
CHANGED
|
@@ -1,206 +1 @@
|
|
|
1
|
-
|
|
2
|
-
interface Timeouts {
|
|
3
|
-
/**
|
|
4
|
-
* The timeout value for script execution. Default 30000
|
|
5
|
-
*/
|
|
6
|
-
script?: number;
|
|
7
|
-
/**
|
|
8
|
-
* The timeout value for page loading (and to be ready). Default 30000
|
|
9
|
-
*/
|
|
10
|
-
pageLoad?: number;
|
|
11
|
-
/**
|
|
12
|
-
* The timeout value for finding an element on the page. Default 0
|
|
13
|
-
*/
|
|
14
|
-
implicit?: number;
|
|
15
|
-
}
|
|
16
|
-
interface CapabilitiesConfiguration {
|
|
17
|
-
/**
|
|
18
|
-
* The WebDriver Capabilties for the configuration
|
|
19
|
-
*/
|
|
20
|
-
capabilities?: Capabilities | Map<string, any> | {};
|
|
21
|
-
/**
|
|
22
|
-
* The WebDriver timeout values for the configuration
|
|
23
|
-
*/
|
|
24
|
-
timeouts?: Timeouts;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Manage instances of [WebDriver](index._internal_.WebDriver.html)
|
|
28
|
-
* to be used by the tests. DriverManager
|
|
29
|
-
* allows a single place where the WebDriver instance can be configured and
|
|
30
|
-
* reused. Traditionally, tests instantiate the WebDriver instance on their own,
|
|
31
|
-
* passing configurations such as the browser to use:
|
|
32
|
-
* ```javascript
|
|
33
|
-
* let driver = new Builder().withCapabilities({
|
|
34
|
-
* browserName: "chrome"
|
|
35
|
-
* }).build()
|
|
36
|
-
* ```
|
|
37
|
-
* This boilerplate code then has to be copied to every test. Additionally, if
|
|
38
|
-
* the capabilities need to change (say, running against a different browser),
|
|
39
|
-
* that change must be applied to all test files.
|
|
40
|
-
*
|
|
41
|
-
* DriverManager addresses this problem by centralizing the place whereby
|
|
42
|
-
* the configuration is done, and persists that configuration for all
|
|
43
|
-
* subsequent requests for the WebDriver instance. The configuration only needs
|
|
44
|
-
* to be set once in a "setup" file, and tests retrieve the configured instance
|
|
45
|
-
* without needing to define anything else.
|
|
46
|
-
*
|
|
47
|
-
* A sample <code>mocha-setup.ts</code> file which configures DriverManager
|
|
48
|
-
* ```javascript
|
|
49
|
-
* import { DriverManager } from "@oracle/oraclejet-webdriver";
|
|
50
|
-
*
|
|
51
|
-
* DriverManager.registerConfig({
|
|
52
|
-
* capabilities: new Capabilities({
|
|
53
|
-
* browserName: "chrome"
|
|
54
|
-
* })
|
|
55
|
-
* })
|
|
56
|
-
* ```
|
|
57
|
-
* This setup test script should be run before any other tests.
|
|
58
|
-
* ```bash
|
|
59
|
-
* $ node node_modules/mocha/bin/mocha --require=ts-node/register mocha-setup.ts other-test.spec.ts ...
|
|
60
|
-
* ```
|
|
61
|
-
* Test files are agnostic of the driver configuration, and simply get the instance
|
|
62
|
-
* by calling <code>getDriver()</code>
|
|
63
|
-
* ```javascript
|
|
64
|
-
* import { DriverManager } from "@oracle/oraclejet-webdriver";
|
|
65
|
-
*
|
|
66
|
-
* describe("My test suite", function() {
|
|
67
|
-
* let driver: WebDriver;
|
|
68
|
-
*
|
|
69
|
-
* before(async function() {
|
|
70
|
-
* driver = await DriverManager.getDriver();
|
|
71
|
-
* })
|
|
72
|
-
* it("open a page to test", async function() {
|
|
73
|
-
* await driver.get("...")
|
|
74
|
-
* })
|
|
75
|
-
* after(async function() {
|
|
76
|
-
* await DriverManager.releaseDriver(driver);
|
|
77
|
-
* })
|
|
78
|
-
* })
|
|
79
|
-
* ```
|
|
80
|
-
*
|
|
81
|
-
* ## Set default timeouts for WebDriver from Mocha.
|
|
82
|
-
* When Mocha is used to start the WebDriver tests, there are two sets of timeout
|
|
83
|
-
* values--one from Mocha and one from WebDriver. This causes some confusion as
|
|
84
|
-
* the command-line argument <code>--timeout=nnn</code> is typically the only one
|
|
85
|
-
* set and assumed to be the only timeout value in play. However, WebDriver has
|
|
86
|
-
* its own set of timeout values whose defaults are sometimes longer than what's
|
|
87
|
-
* set for Mocha. When this happens, WebDriver may be waiting on a condition to
|
|
88
|
-
* timeout, but Mocha has errored the test because its own timeout was exceeded.
|
|
89
|
-
* To ensure that WebDriver timeout conditions are properly reported to the test
|
|
90
|
-
* runner (Mocha), its timeout values must be set to a value shorter than the
|
|
91
|
-
* runner's. This is typically done in the setup test, and set to some factor of
|
|
92
|
-
* the Mocha timeout.
|
|
93
|
-
*
|
|
94
|
-
* ### Set WebDriver timeout to 1/4 of Mocha
|
|
95
|
-
* ```javascript
|
|
96
|
-
* const mochaTimeout = this.timeouts();
|
|
97
|
-
* const wdTimeout = mochaTimeout / 4;
|
|
98
|
-
* DriverManager.registerConfig({
|
|
99
|
-
* timeouts: {
|
|
100
|
-
* pageLoad: wdTimeout,
|
|
101
|
-
* script: wdTimeout,
|
|
102
|
-
* implicit: wdTimeout
|
|
103
|
-
* }
|
|
104
|
-
* });
|
|
105
|
-
* ```
|
|
106
|
-
*
|
|
107
|
-
*/
|
|
108
|
-
export declare class DriverManager {
|
|
109
|
-
/**
|
|
110
|
-
* Optionally set the {@link Builder}
|
|
111
|
-
* instance used by DriverManager to create WebDriver.
|
|
112
|
-
* The Builder allows different settings for thigns such as the remote server,
|
|
113
|
-
* proxies, and other runtime options often needed when running in distributed
|
|
114
|
-
* environments.
|
|
115
|
-
* The instance can be preconfigured with capabilities, and any additional
|
|
116
|
-
* capabilities from [[registerConfig]] will also be applied during the
|
|
117
|
-
* creation process. If no Builder is explicitly passed, a default one will
|
|
118
|
-
* be used.
|
|
119
|
-
* If setting a custom Builder, this function must be called before the first
|
|
120
|
-
* test calls [[getDriver]], and must only be called once per test run. If called
|
|
121
|
-
* multiple times or after [[getDriver]], an error will be thrown.
|
|
122
|
-
* @param b A builder instance
|
|
123
|
-
*/
|
|
124
|
-
static setBuilder(b: Builder): void;
|
|
125
|
-
/**
|
|
126
|
-
* Register a configuration for WebDriver instances. Configurations consist of
|
|
127
|
-
* {@link Capabilities} and/or {@link Timeouts}.
|
|
128
|
-
* This configuration is used by [[getDriver]] to retrieve a configured WebDriver
|
|
129
|
-
* instance.
|
|
130
|
-
* @param config The driver configuration
|
|
131
|
-
* @param name An optional name to assocaite with the config. If no name is given,
|
|
132
|
-
* the config will be the default.
|
|
133
|
-
*
|
|
134
|
-
* ### Register a default config
|
|
135
|
-
* ```javascript
|
|
136
|
-
* DriverManager.registerConfig(
|
|
137
|
-
* {
|
|
138
|
-
* capabilities: new Capabilities({
|
|
139
|
-
* browserName: "chrome"
|
|
140
|
-
* }),
|
|
141
|
-
* timeouts: {
|
|
142
|
-
* implicit: 5000
|
|
143
|
-
* }
|
|
144
|
-
* }
|
|
145
|
-
* );
|
|
146
|
-
* ```
|
|
147
|
-
* ### Register a Firefox config
|
|
148
|
-
* ```javascript
|
|
149
|
-
* DriverManager.registerConfig(
|
|
150
|
-
* {
|
|
151
|
-
* capabilities: new Capabilities({
|
|
152
|
-
* browserName: "firefox",
|
|
153
|
-
* hideAlerts: true
|
|
154
|
-
* })
|
|
155
|
-
* },
|
|
156
|
-
* "firefox-no-alerts"
|
|
157
|
-
* );
|
|
158
|
-
* ```
|
|
159
|
-
*/
|
|
160
|
-
static registerConfig(config: CapabilitiesConfiguration, name?: string): void;
|
|
161
|
-
/**
|
|
162
|
-
* Get a {@link WebDriver}
|
|
163
|
-
* instance for a given configuration. If no configName is given, the returned
|
|
164
|
-
* driver will use the default configuration.
|
|
165
|
-
* @see [[registerConfig]]
|
|
166
|
-
*
|
|
167
|
-
* ### Get driver with default capabilities
|
|
168
|
-
* ```javascript
|
|
169
|
-
* let driver = await DriverManager.getDriver();
|
|
170
|
-
* ```
|
|
171
|
-
* ### Configure and get Firefox driver
|
|
172
|
-
* ```javascript
|
|
173
|
-
* // mocha-setup.ts
|
|
174
|
-
* DriverManager.registerConfig(
|
|
175
|
-
* {
|
|
176
|
-
* browserName: "firefox"
|
|
177
|
-
* },
|
|
178
|
-
* "firefox-config");
|
|
179
|
-
* // test.spec.ts
|
|
180
|
-
* let driver = await DriverManager.getDriver("firefox-config");
|
|
181
|
-
* ```
|
|
182
|
-
* @param configName An optional configuration name, registered through
|
|
183
|
-
* [[registerConfig]], whose set will be applied to the driver instance. If no
|
|
184
|
-
* name is given, the default configuration with the "chrome" browser
|
|
185
|
-
* will be used. If the given configName doesn't exist, an error will be thrown.
|
|
186
|
-
* @return A Promise that resolves to a WebDriver instance, configured with
|
|
187
|
-
* custom capabilities for the given configName, or the default capabilities
|
|
188
|
-
* if none is specified.
|
|
189
|
-
*/
|
|
190
|
-
static getDriver(configName?: string): Promise<WebDriver>;
|
|
191
|
-
/**
|
|
192
|
-
* Gets the current driver instance, if one exists, otherwise create and
|
|
193
|
-
* return the default one. This method is useful for test setups which evaluate
|
|
194
|
-
* the outcome of the previous test to capture screenshots on failures. After-
|
|
195
|
-
* scripts call <code>getCurrentDriver</code> to get the instance of the driver
|
|
196
|
-
* that experienced the test failure, then capture the screenshot from it.
|
|
197
|
-
*/
|
|
198
|
-
static getCurrentDriver(): Promise<WebDriver>;
|
|
199
|
-
/**
|
|
200
|
-
* Release the WebDriver instance from use. Called when each test is done
|
|
201
|
-
* with its driver usage, typicall, in the Mocha <code>after</code> function.
|
|
202
|
-
* @param driver The WebDriver instance
|
|
203
|
-
*/
|
|
204
|
-
static releaseDriver(driver: WebDriver): void;
|
|
205
|
-
}
|
|
206
|
-
export {};
|
|
1
|
+
export { DriverManager, type DriverConfiguration } from '@oracle/oraclejet-selenium-driver/DriverManager';
|
package/lib/driver-manager.js
CHANGED
|
@@ -1,319 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DriverManager = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
4
|
+
/*
|
|
5
|
+
* Although DriverManager has moved to oraclejet-selenium-driver package, re-export
|
|
6
|
+
* from its original location in case other projects are importing it directly from
|
|
7
|
+
* this folder.
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* @private
|
|
11
|
-
*/
|
|
12
|
-
const defaultCapabilities = new selenium_webdriver_1.Capabilities({
|
|
13
|
-
autoWebview: true,
|
|
14
|
-
browserName: 'chrome'
|
|
15
|
-
});
|
|
16
|
-
/**
|
|
17
|
-
* @private
|
|
18
|
-
*/
|
|
19
|
-
const defaultTimeouts = {
|
|
20
|
-
implicit: 0,
|
|
21
|
-
pageLoad: 30000,
|
|
22
|
-
script: 30000
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* @private
|
|
26
|
-
*/
|
|
27
|
-
const configs = {};
|
|
28
|
-
/**
|
|
29
|
-
* @private
|
|
30
|
-
*/
|
|
31
|
-
let currentInstance = {
|
|
32
|
-
configName: undefined,
|
|
33
|
-
driver: undefined
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* The delay, in milliseconds, that the manager will wait after the driver is
|
|
37
|
-
* release to see if there are pending requests for a driver instance. If no
|
|
38
|
-
* requests exist, then the driver is closed, and subsequent requests will
|
|
39
|
-
* receive a new instance.
|
|
40
|
-
* @private
|
|
41
|
-
*/
|
|
42
|
-
const quitDelay = 500;
|
|
43
|
-
/**
|
|
44
|
-
* @private
|
|
45
|
-
*/
|
|
46
|
-
let builder;
|
|
47
|
-
/**
|
|
48
|
-
* The NodeJS.Timer used to cleanup the driver instance if no subsequent test
|
|
49
|
-
* asks for the driver. The type (NodeJS.Timer) cannot be defined here because
|
|
50
|
-
* typedoc cannot resolve the NodeJS namespace, so we infer it by calling
|
|
51
|
-
* setTimeout instead.
|
|
52
|
-
* @private
|
|
53
|
-
*/
|
|
54
|
-
let releaseTimer = setTimeout(() => true, 0);
|
|
55
|
-
/**
|
|
56
|
-
* @private
|
|
57
|
-
*/
|
|
58
|
-
let quitPromise = Promise.resolve();
|
|
59
|
-
/**
|
|
60
|
-
* Manage instances of [WebDriver](index._internal_.WebDriver.html)
|
|
61
|
-
* to be used by the tests. DriverManager
|
|
62
|
-
* allows a single place where the WebDriver instance can be configured and
|
|
63
|
-
* reused. Traditionally, tests instantiate the WebDriver instance on their own,
|
|
64
|
-
* passing configurations such as the browser to use:
|
|
65
|
-
* ```javascript
|
|
66
|
-
* let driver = new Builder().withCapabilities({
|
|
67
|
-
* browserName: "chrome"
|
|
68
|
-
* }).build()
|
|
69
|
-
* ```
|
|
70
|
-
* This boilerplate code then has to be copied to every test. Additionally, if
|
|
71
|
-
* the capabilities need to change (say, running against a different browser),
|
|
72
|
-
* that change must be applied to all test files.
|
|
73
|
-
*
|
|
74
|
-
* DriverManager addresses this problem by centralizing the place whereby
|
|
75
|
-
* the configuration is done, and persists that configuration for all
|
|
76
|
-
* subsequent requests for the WebDriver instance. The configuration only needs
|
|
77
|
-
* to be set once in a "setup" file, and tests retrieve the configured instance
|
|
78
|
-
* without needing to define anything else.
|
|
79
|
-
*
|
|
80
|
-
* A sample <code>mocha-setup.ts</code> file which configures DriverManager
|
|
81
|
-
* ```javascript
|
|
82
|
-
* import { DriverManager } from "@oracle/oraclejet-webdriver";
|
|
83
|
-
*
|
|
84
|
-
* DriverManager.registerConfig({
|
|
85
|
-
* capabilities: new Capabilities({
|
|
86
|
-
* browserName: "chrome"
|
|
87
|
-
* })
|
|
88
|
-
* })
|
|
89
|
-
* ```
|
|
90
|
-
* This setup test script should be run before any other tests.
|
|
91
|
-
* ```bash
|
|
92
|
-
* $ node node_modules/mocha/bin/mocha --require=ts-node/register mocha-setup.ts other-test.spec.ts ...
|
|
93
|
-
* ```
|
|
94
|
-
* Test files are agnostic of the driver configuration, and simply get the instance
|
|
95
|
-
* by calling <code>getDriver()</code>
|
|
96
|
-
* ```javascript
|
|
97
|
-
* import { DriverManager } from "@oracle/oraclejet-webdriver";
|
|
98
|
-
*
|
|
99
|
-
* describe("My test suite", function() {
|
|
100
|
-
* let driver: WebDriver;
|
|
101
|
-
*
|
|
102
|
-
* before(async function() {
|
|
103
|
-
* driver = await DriverManager.getDriver();
|
|
104
|
-
* })
|
|
105
|
-
* it("open a page to test", async function() {
|
|
106
|
-
* await driver.get("...")
|
|
107
|
-
* })
|
|
108
|
-
* after(async function() {
|
|
109
|
-
* await DriverManager.releaseDriver(driver);
|
|
110
|
-
* })
|
|
111
|
-
* })
|
|
112
|
-
* ```
|
|
113
|
-
*
|
|
114
|
-
* ## Set default timeouts for WebDriver from Mocha.
|
|
115
|
-
* When Mocha is used to start the WebDriver tests, there are two sets of timeout
|
|
116
|
-
* values--one from Mocha and one from WebDriver. This causes some confusion as
|
|
117
|
-
* the command-line argument <code>--timeout=nnn</code> is typically the only one
|
|
118
|
-
* set and assumed to be the only timeout value in play. However, WebDriver has
|
|
119
|
-
* its own set of timeout values whose defaults are sometimes longer than what's
|
|
120
|
-
* set for Mocha. When this happens, WebDriver may be waiting on a condition to
|
|
121
|
-
* timeout, but Mocha has errored the test because its own timeout was exceeded.
|
|
122
|
-
* To ensure that WebDriver timeout conditions are properly reported to the test
|
|
123
|
-
* runner (Mocha), its timeout values must be set to a value shorter than the
|
|
124
|
-
* runner's. This is typically done in the setup test, and set to some factor of
|
|
125
|
-
* the Mocha timeout.
|
|
126
|
-
*
|
|
127
|
-
* ### Set WebDriver timeout to 1/4 of Mocha
|
|
128
|
-
* ```javascript
|
|
129
|
-
* const mochaTimeout = this.timeouts();
|
|
130
|
-
* const wdTimeout = mochaTimeout / 4;
|
|
131
|
-
* DriverManager.registerConfig({
|
|
132
|
-
* timeouts: {
|
|
133
|
-
* pageLoad: wdTimeout,
|
|
134
|
-
* script: wdTimeout,
|
|
135
|
-
* implicit: wdTimeout
|
|
136
|
-
* }
|
|
137
|
-
* });
|
|
138
|
-
* ```
|
|
139
|
-
*
|
|
140
|
-
*/
|
|
141
|
-
class DriverManager {
|
|
142
|
-
/**
|
|
143
|
-
* Optionally set the {@link Builder}
|
|
144
|
-
* instance used by DriverManager to create WebDriver.
|
|
145
|
-
* The Builder allows different settings for thigns such as the remote server,
|
|
146
|
-
* proxies, and other runtime options often needed when running in distributed
|
|
147
|
-
* environments.
|
|
148
|
-
* The instance can be preconfigured with capabilities, and any additional
|
|
149
|
-
* capabilities from [[registerConfig]] will also be applied during the
|
|
150
|
-
* creation process. If no Builder is explicitly passed, a default one will
|
|
151
|
-
* be used.
|
|
152
|
-
* If setting a custom Builder, this function must be called before the first
|
|
153
|
-
* test calls [[getDriver]], and must only be called once per test run. If called
|
|
154
|
-
* multiple times or after [[getDriver]], an error will be thrown.
|
|
155
|
-
* @param b A builder instance
|
|
156
|
-
*/
|
|
157
|
-
static setBuilder(b) {
|
|
158
|
-
if (builder) {
|
|
159
|
-
throw Error('DriverManager Builder instance has already been set, and cannot be set again');
|
|
160
|
-
}
|
|
161
|
-
builder = b;
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Register a configuration for WebDriver instances. Configurations consist of
|
|
165
|
-
* {@link Capabilities} and/or {@link Timeouts}.
|
|
166
|
-
* This configuration is used by [[getDriver]] to retrieve a configured WebDriver
|
|
167
|
-
* instance.
|
|
168
|
-
* @param config The driver configuration
|
|
169
|
-
* @param name An optional name to assocaite with the config. If no name is given,
|
|
170
|
-
* the config will be the default.
|
|
171
|
-
*
|
|
172
|
-
* ### Register a default config
|
|
173
|
-
* ```javascript
|
|
174
|
-
* DriverManager.registerConfig(
|
|
175
|
-
* {
|
|
176
|
-
* capabilities: new Capabilities({
|
|
177
|
-
* browserName: "chrome"
|
|
178
|
-
* }),
|
|
179
|
-
* timeouts: {
|
|
180
|
-
* implicit: 5000
|
|
181
|
-
* }
|
|
182
|
-
* }
|
|
183
|
-
* );
|
|
184
|
-
* ```
|
|
185
|
-
* ### Register a Firefox config
|
|
186
|
-
* ```javascript
|
|
187
|
-
* DriverManager.registerConfig(
|
|
188
|
-
* {
|
|
189
|
-
* capabilities: new Capabilities({
|
|
190
|
-
* browserName: "firefox",
|
|
191
|
-
* hideAlerts: true
|
|
192
|
-
* })
|
|
193
|
-
* },
|
|
194
|
-
* "firefox-no-alerts"
|
|
195
|
-
* );
|
|
196
|
-
* ```
|
|
197
|
-
*/
|
|
198
|
-
static registerConfig(config, name) {
|
|
199
|
-
configs[name || defaultConfigName] = config;
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Get a {@link WebDriver}
|
|
203
|
-
* instance for a given configuration. If no configName is given, the returned
|
|
204
|
-
* driver will use the default configuration.
|
|
205
|
-
* @see [[registerConfig]]
|
|
206
|
-
*
|
|
207
|
-
* ### Get driver with default capabilities
|
|
208
|
-
* ```javascript
|
|
209
|
-
* let driver = await DriverManager.getDriver();
|
|
210
|
-
* ```
|
|
211
|
-
* ### Configure and get Firefox driver
|
|
212
|
-
* ```javascript
|
|
213
|
-
* // mocha-setup.ts
|
|
214
|
-
* DriverManager.registerConfig(
|
|
215
|
-
* {
|
|
216
|
-
* browserName: "firefox"
|
|
217
|
-
* },
|
|
218
|
-
* "firefox-config");
|
|
219
|
-
* // test.spec.ts
|
|
220
|
-
* let driver = await DriverManager.getDriver("firefox-config");
|
|
221
|
-
* ```
|
|
222
|
-
* @param configName An optional configuration name, registered through
|
|
223
|
-
* [[registerConfig]], whose set will be applied to the driver instance. If no
|
|
224
|
-
* name is given, the default configuration with the "chrome" browser
|
|
225
|
-
* will be used. If the given configName doesn't exist, an error will be thrown.
|
|
226
|
-
* @return A Promise that resolves to a WebDriver instance, configured with
|
|
227
|
-
* custom capabilities for the given configName, or the default capabilities
|
|
228
|
-
* if none is specified.
|
|
229
|
-
*/
|
|
230
|
-
static async getDriver(configName) {
|
|
231
|
-
clearTimeout(releaseTimer);
|
|
232
|
-
configName = configName || defaultConfigName;
|
|
233
|
-
if (configName === currentInstance.configName) {
|
|
234
|
-
// Test if current driver is still valid
|
|
235
|
-
try {
|
|
236
|
-
if (currentInstance.driver) {
|
|
237
|
-
await currentInstance.driver.getCurrentUrl();
|
|
238
|
-
return currentInstance.driver;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
catch (ex) { }
|
|
242
|
-
}
|
|
243
|
-
quitCurrentDriver();
|
|
244
|
-
return createDriver(configName);
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Gets the current driver instance, if one exists, otherwise create and
|
|
248
|
-
* return the default one. This method is useful for test setups which evaluate
|
|
249
|
-
* the outcome of the previous test to capture screenshots on failures. After-
|
|
250
|
-
* scripts call <code>getCurrentDriver</code> to get the instance of the driver
|
|
251
|
-
* that experienced the test failure, then capture the screenshot from it.
|
|
252
|
-
*/
|
|
253
|
-
static async getCurrentDriver() {
|
|
254
|
-
return DriverManager.getDriver(currentInstance.configName);
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* Release the WebDriver instance from use. Called when each test is done
|
|
258
|
-
* with its driver usage, typicall, in the Mocha <code>after</code> function.
|
|
259
|
-
* @param driver The WebDriver instance
|
|
260
|
-
*/
|
|
261
|
-
static releaseDriver(driver) {
|
|
262
|
-
clearTimeout(releaseTimer);
|
|
263
|
-
// Wait for the delay to quit the driver. If [getDriver] was called before
|
|
264
|
-
// the timeout expired, then it will have cleared the timeout so that the
|
|
265
|
-
// instance isn't closed.
|
|
266
|
-
releaseTimer = setTimeout(() => quitDriver(driver), quitDelay);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
exports.DriverManager = DriverManager;
|
|
270
|
-
DriverManager.registerConfig({ capabilities: defaultCapabilities, timeouts: defaultTimeouts });
|
|
271
|
-
/**
|
|
272
|
-
* Create a WebDriver instance from the given configuration name. The config should
|
|
273
|
-
* already be registered via [registerConfig].
|
|
274
|
-
* @param configName The configuration name used to retrieve the configuration
|
|
275
|
-
* object for the driver instance
|
|
276
|
-
* @return A Promise which resolves to the configured WebDriver instance
|
|
277
|
-
* @private
|
|
278
|
-
*/
|
|
279
|
-
function createDriver(configName) {
|
|
280
|
-
const config = configs[configName];
|
|
281
|
-
if (!config) {
|
|
282
|
-
throw Error(`No driver configuration exists for "${configName}"`);
|
|
283
|
-
}
|
|
284
|
-
// Merge default capabilities with custom ones
|
|
285
|
-
const caps = new selenium_webdriver_1.Capabilities(configs[defaultConfigName].capabilities);
|
|
286
|
-
if (config.capabilities) {
|
|
287
|
-
caps.merge(config.capabilities);
|
|
288
|
-
}
|
|
289
|
-
// Merge default timeouts with custom ones
|
|
290
|
-
const timeouts = Object.assign({}, configs[defaultConfigName].timeouts, config.timeouts);
|
|
291
|
-
if (!builder) {
|
|
292
|
-
builder = new selenium_webdriver_1.Builder();
|
|
293
|
-
}
|
|
294
|
-
return quitPromise.then(async () => {
|
|
295
|
-
const driver = builder.withCapabilities(caps).build();
|
|
296
|
-
currentInstance = { configName, driver };
|
|
297
|
-
await driver.manage().setTimeouts(timeouts);
|
|
298
|
-
return driver;
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* @private
|
|
303
|
-
*/
|
|
304
|
-
function quitCurrentDriver() {
|
|
305
|
-
quitDriver(currentInstance.driver);
|
|
306
|
-
}
|
|
307
|
-
/**
|
|
308
|
-
* @private
|
|
309
|
-
*/
|
|
310
|
-
function quitDriver(driver) {
|
|
311
|
-
if (driver) {
|
|
312
|
-
currentInstance = {
|
|
313
|
-
configName: undefined,
|
|
314
|
-
driver: undefined
|
|
315
|
-
};
|
|
316
|
-
quitPromise = driver.quit().catch((ex) => console.warn(ex));
|
|
317
|
-
}
|
|
318
|
-
}
|
|
9
|
+
var DriverManager_1 = require("@oracle/oraclejet-selenium-driver/DriverManager");
|
|
10
|
+
Object.defineProperty(exports, "DriverManager", { enumerable: true, get: function () { return DriverManager_1.DriverManager; } });
|
|
319
11
|
//# sourceMappingURL=driver-manager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driver-manager.js","sourceRoot":"","sources":["../src/lib/driver-manager.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"driver-manager.js","sourceRoot":"","sources":["../src/lib/driver-manager.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,iFAGyD;AAFvD,8GAAA,aAAa,OAAA"}
|
package/lib/driver-override.js
CHANGED
|
@@ -1,9 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.register = register;
|
|
4
37
|
// @ts-nocheck
|
|
5
38
|
const selenium_webdriver_1 = require("selenium-webdriver");
|
|
6
|
-
const WebDriverErrors = require("selenium-webdriver/lib/error");
|
|
39
|
+
const WebDriverErrors = __importStar(require("selenium-webdriver/lib/error"));
|
|
7
40
|
// Import OjWebElement directly from its file rather than through
|
|
8
41
|
// 'elements' package, to avoid circular dependency (elements will
|
|
9
42
|
// call to register themselves upon loading)
|
|
@@ -70,10 +103,10 @@ selenium_webdriver_1.WebDriver.prototype.executeAsyncScript = wrapExecuteScript(
|
|
|
70
103
|
function getWebDriverErrors() {
|
|
71
104
|
return Object.keys(WebDriverErrors)
|
|
72
105
|
.filter((c) => c.match(/^[A-Z].+Error$/))
|
|
73
|
-
.reduce((accum, className) => {
|
|
74
|
-
accum
|
|
75
|
-
|
|
76
|
-
}, {});
|
|
106
|
+
.reduce((accum, className) => ({
|
|
107
|
+
...accum,
|
|
108
|
+
[className]: new WebDriverErrors[className]()
|
|
109
|
+
}), {});
|
|
77
110
|
}
|
|
78
111
|
/**
|
|
79
112
|
* Create a wrapper for findElement()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driver-override.js","sourceRoot":"","sources":["../src/lib/driver-override.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"driver-override.js","sourceRoot":"","sources":["../src/lib/driver-override.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,4BAKC;AAtBD,cAAc;AACd,2DAA8F;AAC9F,8EAAgE;AAEhE,iEAAiE;AACjE,kEAAkE;AAClE,4CAA4C;AAC5C,2DAAyE;AACzE,mDAAiD;AACjD,6DAA4D;AAG5D;;;;GAIG;AACH,SAAgB,QAAQ,CACtB,OAAe,EACf,IAAqE;IAErE,kBAAkB,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;;;;GAQG;AACH,IAAI,aAAa,GAAG,KAAK,CAAC;AAE1B;;;;;GAKG;AACH,MAAM,kBAAkB;IACtB;;;;OAIG;IACI,MAAM,CAAC,QAAQ,CACpB,OAAe,EACf,IAAqE;QAErE,kBAAkB,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,GAAG,IAAI,CAAC;IAChE,CAAC;IACD;;;;;OAKG;IACI,MAAM,CAAC,GAAG,CACf,OAAe;QAEf,OAAO,kBAAkB,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IAChE,CAAC;;AACD;;GAEG;AACY,+BAAY,GAEvB,EAAE,CAAC;AAGT,8BAAS,CAAC,SAAS,CAAC,WAAW,GAAG,eAAe,CAAC,8BAAS,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;AACnF,8BAAS,CAAC,SAAS,CAAC,YAAY,GAAG,gBAAgB,CAAC,8BAAS,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;AAEtF,+BAAU,CAAC,SAAS,CAAC,WAAW,GAAG,eAAe,CAAC,+BAAU,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;AACrF,+BAAU,CAAC,SAAS,CAAC,YAAY,GAAG,gBAAgB,CAAC,+BAAU,CAAC,SAAS,CA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AAA,8BAAc,EAAC,GAAG,CAAC,CAAC;wBAChC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;oBAC1C,CAAC;oBACD,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACpB,CAAC;gBACD,OAAO,CAAC,IAAI,CAAC,6CAA6C,QAAQ,EAAE,CAAC,CAAC;gBACtE,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACvC,CAAC;YACD,MAAM,EAAE,CAAC;QACX,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,KAAK,UAAU,SAAS,CAAC,MAAiB;IACxC,OAAO,IAAA,yCAAoB,EAAC,MAAM,CAAC,CAAC;AACtC,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,KAAK,UAAU,iBAAiB,CAC9B,EAAc,EACd,SAAkB,EAClB,QAAuB,EACvB,aAAsB;IAEtB,uEAAuE;IACvE,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,UAAU,EAAE,CAAC;IACtC,MAAM,IAAI,GAAG,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,2BAAY,CAAC;IAC7D,OAAO,IAAI,IAAI,CAAC,EAAE,EAAE;QAClB,SAAS;QACT,aAAa;QACb,QAAQ;QACR,OAAO;KACR,CAAC,CAAC;AACL,CAAC"}
|
package/lib/file-picker-utils.js
CHANGED
|
@@ -1,8 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.doSelect = exports.setupPickFiles = void 0;
|
|
4
|
-
const fs = require("fs");
|
|
5
|
-
const path = require("path");
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
6
39
|
const busy_context_utils_1 = require("./busy-context-utils");
|
|
7
40
|
const filestoreName = '__oj_filepicker_files';
|
|
8
41
|
const filenamePrefix = 'file_';
|