@oracle/oraclejet-webdriver 16.1.4 → 17.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/OjWebElement.js +2 -26
- package/elements/OjWebElement.js.map +1 -1
- package/elements/OjWebElement.ts +6 -40
- package/elements/oj-chart/OjChartBase.ts +8 -0
- package/elements/oj-checkboxset/OjCheckboxset.js +11 -12
- package/elements/oj-checkboxset/OjCheckboxset.js.map +1 -1
- package/elements/oj-checkboxset/OjCheckboxset.ts +14 -14
- package/elements/oj-combobox-many/OjComboboxMany.js +11 -20
- package/elements/oj-combobox-many/OjComboboxMany.js.map +1 -1
- package/elements/oj-combobox-many/OjComboboxMany.ts +14 -22
- package/elements/oj-combobox-one/OjComboboxOne.js +9 -18
- package/elements/oj-combobox-one/OjComboboxOne.js.map +1 -1
- package/elements/oj-combobox-one/OjComboboxOne.ts +12 -20
- package/elements/oj-data-grid/OjDataGridBase.ts +24 -0
- package/elements/oj-date-picker/OjDatePickerBase.js +20 -20
- package/elements/oj-date-picker/OjDatePickerBase.ts +53 -20
- package/elements/oj-date-time-picker/OjDateTimePickerBase.js +16 -16
- package/elements/oj-date-time-picker/OjDateTimePickerBase.ts +48 -16
- package/elements/oj-diagram/OjDiagramBase.ts +4 -0
- package/elements/oj-file-picker/OjFilePicker.js +90 -24
- package/elements/oj-file-picker/OjFilePicker.js.map +1 -1
- package/elements/oj-file-picker/OjFilePicker.ts +101 -27
- package/elements/oj-input-date/OjInputDateBase.js +7 -7
- package/elements/oj-input-date/OjInputDateBase.ts +37 -7
- package/elements/oj-input-date-time/OjInputDateTimeBase.js +7 -7
- package/elements/oj-input-date-time/OjInputDateTimeBase.ts +37 -7
- package/elements/oj-list-view/OjListView.js +6 -6
- package/elements/oj-list-view/OjListView.js.map +1 -1
- package/elements/oj-list-view/OjListView.ts +9 -8
- package/elements/oj-navigation-list/OjNavigationList.js +8 -10
- package/elements/oj-navigation-list/OjNavigationList.js.map +1 -1
- package/elements/oj-navigation-list/OjNavigationList.ts +11 -12
- package/elements/oj-navigation-list/OjNavigationListBase.js +2 -2
- package/elements/oj-navigation-list/OjNavigationListBase.ts +3 -2
- package/elements/oj-popup/OjPopupBase.js +1 -1
- package/elements/oj-popup/OjPopupBase.ts +1 -1
- package/elements/oj-row-expander/OjRowExpanderBase.ts +4 -0
- package/elements/oj-select-many/OjSelectMany.js +11 -20
- package/elements/oj-select-many/OjSelectMany.js.map +1 -1
- package/elements/oj-select-many/OjSelectMany.ts +14 -22
- package/elements/oj-select-one/OjSelectOne.js +9 -17
- package/elements/oj-select-one/OjSelectOne.js.map +1 -1
- package/elements/oj-select-one/OjSelectOne.ts +12 -19
- package/elements/oj-select-single/OjSelectSingle.js +7 -14
- package/elements/oj-select-single/OjSelectSingle.js.map +1 -1
- package/elements/oj-select-single/OjSelectSingle.ts +10 -16
- package/elements/oj-stream-list/OjStreamList.js +28 -33
- package/elements/oj-stream-list/OjStreamList.js.map +1 -1
- package/elements/oj-stream-list/OjStreamList.ts +28 -34
- package/elements/oj-sunburst/OjSunburstBase.ts +8 -0
- package/elements/oj-swipe-actions/OjSwipeActions.js +7 -10
- package/elements/oj-swipe-actions/OjSwipeActions.js.map +1 -1
- package/elements/oj-swipe-actions/OjSwipeActions.ts +11 -15
- package/elements/oj-tab-bar/OjTabBarBase.ts +1 -0
- package/elements/oj-table/OjTable.js +100 -81
- package/elements/oj-table/OjTable.js.map +1 -1
- package/elements/oj-table/OjTable.ts +146 -97
- package/elements/oj-table/OjTableBase.js +9 -0
- package/elements/oj-table/OjTableBase.js.map +1 -1
- package/elements/oj-table/OjTableBase.ts +10 -0
- package/elements/oj-tree-view/OjTreeView.js +25 -29
- package/elements/oj-tree-view/OjTreeView.js.map +1 -1
- package/elements/oj-tree-view/OjTreeView.ts +34 -35
- package/elements/oj-treemap/OjTreemapBase.ts +8 -0
- package/index.js +28 -139
- package/index.js.map +1 -1
- package/index.ts +29 -151
- package/lib/busy-context-utils.js +28 -46
- package/lib/busy-context-utils.js.map +1 -1
- package/lib/busy-context-utils.ts +39 -48
- package/lib/dataprovider-utils.js +24 -28
- package/lib/dataprovider-utils.js.map +1 -1
- package/lib/dataprovider-utils.ts +28 -31
- package/lib/no-require-jet.js +12 -0
- package/lib/no-require-jet.js.map +1 -0
- package/lib/no-require-jet.ts +8 -0
- package/lib/oj-module-proxy.js +113 -0
- package/lib/oj-module-proxy.js.map +1 -0
- package/lib/oj-module-proxy.ts +123 -0
- package/lib/viewmodel-utils.js +99 -0
- package/lib/viewmodel-utils.js.map +1 -0
- package/lib/viewmodel-utils.ts +107 -0
- package/package.json +6 -6
- package/tsconfig.json +2 -1
- package/wdtsdoc/assets/navigation.js +1 -1
- package/wdtsdoc/assets/search.js +1 -1
- package/wdtsdoc/classes/elements.OjAccordion.html +2 -2
- package/wdtsdoc/classes/elements.OjActionCard.html +2 -2
- package/wdtsdoc/classes/elements.OjButton.html +2 -2
- package/wdtsdoc/classes/elements.OjButtonsetMany.html +2 -2
- package/wdtsdoc/classes/elements.OjButtonsetOne.html +2 -2
- package/wdtsdoc/classes/elements.OjChart.html +2 -2
- package/wdtsdoc/classes/elements.OjCheckboxset.html +2 -2
- package/wdtsdoc/classes/elements.OjCollapsible.html +2 -2
- package/wdtsdoc/classes/elements.OjColorPalette.html +2 -2
- package/wdtsdoc/classes/elements.OjColorSpectrum.html +2 -2
- package/wdtsdoc/classes/elements.OjComboboxMany.html +2 -2
- package/wdtsdoc/classes/elements.OjComboboxOne.html +2 -2
- package/wdtsdoc/classes/elements.OjConveyorBelt.html +2 -2
- package/wdtsdoc/classes/elements.OjDataGrid.html +2 -2
- package/wdtsdoc/classes/elements.OjDatePicker.html +67 -49
- package/wdtsdoc/classes/elements.OjDateTimePicker.html +57 -42
- package/wdtsdoc/classes/elements.OjDiagram.html +2 -2
- package/wdtsdoc/classes/elements.OjDialog.html +2 -2
- package/wdtsdoc/classes/elements.OjDrawerLayout.html +2 -2
- package/wdtsdoc/classes/elements.OjDrawerPopup.html +2 -2
- package/wdtsdoc/classes/elements.OjFilePicker.html +11 -2
- package/wdtsdoc/classes/elements.OjFilmStrip.html +2 -2
- package/wdtsdoc/classes/elements.OjGantt.html +2 -2
- package/wdtsdoc/classes/elements.OjIndexer.html +2 -2
- package/wdtsdoc/classes/elements.OjInputDate.html +28 -21
- package/wdtsdoc/classes/elements.OjInputDateTime.html +28 -21
- package/wdtsdoc/classes/elements.OjInputNumber.html +2 -2
- package/wdtsdoc/classes/elements.OjInputPassword.html +2 -2
- package/wdtsdoc/classes/elements.OjInputSearch.html +2 -2
- package/wdtsdoc/classes/elements.OjInputText.html +2 -2
- package/wdtsdoc/classes/elements.OjInputTime.html +2 -2
- package/wdtsdoc/classes/elements.OjLabel.html +2 -2
- package/wdtsdoc/classes/elements.OjLedGauge.html +2 -2
- package/wdtsdoc/classes/elements.OjLegend.html +2 -2
- package/wdtsdoc/classes/elements.OjListView.html +4 -4
- package/wdtsdoc/classes/elements.OjMasonryLayout.html +2 -2
- package/wdtsdoc/classes/elements.OjMenu.html +2 -2
- package/wdtsdoc/classes/elements.OjMenuButton.html +2 -2
- package/wdtsdoc/classes/elements.OjMessage.html +2 -2
- package/wdtsdoc/classes/elements.OjMessageBanner.html +2 -2
- package/wdtsdoc/classes/elements.OjNBox.html +2 -2
- package/wdtsdoc/classes/elements.OjNavigationList.html +14 -12
- package/wdtsdoc/classes/elements.OjPagingControl.html +2 -2
- package/wdtsdoc/classes/elements.OjPictoChart.html +2 -2
- package/wdtsdoc/classes/elements.OjPopup.html +6 -5
- package/wdtsdoc/classes/elements.OjProgress.html +2 -2
- package/wdtsdoc/classes/elements.OjProgressList.html +2 -2
- package/wdtsdoc/classes/elements.OjRadioset.html +2 -2
- package/wdtsdoc/classes/elements.OjRatingGauge.html +2 -2
- package/wdtsdoc/classes/elements.OjRefresher.html +2 -2
- package/wdtsdoc/classes/elements.OjRowExpander.html +2 -2
- package/wdtsdoc/classes/elements.OjSelectMany.html +2 -2
- package/wdtsdoc/classes/elements.OjSelectOne.html +2 -2
- package/wdtsdoc/classes/elements.OjSelectSingle.html +2 -2
- package/wdtsdoc/classes/elements.OjSelector.html +2 -2
- package/wdtsdoc/classes/elements.OjSlider.html +2 -2
- package/wdtsdoc/classes/elements.OjSparkChart.html +2 -2
- package/wdtsdoc/classes/elements.OjStatusMeterGauge.html +2 -2
- package/wdtsdoc/classes/elements.OjStreamList.html +2 -2
- package/wdtsdoc/classes/elements.OjSunburst.html +2 -2
- package/wdtsdoc/classes/elements.OjSwipeActions.html +2 -2
- package/wdtsdoc/classes/elements.OjSwitch.html +2 -2
- package/wdtsdoc/classes/elements.OjTabBar.html +2 -2
- package/wdtsdoc/classes/elements.OjTable.html +27 -9
- package/wdtsdoc/classes/elements.OjTagCloud.html +2 -2
- package/wdtsdoc/classes/elements.OjTextArea.html +2 -2
- package/wdtsdoc/classes/elements.OjThematicMap.html +2 -2
- package/wdtsdoc/classes/elements.OjTimeAxis.html +2 -2
- package/wdtsdoc/classes/elements.OjTimeline.html +2 -2
- package/wdtsdoc/classes/elements.OjTrain.html +2 -2
- package/wdtsdoc/classes/elements.OjTreeView.html +5 -5
- package/wdtsdoc/classes/elements.OjTreemap.html +2 -2
- package/wdtsdoc/classes/elements.OjWaterfallLayout.html +2 -2
- package/wdtsdoc/classes/elements.OjWebElement.html +2 -2
- package/wdtsdoc/classes/index.DriverManager.html +2 -2
- package/wdtsdoc/classes/index.Expectation.html +2 -2
- package/wdtsdoc/functions/elements.ojAccordion-1.html +2 -2
- package/wdtsdoc/functions/elements.ojActionCard-1.html +2 -2
- package/wdtsdoc/functions/elements.ojButton-1.html +2 -2
- package/wdtsdoc/functions/elements.ojButtonsetMany-1.html +2 -2
- package/wdtsdoc/functions/elements.ojButtonsetOne-1.html +2 -2
- package/wdtsdoc/functions/elements.ojChart-1.html +2 -2
- package/wdtsdoc/functions/elements.ojCheckboxset-1.html +2 -2
- package/wdtsdoc/functions/elements.ojCollapsible-1.html +2 -2
- package/wdtsdoc/functions/elements.ojColorPalette-1.html +2 -2
- package/wdtsdoc/functions/elements.ojColorSpectrum-1.html +2 -2
- package/wdtsdoc/functions/elements.ojComboboxMany-1.html +2 -2
- package/wdtsdoc/functions/elements.ojComboboxOne-1.html +2 -2
- package/wdtsdoc/functions/elements.ojConveyorBelt-1.html +2 -2
- package/wdtsdoc/functions/elements.ojDataGrid-1.html +2 -2
- package/wdtsdoc/functions/elements.ojDatePicker-1.html +2 -2
- package/wdtsdoc/functions/elements.ojDateTimePicker-1.html +2 -2
- package/wdtsdoc/functions/elements.ojDiagram-1.html +2 -2
- package/wdtsdoc/functions/elements.ojDialog-1.html +2 -2
- package/wdtsdoc/functions/elements.ojDrawerLayout-1.html +2 -2
- package/wdtsdoc/functions/elements.ojDrawerPopup-1.html +2 -2
- package/wdtsdoc/functions/elements.ojFilePicker-1.html +2 -2
- package/wdtsdoc/functions/elements.ojFilmStrip-1.html +2 -2
- package/wdtsdoc/functions/elements.ojGantt-1.html +2 -2
- package/wdtsdoc/functions/elements.ojIndexer-1.html +2 -2
- package/wdtsdoc/functions/elements.ojInputDate-1.html +2 -2
- package/wdtsdoc/functions/elements.ojInputDateTime-1.html +2 -2
- package/wdtsdoc/functions/elements.ojInputNumber-1.html +2 -2
- package/wdtsdoc/functions/elements.ojInputPassword-1.html +2 -2
- package/wdtsdoc/functions/elements.ojInputSearch-1.html +2 -2
- package/wdtsdoc/functions/elements.ojInputText-1.html +2 -2
- package/wdtsdoc/functions/elements.ojInputTime-1.html +2 -2
- package/wdtsdoc/functions/elements.ojLabel-1.html +2 -2
- package/wdtsdoc/functions/elements.ojLedGauge-1.html +2 -2
- package/wdtsdoc/functions/elements.ojLegend-1.html +2 -2
- package/wdtsdoc/functions/elements.ojListView-1.html +2 -2
- package/wdtsdoc/functions/elements.ojMasonryLayout-1.html +2 -2
- package/wdtsdoc/functions/elements.ojMenu-1.html +2 -2
- package/wdtsdoc/functions/elements.ojMenuButton-1.html +2 -2
- package/wdtsdoc/functions/elements.ojMessage-1.html +2 -2
- package/wdtsdoc/functions/elements.ojMessageBanner-1.html +2 -2
- package/wdtsdoc/functions/elements.ojNBox-1.html +2 -2
- package/wdtsdoc/functions/elements.ojNavigationList-1.html +2 -2
- package/wdtsdoc/functions/elements.ojPagingControl-1.html +2 -2
- package/wdtsdoc/functions/elements.ojPictoChart-1.html +2 -2
- package/wdtsdoc/functions/elements.ojPopup-1.html +2 -2
- package/wdtsdoc/functions/elements.ojProgress-1.html +2 -2
- package/wdtsdoc/functions/elements.ojProgressList-1.html +2 -2
- package/wdtsdoc/functions/elements.ojRadioset-1.html +2 -2
- package/wdtsdoc/functions/elements.ojRatingGauge-1.html +2 -2
- package/wdtsdoc/functions/elements.ojRefresher-1.html +2 -2
- package/wdtsdoc/functions/elements.ojRowExpander-1.html +2 -2
- package/wdtsdoc/functions/elements.ojSelectMany-1.html +2 -2
- package/wdtsdoc/functions/elements.ojSelectOne-1.html +2 -2
- package/wdtsdoc/functions/elements.ojSelectSingle-1.html +2 -2
- package/wdtsdoc/functions/elements.ojSelector-1.html +2 -2
- package/wdtsdoc/functions/elements.ojSlider-1.html +2 -2
- package/wdtsdoc/functions/elements.ojSparkChart-1.html +2 -2
- package/wdtsdoc/functions/elements.ojStatusMeterGauge-1.html +2 -2
- package/wdtsdoc/functions/elements.ojStreamList-1.html +2 -2
- package/wdtsdoc/functions/elements.ojSunburst-1.html +2 -2
- package/wdtsdoc/functions/elements.ojSwipeActions-1.html +2 -2
- package/wdtsdoc/functions/elements.ojSwitch-1.html +2 -2
- package/wdtsdoc/functions/elements.ojTabBar-1.html +2 -2
- package/wdtsdoc/functions/elements.ojTable-1.html +2 -2
- package/wdtsdoc/functions/elements.ojTagCloud-1.html +2 -2
- package/wdtsdoc/functions/elements.ojTextArea-1.html +2 -2
- package/wdtsdoc/functions/elements.ojThematicMap-1.html +2 -2
- package/wdtsdoc/functions/elements.ojTimeAxis-1.html +2 -2
- package/wdtsdoc/functions/elements.ojTimeline-1.html +2 -2
- package/wdtsdoc/functions/elements.ojTrain-1.html +2 -2
- package/wdtsdoc/functions/elements.ojTreeView-1.html +2 -2
- package/wdtsdoc/functions/elements.ojTreemap-1.html +2 -2
- package/wdtsdoc/functions/elements.ojWaterfallLayout-1.html +2 -2
- package/wdtsdoc/functions/elements.ojWebElement-1.html +2 -2
- package/wdtsdoc/functions/index.ScreenshotManager.create.html +2 -2
- package/wdtsdoc/functions/index.ScreenshotManager.get.html +2 -2
- package/wdtsdoc/functions/index.ScreenshotManager.set.html +2 -2
- package/wdtsdoc/functions/index.fetchKeyByFilter.html +2 -2
- package/wdtsdoc/functions/index.register.html +2 -2
- package/wdtsdoc/functions/index.slotProxy-1.html +2 -2
- package/wdtsdoc/index.html +2 -2
- package/wdtsdoc/interfaces/index.DriverLike.html +2 -2
- package/wdtsdoc/interfaces/index.SlotProxy.html +2 -2
- package/wdtsdoc/modules/elements.html +2 -2
- package/wdtsdoc/modules/index.ScreenshotManager.html +2 -2
- package/wdtsdoc/modules/index.html +2 -2
- package/wdtsdoc/variables/index.default.html +7 -4
package/index.ts
CHANGED
|
@@ -19,17 +19,19 @@ import {
|
|
|
19
19
|
OjFetch
|
|
20
20
|
} from './lib/OjFetch';
|
|
21
21
|
|
|
22
|
-
import { OjWebElement } from './elements/OjWebElement';
|
|
23
22
|
import { Expectation } from './lib/Expectation';
|
|
24
23
|
import * as sm from './lib/ScreenshotManager';
|
|
25
|
-
import { getBusyStates } from './lib/busy-context-utils';
|
|
24
|
+
import { getBusyStates, pageReady } from './lib/busy-context-utils';
|
|
25
|
+
import { assertViewModelValue } from './lib/viewmodel-utils';
|
|
26
|
+
import { isNoRequireJet, setNoRequireJet } from './lib/no-require-jet';
|
|
26
27
|
|
|
27
28
|
// Export register function before importing elements so that they can
|
|
28
29
|
// call it to register themselves
|
|
29
30
|
export { fetchKeyByFilter } from './lib/dataprovider-utils';
|
|
30
31
|
export { DriverManager } from './lib/driver-manager';
|
|
31
32
|
export { register } from './lib/driver-override';
|
|
32
|
-
export { SlotProxy
|
|
33
|
+
export type { SlotProxy } from './lib/slot-proxy';
|
|
34
|
+
export { slotProxy } from './lib/slot-proxy';
|
|
33
35
|
export { sm as ScreenshotManager };
|
|
34
36
|
export { Expectation };
|
|
35
37
|
|
|
@@ -62,99 +64,6 @@ export interface DriverLike {
|
|
|
62
64
|
findElements(by: Locator): Promise<WebElement[]>;
|
|
63
65
|
}
|
|
64
66
|
|
|
65
|
-
/**
|
|
66
|
-
* Create a Condition for WebDriver to wait on the page's BusyContext to be ready
|
|
67
|
-
*/
|
|
68
|
-
function pageReady(): Condition<Promise<boolean>> {
|
|
69
|
-
return new Condition<Promise<boolean>>('for JET page to indicate ready', async (driver) => {
|
|
70
|
-
// Check that <html> element has a size after page ready
|
|
71
|
-
// Call thru executeScript to bypass WebElement overrides
|
|
72
|
-
const size = await driver.executeScript<{ width: Number; height: number }>(`
|
|
73
|
-
const html = document.querySelector('html');
|
|
74
|
-
return { width: html.clientWidth, height: html.clientHeight }
|
|
75
|
-
`);
|
|
76
|
-
if (!(size.width && size.height)) {
|
|
77
|
-
return Promise.resolve(false);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// Test if the page BusyContext is ready. BusyContext.whenReady() will return
|
|
81
|
-
// true; anything else (timeouts, exceptions) will return false.
|
|
82
|
-
const remoteScript = `
|
|
83
|
-
const done = arguments[0];
|
|
84
|
-
try {
|
|
85
|
-
require('ojs/ojcontext').getPageContext().getBusyContext()
|
|
86
|
-
.whenReady().then(done)
|
|
87
|
-
.catch(ex => done(false))
|
|
88
|
-
} catch (ex) {
|
|
89
|
-
done(false);
|
|
90
|
-
}
|
|
91
|
-
`;
|
|
92
|
-
return driver.executeAsyncScript<boolean>(remoteScript);
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Script executed by ojwd.assert() to run the Chai assertion on the browser
|
|
98
|
-
* @private
|
|
99
|
-
*/
|
|
100
|
-
const ASSERT_SCRIPT = `
|
|
101
|
-
var viewmodelEl = arguments[0];
|
|
102
|
-
var assertion = arguments[1];
|
|
103
|
-
var callback = arguments[arguments.length - 1];
|
|
104
|
-
require([
|
|
105
|
-
'chai',
|
|
106
|
-
'knockout',
|
|
107
|
-
'ojs/ojcspexpressionevaluator'
|
|
108
|
-
], function(chai, ko, ExpressionEval) {
|
|
109
|
-
if (chai) {
|
|
110
|
-
try {
|
|
111
|
-
var viewmodel = ko.dataFor(viewmodelEl);
|
|
112
|
-
var evaluator = new ExpressionEval();
|
|
113
|
-
// Use ExpressionEval to get the value from the viewmodel
|
|
114
|
-
var value = evaluator.createEvaluator(assertion.expression).evaluate([viewmodel]);
|
|
115
|
-
|
|
116
|
-
function compare(value) {
|
|
117
|
-
var expect = chai.expect(value);
|
|
118
|
-
// For each chained assertion, call the assertion method with the arguments
|
|
119
|
-
assertion.chain.forEach((desc) => {
|
|
120
|
-
if (typeof desc === 'string') {
|
|
121
|
-
// Simple assertions, "is", "to", "be", etc
|
|
122
|
-
expect = expect[desc];
|
|
123
|
-
} else {
|
|
124
|
-
// Complex assertions (chained functions)
|
|
125
|
-
const name = desc.name;
|
|
126
|
-
const args = desc.args;
|
|
127
|
-
let evaluatedArgs = [];
|
|
128
|
-
|
|
129
|
-
if (name === 'match') {
|
|
130
|
-
args[0] = new RegExp(args[0]);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
if (args) {
|
|
134
|
-
evaluatedArgs = args;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
expect = expect[name](...evaluatedArgs);
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
callback(true);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// If "value" is a Promise
|
|
144
|
-
if (value && typeof value.then === 'function') {
|
|
145
|
-
value.then(compare).catch(function(ex) { callback(ex.message) });
|
|
146
|
-
} else {
|
|
147
|
-
compare(value);
|
|
148
|
-
}
|
|
149
|
-
} catch (ex) {
|
|
150
|
-
callback(ex.message);
|
|
151
|
-
}
|
|
152
|
-
} else {
|
|
153
|
-
callback('Chai not found');
|
|
154
|
-
}
|
|
155
|
-
}, function(ex) { callback(ex.message); });
|
|
156
|
-
`;
|
|
157
|
-
|
|
158
67
|
/**
|
|
159
68
|
* Check the running JET UI version against this oraclejet-webdriver package
|
|
160
69
|
* version. It's expected that the JET UI is already fully loaded so that
|
|
@@ -198,6 +107,12 @@ ${mismatch}
|
|
|
198
107
|
* ```
|
|
199
108
|
*/
|
|
200
109
|
const ojwd = {
|
|
110
|
+
/**
|
|
111
|
+
* Flag to indicate if testing environment is running a JET application without
|
|
112
|
+
* RequireJS, such as WebPack. This property can only be set once.
|
|
113
|
+
* Defaults to false.
|
|
114
|
+
*/
|
|
115
|
+
noRequireJet: false,
|
|
201
116
|
/**
|
|
202
117
|
* Opens a JET page and wait for the UI to be ready for testing. This method
|
|
203
118
|
* should be used in place of WebDriver.get() to open a page for test. It will
|
|
@@ -371,62 +286,25 @@ const ojwd = {
|
|
|
371
286
|
return driver.findElement(by);
|
|
372
287
|
},
|
|
373
288
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
*
|
|
380
|
-
* The viewmodel is typically identiied by the DOM node on which Knockout's
|
|
381
|
-
* <code>ko.applyBindings</code> was called, but can also be descendants of
|
|
382
|
-
* that originial "root" node.
|
|
383
|
-
* ```javascript
|
|
384
|
-
* new Expectation(...)
|
|
385
|
-
* ```
|
|
386
|
-
*
|
|
387
|
-
* The target value within the viewmodel is identified by a dot-notated path
|
|
388
|
-
* and/or expression which yields the value. For instance, a value may be an
|
|
389
|
-
* observable, therefore, the expression must include parenthesis to unwrap
|
|
390
|
-
* the observable.
|
|
391
|
-
* ```javascript
|
|
392
|
-
* new Expecation(By.id('view-container'), 'firstName()')
|
|
393
|
-
* ```
|
|
394
|
-
*
|
|
395
|
-
* The expression to which the viewmodel value will be compared is expressed
|
|
396
|
-
* as BDD-style chains, such as
|
|
397
|
-
* ```javascript
|
|
398
|
-
* const fnExpectation = new Expectation('firstName()')
|
|
399
|
-
* .to.equal('Joe');
|
|
400
|
-
* ```
|
|
401
|
-
*
|
|
402
|
-
* If a viewmodel value returns a Promise, the assertion will wait for it to
|
|
403
|
-
* resolve before doing the comparison.
|
|
404
|
-
*
|
|
405
|
-
* @param driver The instance of WebDriver to use in performing the expectation
|
|
406
|
-
* @param vmLocator The Locator which identifies the DOM node associated with the
|
|
407
|
-
* viewmodel on the client.
|
|
408
|
-
* @param expression The path within the viewmodel to locate the value
|
|
409
|
-
* @param expectation The Expectation object to evaluate on the client browser.
|
|
289
|
+
assertViewModelValue
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
Object.defineProperties(ojwd, {
|
|
293
|
+
/*
|
|
294
|
+
* Add a guard to only set the noRequireJet flag once
|
|
410
295
|
*/
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
viewmodelEl,
|
|
423
|
-
expectation.assertion
|
|
424
|
-
);
|
|
425
|
-
if (result !== true) {
|
|
426
|
-
throw Error(String(result));
|
|
427
|
-
}
|
|
428
|
-
return result;
|
|
296
|
+
noRequireJet: {
|
|
297
|
+
set: function (v) {
|
|
298
|
+
if (isNoRequireJet() === undefined) {
|
|
299
|
+
setNoRequireJet(v);
|
|
300
|
+
} else {
|
|
301
|
+
throw Error('noRequireJet cannot be set more than once');
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
get: isNoRequireJet,
|
|
305
|
+
enumerable: false,
|
|
306
|
+
configurable: false
|
|
429
307
|
}
|
|
430
|
-
};
|
|
308
|
+
});
|
|
431
309
|
|
|
432
310
|
export default ojwd;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.whenBusyContextReady = exports.getBusyStates = void 0;
|
|
3
|
+
exports.pageReady = exports.whenBusyContextReady = exports.getBusyStates = void 0;
|
|
4
4
|
const selenium_webdriver_1 = require("selenium-webdriver");
|
|
5
|
+
const oj_module_proxy_1 = require("./oj-module-proxy");
|
|
5
6
|
/**
|
|
6
7
|
* Get open busy state descriptions from the page context
|
|
7
8
|
* @private
|
|
8
9
|
* @param driver
|
|
9
10
|
* @returns an array of strings of busy state descriptions
|
|
10
11
|
*/
|
|
11
|
-
const getBusyStates = (driver) => {
|
|
12
|
-
return
|
|
13
|
-
|
|
14
|
-
return
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
.catch((ex) => ex.message);
|
|
12
|
+
const getBusyStates = async (driver) => {
|
|
13
|
+
const hasProxy = await driver.executeScript(`return '${oj_module_proxy_1.TEST_OBJ_NAME}' in window`);
|
|
14
|
+
if (hasProxy) {
|
|
15
|
+
return (0, oj_module_proxy_1.executeWithModules)(driver, ['BusyContext'], [], '(BusyContext) => BusyContext.getBusyStates().map((state) => state.description)').catch((ex) => ex.message);
|
|
16
|
+
}
|
|
17
|
+
return '';
|
|
18
18
|
};
|
|
19
19
|
exports.getBusyStates = getBusyStates;
|
|
20
20
|
/**
|
|
@@ -27,52 +27,34 @@ exports.getBusyStates = getBusyStates;
|
|
|
27
27
|
* page's busy state is ready or to false when it is not a JET page.
|
|
28
28
|
*/
|
|
29
29
|
const whenBusyContextReady = async (driver) => {
|
|
30
|
-
|
|
31
|
-
const done = arguments[0];
|
|
32
|
-
function waitOn(Context) {
|
|
33
|
-
if (Context) {
|
|
34
|
-
Context.getPageContext().getBusyContext()
|
|
35
|
-
.whenReady().then(() => done())
|
|
36
|
-
.catch(ex => done(ex.message))
|
|
37
|
-
} else {
|
|
38
|
-
notFound();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
function notFound() {
|
|
42
|
-
done('ojs/ojcontext module not found')
|
|
43
|
-
}
|
|
44
|
-
if (typeof require === 'function') {
|
|
45
|
-
let Context;
|
|
46
|
-
// Try sync require first
|
|
47
|
-
try {
|
|
48
|
-
Context = require('ojs/ojcontext');
|
|
49
|
-
} catch (ex) {
|
|
50
|
-
require(['ojs/ojcontext'], waitOn, notFound);
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
waitOn(Context);
|
|
54
|
-
} else {
|
|
55
|
-
done('RequireJS not found')
|
|
56
|
-
}
|
|
57
|
-
`;
|
|
58
|
-
const ret = await driver.executeAsyncScript(remoteScript).catch(async (ex) => {
|
|
30
|
+
return (0, oj_module_proxy_1.executeWithModules)(driver, ['BusyContext'], [], '(BusyContext) => BusyContext.whenReady()').catch(async (ex) => {
|
|
59
31
|
if (ex instanceof selenium_webdriver_1.error.TimeoutError || ex instanceof selenium_webdriver_1.error.ScriptTimeoutError) {
|
|
60
32
|
const openStates = await (0, exports.getBusyStates)(driver);
|
|
61
33
|
throw Error(`BusyContext.whenReady() timed out: ${ex.message}\nBusy states: ${openStates}`);
|
|
62
34
|
}
|
|
63
35
|
else {
|
|
64
36
|
// unexpected error which is just reported as a warning below
|
|
65
|
-
return
|
|
37
|
+
return false;
|
|
66
38
|
}
|
|
67
39
|
});
|
|
68
|
-
if (ret) {
|
|
69
|
-
// If error during require call, log warning
|
|
70
|
-
console.warn(`Cannot wait on BusyContext: ${ret}`);
|
|
71
|
-
// return false - not a JET page
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
// return true - a JET page
|
|
75
|
-
return true;
|
|
76
40
|
};
|
|
77
41
|
exports.whenBusyContextReady = whenBusyContextReady;
|
|
42
|
+
/**
|
|
43
|
+
* Create a Condition for WebDriver to wait on the page's BusyContext to be ready
|
|
44
|
+
*/
|
|
45
|
+
function pageReady() {
|
|
46
|
+
return new selenium_webdriver_1.Condition('for JET page to indicate ready', async (driver) => {
|
|
47
|
+
// Check that <html> element has a size after page ready
|
|
48
|
+
// Call thru executeScript to bypass WebElement overrides
|
|
49
|
+
const size = await driver.executeScript(`
|
|
50
|
+
const html = document.querySelector('html');
|
|
51
|
+
return { width: html.clientWidth, height: html.clientHeight }
|
|
52
|
+
`);
|
|
53
|
+
if (!(size.width && size.height)) {
|
|
54
|
+
return Promise.resolve(false);
|
|
55
|
+
}
|
|
56
|
+
return (0, exports.whenBusyContextReady)(driver);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
exports.pageReady = pageReady;
|
|
78
60
|
//# sourceMappingURL=busy-context-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"busy-context-utils.js","sourceRoot":"","sources":["../../lib/busy-context-utils.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"busy-context-utils.js","sourceRoot":"","sources":["../../lib/busy-context-utils.ts"],"names":[],"mappings":";;;AAAA,2DAAiE;AACjE,uDAAsE;AAEtE;;;;;GAKG;AACI,MAAM,aAAa,GAAG,KAAK,EAAE,MAAiB,EAAmB,EAAE;IACxE,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,aAAa,CAAU,WAAW,+BAAa,aAAa,CAAC,CAAC;IAC5F,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,IAAA,oCAAkB,EACvB,MAAM,EACN,CAAC,aAAa,CAAC,EACf,EAAE,EACF,gFAAgF,CACjF,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAXW,QAAA,aAAa,iBAWxB;AAEF;;;;;;;;GAQG;AACI,MAAM,oBAAoB,GAAG,KAAK,EAAE,MAAiB,EAAoB,EAAE;IAChF,OAAO,IAAA,oCAAkB,EACvB,MAAM,EACN,CAAC,aAAa,CAAC,EACf,EAAE,EACF,0CAA0C,CAC3C,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE;QACnB,IAAI,EAAE,YAAY,0BAAK,CAAC,YAAY,IAAI,EAAE,YAAY,0BAAK,CAAC,kBAAkB,EAAE,CAAC;YAC/E,MAAM,UAAU,GAAG,MAAM,IAAA,qBAAa,EAAC,MAAM,CAAC,CAAC;YAC/C,MAAM,KAAK,CAAC,sCAAsC,EAAE,CAAC,OAAO,kBAAkB,UAAU,EAAE,CAAC,CAAC;QAC9F,CAAC;aAAM,CAAC;YACN,6DAA6D;YAC7D,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAfW,QAAA,oBAAoB,wBAe/B;AAEF;;GAEG;AACH,SAAgB,SAAS;IACvB,OAAO,IAAI,8BAAS,CAAmB,gCAAgC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QACxF,wDAAwD;QACxD,yDAAyD;QACzD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,aAAa,CAAoC;;;KAG1E,CAAC,CAAC;QACH,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YACjC,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;QAED,OAAO,IAAA,4BAAoB,EAAC,MAAM,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC;AAdD,8BAcC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { WebDriver, error } from 'selenium-webdriver';
|
|
1
|
+
import { Condition, WebDriver, error } from 'selenium-webdriver';
|
|
2
|
+
import { executeWithModules, TEST_OBJ_NAME } from './oj-module-proxy';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Get open busy state descriptions from the page context
|
|
@@ -6,15 +7,17 @@ import { WebDriver, error } from 'selenium-webdriver';
|
|
|
6
7
|
* @param driver
|
|
7
8
|
* @returns an array of strings of busy state descriptions
|
|
8
9
|
*/
|
|
9
|
-
export const getBusyStates = (driver: WebDriver): Promise<string> => {
|
|
10
|
-
return
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
.catch((ex) => ex.message);
|
|
10
|
+
export const getBusyStates = async (driver: WebDriver): Promise<string> => {
|
|
11
|
+
const hasProxy = await driver.executeScript<boolean>(`return '${TEST_OBJ_NAME}' in window`);
|
|
12
|
+
if (hasProxy) {
|
|
13
|
+
return executeWithModules<string>(
|
|
14
|
+
driver,
|
|
15
|
+
['BusyContext'],
|
|
16
|
+
[],
|
|
17
|
+
'(BusyContext) => BusyContext.getBusyStates().map((state) => state.description)'
|
|
18
|
+
).catch((ex) => ex.message);
|
|
19
|
+
}
|
|
20
|
+
return '';
|
|
18
21
|
};
|
|
19
22
|
|
|
20
23
|
/**
|
|
@@ -27,49 +30,37 @@ return require('ojs/ojcontext').getPageContext().getBusyContext().getBusyStates(
|
|
|
27
30
|
* page's busy state is ready or to false when it is not a JET page.
|
|
28
31
|
*/
|
|
29
32
|
export const whenBusyContextReady = async (driver: WebDriver): Promise<boolean> => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
.catch(ex => done(ex.message))
|
|
37
|
-
} else {
|
|
38
|
-
notFound();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
function notFound() {
|
|
42
|
-
done('ojs/ojcontext module not found')
|
|
43
|
-
}
|
|
44
|
-
if (typeof require === 'function') {
|
|
45
|
-
let Context;
|
|
46
|
-
// Try sync require first
|
|
47
|
-
try {
|
|
48
|
-
Context = require('ojs/ojcontext');
|
|
49
|
-
} catch (ex) {
|
|
50
|
-
require(['ojs/ojcontext'], waitOn, notFound);
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
waitOn(Context);
|
|
54
|
-
} else {
|
|
55
|
-
done('RequireJS not found')
|
|
56
|
-
}
|
|
57
|
-
`;
|
|
58
|
-
const ret = await driver.executeAsyncScript(remoteScript).catch(async (ex) => {
|
|
33
|
+
return executeWithModules<boolean>(
|
|
34
|
+
driver,
|
|
35
|
+
['BusyContext'],
|
|
36
|
+
[],
|
|
37
|
+
'(BusyContext) => BusyContext.whenReady()'
|
|
38
|
+
).catch(async (ex) => {
|
|
59
39
|
if (ex instanceof error.TimeoutError || ex instanceof error.ScriptTimeoutError) {
|
|
60
40
|
const openStates = await getBusyStates(driver);
|
|
61
41
|
throw Error(`BusyContext.whenReady() timed out: ${ex.message}\nBusy states: ${openStates}`);
|
|
62
42
|
} else {
|
|
63
43
|
// unexpected error which is just reported as a warning below
|
|
64
|
-
return
|
|
44
|
+
return false;
|
|
65
45
|
}
|
|
66
46
|
});
|
|
67
|
-
if (ret) {
|
|
68
|
-
// If error during require call, log warning
|
|
69
|
-
console.warn(`Cannot wait on BusyContext: ${ret}`);
|
|
70
|
-
// return false - not a JET page
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
// return true - a JET page
|
|
74
|
-
return true;
|
|
75
47
|
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Create a Condition for WebDriver to wait on the page's BusyContext to be ready
|
|
51
|
+
*/
|
|
52
|
+
export function pageReady(): Condition<Promise<boolean>> {
|
|
53
|
+
return new Condition<Promise<boolean>>('for JET page to indicate ready', async (driver) => {
|
|
54
|
+
// Check that <html> element has a size after page ready
|
|
55
|
+
// Call thru executeScript to bypass WebElement overrides
|
|
56
|
+
const size = await driver.executeScript<{ width: number; height: number }>(`
|
|
57
|
+
const html = document.querySelector('html');
|
|
58
|
+
return { width: html.clientWidth, height: html.clientHeight }
|
|
59
|
+
`);
|
|
60
|
+
if (!(size.width && size.height)) {
|
|
61
|
+
return Promise.resolve(false);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return whenBusyContextReady(driver);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fetchKeyByFilter = void 0;
|
|
4
|
+
const oj_module_proxy_1 = require("./oj-module-proxy");
|
|
4
5
|
/**
|
|
5
6
|
* Get the key for the record filtered by filterDef. If exactly one record is
|
|
6
7
|
* found after filtering is applied, the key of that record is returned.
|
|
@@ -33,40 +34,35 @@ exports.fetchKeyByFilter = void 0;
|
|
|
33
34
|
* ```
|
|
34
35
|
*/
|
|
35
36
|
async function fetchKeyByFilter(el, dataProviderProp, filterDef) {
|
|
36
|
-
const driver = el.getDriver();
|
|
37
37
|
await el.whenBusyContextReady();
|
|
38
|
-
return
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const filterDef = arguments[2];
|
|
38
|
+
return (0, oj_module_proxy_1.executeWithModules)(el.getDriver(), ['CustomElementUtils'], [el, dataProviderProp, filterDef], `
|
|
39
|
+
(({ getElementProperty }, comp, dataProviderProp, filterDef) => {
|
|
40
|
+
return new Promise((resolve, reject) => {
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (!(dp && typeof dp.fetchFirst === 'function')) {
|
|
48
|
-
reject('Property "'+propName+'" does not reference a supported DataProvider');
|
|
49
|
-
}
|
|
42
|
+
const dp = getElementProperty(comp, dataProviderProp);
|
|
43
|
+
if (!(dp && typeof dp.fetchFirst === 'function')) {
|
|
44
|
+
reject('Property "${dataProviderProp}" does not reference a supported DataProvider');
|
|
45
|
+
}
|
|
50
46
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
const iter = dp.fetchFirst({
|
|
48
|
+
filterCriterion: filterDef
|
|
49
|
+
})[Symbol.asyncIterator]();
|
|
54
50
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
51
|
+
iter.next().then(res => {
|
|
52
|
+
if (res.value.metadata.length === 1) {
|
|
53
|
+
resolve(res.value.metadata[0].key);
|
|
54
|
+
}
|
|
55
|
+
else if (res.value.metadata.length > 1) {
|
|
56
|
+
reject('Filter returned too many keys: ' + res.value.metadata.map(r => r.key));
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
reject('Filter returned no keys');
|
|
60
|
+
}
|
|
61
|
+
});
|
|
65
62
|
});
|
|
66
|
-
});
|
|
67
63
|
|
|
68
|
-
|
|
69
|
-
|
|
64
|
+
})
|
|
65
|
+
`);
|
|
70
66
|
}
|
|
71
67
|
exports.fetchKeyByFilter = fetchKeyByFilter;
|
|
72
68
|
//# sourceMappingURL=dataprovider-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataprovider-utils.js","sourceRoot":"","sources":["../../lib/dataprovider-utils.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"dataprovider-utils.js","sourceRoot":"","sources":["../../lib/dataprovider-utils.ts"],"names":[],"mappings":";;;AAEA,uDAAuD;AAUvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACI,KAAK,UAAU,gBAAgB,CAKpC,EAAgB,EAChB,gBAAmC,EACnC,SAAoC;IAEpC,MAAM,EAAE,CAAC,oBAAoB,EAAE,CAAC;IAEhC,OAAO,IAAA,oCAAkB,EACvB,EAAE,CAAC,SAAS,EAAE,EACd,CAAC,oBAAoB,CAAC,EACtB,CAAC,EAAE,EAAE,gBAAgB,EAAE,SAAS,CAAC,EACjC;;;;;;8BAM0B,gBAAgB;;;;;;;;;;;;;;;;;;;;;GAqB3C,CACA,CAAC;AACJ,CAAC;AA5CD,4CA4CC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DataProvider, DataFilter } from '@oracle/oraclejet/ojdataprovider';
|
|
2
2
|
import { OjWebElement } from '../elements';
|
|
3
|
+
import { executeWithModules } from './oj-module-proxy';
|
|
3
4
|
|
|
4
5
|
type FilterFlags<Base, Condition> = {
|
|
5
6
|
[Key in keyof Base]: Base[Key] extends Condition ? Key : never;
|
|
@@ -49,43 +50,39 @@ export async function fetchKeyByFilter<
|
|
|
49
50
|
dataProviderProp: DataProviderProps,
|
|
50
51
|
filterDef: DataFilter.FilterDef<any>
|
|
51
52
|
): Promise<K> {
|
|
52
|
-
const driver = el.getDriver();
|
|
53
53
|
await el.whenBusyContextReady();
|
|
54
|
-
return driver.executeScript<K>(
|
|
55
|
-
`
|
|
56
|
-
const comp = arguments[0];
|
|
57
|
-
const propName = arguments[1];
|
|
58
|
-
const filterDef = arguments[2];
|
|
59
54
|
|
|
60
|
-
return
|
|
55
|
+
return executeWithModules(
|
|
56
|
+
el.getDriver(),
|
|
57
|
+
['CustomElementUtils'],
|
|
58
|
+
[el, dataProviderProp, filterDef],
|
|
59
|
+
`
|
|
60
|
+
(({ getElementProperty }, comp, dataProviderProp, filterDef) => {
|
|
61
|
+
return new Promise((resolve, reject) => {
|
|
61
62
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
63
|
+
const dp = getElementProperty(comp, dataProviderProp);
|
|
64
|
+
if (!(dp && typeof dp.fetchFirst === 'function')) {
|
|
65
|
+
reject('Property "${dataProviderProp}" does not reference a supported DataProvider');
|
|
66
|
+
}
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
const iter = dp.fetchFirst({
|
|
69
|
+
filterCriterion: filterDef
|
|
70
|
+
})[Symbol.asyncIterator]();
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
72
|
+
iter.next().then(res => {
|
|
73
|
+
if (res.value.metadata.length === 1) {
|
|
74
|
+
resolve(res.value.metadata[0].key);
|
|
75
|
+
}
|
|
76
|
+
else if (res.value.metadata.length > 1) {
|
|
77
|
+
reject('Filter returned too many keys: ' + res.value.metadata.map(r => r.key));
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
reject('Filter returned no keys');
|
|
81
|
+
}
|
|
82
|
+
});
|
|
82
83
|
});
|
|
83
|
-
});
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
el,
|
|
88
|
-
dataProviderProp,
|
|
89
|
-
filterDef
|
|
85
|
+
})
|
|
86
|
+
`
|
|
90
87
|
);
|
|
91
88
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Module to hold the noRequireJet flag
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isNoRequireJet = exports.setNoRequireJet = void 0;
|
|
7
|
+
let noRequireJet;
|
|
8
|
+
const setNoRequireJet = (v) => (noRequireJet = v);
|
|
9
|
+
exports.setNoRequireJet = setNoRequireJet;
|
|
10
|
+
const isNoRequireJet = () => noRequireJet;
|
|
11
|
+
exports.isNoRequireJet = isNoRequireJet;
|
|
12
|
+
//# sourceMappingURL=no-require-jet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-require-jet.js","sourceRoot":"","sources":["../../lib/no-require-jet.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,IAAI,YAAiC,CAAC;AAE/B,MAAM,eAAe,GAAG,CAAC,CAAU,EAAE,EAAE,CAAC,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;AAArD,QAAA,eAAe,mBAAsC;AAC3D,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC;AAApC,QAAA,cAAc,kBAAsB"}
|