diff --git a/src/native-automation/client/event-descriptor.ts b/src/native-automation/client/event-descriptor.ts index 4e0a83b385f..e90537ccf24 100644 --- a/src/native-automation/client/event-descriptor.ts +++ b/src/native-automation/client/event-descriptor.ts @@ -15,6 +15,7 @@ const messageSandbox = eventSandbox.message; const MOUSE_EVENT_OPTIONS = { clickCount: 1, + force: 0.5, }; const CALCULATE_TOP_LEFT_POINT_REQUEST_CMD = 'native-automation|calculate-top-left-point|request'; diff --git a/test/functional/fixtures/api/es-next/click/pages/index.html b/test/functional/fixtures/api/es-next/click/pages/index.html index e91d29b714e..c93e3869972 100644 --- a/test/functional/fixtures/api/es-next/click/pages/index.html +++ b/test/functional/fixtures/api/es-next/click/pages/index.html @@ -31,6 +31,12 @@ status.textContent = 'Clicked!'; }); + + document.querySelector('#statusBtn').addEventListener('pointerdown', function (e) { + window.pointerdownPressure = e.pressure; + }); + + window.pointerdownPressure = 0;
diff --git a/test/functional/fixtures/api/es-next/click/test.js b/test/functional/fixtures/api/es-next/click/test.js index 9a89a4c7f66..7c9916963b3 100644 --- a/test/functional/fixtures/api/es-next/click/test.js +++ b/test/functional/fixtures/api/es-next/click/test.js @@ -1,4 +1,5 @@ -const expect = require('chai').expect; +const { onlyInNativeAutomation } = require('../../../../utils/skip-in'); +const expect = require('chai').expect; //GH-1674 const TEST_DURATION_BOUND = 10000; @@ -234,4 +235,8 @@ describe('[API] t.click()', function () { }); }); }); + + onlyInNativeAutomation('Should set pressure in Native Automation', () => { + return runTests('./testcafe-fixtures/click-test.js', 'Check click pressure', { only: 'chrome' }); + }); }); diff --git a/test/functional/fixtures/api/es-next/click/testcafe-fixtures/click-test.js b/test/functional/fixtures/api/es-next/click/testcafe-fixtures/click-test.js index 2f795505386..04d51771404 100644 --- a/test/functional/fixtures/api/es-next/click/testcafe-fixtures/click-test.js +++ b/test/functional/fixtures/api/es-next/click/testcafe-fixtures/click-test.js @@ -107,3 +107,9 @@ test('Click on an element with overlapped center', async t => { test('Click overlapped element', async t => { await t.click('.child1'); }).page('http://localhost:3000/fixtures/api/es-next/click/pages/overlapped.html'); + +test('Check click pressure', async t => { + await t.click('#statusBtn'); + + expect(await t.eval(() => window.pointerdownPressure)).gt(0); +});