/
index.js
75 lines (65 loc) · 3.49 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// NOTE: Initializer should be the first
import './shared-adapter-initializer';
import hammerhead from './deps/hammerhead';
import DispatchEventAutomation from './playback/dispatch-event';
import SetScrollAutomation from './playback/set-scroll';
import ScrollIntoViewAutomation from './playback/scroll-into-view';
import ClickAutomation from './playback/click';
import SelectChildClickAutomation from './playback/click/select-child';
import DblClickAutomation from './playback/dblclick';
import DragToOffsetAutomation from './playback/drag/to-offset';
import DragToElementAutomation from './playback/drag/to-element';
import HoverAutomation from './playback/hover';
import PressAutomation from './playback/press';
import RClickAutomation from './playback/rclick';
import SelectTextAutomation from './playback/select/select-text';
import SelectEditableContentAutomation from './playback/select/select-editable-content';
import TypeAutomation from './playback/type';
import UploadAutomation from './playback/upload';
import {
MouseOptions,
ClickOptions,
TypeOptions,
} from '../../test-run/commands/options';
import AutomationSettings from '../../shared/actions/automations/settings';
import { getOffsetOptions } from './utils/offsets';
import { getNextFocusableElement } from './playback/press/utils';
import SHORTCUT_TYPE from './playback/press/shortcut-type';
import { getSelectionCoordinatesByPosition } from './playback/select/utils';
import getElementFromPoint from './get-element';
import calculateSelectTextArguments from './playback/select/calculate-select-text-arguments';
import ERROR_TYPES from '../../shared/errors/automation-errors';
import cursor from './cursor';
const exports = {};
exports.DispatchEvent = DispatchEventAutomation;
exports.SetScroll = SetScrollAutomation;
exports.ScrollIntoView = ScrollIntoViewAutomation;
exports.Click = ClickAutomation;
exports.SelectChildClick = SelectChildClickAutomation;
exports.DblClick = DblClickAutomation;
exports.DragToOffset = DragToOffsetAutomation;
exports.DragToElement = DragToElementAutomation;
exports.Hover = HoverAutomation;
exports.Press = PressAutomation;
exports.RClick = RClickAutomation;
exports.SelectText = SelectTextAutomation;
exports.SelectEditableContent = SelectEditableContentAutomation;
exports.Type = TypeAutomation;
exports.Upload = UploadAutomation;
exports.MouseOptions = MouseOptions;
exports.ClickOptions = ClickOptions;
exports.TypeOptions = TypeOptions;
exports.ERROR_TYPES = ERROR_TYPES;
exports.AutomationSettings = AutomationSettings;
exports.getOffsetOptions = getOffsetOptions;
exports.calculateSelectTextArguments = calculateSelectTextArguments;
exports.cursor = cursor;
exports.getNextFocusableElement = getNextFocusableElement;
exports.SHORTCUT_TYPE = SHORTCUT_TYPE;
exports.getSelectionCoordinatesByPosition = getSelectionCoordinatesByPosition;
exports.getElementFromPoint = getElementFromPoint;
const nativeMethods = hammerhead.nativeMethods;
const evalIframeScript = hammerhead.EVENTS.evalIframeScript;
nativeMethods.objectDefineProperty(window, '%testCafeAutomation%', { configurable: true, value: exports });
// eslint-disable-next-line no-undef
hammerhead.on(evalIframeScript, e => initTestCafeAutomation(nativeMethods.contentWindowGetter.call(e.iframe), true));