diff --git a/src/client/automation/playback/click/browser-click-strategy.ts b/src/client/automation/playback/click/browser-click-strategy.ts index 9e1769c8462..21ff1b95a41 100644 --- a/src/client/automation/playback/click/browser-click-strategy.ts +++ b/src/client/automation/playback/click/browser-click-strategy.ts @@ -1,7 +1,6 @@ import hammerhead from '../../deps/hammerhead'; import testCafeCore from '../../deps/testcafe-core'; import { focusAndSetSelection } from '../../utils/utils'; -import nextTick from '../../../core/utils/next-tick'; import createClickCommand from './click-command'; import { MouseEventArgs } from '../../visible-element-automation'; @@ -82,10 +81,9 @@ export class MouseClickStrategy { this.activeElementBeforeMouseDown = activeElement; - // NOTE: In WebKit and IE, the mousedown event opens the select element's dropdown; + // NOTE: In WebKit, the mousedown event opens the select element's dropdown; // therefore, we should prevent mousedown and hide the dropdown (B236416). - const needCloseSelectDropDown = (browserUtils.isWebKit || browserUtils.isIE) && - domUtils.isSelectElement(this.mouseDownElement); + const needCloseSelectDropDown = browserUtils.isWebKit && domUtils.isSelectElement(this.mouseDownElement); if (needCloseSelectDropDown) this._bindMousedownHandler(); @@ -115,8 +113,7 @@ export class MouseClickStrategy { listeners.removeInternalEventBeforeListener(window, ['mouseup'], getTimeStamp); }; - if (!browserUtils.isIE) - listeners.addInternalEventBeforeListener(window, ['mouseup'], getTimeStamp); + listeners.addInternalEventBeforeListener(window, ['mouseup'], getTimeStamp); if (!this._isTouchEventWasCancelled()) eventSimulator.mouseup(element, eventArgs.options); @@ -174,21 +171,8 @@ export class MouseClickStrategy { return; } - if (browserUtils.isIE && browserUtils.version < 12) { - // NOTE: In whatever way an element is blurred from the client script, the - // blur event is raised asynchronously in IE (in MSEdge focus/blur is sync) - nextTick() - .then(() => { - if (!this.eventState.blurRaised) - eventSimulator.blur(element); - - resolve(); - }); - } - else { - eventSimulator.blur(element); - resolve(); - } + eventSimulator.blur(element); + resolve(); }); } @@ -201,10 +185,7 @@ export class MouseClickStrategy { // element, a selection position may be calculated incorrectly (by using the caretPos option). const elementForFocus = domUtils.isContentEditableElement(this.element) ? this.element : eventArgs.element; - // NOTE: IE doesn't perform focus if active element has been changed while executing mousedown - const simulateFocus = !browserUtils.isIE || this.activeElementBeforeMouseDown === domUtils.getActiveElement(); - - return focusAndSetSelection(elementForFocus, simulateFocus, this.caretPos); + return focusAndSetSelection(elementForFocus, true, this.caretPos); } private _raiseTouchEvents (eventArgs: MouseEventArgs): void { diff --git a/src/client/automation/playback/click/select-child.js b/src/client/automation/playback/click/select-child.js index d4b820d3b0d..69a139f1bcf 100644 --- a/src/client/automation/playback/click/select-child.js +++ b/src/client/automation/playback/click/select-child.js @@ -64,11 +64,10 @@ export default class SelectChildClickAutomation { _calculateEventArguments () { const childElement = this.optionListExpanded ? selectController.getEmulatedChildElement(this.element) : this.element; - const parentSelectSize = styleUtils.getSelectElementSize(this.parentSelect) > 1; return { options: this.modifiers, - element: browserUtils.isIE && parentSelectSize ? this.parentSelect : childElement, + element: childElement, }; } @@ -123,12 +122,6 @@ export default class SelectChildClickAutomation { return this._focus(); } - if (browserUtils.isIE) { - eventSimulator.mousedown(this.eventsArgs.element, this.eventsArgs.options); - - return this._focus(); - } - // NOTE: In Chrome, document.activeElement is 'select' after mousedown. But we need to // raise blur and change the event for a previously active element during focus raising. // That's why we should change the event order and raise focus before mousedown. @@ -150,22 +143,15 @@ export default class SelectChildClickAutomation { } _mouseup () { - const elementForMouseupEvent = browserUtils.isIE ? this.parentSelect : this.eventsArgs.element; - - eventSimulator.mouseup(elementForMouseupEvent, this.eventsArgs.options); - - if (browserUtils.isIE && this.clickCausesChange) - this.parentSelect.selectedIndex = this.childIndex; + eventSimulator.mouseup(this.eventsArgs.element, this.eventsArgs.options); const simulateInputEventOnValueChange = browserUtils.isFirefox || browserUtils.isSafari || browserUtils.isChrome && browserUtils.version >= 53; - const simulateChangeEventOnValueChange = simulateInputEventOnValueChange || browserUtils.isIE; - if (simulateInputEventOnValueChange && this.clickCausesChange) eventSimulator.input(this.parentSelect); - if (simulateChangeEventOnValueChange && this.clickCausesChange) + if (simulateInputEventOnValueChange && this.clickCausesChange) eventSimulator.change(this.parentSelect); return Promise.resolve(); diff --git a/src/client/automation/playback/move/event-sequence/base.js b/src/client/automation/playback/move/event-sequence/base.js index e4d08a072c5..0b471d7363f 100644 --- a/src/client/automation/playback/move/event-sequence/base.js +++ b/src/client/automation/playback/move/event-sequence/base.js @@ -1,7 +1,5 @@ -import hammerhead from '../../../deps/hammerhead'; import { domUtils } from '../../../deps/testcafe-core'; -const browserUtils = hammerhead.utils.browser; export default class MoveEventSequenceBase { constructor ({ moveEvent }) { @@ -31,16 +29,6 @@ export default class MoveEventSequenceBase { } run (currentElement, prevElement, options, dragElement, dragDataStore) { - // NOTE: if last hovered element was in an iframe that has been removed, IE - // raises an exception when we try to compare it with the current element - const prevElementInDocument = prevElement && domUtils.isElementInDocument(prevElement); - - const prevElementInRemovedIframe = prevElement && domUtils.isElementInIframe(prevElement) && - !domUtils.getIframeByElement(prevElement); - - if (!prevElementInDocument || prevElementInRemovedIframe) - prevElement = null; - const elementChanged = currentElement !== prevElement; const commonAncestor = elementChanged ? domUtils.getCommonAncestor(currentElement, prevElement) : null; @@ -49,14 +37,10 @@ export default class MoveEventSequenceBase { if (elementChanged && !!prevElement) this.leaveElement(currentElement, prevElement, commonAncestor, options); - if (browserUtils.isIE) - this.move(currentElement, options); - if (elementChanged && domUtils.isElementInDocument(currentElement)) this.enterElement(currentElement, prevElement, commonAncestor, options); - if (!browserUtils.isIE) - this.move(currentElement, options); + this.move(currentElement, options); this.dragAndDrop(dragElement, currentElement, prevElement, options, dragDataStore); this.teardown(currentElement, options, prevElement); diff --git a/src/client/automation/playback/press/key-press-simulator.js b/src/client/automation/playback/press/key-press-simulator.js index c5613c838fd..3f14e22a8e4 100644 --- a/src/client/automation/playback/press/key-press-simulator.js +++ b/src/client/automation/playback/press/key-press-simulator.js @@ -35,27 +35,18 @@ export default class KeyPressSimulator { const isActiveElementEditable = domUtils.isEditableElement(element); const isStoredElementEditable = domUtils.isEditableElement(this.storedActiveElement); - // Unnecessary typing happens if an element was changed after the keydown/keypress event (T210448) - // In IE, this error may occur when we try to determine if the removed element is in an iframe - try { - if (elementChanged) { - const isActiveElementInIframe = domUtils.isElementInIframe(element); - const isStoredElementInIframe = domUtils.isElementInIframe(this.storedActiveElement); - - const shouldTypeInWebKit = isActiveElementInIframe === isStoredElementInIframe || isStoredElementEditable; - - shouldType = (!browserUtils.isFirefox || isStoredElementEditable) && - (!browserUtils.isWebKit || shouldTypeInWebKit); - } - } - /*eslint-disable no-empty */ - catch (err) { - } - /*eslint-disable no-empty */ + if (elementChanged) { + const isActiveElementInIframe = domUtils.isElementInIframe(element); + const isStoredElementInIframe = domUtils.isElementInIframe(this.storedActiveElement); + const shouldTypeInWebKit = isActiveElementInIframe === isStoredElementInIframe || isStoredElementEditable; + + shouldType = (!browserUtils.isFirefox || isStoredElementEditable) && + (!browserUtils.isWebKit || shouldTypeInWebKit); + } if (shouldType) { - if (!browserUtils.isIE && elementChanged && isStoredElementEditable && isActiveElementEditable) + if (elementChanged && isStoredElementEditable && isActiveElementEditable) elementForTyping = this.storedActiveElement; typeText(elementForTyping, char); diff --git a/src/client/automation/playback/press/shortcuts.js b/src/client/automation/playback/press/shortcuts.js index 47a54d36796..2b5bb40818b 100644 --- a/src/client/automation/playback/press/shortcuts.js +++ b/src/client/automation/playback/press/shortcuts.js @@ -491,8 +491,7 @@ function enter (element) { //submit form on enter pressed if (domUtils.isInputElement(element)) { - if (!browserUtils.isIE) - elementEditingWatcher.processElementChanging(element); + elementEditingWatcher.processElementChanging(element); const form = domUtils.getParents(element, 'form')[0];