diff --git a/src/client/automation/playback/type/type-text.js b/src/client/automation/playback/type/type-text.js index 1708084599d..55fae79be0e 100644 --- a/src/client/automation/playback/type/type-text.js +++ b/src/client/automation/playback/type/type-text.js @@ -105,8 +105,11 @@ function _excludeInvisibleSymbolsFromSelection (selection) { } // NOTE: typing can be prevented in Chrome/Edge but can not be prevented in IE11 or Firefox +// Firefox does not support TextInput event +// Safari support TextInput event but adds e.data to node value. So let's ignore it function simulateTextInput (element, text) { - const isInputEventRequired = eventSimulator.textInput(element, text); + const isTextInputIgnoredByBrowser = [ browserUtils.isFirefox, browserUtils.isSafari ].some(browser => browser); + const isInputEventRequired = isTextInputIgnoredByBrowser || eventSimulator.textInput(element, text); return isInputEventRequired || browserUtils.isIE11 || browserUtils.isFirefox; } diff --git a/test/functional/fixtures/regression/gh-1956/test.js b/test/functional/fixtures/regression/gh-1956/test.js index 9a1363e2748..7356a0e7be7 100644 --- a/test/functional/fixtures/regression/gh-1956/test.js +++ b/test/functional/fixtures/regression/gh-1956/test.js @@ -1,34 +1,16 @@ var expect = require('chai').expect; describe('Should support TextInput event[Regression](GH-1956)', function () { - it('Modify text node of ContentEditable div on TextInput event and prevent Input event', function () { - return runTests('testcafe-fixtures/index.js', - 'Modify text node of ContentEditable div on TextInput event and prevent Input event', - { skip: [ 'firefox', 'ie' ] }); - }); - - it('Type to ContentEditable div when selected node was replaced on TextInput event', function () { - return runTests('testcafe-fixtures/index.js', - 'Type to ContentEditable div when selected node was replaced on TextInput event', - { skip: [ 'firefox', 'ie' ] }); - }); - - it('Prevent Input event on TextInput when type to element node', function () { - return runTests('testcafe-fixtures/index.js', - 'Prevent Input event on TextInput when type to element node', - { skip: [ 'firefox', 'ie' ] }); - }); - it('Prevent Input event on TextInput when type to input element', function () { return runTests('testcafe-fixtures/index.js', 'Prevent Input event on TextInput when type to input element', - { skip: [ 'ie', 'firefox' ] }); + { skip: [ 'ie', 'safari', 'firefox', 'firefox-osx' ] }); }); it('Prevent Input event on TextInput when type to input element IE11/Firefox', function () { return runTests('testcafe-fixtures/index.js', 'Prevent Input event on TextInput when type to input element IE11/Firefox', - { only: [ 'ie', 'firefox' ], shouldFail: true }) + { only: [ 'ie', 'firefox', 'firefox-osx' ], shouldFail: true }) .catch(function (errs) { expect(errs['ie'][0]).contains('Input event has raised'); expect(errs['firefox'][0]).contains('Input event has raised'); @@ -38,7 +20,7 @@ describe('Should support TextInput event[Regression](GH-1956)', function () { it('Prevent Input event on TextInput when type to ContentEditable div', function () { return runTests('testcafe-fixtures/index.js', 'Prevent Input event on TextInput when type to ContentEditable div', - { skip: [ 'ie', 'firefox' ] }); + { skip: [ 'ie', 'safari', 'firefox', 'firefox-osx' ] }); }); it('Prevent Input event on TextInput when type to ContentEditable div IE11', function () { @@ -50,9 +32,27 @@ describe('Should support TextInput event[Regression](GH-1956)', function () { it('Prevent Input event on TextInput when type to ContentEditable div Firefox', function () { return runTests('testcafe-fixtures/index.js', 'Prevent Input event on TextInput when type to ContentEditable div IE11/Firefox', - { only: [ 'firefox' ], shouldFail: true }) + { only: [ 'firefox', 'firefox-osx' ], shouldFail: true }) .catch(function (errs) { expect(errs[0]).contains('Input event has raised'); }); }); + + it('Modify text node of ContentEditable div on TextInput event and prevent Input event', function () { + return runTests('testcafe-fixtures/index.js', + 'Modify text node of ContentEditable div on TextInput event and prevent Input event', + { skip: [ 'ie', 'safari', 'firefox', 'firefox-osx' ] }); + }); + + it('Type to ContentEditable div when selected node was replaced on TextInput event', function () { + return runTests('testcafe-fixtures/index.js', + 'Type to ContentEditable div when selected node was replaced on TextInput event', + { skip: [ 'ie', 'safari', 'firefox', 'firefox-osx' ] }); + }); + + it('Prevent Input event on TextInput when type to element node', function () { + return runTests('testcafe-fixtures/index.js', + 'Prevent Input event on TextInput when type to element node', + { skip: [ 'ie', 'safari', 'firefox', 'firefox-osx' ] }); + }); });