Skip to content

Commit

Permalink
[WIP](closes DevExpress#2056)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKamaev committed Jun 22, 2018
1 parent be2206f commit f694932
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
"source-map-support": "^0.5.5",
"strip-bom": "^2.0.0",
"testcafe-browser-tools": "1.6.3",
"testcafe-hammerhead": "14.1.0",
"testcafe-hammerhead": "testcafe-hammerhead-14.1.0.tgz",
"testcafe-legacy-api": "3.1.7",
"testcafe-reporter-json": "^2.1.0",
"testcafe-reporter-list": "^2.1.0",
Expand Down
77 changes: 77 additions & 0 deletions test/functional/fixtures/regression/gh-2056/pages/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>

#el1, #el2, #el3 {
position: absolute;
background-color: black;
display: inline-block;
height: 50px;
width: 50px;
top: 0;
left: 0;
}
#el2 {
top: 200px;
left: 200px;
}

#el3 {
top: 0;
left: 200px;
}
</style>
<script>
function log (text) {
document.getElementById('result').innerHTML += text;
}

function onMove (e) {
window.removeEventListener('mousemove', onMove);

log('onMove:' + e.button + e.buttons + e.which);
}

function onMoveWithLeftButtonPressed (e) {
window.removeEventListener('mousemove', onMoveWithLeftButtonPressed);

log('onMoveWithLeftButtonPressed:' + e.button + e.buttons + e.which);
}

function listenMouseMove(e) {
window.addEventListener('mousemove', onMove);
}

function listenMouseMoveWithLeftButtonPressed(e) {
window.addEventListener('mousemove', onMoveWithLeftButtonPressed);
}

function onclick (e) {

}

function oncontextmenu (e) {

}

function ondblclick (e) {

}
</script>
</head>
<body>
<div id="el1" onclick="listenMouseMove()"></div>
<div id="el2" onclick="listenMouseMoveWithLeftButtonPressed()"></div>
<div id="el3"></div>
<div id="el4" onclick="onclick()" oncontextmenu="oncontextmenu()" ondblclick="ondblclick()"></div>
<br/>
<br/>
<br/>
<br/>
<br/>
<div id="result"></div>
</body>
</html>
5 changes: 5 additions & 0 deletions test/functional/fixtures/regression/gh-2056/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe('[Regression](GH-2056)', function () {
it('Move actions should provide correct button, buttons, which properties', function () {
return runTests('testcafe-fixtures/index.js');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Selector, ClientFunction } from 'testcafe';
import userAgent from 'useragent';

fixture `GH-2056`
.page `http://localhost:3000/fixtures/regression/gh-2056/pages/index.html`;

const el1 = Selector('#el1');
const el2 = Selector('#el2');
const el3 = Selector('#el3');
const result = Selector('#result');

const getUserAgent = ClientFunction(() => navigator.userAgent.toString());

test('Move actions should provide correct button, buttons, which properties', async t => {
var userAgentStr = await getUserAgent();
var isChrome = userAgent.is(userAgentStr).chrome;
var expected = isChrome ? 'onMove:000onMoveWithLeftButtonPressed:011' : 'onMove:001onMoveWithLeftButtonPressed:011';

await t
.setTestSpeed(0.1)
.click(el1)
.debug()
.hover(el3)
.click(el2)
.dragToElement(el2, el3)
.expect(result.innerText).eql(expected);
});
Binary file added testcafe-hammerhead-14.1.0.tgz
Binary file not shown.

0 comments on commit f694932

Please sign in to comment.